fix/355-increase-tree-service-client-cache-size #359

Closed
ale64bit wants to merge 156 commits from ale64bit/frostfs-node:fix/355-increase-tree-service-client-cache-size into support/v0.36
2 changed files with 10 additions and 13 deletions
Showing only changes of commit e9461686b8 - Show all commits

View file

@ -29,9 +29,6 @@ func (c *cache) SetMode(m mode.Mode) error {
))
defer span.End()
c.modeMtx.Lock()
defer c.modeMtx.Unlock()
return c.setMode(ctx, m)
}
@ -40,13 +37,6 @@ func (c *cache) setMode(ctx context.Context, m mode.Mode) error {
var err error
turnOffMeta := m.NoMetabase()
if turnOffMeta && !c.mode.NoMetabase() {
err = c.flush(ctx, true)
if err != nil {
return err
}
}
if !c.initialized.Load() {
close(c.stopInitCh)
@ -60,6 +50,16 @@ func (c *cache) setMode(ctx context.Context, m mode.Mode) error {
}()
}
c.modeMtx.Lock()
defer c.modeMtx.Unlock()
if turnOffMeta && !c.mode.NoMetabase() {
err = c.flush(ctx, true)
if err != nil {
return err
}
}
if c.db != nil {
if err = c.db.Close(); err != nil {
return fmt.Errorf("can't close write-cache database: %w", err)

View file

@ -163,9 +163,6 @@ func (c *cache) Init() error {
// Close closes db connection and stops services. Executes ObjectCounters.FlushAndClose op.
func (c *cache) Close() error {
c.modeMtx.Lock()
defer c.modeMtx.Unlock()
// Finish all in-progress operations.
if err := c.setMode(context.TODO(), mode.ReadOnly); err != nil {
return err