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

Support resolve blocking of DMLs when one worker doesn't see all shard DDLs #2062

Open
lance6716 opened this issue Aug 30, 2021 · 1 comment
Assignees

Comments

@lance6716
Copy link
Collaborator

lance6716 commented Aug 30, 2021

Feature Request

Is your feature request related to a problem? Please describe:

DM source reading

The main processing logic of pessimistic sharding DDL is

  1. one DM-worker handles one upstream MySQL. When it reads a sharding DDL, it will block replicating DMLs of this shard and continue reading binlog, until all shards of this upstream MySQL have sent sharding DDL. At that time DM-worker will stop replicating, build a DDL lock and wait for DM-master to coordinate and resolve it
  2. DM-master waits for all DM-worker to build the DDL lock (if shards are splitted among N upstream sources, there should be N DM-worker to build the lock), let first DM-worker execute the DDL downstream and resolve all locks so DM-worker will continue to replicate binlog.

currently unlock-ddl-lock command is used to forcibly let DM-master resolve a lock. But when DM-worker doesn't see DDLs of all shard tables in its upstream, it didn't build a lock so there's no way to resolve blocking of shard tables whose sharding DDL has been seen.

Describe the feature you'd like:

Resolve above issue.

currently most related command is unlock-ddl-lock, but the parameter of this command is "lock ID" which is shown in show-ddl-locks. There's no "lock ID" when not see DDLs of all shard.

maybe we can propose a new command?

shard-ddl-lock
show ddl lock and partial synchronized sharding DDLs

shard-ddl-lock unlock <task> <-d target-database> <-t target-table> [--no-exec]
expect that the blocking of DML is resolved after this command

shard-ddl-lock inject <task> [-s source-id] <-d target-database> <-t target-table>
ignore unseen shard tables, build a DDL lock now

And I think for shard-ddl-lock unlock we can let DM-master to execute the DDL, to get rid of owner parameter of old unlock-ddl-lock.

Describe alternatives you've considered:

Teachability, Documentation, Adoption, Migration Strategy:

@lance6716 lance6716 self-assigned this Aug 30, 2021
@lance6716 lance6716 changed the title Support unlock-ddl-lock when one worker doesn't see DDLs of all shard Support resolve blocking of DMLs when one worker doesn't see DDLs of all shard Aug 30, 2021
@lance6716
Copy link
Collaborator Author

@GMHDBJD @lichunzhu PTAL about how to resolve this issue

@lance6716 lance6716 changed the title Support resolve blocking of DMLs when one worker doesn't see DDLs of all shard Support resolve blocking of DMLs when one worker doesn't see all shard DDLs Aug 30, 2021
@lance6716 lance6716 assigned db-will and unassigned lance6716 Sep 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants