This topic introduces how to create and view shadow table synchronization tasks in ODC.
Background information
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 end-to-end stress testing.
Note
- The shadow table synchronization feature of ODC V4.0.0 and later supports only the MySQL mode. If the source table contains subpartitions, only HASH/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
Assume that you want to create a shadow table named employee_t in the odc_test database under the mysql410 data source.
| Parameter | Example |
|---|---|
| Data Source | mysql4.2.0 |
| Database Name | odc_test |
| Source Table Name | employee |
| Shadow Table Name | employee_t |
On the
Ticket tab in the SQL development window, chooseSynchronize Shadow Table >Create Shadow Table Synchronization Project .On the
Create Shadow Table Synchronization Project panel, specify the following information.Select a synchronization object.
Parameter Description Database The database to which the shadow table to be created belongs. You can view the name of the current data source. Synchronization Range The table to be synchronized. -
Partial Tables : Shadow tables will be created in the current database for the selected tables. You can also check theSelect All box on the left of the search box to select all source 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 a 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 toPartial Tables .-
Click
Next to analyze the structure of the shadow table.Parameter Description Synchronized Tables The Synchronized Tables tab displays the source table name, shadow table name, and analysis result. You can clickView to view the source table schema, shadow table schema, and schema change SQL statement, or clickSkip , 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 clickUndo 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.
-
- 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.
-
Description The business background of the project, such as the change purpose and expected goal. - Options of
After you specify the preceding information, click
Submit in the lower-right corner of the panel.After a task is generated, the
Tasks panel appears. In theTask panel, you can view the approval status and information about the task.
View shadow table synchronization tasks
Task information
In the shadow table synchronization list on the
Tasks page, clickView in theActions column.In the
Task Details panel, click theTask Information tab to view the basic information and settings of the task.In the
Task Details panel, clickInitiate Again in the lower-right corner to initiate the task again.
Task process
In the
Task Details panel, click theTask Process tab to view Initiated Task Status,Approval Status ,Execution Status , andCompletion Result .You can click
Initiate Again in the lower-right corner of the panel to initiate the task again.
Task logs
In the
Task Details panel, click theTask Logs tab and view all logs and alert logs of the task.Parameter Description All Logs Displays the complete information of all task logs, including INFO ,ERROR , andWARN logs.
You can clickSearch ,Download , orCopy to search for, download, or copy all logs.Alert Logs Displays the ERROR andWARN logs of the task. When a task fails, you can view the error message in the alert logs.
You can clickSearch ,Download , orCopy to search for, download, or copy alert logs.You can click
Initiate Again to initiate the task again.