Skip to content

sync-diff-inspector: --check-struct-only should not warn 'fail to get the correct size of table' #12821

Description

@meiking

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:

  1. --check-struct-only means the user only wants to compare table structures, not data. Table size is irrelevant in this scenario.
  2. Even if the user does not use --check-struct-only, when a table is genuinely empty (data_length = 0 in information_schema.tables), the warning is also incorrectly triggered. The code treats size == 0 the 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?

  1. When --check-struct-only is true, CalculateTotalSize should be skipped entirely, since table size is meaningless when only checking structure.
  2. When size == 0 and err == nil (i.e., the table is empty), the warning should not be emitted. Only a real error (err != nil) should trigger the warning.

Activity

  1. added
    contributionThis PR is from a community contributor.
    first-time-contributorIndicates that the PR was contributed by an external member and is a first-time contributor.
    on Aug 18, 2026
  2. ti-chi-bot commented on Aug 18, 2026

    @ti-chi-bot
    Contributor

    Welcome @meiking! It looks like this is your first issue to pingcap/tiflow 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    contributionThis PR is from a community contributor.first-time-contributorIndicates that the PR was contributed by an external member and is a first-time contributor.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions