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

Revive dead object via control service #2968

Merged

Conversation

End-rey
Copy link
Contributor

@End-rey End-rey commented Oct 17, 2024

Closes #1450.

@End-rey End-rey force-pushed the 1450-allow-to-revive-dead-object-via-control-service branch from 7399fa6 to 2694957 Compare October 17, 2024 12:27
Copy link

codecov bot commented Oct 17, 2024

Codecov Report

Attention: Patch coverage is 9.67239% with 579 lines in your changes missing coverage. Please review.

Project coverage is 22.89%. Comparing base (c4bdae1) to head (26563d4).
Report is 8 commits behind head on master.

Files with missing lines Patch % Lines
pkg/services/control/service.pb.go 4.02% 262 Missing ⚠️
pkg/services/control/service_neofs.pb.go 0.00% 87 Missing ⚠️
pkg/services/control/service_grpc.pb.go 0.00% 62 Missing ⚠️
cmd/neofs-cli/modules/control/object_revive.go 0.00% 52 Missing ⚠️
pkg/services/control/server/object_revive.go 0.00% 33 Missing ⚠️
pkg/local_object_storage/metabase/revive.go 61.44% 23 Missing and 9 partials ⚠️
pkg/local_object_storage/engine/revive.go 0.00% 17 Missing ⚠️
pkg/services/control/rpc.go 0.00% 13 Missing ⚠️
pkg/local_object_storage/shard/revive.go 0.00% 10 Missing ⚠️
pkg/services/control/convert.go 0.00% 9 Missing ⚠️
... and 1 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2968      +/-   ##
==========================================
- Coverage   23.47%   22.89%   -0.59%     
==========================================
  Files         780      785       +5     
  Lines       46655    58747   +12092     
==========================================
+ Hits        10953    13449    +2496     
- Misses      34833    44419    +9586     
- Partials      869      879      +10     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

pkg/local_object_storage/shard/mode/mode.go Outdated Show resolved Hide resolved
pkg/local_object_storage/engine/revive.go Outdated Show resolved Hide resolved
pkg/local_object_storage/engine/revive.go Outdated Show resolved Hide resolved
pkg/local_object_storage/metabase/revive.go Outdated Show resolved Hide resolved
pkg/local_object_storage/metabase/revive.go Outdated Show resolved Hide resolved
pkg/local_object_storage/metabase/revive.go Outdated Show resolved Hide resolved
pkg/local_object_storage/metabase/revive.go Show resolved Hide resolved
@End-rey End-rey self-assigned this Oct 18, 2024
@End-rey End-rey force-pushed the 1450-allow-to-revive-dead-object-via-control-service branch from 2694957 to 1e3f1ae Compare October 18, 2024 11:58
@End-rey End-rey requested a review from carpawell October 21, 2024 13:27
}

var addr oid.Address
err = addr.DecodeString(request.GetBody().GetObjectAddress())
Copy link
Member

Choose a reason for hiding this comment

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

Why a string representation here? I'd not expect this in a protobuf protocol, you can avoid decoding.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't really understand. Do I need to transmit via bytes? I did the same as the status.

Copy link
Member

Choose a reason for hiding this comment

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

Whoa. Really unexpected. Well, it's a good reference, but I'd say it's a bug of status implementation. We can either divert here and make it better (it simplifies things) or follow established practice. Not critical then.

Copy link
Member

Choose a reason for hiding this comment

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

i thought i was expired by some another example for status but i do not find any string implementation (it is strange, cause i am for raw bytes too) so let it be raw bytes then cause we also have it in control API:

// List of object addresses to be removed.
// in NeoFS API binary format.
repeated bytes address_list = 1;

status can be fixed separately

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can you please explain where I should use bytes and where string?
For example, here:

string shard_id = 1;
// Object's revival status in a free form (human readable).
string status = 2;

I see that shard_id can also be bytes, as shown here:
bytes shard_ID = 1 [json_name = "shardID"];

Copy link
Member

@carpawell carpawell Oct 23, 2024

Choose a reason for hiding this comment

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

i think shard ID is ok to be string cause there is no fixed public rule for bytes -> string conversion (for addresses we know it), but for things from our public API it is ok to be bytes and cli can convert it inside according to SDK
@roman-khimov

Copy link
Member

Choose a reason for hiding this comment

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

Shard ID can be a string, it's deeply internal to the node, no one knows how to convert it properly into something human-oriented.

pkg/local_object_storage/engine/revive.go Outdated Show resolved Hide resolved
pkg/local_object_storage/engine/revive.go Show resolved Hide resolved
@End-rey End-rey force-pushed the 1450-allow-to-revive-dead-object-via-control-service branch from 1e3f1ae to 4ded500 Compare October 23, 2024 11:57
Includes API definition extending, RPC implementation, tests of metabase func.
The command requests server's storage engine to revive object by address. It's
purge all removal marks from all metabases and returns revival statuses.

