Replay from an OceanBase database of the source version to that of the target version is used to verify whether the performance before and after an upgrade meets the expectation. This topic describes how to obtain logs, how to perform two types of replay comparisons, and how the parameters for the old version's replay correspond to those in the current command line. For parameter details, see Replay execution. For statistical fields, see Performance statistics and reports.
Log acquisition
There are two methods: reading files or directly connecting to the source to collect data using plugins.
Method |
-f value |
Input |
|---|---|---|
| Export files from audit views | OCEANBASE_SQL_AUDIT_CSV |
Query and export audit views within a time window yourself. Supports .csv and .gz.csv formats. |
| Direct connection to audit views for collection | OCEANBASE_SQL_AUDIT |
The plugin connects to the source via JDBC and polls audit views within a time window. |
| Cloud OceanBase audit logs | OCEANBASE_SLS |
Files exported by the log service. The built-in format does not require a plugin. |
| Old OMA export files | OMA_DUMP_JSON |
Directory of historical dump outputs |
Parameters for direct connection collection are specified in the options.sqlAudit configuration file. Pass them using -c <configuration_file>:
Field |
Required |
Description |
|---|---|---|
host and port |
Yes | The IP address and port of the source. |
username |
Yes | The username of the source. Must have read access to the SQL audit view. |
password |
Not mandatory | Actual connection is provided according to the source authentication configuration. |
tenantMode |
Yes | mysql or oracle, in lowercase. Other values result in sqlAudit.tenantMode must be 'mysql' or 'oracle'. |
version |
Yes | 3.x or 4.x. Other values result in sqlAudit.version must be '3.x' or '4.x'. |
startTime and endTime |
Yes | The collection time window, which must be written as a time zone-adjusted ISO offset, e.g., 2026-11-12T17:00:00+08:00. endTime is the polling watermark, set to a point in the future that will always be polled. |
database |
Yes | The database used for the collection connection. Generally fill in oceanbase. If missing, it reports No database selected. |
tenant |
No | The source tenant. Choose either this or username: specifying this field when username is already written as root@tenant results in Access denied. |
targetTenant |
No | Does not participate in generating filter conditions, only serves as an identifier; use whereClause to scope records by tenant. |
whereClause |
No | Additional filter conditions for range queries. |
batchSize and pollIntervalMillis |
No | Number of rows per batch and polling interval. Default is 5000 and 10000. |
connectRetry and queryTimeoutSeconds |
No | Number of connection retries and query timeout. |
Missing required fields will sequentially report sqlAudit.<field_name> is required. version only determines which view to query (4.x corresponds to gv$ob_sql_audit, 3.x corresponds to gv$sql_audit). It does not detect the actual cluster version; fill in based on the view present at the source. Collection behavior and considerations are described in "Direct connection to source collection" under Log analysis.
The collection window is controlled on the export side or in options.sqlAudit: collect records only during business peak hours, or for a specified tenant or database. On the replay side, --start-time can be used to filter by a lower time boundary.
Replay comparison
Single-replay comparison: Use audit logs from the old version as input to replay to a tenant of the new version. In the report, the source_* column shows the time consumed by the old version as recorded in the logs, and the target_* column shows the measured time consumed by the new version. This method is convenient but is subject to cache, data volume, and concurrency effects since the data comes from runs at different times. It is suitable only for preliminary screening.
Double-replay comparison: Use the same CANONICAL_JSONL event catalog to replay to two tenants, one before and one after the upgrade. Generate independent statistical files for each replay, then compare the target_* columns of the two results. Fewer control variables yield a more reliable conclusion:
Must be consistent |
Description |
|---|---|
| Event catalog | Use exactly the same parsed output for both replays. Do not parse again. |
| Data | Same table structure and data scale, same data refresh method. |
| Tenant specifications | Same unit specifications, local and remote deployment configurations. |
| Concurrency and timing | Same replay.replayerCount, replay.replayMode, and replay.bufSize. |
| Filter scope | Same filters and sqlKeywordFilter configurations. |
| Statistics and checkpoints | Use a separate stats.dir for each replay and clear or replace the checkpoint. In practice, the execution directory's checkpoint.json file is read for continuation. Using the same checkpoint skips completed shards. See "Shards and continuation" in Replay execution. |
Procedure
Parse the exported audit logs. For direct connection collection, use
-c <configuration_file>to provideoptions.sqlAudit;-sis not needed.java -Xmx2g -jar oma.jar analyze \ -f OCEANBASE_SQL_AUDIT_CSV --plugins-dir ./plugins \ -s ./logs/ob-audit -o ./work/ob-canonical \ --source-type oceanbase --shards 4 --max-threads 4Configure the settings according to the target tenant mode. Use
tenantModeasMYSQLfor MySQL mode andORACLEfor Oracle mode. When comparing the two replays, modify only thedatabasegroup,stats.dir, andcheckpoint.filePath.Replay to the tenants of the two versions in sequence, confirming the consistency of the logs step by step. The confirmation method is the "Replay reconciliation" report and the number of submitted records in the summary: both replays should complete normally (
statusofreplay_run_metadataisCOMPLETED). Otherwise, the number of iterations and percentiles are not comparable.Generate reports separately and compare the
target_*percentiles. By default, the report outputs the top N by SQL ID. Sort fields are specified using--order-by. To view statistics at the statement text level, check the SQL original statistics or export the entire table for manual aggregation.java -Xmx2g -jar oma.jar replay --report ./work/stats/stats-before.db \ --order-by target_p90_ms --top 50 --format csv --output before.csvTo re-aggregate by database, tenant, or user, use
--export-sql-id-global-csv <path>to export thesql_id_global_statstable and continue the calculation on it.