engine: Set Disabled mode to deleted shard #452

Merged
fyrchik merged 1 commit from dstepanov-yadro/frostfs-node:fix/read_after_close_support into support/v0.36 2023-06-20 07:43:07 +00:00

To reproduce:

  1. Using frostfs-cli set shard mode to degraded-read-only.
  2. Set shard mode to disabled in config file, then SIGHUP.

The following may happen:

  • get request goroutine: gets shard list to search object
  • sighup goroutine: gets shard list to close, closes shards
  • get request goroutine: executes the request on the closed shard, blobovniza opens
To reproduce: 1. Using `frostfs-cli` set shard mode to `degraded-read-only`. 2. Set shard mode to `disabled` in config file, then SIGHUP. The following may happen: * get request goroutine: gets shard list to search object * sighup goroutine: gets shard list to close, closes shards * get request goroutine: executes the request on the closed shard, blobovniza opens
dstepanov-yadro force-pushed fix/read_after_close_support from 3898ec28a2 to 6ccb9b24a7 2023-06-19 15:37:56 +00:00 Compare
dstepanov-yadro requested review from storage-core-committers 2023-06-19 15:38:04 +00:00
dstepanov-yadro requested review from storage-core-developers 2023-06-19 15:38:04 +00:00
dstepanov-yadro requested review from fyrchik 2023-06-19 15:38:15 +00:00
dstepanov-yadro requested review from JuliaKovshova 2023-06-19 15:38:26 +00:00
dstepanov-yadro reviewed 2023-06-19 15:42:27 +00:00
@ -140,3 +140,2 @@
func (e *StorageEngine) close(releasePools bool) error {
e.mtx.RLock()
defer e.mtx.RUnlock()
e.mtx.Lock()
Author
Member

I believe it is mistake so i changed type of lock

I believe it is mistake so i changed type of lock
Owner

It could be mistake, but may be not: mtx protects e.shards which is read here.
Do you have any particular scenario in mind?

It could be mistake, but may be not: `mtx` protects `e.shards` which is read here. Do you have any particular scenario in mind?
Author
Member

Hm, right. Reverted.

Hm, right. Reverted.
fyrchik marked this conversation as resolved
dstepanov-yadro reviewed 2023-06-19 15:43:11 +00:00
@ -175,3 +175,3 @@
for _, sh := range ss {
err := sh.Close()
err := sh.Close(true)
Author
Member

Disabled mode sets only when shards are deleted fron engine

Disabled mode sets only when shards are deleted fron engine
fyrchik reviewed 2023-06-19 15:43:44 +00:00
@ -261,0 +260,4 @@
func (s *Shard) Close(disable bool) error {
var lastErr error
if disable {
if err := s.SetMode(mode.Disabled); err != nil {
Owner

We have exactly 1 case, where disable == true, why not doing it on the caller-side when needed?

We have exactly 1 case, where `disable == true`, why not doing it on the caller-side when needed?
Author
Member

Right. Fixed.

Right. Fixed.
fyrchik marked this conversation as resolved
dstepanov-yadro reviewed 2023-06-19 15:44:11 +00:00
@ -7,3 +8,4 @@
apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status"
)
var ErrShardDisabled = logicerr.New("shard disabled")
Author
Member

Error type is logic to not to count this kind of errors with error counter

Error type is logic to not to count this kind of errors with error counter
dstepanov-yadro force-pushed fix/read_after_close_support from 6ccb9b24a7 to 6867742c5c 2023-06-19 15:49:08 +00:00 Compare
dstepanov-yadro force-pushed fix/read_after_close_support from 6867742c5c to d015178f2d 2023-06-19 15:50:42 +00:00 Compare
dstepanov-yadro reviewed 2023-06-19 15:53:48 +00:00
@ -160,2 +160,4 @@
return 0, ErrPiloramaDisabled
}
s.m.RLock()
Author
Member

I think it must be mode check too.

I think it must be mode check too.
dstepanov-yadro force-pushed fix/read_after_close_support from d015178f2d to 1cae03c47c 2023-06-19 16:04:57 +00:00 Compare
fyrchik approved these changes 2023-06-19 16:08:07 +00:00
acid-ant approved these changes 2023-06-19 18:55:03 +00:00
JuliaKovshova approved these changes 2023-06-20 07:18:16 +00:00
JuliaKovshova approved these changes 2023-06-20 07:23:41 +00:00
fyrchik merged commit 1cae03c47c into support/v0.36 2023-06-20 07:43:07 +00:00
Sign in to join this conversation.
No reviewers
TrueCloudLab/storage-core-developers
No milestone
No project
No assignees
4 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#452
No description provided.