sync-diff-inspector: --check-struct-only should not warn 'fail to get the correct size of table'
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- Half a day
- Newbie friendliness
- 76/100
Research direction
In sync-diff-inspector/report/report.go, start at PrintSummary and trace how it calls CalculateTotalSize and handles size and err. Verify the behavior with --check-struct-only and with an empty table. Done means size calculation is skipped for structure-only checks and warnings occur only when err is non-nil.
Written by the indexing model from the issue text.
Description
What problem does this issue solve?
When running sync-diff-inspector with --check-struct-only, it still outputs the warning:
[WARN] [report.go:166] ["fail to get the correct size of table, if you want to get the correct size, please analyze the corresponding tables"] [table=`futures_position`.`position_10`]
This warning is misleading because:
--check-struct-onlymeans the user only wants to compare table structures, not data. Table size is irrelevant in this scenario.- Even if the user does not use
--check-struct-only, when a table is genuinely empty (data_length = 0 ininformation_schema.tables), the warning is also incorrectly triggered. The code treatssize == 0the same as a query error, but an empty table is a perfectly valid case.
Root Cause
In sync_diff_inspector/report/report.go, CalculateTotalSize is unconditionally called in PrintSummary, regardless of whether --check-struct-only is set. The condition if size == 0 || err != nil conflates two different cases: a real error vs. a legitimately empty table.
What is the expected behavior?
- When
--check-struct-onlyis true,CalculateTotalSizeshould be skipped entirely, since table size is meaningless when only checking structure. - When
size == 0anderr == nil(i.e., the table is empty), the warning should not be emitted. Only a real error (err != nil) should trigger the warning.
- Dominant language
- Go
- Stars
- 464
- Forks
- 313
- Avg merge
- 4d 7h
- Merged PRs (30d)
- 14
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from pingcap/tiflow
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
area/dm area/ticdc type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
area/dm type/feature
Difficulty 2/5 Half a day Newbie friendliness 74/100
-
component/test severity/minor type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
area/dm contribution type/bug
Difficulty 3/5 1-2 days Newbie friendliness 68/100
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 84/100
-
enhancement needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
kind/cleanup
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
kubernetes-sigs/kueue#15947 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
sympozium-ai/sympozium#627 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100