All Products
Search
Document Center

:Shadow table synchronization

更新時間:Mar 16, 2023

Background

The shadow table synchronization feature of OceanBase Developer Center (ODC) allows you to automatically create a shadow table in the current database based on the schema of the source table. The shadow table name is the combination of the source table name and a prefix or suffix. This feature applies to scenarios like full-link stress testing.

This topic describes how to create a shadow table synchronization task in ODC.

Note

The shadow table synchronization feature of ODC V4.0.0 supports only the MySQL mode. If the source table contains subpartitions, only template-based HASH or KEY subpartitions are supported.

After a shadow table is created, you can view it on the **Table** page.

When a shadow table is created, if a table with the same name but a different schema already exists, a synchronization SQL statement is generated to update the schema of the existing shadow table.

Create a shadow table synchronization task

  1. Log on to the ODC console, and click the name of the target connection to go to the corresponding database object management page.

  2. In the top navigation bar, choose Tool > Synchronize Shadow Table to display the Create Shadow Table Synchronization Project panel.

    Shadow%20table%20synchronization%201
  3. On the Create Shadow Table Synchronization Project panel, specify the following information.

    1. Select a synchronization object.

      image

      Field

      Description

      Database

      The database to which the shadow table to be created belongs. You can view the name of the current connection.

      Synchronization Range

      The table to be synchronized.

      • Partial Tables: Shadow tables will be created in the current database for the selected tables.

      • All Tables: Shadow tables will be created in the current database for all tables in the source database.

      Name of Shadow Table

      The name of the shadow table, in the format of prefix + source table name or source table name + suffix. You can use custom prefix or suffix.

      Synchronization Objects

      The source tables to be synchronized as shadow tables. You must specify this field when Synchronization Range is set to Partial Tables.

    2. Analyze the schema of the shadow table.

      image

      Field

      Description

      Synchronized Tables

      The Synchronized Tables tab displays the source table name, shadow table name, and analysis result. You can click View to view the source table schema, shadow table schema, and schema change SQL statement, or click Skip, indicating that this shadow table is not synchronized.

      Unsynchronized Tables

      The Unsynchronized Tables tab displays the source table name, shadow table name, and analysis result. You can click Undo Skip to synchronize this shadow table.

      Note

      A skipped table will be displayed on the Unsynchronized Tables tab. If a shadow table with the same name and the same schema as the source table already exists, schema synchronization will be skipped.

      SQL Preview

      The SQL statement for schema synchronization.

      Task Settings

      Options of Execution Mode include:

      • Execute Immediately: The synchronization task is executed immediately.

      • Execute On Schedule: The synchronization task is executed on schedule.

      Task Settings

      Options of Task Error Handling Method include:

      • Abort Task: If an error occurs during the execution of the synchronization task, the subsequent SQL scripts are interrupted and no longer executed.

      • Ignore Error and Continue: If an error occurs during the execution of the synchronization task, the SQL script with the error is skipped, but subsequent SQL scripts will be executed.

      Remarks

      The business background of the project, such as the change purpose and expected goal.

  4. After you specify the preceding information, click Submit in the lower-right corner of the panel.

  5. After the task is generated, the Task Center panel automatically appears, where you can view the task status and task information. For more information, see Shadow table synchronization tasks.

    Shadow%20table%20synchronization%20Approve%20task%203

Related topics