Generate test data

更新时间:
复制 MD 格式

Background information

OceanBase Developer Center (ODC) provides an analog data feature. You can use this feature to quickly generate data based on the field types in a table for scenarios that require large amounts of data, such as testing database performance or validating features.

This document describes how to generate analog data from existing database tables within a ticket.

Note

The data in this document is for example purposes only. Replace it with your actual data as needed.

Notes

  • You can generate a maximum of 100 million rows of analog data at a time.

  • You cannot generate analog data for tables with CHECK constraints.

  • You cannot generate analog data for tables that use ZHSGB2312 encoding.

Create an analog data task

  1. In the SQL development window, click Ticket > Analog Data > New Analog Data.

  2. On the New Analog Data page, specify the following information.

    Item

    Description

    Database

    Select the database to change, for example, odc_test.

    Table

    Select an existing table in the current database, for example, employee. Analog data will be generated for this table.

    Data Volume

    Specify the amount of data to generate. The default value is 1,000 records. You can generate a maximum of 1,000,000 rows. Enter an integer from 1 to 1,000,000 in the text box.

    Batch Size

    Specify the number of records to commit in each batch. A COMMIT command is executed after each batch is generated. By default, a commit occurs every 200 records. The maximum value is 500. Enter an integer from 1 to 500 in the text box.

    Clear table before inserting analog data

    Select whether to clear the original data in the table when you insert analog data.

    Data conflict handling

    Select how to handle data conflicts. ODC supports the following methods:

    • Ignore: This is the default method. If a data conflict occurs, the conflicting data is not inserted.

    • Overwrite: If a data conflict occurs, the original data is deleted and the new data is inserted.

    • Stop: If a data conflict occurs, data generation stops and the entire analog data task is terminated.

    Rule Settings

    Set the data generation rules.

    In the Rule and Details columns, set the generation rules for the Field Name and Field Type of the selected table. The Rule column provides built-in rules based on the field type. The Details column displays specific information for the selected rule. Click the edit icon next to the details to modify them.

    Task Settings

    Select Execute Now or Scheduled Execution.

  3. Click Submit to create the analog data task.

  4. After the task is created, the Task Hub panel appears. In the Task Hub, you can view the approval result and task information.

View analog data

Task information

  1. In the Task Hub, find the target task in the analog data list and click View in the Actions column. The task details panel appears. In the upper-right corner of the panel, click the Task Information tab to view the basic task information and analog data settings.

    Item

    Description

    Basic Task Information

    Displays information such as Task ID, Connection, Database, Task Type, Execution Method, Creator, and Creation Time.

    Analog Data Settings

    Displays the settings you specified when you created the task, such as Target Table, Data Volume, Batch Size, Clear table before inserting analog data, Data conflict handling, Actual Inserted Records, Conflicting Records, Ignored Inserts, Purged Records, and Rule Settings.

  2. In the lower-right corner of the Task Information panel, click Run Again or Download to restart the task or download the export file.

Task logs

In the Task Hub, find the target task in the analog data list and click View in the Actions column. The task details panel appears. In the upper-right corner of the panel, click the Task Logs tab to view all logs and alert logs for the task.

Item

Description

All Logs

Displays all log information for the task, including INFO, ERROR, and WARN logs.

Alert Log

Displays only the ERROR and WARN logs for the task. If a task fails, you can view the alert log to get the error message.

The toolbar also provides the following buttons:

Feature

Description

Find

Click this button to search for log information.

Download

Click this button to download the log information.

Copy

Click this button to copy the log information.

Download analog data

In the Task Hub, find the target task in the analog data list and click View in the Actions column. The task details panel appears. In the lower-right corner of the panel, click Download to save the analog data to your computer. You can then view the exported data structure file on your computer.

References