node: Fix Put in multi REP with intersecting sets of nodes #560

Merged
fyrchik merged 1 commit from acid-ant/frostfs-node:bugfix/traverse-via-intersecting-sets into master 2023-08-08 10:22:54 +00:00
Member

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

Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
acid-ant force-pushed bugfix/traverse-via-intersecting-sets from 36dc79922d to df8e86df2f 2023-08-03 07:41:53 +00:00 Compare
aarifullin approved these changes 2023-08-03 07:50:17 +00:00
fyrchik approved these changes 2023-08-03 08:47:14 +00:00
fyrchik left a comment
Owner

LGTM, could you also describe a scenario in the commit body?

LGTM, could you also describe a scenario in the commit body?
acid-ant force-pushed bugfix/traverse-via-intersecting-sets from df8e86df2f to 33a8430bb8 2023-08-03 12:44:25 +00:00 Compare
Author
Member

LGTM, could you also describe a scenario in the commit body?

Updated body with policies examples.

> LGTM, could you also describe a scenario in the commit body? Updated body with policies examples.
fyrchik approved these changes 2023-08-03 13:16:31 +00:00
fyrchik requested changes 2023-08-03 13:21:29 +00:00
@ -248,6 +248,7 @@ func (s *Service) saveToPlacementNodes(ctx context.Context,
for _, nodeAddress := range nodeAddresses {
nodeAddress := nodeAddress
if traversal.processed(nodeAddress) {
traverser.SubmitSuccess()
Owner

Hm, actually this is not completely true -- we submit a node as processed if we made a request to it, but the request could've failed, so we cannot SubmitSuccess() unconditionally.

Hm, actually this is not completely true -- we submit a node as `processed` if we made a request to it, but the request could've failed, so we cannot `SubmitSuccess()` unconditionally.
Author
Member

Updated a bit, now checks is node processed successful on the previous iteration.

Updated a bit, now checks is node processed successful on the previous iteration.
fyrchik marked this conversation as resolved
acid-ant force-pushed bugfix/traverse-via-intersecting-sets from 33a8430bb8 to 46b557d471 2023-08-08 06:57:34 +00:00 Compare
acid-ant requested review from aarifullin 2023-08-08 06:59:30 +00:00
acid-ant requested review from fyrchik 2023-08-08 06:59:32 +00:00
acid-ant force-pushed bugfix/traverse-via-intersecting-sets from 46b557d471 to 647cde3f07 2023-08-08 07:00:18 +00:00 Compare
acid-ant requested review from storage-core-committers 2023-08-08 07:02:33 +00:00
acid-ant requested review from storage-core-developers 2023-08-08 07:02:33 +00:00
acid-ant force-pushed bugfix/traverse-via-intersecting-sets from 647cde3f07 to 748dab0d4a 2023-08-08 07:46:53 +00:00 Compare
dstepanov-yadro requested changes 2023-08-08 07:54:43 +00:00
@ -49,3 +53,3 @@
// container nodes which was processed during the primary object placement
mExclude map[string]struct{}
mExclude map[string]*mExcludeItem

There is no need for mExcludeItem structure.

There is no need for `mExcludeItem` structure.
Author
Member

Agree, replaced with *bool.

Agree, replaced with `*bool`.
fyrchik approved these changes 2023-08-08 08:23:32 +00:00
@ -84,3 +88,1 @@
func (x *traversal) processed(n placement.Node) bool {
_, ok := x.mExclude[string(n.PublicKey())]
return ok
func (x *traversal) processed(n placement.Node) (*mExcludeItem, bool) {
Owner

Maybe return a pointer and compare it with nil instead of a second argument?

Maybe return a pointer and compare it with nil instead of a second argument?
Author
Member

Removed processed completely.

Removed `processed` completely.
@ -217,1 +223,3 @@
if t.traversal.processed(addrs[i]) {
if val, ok := t.traversal.processed(addrs[i]); ok {
// Check is node processed successful on the previous iteration.
if val != nil && val.res {
Owner

val can never be nil by construction -- we never put nil in map.

`val` can never be nil by construction -- we never put nil in map.
Author
Member

Agree, replaced with your suggestion.

Agree, replaced with your suggestion.
fyrchik marked this conversation as resolved
acid-ant force-pushed bugfix/traverse-via-intersecting-sets from 748dab0d4a to db327ecdd3 2023-08-08 08:31:00 +00:00 Compare
acid-ant force-pushed bugfix/traverse-via-intersecting-sets from db327ecdd3 to e8b484bcef 2023-08-08 08:48:59 +00:00 Compare
dstepanov-yadro approved these changes 2023-08-08 08:50:47 +00:00
fyrchik approved these changes 2023-08-08 10:22:45 +00:00
fyrchik merged commit 8d589314b5 into master 2023-08-08 10:22:54 +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#560
No description provided.