Signed-off-by: Andrey Butusov <[email protected]>
Support command that revive object by purging all removal marks from all
metabases.

```
$ neofs-cli control object status --endpoint s04.neofs.devenv:8081 -w
services/storage/wallet04.json --object 4yYJV2AyHaJ3fpVimEihAj6NTkwmanbwE7YatJUWBPyM/CYUeRyjfiNXhBMW9XZmdSBJNVLXYBH3gSNQASWTGZX8t
Enter password >
Shard ID: 2wEzFvWsao9yBiDWKjSBfF
	metabase: AVAILABLE
	peapod: path: "/storage/peapod1.db"
$ neofs-cli object delete -r s04.neofs.devenv:8080 -w services/storage/wallet04
.json --cid 4yYJV2AyHaJ3fpVimEihAj6NTkwmanbwE7YatJUWBPyM --oid CYUeRyjfiNXhBMW9XZmdSBJNVLXYBH3gSNQASWTGZX8t
Enter password >
Object CYUeRyjfiNXhBMW9XZmdSBJNVLXYBH3gSNQASWTGZX8t removed successfully.
  ID: C2LrMExCF3FTfQaFYYZfoDGLpsUVLUy156pUpWh72YeN
  CID: 4yYJV2AyHaJ3fpVimEihAj6NTkwmanbwE7YatJUWBPyM
$ neofs-cli control object status --endpoint s04.neofs.devenv:8081 -w
services/storage/wallet04.json --object 4yYJV2AyHaJ3fpVimEihAj6NTkwmanbwE7YatJUWBPyM/CYUeRyjfiNXhBMW9XZmdSBJNVLXYBH3gSNQASWTGZX8t
Enter password >
Shard ID: 2wEzFvWsao9yBiDWKjSBfF
	metabase: AVAILABLE,IN GRAVEYARD
	peapod: path: "/storage/peapod1.db"
$ neofs-cli control object revive --endpoint s04.neofs.devenv:8081 -w
services/storage/wallet04.json --object 4yYJV2AyHaJ3fpVimEihAj6NTkwmanbwE7YatJUWBPyM/CYUeRyjfiNXhBMW9XZmdSBJNVLXYBH3gSNQASWTGZX8t
Enter password >
Shard ID: Vuy2Q8QaPZSuUxDycPxSBC
Revival status: don't revive, err: logical error: object neither in the graveyard nor was marked with GC mark
Shard ID: 2wEzFvWsao9yBiDWKjSBfF
Revival status: successful revival from graveyard, tomb: 4yYJV2AyHaJ3fpVimEihAj6NTkwmanbwE7YatJUWBPyM/C2LrMExCF3FTfQaFYYZfoDGLpsUVLUy156pUpWh72YeN
$ neofs-cli control object status --endpoint s04.neofs.devenv:8081 -w
services/storage/wallet04.json --object 4yYJV2AyHaJ3fpVimEihAj6NTkwmanbwE7YatJUWBPyM/CYUeRyjfiNXhBMW9XZmdSBJNVLXYBH3gSNQASWTGZX8t
Enter password >
Shard ID: 2wEzFvWsao9yBiDWKjSBfF
	metabase: AVAILABLE
	peapod: path: "/storage/peapod1.db"
```

Closes #1450.

Signed-off-by: Andrey Butusov <[email protected]>
@End-rey End-rey force-pushed the 1450-allow-to-revive-dead-object-via-control-service branch from 4ded500 to 26563d4 Compare October 23, 2024 14:26
@End-rey End-rey requested a review from roman-khimov October 24, 2024 07:43
}

var addr oid.Address
err = addr.DecodeString(string(request.GetBody().GetObjectAddress()))
Copy link
Member

Choose a reason for hiding this comment

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

Wait, but the idea was exactly to avoid DecodeString.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But I don't really understand how to avoid it. I did it like drop object, that @carpawell provided as example:

// List of object addresses to be removed.
// in NeoFS API binary format.
repeated bytes address_list = 1;

And I can't find a method to convert bytes to an address.

Copy link
Member

Choose a reason for hiding this comment

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

Looks like our control API is broken all over the place wrt this problem, so we can just follow the way it currently works and solve the problem for all requests in #2980.

@roman-khimov roman-khimov merged commit 1b2a229 into master Oct 25, 2024
18 of 21 checks passed
@roman-khimov roman-khimov deleted the 1450-allow-to-revive-dead-object-via-control-service branch October 25, 2024 12:12
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.

Allow to revive dead object via control service
3 participants