[#255] write-cache: Fix init race condition
Do not use WC's internals in the initialization routines without mode protection. WC should be able to change its mode even if the initialization is not finished yet. Signed-off-by: Pavel Karpy <p.karpy@yadro.com>
This commit is contained in:
parent
7b981bfe97
commit
f87f44725a
1 changed files with 8 additions and 0 deletions
|
@ -86,13 +86,21 @@ func (c *cache) fsTreeFlushMarkUpdate(ctx context.Context) {
|
|||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
c.modeMtx.RLock()
|
||||
defer c.modeMtx.RUnlock()
|
||||
|
||||
_, _ = c.fsTree.Iterate(prm)
|
||||
|
||||
c.log.Info(logs.WritecacheFinishedUpdatingFSTreeFlushMarks)
|
||||
}
|
||||
|
||||
func (c *cache) dbFlushMarkUpdate(ctx context.Context) {
|
||||
c.log.Info(logs.WritecacheFillingFlushMarksForObjectsInDatabase)
|
||||
|
||||
c.modeMtx.RLock()
|
||||
defer c.modeMtx.RUnlock()
|
||||
|
||||
var m []string
|
||||
var indices []int
|
||||
var lastKey []byte
|
||||
|
|
Loading…
Add table
Reference in a new issue