Skip to content

Commit

Permalink
chore: minor refactor suggested by go lint
Browse files Browse the repository at this point in the history
  • Loading branch information
davidby-influx committed Jun 4, 2021
1 parent 8be1b13 commit 7d10228
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tsdb/shard.go
Original file line number Diff line number Diff line change
Expand Up @@ -1651,7 +1651,7 @@ func NewMeasurementFieldSet(path string) (*MeasurementFieldSet, error) {
fields: make(map[string]*MeasurementFields),
path: path,
}
fs.SetMeasurementFieldSetWriter(100)
fs.SetMeasurementFieldSetWriter(MaxCombinedWrites)
// If there is a load error, return the error and an empty set so
// it can be rebuild manually.
return fs, fs.load()
Expand Down Expand Up @@ -1855,7 +1855,7 @@ func (fs *MeasurementFieldSet) writeToFile(first writeRequest) {
if err != nil || isEmpty {
return
}
err = fs.renameFile(path, err)
err = fs.renameFile(path)
}

// marshalMeasurementFieldSet: remove the fields.idx file if no fields
Expand All @@ -1875,15 +1875,15 @@ func (fs *MeasurementFieldSet) marshalMeasurementFieldSet() ([]byte, error) {
return fs.marshalMeasurementFieldSetNoLock()
}

func (fs *MeasurementFieldSet) renameFile(path string, err error) error {
func (fs *MeasurementFieldSet) renameFile(path string) error {
fs.mu.Lock()
defer fs.mu.Unlock()

if err := file.RenameFile(path, fs.path); err != nil {
return err
}

if err = file.SyncDir(filepath.Dir(fs.path)); err != nil {
if err := file.SyncDir(filepath.Dir(fs.path)); err != nil {
return err
}

Expand Down

0 comments on commit 7d10228

Please sign in to comment.