forked from TrueCloudLab/frostfs-node
[#959] node: Set mode to shard's components when open it
Avoid opening database for `metabase` and `cache` in `Degraded` mode. Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
This commit is contained in:
parent
60527abb65
commit
d19ade23c8
25 changed files with 219 additions and 74 deletions
|
@ -95,8 +95,14 @@ func (c *cache) DumpInfo() Info {
|
|||
}
|
||||
|
||||
// Open opens and initializes database. Reads object counters from the ObjectCounters instance.
|
||||
func (c *cache) Open(_ context.Context, readOnly bool) error {
|
||||
err := c.openStore(readOnly)
|
||||
func (c *cache) Open(_ context.Context, mode mode.Mode) error {
|
||||
c.modeMtx.Lock()
|
||||
defer c.modeMtx.Unlock()
|
||||
c.mode = mode
|
||||
if mode.NoMetabase() {
|
||||
return nil
|
||||
}
|
||||
err := c.openStore(mode.ReadOnly())
|
||||
if err != nil {
|
||||
return metaerr.Wrap(err)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue