Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions extension/storage/filestorage/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,17 @@ type fileStorageClient struct {
closed bool
}

func bboltOptions(timeout time.Duration, fSync bool) *bbolt.Options {
func bboltOptions(timeout time.Duration, noSync bool) *bbolt.Options {
return &bbolt.Options{
Timeout: timeout,
NoSync: !fSync,
NoSync: noSync,
NoFreelistSync: true,
FreelistType: bbolt.FreelistMapType,
}
}

func newClient(logger *zap.Logger, filePath string, timeout time.Duration, compactionCfg *CompactionConfig, fSync bool) (*fileStorageClient, error) {
options := bboltOptions(timeout, fSync)
func newClient(logger *zap.Logger, filePath string, timeout time.Duration, compactionCfg *CompactionConfig, noSync bool) (*fileStorageClient, error) {
options := bboltOptions(timeout, noSync)
db, err := bbolt.Open(filePath, 0600, options)
if err != nil {
return nil, err
Expand Down Expand Up @@ -172,7 +172,7 @@ func (c *fileStorageClient) Compact(compactionDirectory string, timeout time.Dur
}()

// use temporary file as compaction target
options := bboltOptions(timeout, false)
options := bboltOptions(timeout, c.db.NoSync)

c.compactionMutex.Lock()
defer c.compactionMutex.Unlock()
Expand Down
2 changes: 1 addition & 1 deletion extension/storage/filestorage/extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func (lfs *localFileStorage) GetClient(_ context.Context, kind component.Kind, e
rawName = sanitize(rawName)
}
absoluteName := filepath.Join(lfs.cfg.Directory, rawName)
client, err := newClient(lfs.logger, absoluteName, lfs.cfg.Timeout, lfs.cfg.Compaction, lfs.cfg.FSync)
client, err := newClient(lfs.logger, absoluteName, lfs.cfg.Timeout, lfs.cfg.Compaction, !lfs.cfg.FSync)

if err != nil {
return nil, err
Expand Down