-
Notifications
You must be signed in to change notification settings - Fork 767
http client: support update keyspce config #10717
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -120,6 +120,8 @@ type Client interface { | |
|
|
||
| /* Keyspace interface */ | ||
|
|
||
| // UpdateKeyspaceConfig patches the keyspace config. | ||
| UpdateKeyspaceConfig(ctx context.Context, keyspaceName string, params *UpdateKeyspaceConfigParams) error | ||
| // UpdateKeyspaceGCManagementType update the `gc_management_type` in keyspace meta config. | ||
| // If `gc_management_type` is `global_gc`, it means the current keyspace requires a tidb without 'keyspace-name' | ||
| // configured to run a global gc worker to calculate a global gc safe point. | ||
|
|
@@ -1143,19 +1145,28 @@ func (c *client) DeleteOperators(ctx context.Context) error { | |
| WithMethod(http.MethodDelete)) | ||
| } | ||
|
|
||
| // UpdateKeyspaceGCManagementType patches the keyspace config. | ||
| func (c *client) UpdateKeyspaceGCManagementType(ctx context.Context, keyspaceName string, keyspaceGCmanagementType *KeyspaceGCManagementTypeConfig) error { | ||
| keyspaceConfigPatchJSON, err := json.Marshal(keyspaceGCmanagementType) | ||
| func (c *client) updateKeyspaceConfig(ctx context.Context, reqName, keyspaceName string, params any) error { | ||
| keyspaceConfigPatchJSON, err := json.Marshal(params) | ||
| if err != nil { | ||
| return errors.Trace(err) | ||
| } | ||
| return c.request(ctx, newRequestInfo(). | ||
| WithName(UpdateKeyspaceGCManagementTypeName). | ||
| WithName(reqName). | ||
| WithURI(GetUpdateKeyspaceConfigURL(keyspaceName)). | ||
| WithMethod(http.MethodPatch). | ||
| WithBody(keyspaceConfigPatchJSON)) | ||
| } | ||
|
|
||
| // UpdateKeyspaceConfig patches the keyspace config. | ||
| func (c *client) UpdateKeyspaceConfig(ctx context.Context, keyspaceName string, params *UpdateKeyspaceConfigParams) error { | ||
| return c.updateKeyspaceConfig(ctx, UpdateKeyspaceConfigName, keyspaceName, params) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please consider the retry semantics for 409 Conflict here. A keyspace config precondition failure is returned by the server as 409, and this is a deterministic CAS failure, so it should not be retried against other PD members. The current HTTP client noNeedRetry only includes 400/403/404, so this PATCH will continue to be sent to subsequent endpoints after a 409. That can duplicate the same failed semantic request and logs. I suggest either disabling 409 retry for this API, or adding http.StatusConflict to noNeedRetry after confirming no other API relies on retrying 409.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @lhy1024 Modifying noNeedRetry requires further discussion; it's better not to include it in this PR. |
||
| } | ||
|
|
||
| // UpdateKeyspaceGCManagementType patches the keyspace config. | ||
| func (c *client) UpdateKeyspaceGCManagementType(ctx context.Context, keyspaceName string, keyspaceGCmanagementType *KeyspaceGCManagementTypeConfig) error { | ||
| return c.updateKeyspaceConfig(ctx, UpdateKeyspaceGCManagementTypeName, keyspaceName, keyspaceGCmanagementType) | ||
| } | ||
|
|
||
| // GetKeyspaceMetaByName get the given keyspace meta. | ||
| func (c *client) GetKeyspaceMetaByName(ctx context.Context, keyspaceName string) (*keyspacepb.KeyspaceMeta, error) { | ||
| var ( | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.