Skip to content

Allow max-optimization-thread config to be set to null on update#5520

Closed
ghost wants to merge 1 commit intodevfrom
unknown repository
Closed

Allow max-optimization-thread config to be set to null on update#5520
ghost wants to merge 1 commit intodevfrom
unknown repository

Conversation

@ghost
Copy link
Copy Markdown

@ghost ghost commented Nov 25, 2024

All Submissions:

Fixes #5243

New Feature Submissions:

  1. Does your submission pass tests?
  2. Have you formatted your code locally using cargo +nightly fmt --all command prior to submission?
  3. Have you checked your code using cargo clippy --all --all-features command?

Changes to Core Features:

  • Have you written new tests for your core changes, as applicable?
  • Have you successfully ran tests with your changes locally?

Copy link
Copy Markdown
Contributor

@coszio coszio left a comment

Choose a reason for hiding this comment

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

Nice job, @gulshan-rs! However, there are interface changes still to be made for this to work as expected.

  1. GRPC interface needs to be updated as well with a new field (old field can be renamed, but can't change its numbering).
    Surely it will need deprecation, but to allow zero-downtime upgrades, for now we will need to be able to read both fields (new and old). We can take care of safely removing the old field after a releasing a later version.
  2. Right now the generated openapi model for MaxOptimizationThreads accepts null or a number, but we want "auto" or a number.
  3. Please run ./tools/generate_openapi_models.sh (for REST) and ./tools/generate_grpc_docs.sh (for grpc) after making the respective interface updates.

Comment on lines +503 to +505
.map_or(MaxOptimizationThreads::Auto, |n| {
MaxOptimizationThreads::Threads(n as usize)
}),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This means that even if max_optimization_threads is not specified in a grpc client, it will set it to Auto, which is not necessarily the intention.

Copy link
Copy Markdown
Author

@ghost ghost Nov 26, 2024

Choose a reason for hiding this comment

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

Thanks for the review and detailed comments. I will take another pass at it.

My initial intention was to not make any change in the GRPC interface so as to avoid any need of deprecation (tags) and worry about backward compatibility. Hence I decided to only change the inners i.e the OptimizersConfig and handle remaps via conversions -- but it seems broken. I will rerun integration tests locally to see what is broken or follow what you have suggested.

Copy link
Copy Markdown
Contributor

@coszio coszio Nov 26, 2024

Choose a reason for hiding this comment

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

Unfortunately we don't have a test which would break with this change yet, nor an easy framework for testing grpc interface. Most grpc changes are just validated with the compiler.

For REST, though, a test could be made to validate that setting a number or "auto" works ok. These tests usually take place at tests/openapi

@timvisee
Copy link
Copy Markdown
Member

timvisee commented Nov 26, 2024

I'm afraid we'll not be able to make this change, because as far as I understand is this will introduce a breaking change on the API level.

Also note that we cannot use null in the REST interface here. Some of our clients cannot distinguish between the field not being set at all, or it being set at null. That's an important difference in this interface.

Sadly I don't have a better suggestion. We've been struggling with this limitation for quite a while.

@ghost
Copy link
Copy Markdown
Author

ghost commented Nov 26, 2024

Also note that we cannot use null in the REST interface here.

Ok. I am more concerned with this one, yes this will be breaking changes for existing customers. I am going to pause work and discard this PR. thankyou both for all your quick feedback.

@timvisee
Copy link
Copy Markdown
Member

Thank you so much for giving it a shot though!

I'll let you know if I think of another way to potentially approach this.

This pull request was closed.
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