Automatically update broker resource on broker changes #8249
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Fix #7578
Currently, when a new broker joins the cluster, or the tags for a broker is changed, broker resource won't be updated automatically. Users need to either rebuild broker resource for each table in that broker tenant, or wait for the periodic task to fix the broker resource. Before that, the changes for the broker won't be reflected.
This PR makes the following enhancements:
updateBrokerResource
to create/update instance rest APIs to automatically update the broker resource when enabled (disabled by default to keep the current behavior because updating broker resource can be costly for large cluster)DefaultTenant
, automatically update the broker resource so that it can build the routing tables properly.Release Notes
Add an optional boolean query parameter
updateBrokerResource
to the following rest APIs:POST /instances
: Add an instancePUT /instances/{instanceName}
: Update an instancePUT /instances/{instanceName}/updateTags
: Update the tags for an instanceAdd a rest API to update the broker resource for a specified broker:
POST /instances/{instanceName}/updateBrokerResource
For single-tenant cluster, when broker joins the cluster for the first time as
DefaultTenant
, automatically update the broker resource so that it can build the routing tables properly