node: Set mode to shard's components when open it #967

Merged
fyrchik merged 1 commit from acid-ant/frostfs-node:bugfix/959-init-with-mode into master 2024-02-09 14:04:03 +00:00
Member

Close #959

Avoid opening database for metabase and cache in Degraded mode.

Signed-off-by: Anton Nikiforov an.nikiforov@yadro.com

Close #959 Avoid opening database for `metabase` and `cache` in `Degraded` mode. Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
acid-ant requested review from storage-core-committers 2024-02-07 14:39:11 +00:00
acid-ant requested review from storage-core-developers 2024-02-07 14:39:16 +00:00
fyrchik requested changes 2024-02-07 16:08:17 +00:00
@ -267,6 +271,7 @@ func TestConcurrentDelete(t *testing.T) {
const smallSizeLimit = 512
blobStor := New(
mode.ReadWrite,
Owner

It is necessary to put this inNew()? It doesn't accepts such things by design, because
they are provided in Open (where ro bool parameter can be replaced with m mode.Mode I guess)

It is necessary to put this in`New()`? It doesn't accepts such things by design, because they are provided in `Open` (where `ro bool` parameter can be replaced with `m mode.Mode` I guess)
Author
Member

No, it is not necessary. But in this case, we need to store mode inside Open, except when Open executed from SetMode.

No, it is not necessary. But in this case, we need to store `mode` inside `Open`, except when `Open` executed from `SetMode`.
Author
Member

Updated, now mode propagated via Open.

Updated, now `mode` propagated via `Open`.
dstepanov-yadro requested changes 2024-02-08 12:57:58 +00:00
@ -36,6 +37,7 @@ func init() {
func openMeta(cmd *cobra.Command) *meta.DB {
db := meta.New(
mode.ReadWrite,

Here metabase must be open read-only, see lines below.

Here metabase must be open read-only, see lines below.
Owner

Another reason to provide mode in Open -- this avoids duplication and inconsistence.

Another reason to provide mode in `Open` -- this avoids duplication and inconsistence.
Author
Member

Thanks, fixed.

Thanks, fixed.
acid-ant force-pushed bugfix/959-init-with-mode from e5dd857474 to 5164ec6f67 2024-02-09 06:18:52 +00:00 Compare
acid-ant requested review from fyrchik 2024-02-09 06:20:24 +00:00
acid-ant requested review from dstepanov-yadro 2024-02-09 06:20:24 +00:00
acid-ant changed title from node: Set mode to shard's components when created to node: Set mode to shard's components when open it 2024-02-09 06:23:34 +00:00
fyrchik approved these changes 2024-02-09 07:38:14 +00:00
@ -38,2 +36,2 @@
} else {
metabaseOpened = true
m := s.GetMode()
if !m.NoMetabase() {
Owner

No when the mode is provided to Open(), do we still need this if? It seems metabase knows to do nothing in Degraded mode.

No when the mode is provided to Open(), do we still need this if? It seems metabase knows to do nothing in Degraded mode.
Author
Member

Thanks, simplified this part.

Thanks, simplified this part.
dstepanov-yadro requested changes 2024-02-09 08:18:44 +00:00
dstepanov-yadro left a comment
Member

Some unit test required

Some unit test required
acid-ant force-pushed bugfix/959-init-with-mode from 5164ec6f67 to 29812f6683 2024-02-09 09:28:04 +00:00 Compare
Author
Member

Some unit test required

Thanks, added.

> Some unit test required Thanks, added.
acid-ant requested review from dstepanov-yadro 2024-02-09 09:29:51 +00:00
dstepanov-yadro approved these changes 2024-02-09 09:33:45 +00:00
fyrchik merged commit d19ade23c8 into master 2024-02-09 14:04:03 +00:00
Sign in to join this conversation.
No reviewers
TrueCloudLab/storage-core-developers
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: TrueCloudLab/frostfs-node#967
No description provided.