Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/Unlock objects on deletion lock object #1461

Merged
merged 13 commits into from
Jun 17, 2022
Merged

Fix/Unlock objects on deletion lock object #1461

merged 13 commits into from
Jun 17, 2022

Conversation

carpawell
Copy link
Member

@carpawell carpawell commented May 31, 2022

Related to #1227.

  • Lock object could not exist without expiration.
  • Lock object is impossible to delete.
  • 2nd has an exception: control service.

Why two new options:

  1. Regular removal: WithTombstoneAddress/ WithGCMark.
  2. Removal by control service: WithForceGCMark to be able to delete Lock objects and unlock locked objects.
  3. Removal of tombstones/expired SGs/expired Locks by GC: WithGCMark and WithoutLockObjectHandling (the last is kinda optimization, we do not need to check if an object is a Lock object if we know that is it a TS/SG AND we must NOT check whether it is a Lock if we KNOW that we remove expired lock).

Also, I did not want to remove TS/SG/Expired LOCKS with WithForceGCMark since it is not forced removal in fact.

Question: does the SE need WithForceRemoval option or every StorageEngine.Delete call could be considered as a "force removal"?

@carpawell
Copy link
Member Author

Question[2]: do we need a separate error status for "lock object removal"?

@KirillovDenis
Copy link
Contributor

KirillovDenis commented Jun 2, 2022

I tested this PR and found out that the removal of the lock object doesn't produce any error (though the lock is still not removed). Is it expected?

@carpawell
Copy link
Member Author

carpawell commented Jun 6, 2022

Is it expected?

@KirillovDenis, no, fixed. Also, I guess, we will add a separate status code for such cases in another PR.

@carpawell carpawell marked this pull request as ready for review June 6, 2022 14:57
pkg/local_object_storage/metabase/inhume.go Outdated Show resolved Hide resolved
pkg/local_object_storage/shard/inhume.go Outdated Show resolved Hide resolved
pkg/local_object_storage/engine/inhume.go Show resolved Hide resolved
Comment on lines 50 to 51
expEpoch, err := cmd.Flags().GetUint64(lockExpiresOnFlag)
common.ExitOnErr(cmd, "Incorrect expiration epoch: %w", err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could also support +X format, which means relative to the current epoch.
The examples are here

// parseEpoch parses epoch argument. Second return value is true if

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good UX improvement

required to move that funcs to the common pkg and reorganized client pkg a little: d70bc5a

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ParseEpoch is ok, but moving GetSDKClientByFlag to common is not worth IMO. CAn we move GetCurrentEpoch to some other package? Or just export from modules/bearer package, there is a number of places we do a similar thing.

Copy link
Member Author

@carpawell carpawell Jun 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO, internal/client/sdk.go is smth strange: pkg exists only to hold the wrapper around SDK client and we have somehow added sdk.go file that returns raw SDK client

but ok, moved GetCurrentEpoch to the internal/client/sdk.go since it is a kinda helper that works with SDK client

ParseEpoch moved to the common

GetSDKClientByFlag kept at its previous place

pkg/local_object_storage/metabase/inhume.go Outdated Show resolved Hide resolved
pkg/local_object_storage/shard/lock_test.go Outdated Show resolved Hide resolved
pkg/local_object_storage/engine/lock_test.go Show resolved Hide resolved
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Make `ParseEpoch` and `GetCurrentEpoch` funcs public and move the first one
to the `common` package.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
pkg/local_object_storage/metabase/inhume.go Outdated Show resolved Hide resolved
cmd/neofs-cli/internal/client/sdk.go Outdated Show resolved Hide resolved
pkg/local_object_storage/metabase/inhume.go Outdated Show resolved Hide resolved
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
`WitDeletedLockCallback` => `WithDeletedLockCallback`.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
@fyrchik fyrchik merged commit 398eb80 into nspcc-dev:fix/correct-lock-objects Jun 17, 2022
@carpawell carpawell deleted the fix/unlock-objects-on-deletion-LOCK-object branch June 19, 2022 12:40
carpawell added a commit that referenced this pull request Jul 7, 2022
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
carpawell added a commit that referenced this pull request Jul 12, 2022
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
carpawell added a commit that referenced this pull request Jul 12, 2022
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
carpawell added a commit that referenced this pull request Jul 12, 2022
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
carpawell added a commit that referenced this pull request Jul 12, 2022
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
carpawell added a commit that referenced this pull request Jul 12, 2022
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
carpawell added a commit that referenced this pull request Jul 12, 2022
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
carpawell added a commit that referenced this pull request Jul 12, 2022
`WitDeletedLockCallback` => `WithDeletedLockCallback`.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
carpawell added a commit that referenced this pull request Jul 12, 2022
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
carpawell added a commit that referenced this pull request Jul 12, 2022
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
carpawell added a commit that referenced this pull request Jul 12, 2022
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
carpawell added a commit that referenced this pull request Jul 12, 2022
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
carpawell added a commit that referenced this pull request Jul 12, 2022
Document force removal behaviour in all the Storage engine parts.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
carpawell added a commit that referenced this pull request Jul 12, 2022
Do not return `meta.ErrLockObjectRemoval` from shard's methods, add shard's
own error for that.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
aprasolova pushed a commit to aprasolova/neofs-node that referenced this pull request Oct 19, 2022
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
aprasolova pushed a commit to aprasolova/neofs-node that referenced this pull request Oct 19, 2022
Make `ParseEpoch` and `GetCurrentEpoch` funcs public and move the first one
to the `common` package.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
aprasolova pushed a commit to aprasolova/neofs-node that referenced this pull request Oct 19, 2022
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
aprasolova pushed a commit to aprasolova/neofs-node that referenced this pull request Oct 19, 2022
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
aprasolova pushed a commit to aprasolova/neofs-node that referenced this pull request Oct 19, 2022
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
aprasolova pushed a commit to aprasolova/neofs-node that referenced this pull request Oct 19, 2022
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
aprasolova pushed a commit to aprasolova/neofs-node that referenced this pull request Oct 19, 2022
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
aprasolova pushed a commit to aprasolova/neofs-node that referenced this pull request Oct 19, 2022
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
aprasolova pushed a commit to aprasolova/neofs-node that referenced this pull request Oct 19, 2022
`WitDeletedLockCallback` => `WithDeletedLockCallback`.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
aprasolova pushed a commit to aprasolova/neofs-node that referenced this pull request Oct 19, 2022
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
aprasolova pushed a commit to aprasolova/neofs-node that referenced this pull request Oct 19, 2022
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
aprasolova pushed a commit to aprasolova/neofs-node that referenced this pull request Oct 19, 2022
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
aprasolova pushed a commit to aprasolova/neofs-node that referenced this pull request Oct 19, 2022
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
aprasolova pushed a commit to aprasolova/neofs-node that referenced this pull request Oct 19, 2022
Document force removal behaviour in all the Storage engine parts.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
aprasolova pushed a commit to aprasolova/neofs-node that referenced this pull request Oct 19, 2022
Do not return `meta.ErrLockObjectRemoval` from shard's methods, add shard's
own error for that.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants