forked from TrueCloudLab/frostfs-node
[#728] writecache: Fix Badger writecache race.
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
d4b6ebe7e7
commit
869518be0a
2 changed files with 24 additions and 13 deletions
|
@ -85,6 +85,9 @@ func (c *cache) DumpInfo() writecache.Info {
|
|||
|
||||
// Open opens and initializes database. Reads object counters from the ObjectCounters instance.
|
||||
func (c *cache) Open(_ context.Context, readOnly bool) error {
|
||||
c.modeMtx.Lock()
|
||||
defer c.modeMtx.Unlock()
|
||||
|
||||
err := c.openStore(readOnly)
|
||||
if err != nil {
|
||||
return metaerr.Wrap(err)
|
||||
|
@ -94,6 +97,9 @@ func (c *cache) Open(_ context.Context, readOnly bool) error {
|
|||
|
||||
// Init runs necessary services.
|
||||
func (c *cache) Init() error {
|
||||
c.modeMtx.Lock()
|
||||
defer c.modeMtx.Unlock()
|
||||
|
||||
c.log.Info(logs.WritecacheBadgerInitExperimental)
|
||||
c.metrics.SetMode(c.mode)
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue