core/rawdb: rename syncWithNoLock to doSync

This commit is contained in:
Felix Lange 2025-02-04 00:21:48 +01:00
parent eb5a449316
commit 6b917b393d

View file

@ -754,7 +754,7 @@ func (t *freezerTable) truncateTail(items uint64) error {
// //
// Therefore, forcibly flush everything above the offset to ensure this // Therefore, forcibly flush everything above the offset to ensure this
// assumption is satisfied! // assumption is satisfied!
if err := t.syncWithNoLock(); err != nil { if err := t.doSync(); err != nil {
return err return err
} }
// Count how many items can be deleted from the file. // Count how many items can be deleted from the file.
@ -835,7 +835,7 @@ func (t *freezerTable) Close() error {
t.lock.Lock() t.lock.Lock()
defer t.lock.Unlock() defer t.lock.Unlock()
if err := t.syncWithNoLock(); err != nil { if err := t.doSync(); err != nil {
return err return err
} }
var errs []error var errs []error
@ -1135,7 +1135,7 @@ func (t *freezerTable) advanceHead() error {
t.lock.Lock() t.lock.Lock()
defer t.lock.Unlock() defer t.lock.Unlock()
if err := t.syncWithNoLock(); err != nil { if err := t.doSync(); err != nil {
return err return err
} }
// We open the next file in truncated mode -- if this file already // We open the next file in truncated mode -- if this file already
@ -1166,12 +1166,11 @@ func (t *freezerTable) Sync() error {
t.lock.Lock() t.lock.Lock()
defer t.lock.Unlock() defer t.lock.Unlock()
return t.syncWithNoLock() return t.doSync()
} }
// syncWithNoLock is the internal version of Sync which assumes the lock is // doSync is the internal version of Sync which assumes the lock is already held.
// already held. func (t *freezerTable) doSync() error {
func (t *freezerTable) syncWithNoLock() error {
// Trying to fsync a file opened in rdonly causes "Access denied" // Trying to fsync a file opened in rdonly causes "Access denied"
// error on Windows. // error on Windows.
if t.readonly { if t.readonly {