Skip to content

Commit

Permalink
fix(agent.buffer): Fix shared wal file between same named plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
DStrand1 committed Oct 2, 2024
1 parent ddd6023 commit 949e49f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion models/buffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func NewBuffer(name string, alias string, capacity int, strategy string, path st
case "", "memory":
return NewMemoryBuffer(capacity, bs)
case "disk":
return NewDiskBuffer(name, path, bs)
return NewDiskBuffer(name, alias, path, bs)
}
return nil, fmt.Errorf("invalid buffer strategy %q", strategy)
}
Expand Down
9 changes: 7 additions & 2 deletions models/buffer_disk.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,13 @@ type DiskBuffer struct {
originalEnd uint64
}

func NewDiskBuffer(name string, path string, stats BufferStats) (*DiskBuffer, error) {
filePath := filepath.Join(path, name)
func NewDiskBuffer(name, alias, path string, stats BufferStats) (*DiskBuffer, error) {
pluginName := name
if alias != "" {
pluginName += "-" + alias
}

filePath := filepath.Join(path, pluginName)
walFile, err := wal.Open(filePath, nil)
if err != nil {
return nil, fmt.Errorf("failed to open wal file: %w", err)
Expand Down

0 comments on commit 949e49f

Please sign in to comment.