Modernize dm/pkg#12718
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Code Review
This pull request modernizes the codebase by replacing interface{} with any, adopting for range loops for integer iterations, and leveraging standard library packages like slices and maps. However, several critical compilation errors are introduced where wg.Go is called on standard sync.WaitGroup instances, which do not support this method. Additionally, the performance of strings.Builder in basedb.go can be improved by using fmt.Fprintf directly instead of writing formatted strings, which avoids unnecessary allocations.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| if rawCfg.ReadTimeout != "" { | ||
| dsn += fmt.Sprintf("&readTimeout=%s", rawCfg.ReadTimeout) | ||
| dsn.WriteString(fmt.Sprintf("&readTimeout=%s", rawCfg.ReadTimeout)) | ||
| } | ||
| if rawCfg.WriteTimeout != "" { | ||
| dsn += fmt.Sprintf("&writeTimeout=%s", rawCfg.WriteTimeout) | ||
| dsn.WriteString(fmt.Sprintf("&writeTimeout=%s", rawCfg.WriteTimeout)) | ||
| } |
There was a problem hiding this comment.
Using dsn.WriteString(fmt.Sprintf(...)) allocates intermediate strings. Use fmt.Fprintf directly with the strings.Builder to avoid unnecessary allocations and improve efficiency.
| if rawCfg.ReadTimeout != "" { | |
| dsn += fmt.Sprintf("&readTimeout=%s", rawCfg.ReadTimeout) | |
| dsn.WriteString(fmt.Sprintf("&readTimeout=%s", rawCfg.ReadTimeout)) | |
| } | |
| if rawCfg.WriteTimeout != "" { | |
| dsn += fmt.Sprintf("&writeTimeout=%s", rawCfg.WriteTimeout) | |
| dsn.WriteString(fmt.Sprintf("&writeTimeout=%s", rawCfg.WriteTimeout)) | |
| } | |
| if rawCfg.ReadTimeout != "" { | |
| fmt.Fprintf(&dsn, "&readTimeout=%s", rawCfg.ReadTimeout) | |
| } | |
| if rawCfg.WriteTimeout != "" { | |
| fmt.Fprintf(&dsn, "&writeTimeout=%s", rawCfg.WriteTimeout) | |
| } |
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
|
/retest |
Resolve conflict in dm/pkg/storage/utils_test.go: upstream PR pingcap#12716 (loader(dm): update import-into external ID handling) removed the StripS3ExternalID helper from dm/pkg/storage/utils.go in favor of the lightning TikvImporter.StripS3ExternalIDForImportSQL config flag. Drop the now-orphaned TestStripS3ExternalID test accordingly. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
What problem does this PR solve?
Issue Number: ref #12691
What is changed and how it works?
Check List
Tests
Questions
Will it cause performance regression or break compatibility?
Do you need to update user documentation, design documentation or monitoring documentation?
Release note