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

Harden restatectl reconfigure and avoid sending full LogletParams #2740

Merged
merged 1 commit into from
Feb 20, 2025

Conversation

muhamadazmy
Copy link
Contributor

Harden restatectl reconfigure and avoid sending full LogletParams

Summary:

  • Arguments provided to this command (in case of replicated provider) act as "hints" to
    the node to consider during replication. It still possible that the node decides to
    use more nodes or different than the provided nodeset
  • sequencer can also be a PlainNodeId
  • Most arguments are optional in case previous loglet is a replicated loglet, Otherwise the user needs
    to provide most arguments

@muhamadazmy muhamadazmy marked this pull request as ready for review February 14, 2025 16:10
@muhamadazmy
Copy link
Contributor Author

@tillrohrmann totally not urgent, but this is a follow up to #2730 now it's fully up to the node to figure out the new loglet-id. The reconfigure command only sends hints to the node, including the nodeset and the sequencer id, which are completely optional if previous loglet was also a replicated loglet

Copy link
Contributor

@pcholakov pcholakov left a comment

Choose a reason for hiding this comment

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

Thank you for making this better, @muhamadazmy!

Slight concern - I think we should try a bit harder to at least detect cross-version incompatibilities. I know it's annoying since we only just shipped 1.2.0 but now the possibility exists of using mismatched restate-server and restatectl versions together. Even if we don't support backwards compatibility, should we at least detect and fail loudly if we get a request with the old string params field set?

@@ -90,12 +90,19 @@ message CreatePartitionSnapshotRequest { uint32 partition_id = 1; }
message CreatePartitionSnapshotResponse { string snapshot_id = 1; }

message ChainExtension {
reserved 5;
Copy link
Contributor

Choose a reason for hiding this comment

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

TIL you can do this in proto!

Copy link
Contributor

Choose a reason for hiding this comment

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

It's not going to be a great experience if someone mixes different versions of restate-server and restatectl. Not fatal in this case but you might be wondering why you're getting validation errors on a seemingly legit reconfigure request. At some point we should start including explicit version info in these messages.

Should we keep the field on the server and explicitly reject the request as a validation error if params is used for now?

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 get your concern. I definitely missed that one. My focus was to make sure it doesn't do harm if `params is missing and the system will just reconfigure based on the cluster configuration.

I like your idea. I will put this field back and just fail if it's set

.preferred_sequencer(&self.log_id)
});

// let provider_kind = self.extension.unwrap(log.con)
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need this?

Suggested change
// let provider_kind = self.extension.unwrap(log.con)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Definitely not! I am blind 😅

@muhamadazmy
Copy link
Contributor Author

Thank you @pcholakov for your review. Good catch on the deprecation error. We now return an error if we using an older version of the cmdline tool with a newer version of the server.

It's unfortunately still possible to use newer version of the tool with older version of the server. it will not cause a problem but will not behave as expected.

I will look into always include the client and server version in requests/responses headers as a follow up, so it's always possible for both the server and the client to decide if the payload should be accepted or not.

Copy link
Contributor

@pcholakov pcholakov left a comment

Choose a reason for hiding this comment

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

Thanks for taking my feedback on board! Appreciate the changes you made 🙏

Comment on lines +103 to +104
// [deprecated] We return an error if this
// field is set.
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice! In the future we could require an explicit version to be passed in, and then we can actually drop this.

// `params`` is no longer supported. It's better to fail loudly
// then act unexpectedly on invalid request version
return Err(Status::invalid_argument(
"Detected a deprecated argument. Please upgrade to the latest version of the command-line tool to ensure compatibility.",
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe better to be explicit about which tool we mean?

Suggested change
"Detected a deprecated argument. Please upgrade to the latest version of the command-line tool to ensure compatibility.",
"Detected a deprecated argument. Please upgrade to the latest version of the restatectl tool to ensure compatibility.",

Some(ext) => {
if !ext.params.is_empty() {
// `params`` is no longer supported. It's better to fail loudly
// then act unexpectedly on invalid request version
Copy link
Contributor

Choose a reason for hiding this comment

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

nit

Suggested change
// then act unexpectedly on invalid request version
// than act unexpectedly on invalid request version

Summary:
- Arguments provided to this command (in case of replicated provider) act as "hints" to
the node to consider during replication. It still possible that the node decides to
use more nodes or different than the provided nodeset
- `sequencer` can also be a PlainNodeId
- Most arguments are optional in case previous loglet is a replicated loglet, Otherwise the user needs
  to provide most arguments
@muhamadazmy muhamadazmy merged commit 580bc46 into restatedev:main Feb 20, 2025
52 checks passed
@muhamadazmy muhamadazmy deleted the pr2740 branch February 20, 2025 07:54
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.

2 participants