Skip to content
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

DM(syncer): syncer may lost dml under special sharding ddls #5002

Closed
WizardXiao opened this issue Mar 23, 2022 · 4 comments · Fixed by #5006
Closed

DM(syncer): syncer may lost dml under special sharding ddls #5002

WizardXiao opened this issue Mar 23, 2022 · 4 comments · Fixed by #5006
Assignees
Labels
affects-2.0.5 affects-2.0.6 affects-2.0.7 affects-5.3 affects-5.4 This bug affects the 5.4.x(LTS) versions. affects-6.0 area/dm Issues or PRs related to DM. severity/moderate type/bug The issue is confirmed as a bug.

Comments

@WizardXiao
Copy link
Contributor

What did you do?

  1. open gtid
  2. pessimistic shard mode
  3. two sub-table in one source
  4. sql like this:
    tb1 --> ddl1
    tb1 --> dml (lost)
    tb1 --> ddl2
    tb2 --> ddl1
    tb2 --> ddl2

What did you expect to see?

Don't lost tb1's dml.

What did you see instead?

lost tb1's dml

Versions of the cluster

DM version (run dmctl -V or dm-worker -V or dm-master -V):

v5.3 --> master

Upstream MySQL/MariaDB server version:

5.7.22-log

Downstream TiDB cluster version (execute SELECT tidb_version(); in a MySQL client):

5.7.25-TiDB-v5.3.0

How did you deploy DM: tiup or manually?

manually

Other interesting information (system version, hardware config, etc):

>
>

current status of DM cluster (execute query-status <task-name> in dmctl)

(paste current status of DM cluster here)
@WizardXiao WizardXiao added type/bug The issue is confirmed as a bug. area/dm Issues or PRs related to DM. labels Mar 23, 2022
@GMHDBJD
Copy link
Contributor

GMHDBJD commented Mar 23, 2022

middle_img_v2_2a630eea-6a5b-45f7-86f7-4d62a59ec86g
ping @lance6716

@lance6716
Copy link
Contributor

If this bug need not to be cherry-pick to earlier version, I guess it's earier to fix when use

type locationRecorder struct {
// +-------------+
// ... |current event| ...
// ^ +-------------+ ^
// | |
// curStartLocation curEndLocation
// there may be more events between curStartLocation and curEndLocation due to the limitation of binlog or
// implementation of DM, but in such scenario, those events should always belong to one transaction.
// When curStartLocation is equal to curEndLocation, it means current event is not a data change.
//
// curStartLocation is used when
// - display a meaningful location
// - match the injected location by handle-error
// - save table checkpoint of DML
// curEndLocation is used when
// - handle end location of DDL, when save table checkpoint or shard-resync

😂 not likely that we don't cherry-pick

@GMHDBJD
Copy link
Contributor

GMHDBJD commented Mar 23, 2022

😂 not likely that we don't cherry-pick

/(ㄒoㄒ)/~~

@niubell niubell assigned niubell and WizardXiao and unassigned niubell Mar 24, 2022
@WizardXiao
Copy link
Contributor Author

After tb1-ddl1 and tb2-ddl1 has been resolved, tb1-dml will be synced, and we will check wether tb1-dml < tb1-ddl2 (active ddl), but caculate tb1-ddl2's position use last_position‘s gtid which is the same as tb1-dml, when use gtid, we will filter tb1-dml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-2.0.5 affects-2.0.6 affects-2.0.7 affects-5.3 affects-5.4 This bug affects the 5.4.x(LTS) versions. affects-6.0 area/dm Issues or PRs related to DM. severity/moderate type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants