Note
This view is available starting with V4.2.0.
Overview
The CDB_OB_TENANT_EVENT_HISTORY view displays the historical operation records of all tenants in the current cluster.
Columns
field |
Type |
Is NULL |
Description |
|---|---|---|---|
| TENANT_ID | bigint(20) | NO | Tenant ID |
| TIMESTAMP | timestamp(6) | NO | Execution time, in microseconds |
| MODULE | varchar(256) | NO | Module Name |
| EVENT | varchar(256) | NO | Event Name |
| NAME1 | varchar(256) | YES | First Attribute Name |
| VALUE1 | longtext | YES | First Attribute Value |
| NAME2 | varchar(256) | YES | The name of the second attribute |
| VALUE2 | longtext | YES | The value of the second attribute |
| NAME3 | varchar(256) | YES | Third Attribute Name |
| VALUE3 | longtext | YES | The value of the third attribute. |
| NAME4 | varchar(256) | YES | Fourth Attribute Name |
| VALUE4 | longtext | YES | The value of the fourth attribute |
| NAME5 | varchar(256) | YES | The fifth attribute name |
| VALUE5 | longtext | YES | The fifth attribute value |
| NAME6 | varchar(256) | YES | Sixth Attribute Name |
| VALUE6 | longtext | YES | The sixth attribute value |
| EXTRA_INFO | longtext | YES | Additional information |
| SVR_IP | varchar(46) | YES | IP address of the OBServer node where the action is executed |
| SVR_PORT | bigint(20) | YES | Port number of the OBServer node where the action is executed |
| TRACE_ID | varchar(64) | YES | Trace ID of the executed action |
| COST_TIME | bigint(20) | YES | Time consumed by the execution action |
| RET_CODE | bigint(20) | YES | Error code of the execution action. If it is0, the operation succeeded. |
| ERROR_MSG | varchar(512) | YES | Error message when the execution action fails |
Examples of typical tenant events
Typical tenant event modules include: TENANT ROLE CHANGE (primary/standby tenant switchover) and SERVICE NAME.
When users perform different module operations, the corresponding event NAME and VALUE values vary.
TENANT ROLE CHANGE
The TENANT ROLE CHANGE module includes three operations: FAILOVER TO PRIMARY, SWITCHOVER TO PRIMARY, and SWITCHOVER TO STANDBY.
FAILOVER TO PRIMARY OPERATION
When a user initiates a
FAILOVER TO PRIMARYoperation, the following important events are recorded in the tenant event log table.FAILOVER TO PRIMARY START
This event records the specific moment when the
ALTER SYSTEM ACTIVATE STANDBYcommand is executed and the related tenant information.AttributeAttribute valueNAME1:STMT_STR VALUE1:User input command text NAME2:TENANT_INFO VALUE2:The status or information of the tenant when the command is initiated. FAILOVER TO PRIMARY END
This event records the exact moment when the
ALTER SYSTEM ACTIVATE STANDBYcommand is completed. It includes information about the tenant that performed the operation, the final status of the log stream, and detailed timing for each key step.AttributeAttribute valueNAME1:STMT_STR VALUE1:User input command text NAME2:TENANT_INFO VALUE2:The status or information of the tenant at the end of the command. NAME3:FAILOVER_SCN VALUE3:The synchronization timestamp after tenant failover. NAME4:COST_DETAIL VALUE4:The time consumed in each phase during command execution, in microseconds. NAME5:ALL_LS VALUE5:All log stream states when the tenant changes the ACCESS MODE
SWITCHOVER TO PRIMARY operation
When a user initiates a
SWITCHOVER TO PRIMARYoperation, the following important events are recorded in the tenant's event log table.SWITCHOVER TO PRIMARY START
This event records the specific moment when the
ALTER SYSTEM SWITCHOVER TO PRIMARYcommand is executed and the related tenant information.AttributeAttribute valueNAME1:STMT_STR VALUE1:User input command text NAME2:TENANT_INFO VALUE2:The status or information of the tenant when the command is initiated. WAIT LOG SYNC
This event records information related to tenant log synchronization. When a user executes the
ALTER SYSTEM SWITCHOVER TO PRIMARYcommand, the involved tenant must wait until all the latest log records are synchronized from the current primary tenant to ensure data consistency and integrity.AttributeAttribute valueNAME1:IS_SYS_LS_SYNCED VALUE1:Whether the tenant's system log stream is synchronized. NAME2: IS_ALL_LS_SYNCED VALUE2: Whether all log streams of the tenant are synchronized. NAME3:NON_SYNC_INFO VALUE3:If there are log streams that are out of sync, the system displays the number of such streams and provides information about the five slowest-synchronizing log streams. SWITCHOVER_TO_PRIMARY_END
This event records the exact moment when the
ALTER SYSTEM SWITCHOVER TO PRIMARYcommand is completed. It includes information about the tenant that performed the operation, the final status of the log stream, and detailed timing for each key step.AttributeAttribute valueNAME1:STMT_STR VALUE1:User input command text NAME2:TENANT_INFO VALUE2:The status or information of the tenant at the end of the command. NAME3:SWITCHOVER_SCN VALUE3:The synchronization timestamp after tenant switchover. NAME4:COST_DETAIL VALUE4:Statistics of the phase duration during command execution, in microseconds. NAME5:ALL_LS VALUE5:All log stream statuses when the tenant changes the ACCESS MODE
SWITCHOVER TO STANDBY operation
When a user initiates a
SWITCHOVER TO STANDBYoperation, the following important events are recorded in the tenant's event log table.SWITCHOVER TO STANDBY START
This event records the specific moment when the
ALTER SYSTEM SWITCHOVER TO STANDBYcommand is executed and the related tenant information.AttributeAttribute valueNAME1:STMT_STR VALUE1:User input command text NAME2:TENANT_INFO VALUE2:The status or information of the tenant when the command is initiated. SWITCHOVER TO STANDBY END
This event records the exact moment when the
ALTER SYSTEM SWITCHOVER TO STANDBYcommand is completed. It includes information about the tenant that performed the operation, the final status of the log stream, and detailed timing for each key step.AttributeAttribute valueNAME1:STMT_STR VALUE1:User input command text NAME2:TENANT_INFO VALUE2:The status or information of the tenant at the end of the command. NAME3:SWITCHOVER_SCN VALUE3:The synchronization timestamp after tenant switchover. NAME4:COST_DETAIL VALUE4:Statistics of the phase duration during command execution, in microseconds. NAME5:ALL_LS VALUE5:All log stream statuses when the tenant modifies the ACCESS MODE
SERVICE NAME
The SERVICE NAME module includes four operations: CREATE SERVICE, DELETE SERVICE, START SERVICE, and STOP SERVICE.
These four operations can be retrieved using the TRACE_ID. For example, by locating the service creation event, you can trace back to the broadcasts triggered during that service creation based on its TRACE_ID.
CREATE SERVICE
When a service is created for a user tenant, the following events are recorded.
BROADCAST SERVICE NAME
This event provides detailed records of the broadcast content, the list of target OBServer machines, and the list of OBServer machines that successfully received the broadcast. When you execute the
ALTER SYSTEM CREATE SERVICEcommand, the OBServer that initiates the command broadcasts the current service name information for the tenant to all OBServer machines where units belonging to that tenant are located.AttributeAttribute valueNAME1:EPOCH VALUE1:Information version related to all current service names of the tenant in this broadcast NAME2:TARGET_SERVICE_NAME_ID VALUE2:The service_name_idthat triggered this broadcast event.NAME3:SERVICE_NAME_LIST VALUE3:Information about all current service names of the tenant. NAME4:SERVICE_NAME_COMMAND_TYPE VALUE4:The operation type that triggered this broadcast event. NAME5:TARGET_SERVERS_LIST VALUE5:All non-permanently offline servers where the units of the tenant reside. NAME6:SUCCESS_SERVERS_LIST VALUE6:The servers that broadcast the data successfully. CREATE SERVICE
This event records the name of the service to be created and the related details after the service is created. It is generated after the user's executed
ALTER SYSTEM CREATE SERVICEcommand completes.AttributeAttribute valueNAME1:SERVICE_NAME_STRING VALUE1:The name of the new service that you want to create. NAME2:CREATED_SERVICE_NAME VALUE2:Information about the created service name
DELETE SERVICE
The following events are recorded when a user tenant is deleted.
DELETE SERVICE
This event records information related to the command initiation time. It is generated after a user's
ALTER SYSTEM DELETE SERVICEcommand is executed.AttributeAttribute valueNAME1:DELETED_SERVICE_NAME VALUE1:Information about the service name to be deleted
START SERVICE
The following events are recorded when a user tenant has its service started.
BROADCAST SERVICE NAME
This event records in detail the broadcast content, the list of target OBServer machines, and the list of OBServer machines that successfully received the broadcast. When you execute the
ALTER SYSTEM SERVICE NAMEcommand, the OBServer that initiates the command broadcasts the current service name of the tenant to all OBServer machines where units belonging to that tenant are located.AttributeAttribute valueNAME1:EPOCH VALUE1:The version of information about all current service names of the tenant in this broadcast. NAME2:TARGET_SERVICE_NAME_ID VALUE2:The service_name_idthat triggered this broadcast event.NAME3:SERVICE_NAME_LIST VALUE3:The current all service_nameof the tenantNAME4:SERVICE_NAME_COMMAND_TYPE VALUE4:The operation type that triggered this broadcast event. NAME5:TARGET_SERVERS_LIST VALUE5:All non-permanently offline servers where the units of the tenant reside. NAME6:SUCCESS_SERVERS_LIST VALUE6: Machines with successful broadcasting START SERVICE
This event records information about the start and end times of a command. It is generated after the user-initiated
ALTER SYSTEM START SERVICEcommand completes execution.AttributeAttribute valueNAME1:SERVICE_NAME_BEFORE VALUE1:Information about the service name before the service is started. NAME2:SERVICE_NAME_AFTER VALUE2:Information about the service name after startup
STOP SERVICE
When a user tenant is stopped, the following events are recorded.
KILL CONNECTIONS OF SERVICE NAME
Each OBServer terminates the connections established on it through the stopped service name and then generates a record in the tenant event view. If no connections are established on an OBServer through the stopped service name, the event is not recorded in the table.
AttributeAttribute valueNAME1:SERVICE_NAME VALUE1:Information about the stopped service name NAME2:KILLED_CONNECTIONS_COUNT VALUE2:Number of killed connections NAME3:KILLED_CONNECTIONS_LIST VALUE3:ID of the killed connection BROADCAST SERVICE NAME
This event details the broadcast content, the list of target OBServer machines, and the list of OBServer machines that successfully received the broadcast. When you execute the
ALTER SYSTEM STOP SERVICEcommand, the OBServer that initiates the command broadcasts the current service name of the tenant to all OBServer machines where units belonging to that tenant are located.AttributeAttribute valueNAME1:EPOCH VALUE1:The version of information about all current service names for the tenant in this broadcast. NAME2:TARGET_SERVICE_NAME _ID VALUE2:The service _name _idthat triggered this broadcast event.NAME3:SERVICE_NAME_LIST VALUE3:The current tenant's all service_namesNAME4:SERVICE_NAME_COMMAND_TYPE VALUE4:The operation type that triggered this broadcast event. NAME5:TARGET_SERVERS_LIST VALUE5:All non-permanently offline servers where the units of the tenant reside. These are the servers for target broadcasting. NAME6:SUCCESS_SERVERS_LIST VALUE6: Machines with successful broadcasting STOP SERVICE
This event records information about the start and end times of a command. It is generated after the user-initiated
ALTER SYSTEM STOP SERVICEcommand is completed.AttributeAttribute valueNAME1:SERVICE_NAME_BEFORE VALUE1:Information about the service name before stopping the service. NAME2:SERVICE_NAME_AFTER VALUE2:Information about the service name after stopping the service.
DBMS_BALANCE
The DBMS_BALANCE module provides four operations: TRIGGER PARTITION BALANCE, SET BALANCE WEIGHT, CLEAR BALANCE WEIGHT, and CLEAR EXPIRED BALANCE WEIGHT.
TRIGGER PARTITION BALANCE operations
When a user initiates a
DBMS_BALANCE.TRIGGER_PARTITION_BALANCEoperation, aTRIGGER PARTITION BALANCEevent is recorded in the tenant's event log table.The
TRIGGER PARTITION BALANCEevent records the specific moment when theDBMS_BALANCE.TRIGGER_PARTITION_BALANCEcommand is initiated and its related parameter information.AttributeAttribute valueNAME1:BALANCE_TIMEOUT_S VALUE1:Timeout parameter when balancing is triggered, in seconds. SET BALANCE WEIGHT
When a user initiates a
DBMS_BALANCE.SET_BALANCE_WEIGHToperation, aSET BALANCE WEIGHTevent is recorded in the tenant's event log table.The
SET BALANCE WEIGHTevent records the specific moment when theDBMS_BALANCE.SET_BALANCE_WEIGHTcommand is executed and its related parameter information.AttributeAttribute valueNAME1:WEIGHT VALUE1:Partition weight NAME2:DATABASE_NAME VALUE2:The name of the database to which the table with partition weights belongs. NAME3:TABLE_NAME VALUE3:The name of the table for which you want to set partition weights. NAME4:PARTITION_NAME VALUE4:The name of the partition for which you want to set the weight. NAME5:SUBPARTITION_NAME VALUE5:The name of the subpartition for which you want to set the partition weight. CLEAR BALANCE WEIGHT
When a user initiates a
DBMS_BALANCE.CLEAR_BALANCE_WEIGHToperation, aCLEAR BALANCE WEIGHTevent is recorded in the tenant's event log table.The
CLEAR BALANCE WEIGHTevent records the specific moment when theDBMS_BALANCE.CLEAR_BALANCE_WEIGHTcommand is initiated and its related parameter information.AttributeAttribute valueNAME1:DATABASE_NAME VALUE1:The name of the database to which the table whose partition weights are to be cleared belongs. NAME2:TABLE_NAME VALUE2:The name of the table whose partition weights are cleared NAME3: PARTITION_NAME VALUE3: The name of the partition whose weight is to be cleared NAME4: SUBPARTITION_NAME VALUE4: The name of the subpartition whose partition weight is to be cleared. CLEAR EXPIRED BALANCE WEIGHT
When the background thread cleans up expired partition weights, a
CLEAR EXPIRED BALANCE WEIGHTevent is recorded in the tenant's event log table.The
CLEAR EXPIRED BALANCE WEIGHTevent records the specific time and related parameter information when the backend clears expired partition weights.AttributeAttribute valueNAME1:TABLE_NAME VALUE1:The name of the table whose expired partition weights are being cleaned up NAME2:PARTITION_NAME VALUE2:The name of the partition whose weight of expired partitions is to be cleared NAME3:SUBPARTITION_NAME VALUE3:The name of the subpartition whose weight is to be cleaned up.
Sample query
Query the historical operation records of tenant 1002 in this cluster.
obclient [oceanbase]> SELECT * FROM oceanbase.CDB_OB_TENANT_EVENT_HISTORY WHERE TENANT_ID = 1002 AND EVENT = 'SWITCHOVER TO STANDBY END'\G
The query result is as follows:
*************************** 1. row ***************************
TENANT_ID: 1002
TIMESTAMP: 2023-12-14 14:33:20.321725
MODULE: TENANT ROLE CHANGE
EVENT: SWITCHOVER TO STANDBY END
NAME1: STMT_STR
VALUE1: ALTER SYSTEM SWITCHOVER TO STANDBY TENANT backup_mysql_tenant
NAME2: TENANT_INFO
VALUE2: {tenant_id:1002, tenant_role:"STANDBY", switchover_status:"NORMAL", switchover_epoch:1702535600271677, sync_scn:1702535620070597000, replayable_scn:1702535620070597000, readable_scn:1702535620070597000, recovery_until_scn:4611686018427387903, log_mode:"ARCHIVELOG", max_ls_id:1003}
NAME3: SWITCHOVER_SCN
VALUE3: 1702535620070597000
NAME4: COST_DETAIL
VALUE4: WAIT_LOG_END: 100190, CHANGE_ACCESS_MODE: 47261, OTHERS: 136839
NAME5: ALL_LS
VALUE5: NORMAL: 1, 1001, 1002, 1003
NAME6: NULL
VALUE6:
EXTRA_INFO: NULL
SVR_IP: 100.xx.xx.xx
SVR_PORT: 13324
TRACE_ID: Y340C64586BD4-00060C724AEB962B-0-0
COST_TIME: 284290
RET_CODE: 0
ERROR_MSG: NULL
1 row in set
