Skip to content
This repository has been archived by the owner on Nov 24, 2023. It is now read-only.

shardddl: add infoOpLock for pessmist shardddl #1257

Merged
merged 3 commits into from
Nov 2, 2020

Conversation

GMHDBJD
Copy link
Collaborator

@GMHDBJD GMHDBJD commented Nov 2, 2020

What problem does this PR solve?

close #1253

[2020-10-30T02:25:09.879Z] [2020/10/30 10:24:51.715 +08:00] [INFO] [pessimist.go:522] ["the lock for the shard DDL lock operation has been resolved"] [component="shard DDL pessimist"] [operation="{\"id\":\"test-`shardddl`.`tb`\",\"task\":\"test\",\"source\":\"mysql-replica-02\",\"ddls\":[\"ALTER TABLE `shardddl`.`tb` ADD UNIQUE `idx_a`(`a`)\"],\"exec\":false,\"done\":true}"]
[2020-10-30T02:25:09.879Z] [2020/10/30 10:24:51.818 +08:00] [INFO] [pessimist.go:466] ["receive a shard DDL info"] [component="shard DDL pessimist"] [info="{\"task\":\"test\",\"source\":\"mysql-replica-01\",\"schema\":\"shardddl\",\"table\":\"tb\",\"ddls\":[\"ALTER TABLE `shardddl`.`tb` ADD UNIQUE `idx_b`(`b`)\"]}"]
[2020-10-30T02:25:09.880Z] [2020/10/30 10:24:51.818 +08:00] [ERROR] [pessimist.go:472] ["fail to try sync shard DDL lock"] [component="shard DDL pessimist"] [info="{\"task\":\"test\",\"source\":\"mysql-replica-01\",\"schema\":\"shardddl\",\"table\":\"tb\",\"ddls\":[\"ALTER TABLE `shardddl`.`tb` ADD UNIQUE `idx_b`(`b`)\"]}"] [error="[code=38016:class=dm-master:scope=internal:level=high], Message: sharding ddls in ddl lock [ALTER TABLE `shardddl`.`tb` ADD UNIQUE `idx_a`(`a`)] is different with [ALTER TABLE `shardddl`.`tb` ADD UNIQUE `idx_b`(`b`)], Workaround: Please use show-ddl-locks command for more details."]
[2020-10-30T02:25:09.880Z] [2020/10/30 10:24:51.828 +08:00] [INFO] [pessimist.go:652] ["delete shard DDL lock operations"] [component="shard DDL pessimist"] [lock=test-`shardddl`.`tb`] [revision=114]

we have fixed put shard DDL info if the done operation exists in #725 , so the above log may because the done operations have been deleted but lock has not.

What is changed and how it works?

add mutex in handleInfoPut and handleOperationPut

Check List

Tests

  • Integration test

@GMHDBJD GMHDBJD added priority/normal Minor change, requires approval from ≥1 primary reviewer type/bug-fix Bug fix needs-cherry-pick-release-2.0 This PR should be cherry-picked to release-2.0. Remove this label after cherry-picked to release-2.0 labels Nov 2, 2020
@csuzhangxc csuzhangxc added this to the v2.0.1 milestone Nov 2, 2020
Copy link
Member

@csuzhangxc csuzhangxc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@csuzhangxc csuzhangxc added the status/LGT1 One reviewer already commented LGTM label Nov 2, 2020
Copy link
Collaborator

@lance6716 lance6716 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lance6716 lance6716 merged commit 3358dcf into pingcap:master Nov 2, 2020
ti-srebot pushed a commit to ti-srebot/dm that referenced this pull request Nov 2, 2020
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot
Copy link

cherry pick to release-2.0 in PR #1263

@ti-srebot ti-srebot added already-cherry-pick-2.0 The related PR is already cherry-picked to release-2.0. Add this label once the PR is cherry-picked and removed needs-cherry-pick-release-2.0 This PR should be cherry-picked to release-2.0. Remove this label after cherry-picked to release-2.0 labels Nov 2, 2020
csuzhangxc pushed a commit that referenced this pull request Nov 2, 2020
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>

Co-authored-by: GMHDBJD <35025882+GMHDBJD@users.noreply.github.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
already-cherry-pick-2.0 The related PR is already cherry-picked to release-2.0. Add this label once the PR is cherry-picked priority/normal Minor change, requires approval from ≥1 primary reviewer status/LGT1 One reviewer already commented LGTM type/bug-fix Bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pessimistic shard ddl block in GetOperation
4 participants