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: tracker panic when pk of downstream table orders behind #5159

Closed
D3Hunter opened this issue Apr 13, 2022 · 1 comment
Closed

dm: tracker panic when pk of downstream table orders behind #5159

D3Hunter opened this issue Apr 13, 2022 · 1 comment
Assignees
Labels
affects-5.3 affects-5.4 affects-6.0 area/dm Issues or PRs related to DM. severity/moderate type/bug The issue is confirmed as a bug.

Comments

@D3Hunter
Copy link
Contributor

D3Hunter commented Apr 13, 2022

What did you do?

to reproduce

  • downstream create table before sync or the table has no pk on create then add multiple pk later.
  • tracker will panic when downstream table ddl has, but even if the ddl doesn't satisfy all condition, dm may use the wrong key:
    • multiple normal index before pk
    • multiple uk/pk
    • number of normal index >= number of uk/pk

such as downstream create table below before sync:

create table t(
    a int not null,
    b int not null,
    c int not null,
    d int not null,
    e int not null,
    index (a),
    index(b),
    index(c),
    unique(d),
    unique(e)
);

or add pk after create table in upstream:

create database test;
use test;
create table t(
    a int not null,
    b int not null,
    c int not null,
    d int not null,
    e int not null,
    index (a),
    index(b),
    index(c)
);

alter table t add unique(d);
alter table t add unique(e);
show create table t;
insert into t values(1,1,1,1,1);

code panics since absoluteUKPosition comes from all indices but index into uk/pk arr:

availableUKIndexList[0], availableUKIndexList[absoluteUKPosition] = availableUKIndexList[absoluteUKPosition], availableUKIndexList[0]

"Message": "panic error: runtime error: index out of range [3] with length 2",

What did you expect to see?

works

What did you see instead?

panic

Versions of the cluster

occurs in 5.3, reproduced on 5.4/6.0

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

(paste current status of DM cluster here)
@lance6716
Copy link
Contributor

closed by #5167

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-5.3 affects-5.4 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

No branches or pull requests

2 participants