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) #1263

Merged
merged 1 commit into from
Nov 2, 2020

Conversation

ti-srebot
Copy link

cherry-pick #1257 to release-2.0


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

@ti-srebot ti-srebot added priority/normal Minor change, requires approval from ≥1 primary reviewer type/bug-fix Bug fix type/cherry-pick This PR is just a cherry-pick (backport) labels 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
@csuzhangxc csuzhangxc added this to the v2.0.1 milestone Nov 2, 2020
@csuzhangxc csuzhangxc merged commit a8a59e6 into pingcap:release-2.0 Nov 2, 2020
@csuzhangxc csuzhangxc added the needs-update-release-note This PR should be added into release notes. Remove this label once the release notes are updated label Nov 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
first-time-contributor needs-update-release-note This PR should be added into release notes. Remove this label once the release notes are updated priority/normal Minor change, requires approval from ≥1 primary reviewer status/LGT1 One reviewer already commented LGTM type/bug-fix Bug fix type/cherry-pick This PR is just a cherry-pick (backport)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants