Skip to content

Commit

Permalink
dm: add a note about DM to sql_require_primary_key (pingcap#15993)
Browse files Browse the repository at this point in the history
  • Loading branch information
Frank945946 authored Jan 9, 2024
1 parent 9a133cb commit 0a0a21c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions dm/task-configuration-file-full.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ target-database: # Configuration of the downstream database insta
sql_mode: "ANSI_QUOTES,NO_ZERO_IN_DATE,NO_ZERO_DATE" # Since DM v2.0.0, if this item does not appear in the configuration file, DM automatically fetches a proper value for "sql_mode" from the downstream TiDB. Manual configuration of this item has a higher priority.
tidb_skip_utf8_check: 1 # Since DM v2.0.0, if this item does not appear in the configuration file, DM automatically fetches a proper value for "tidb_skip_utf8_check" from the downstream TiDB. Manual configuration of this item has a higher priority.
tidb_constraint_check_in_place: 0
sql_require_primary_key: OFF # Controls whether a table must have a primary key at the session level. During the creation of a DM task, several metadata tables are created in TiDB, and some of them have no primary key. If this parameter is enabled, these metadata tables without primary keys cannot be created, which will cause DM to fail to create the task. In this case, you need to set this parameter to `OFF`.
security: # The TLS configuration of the downstream TiDB
ssl-ca: "/path/to/ca.pem"
ssl-cert: "/path/to/cert.pem"
Expand Down
6 changes: 6 additions & 0 deletions system-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -922,6 +922,12 @@ mysql> SHOW GLOBAL VARIABLES LIKE 'max_prepared_stmt_count';
- This feature is based on the similarly named [`sql_require_primary_key`](https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_sql_require_primary_key) in MySQL 8.0.
- It is strongly recommended to enable this variable when using TiCDC. This is because replicating changes to a MySQL sink requires that tables have a primary key.
<CustomContent platform="tidb">
- If you enable this variable and are using TiDB Data Migration (DM) to migrate data, it is recommended that you add `sql_require_ primary_key` to the `session` part in the [DM Task Configuration File](/dm/task-configuration-file-full.md#task-configuration-file-template-advanced) and set it to `OFF`. Otherwise, it will cause DM to fail to create tasks.
</CustomContent>
### sql_select_limit <span class="version-mark">New in v4.0.2</span>
- Scope: SESSION | GLOBAL
Expand Down

0 comments on commit 0a0a21c

Please sign in to comment.