Note
This view was introduced in OceanBase Database V4.2.0.
Purpose
The oceanbase.CDB_OB_TENANT_EVENT_HISTORY view displays the historical operation records of all tenants in the current cluster.
Columns
| Column | Type | Nullable? | Description |
|---|---|---|---|
| TENANT_ID | bigint(20) | NO | The ID of the tenant. |
| TIMESTAMP | timestamp(6) | NO | The time when the operation was executed, in µs. |
| MODULE | varchar(256) | NO | The name of the module. |
| EVENT | varchar(256) | NO | The name of the event. |
| NAME1 | varchar(256) | YES | The name of the first attribute. |
| VALUE1 | longtext | YES | The value of the first attribute. |
| NAME2 | varchar(256) | YES | The name of the second attribute. |
| VALUE2 | longtext | YES | The value of the second attribute. |
| NAME3 | varchar(256) | YES | The name of the third attribute. |
| VALUE3 | longtext | YES | The value of the third attribute. |
| NAME4 | varchar(256) | YES | The name of the fourth attribute. |
| VALUE4 | longtext | YES | The value of the fourth attribute. |
| NAME5 | varchar(256) | YES | The name of the fifth attribute. |
| VALUE5 | longtext | YES | The value of the fifth attribute. |
| NAME6 | varchar(256) | YES | The name of the sixth attribute. |
| VALUE6 | longtext | YES | The value of the sixth attribute. |
| EXTRA_INFO | longtext | YES | The additional information. |
| SVR_IP | varchar(46) | YES | The IP address of the OBServer node where the operation was executed. |
| SVR_PORT | bigint(20) | YES | The port number of the OBServer node where the operation was executed. |
| TRACE_ID | varchar(64) | YES | The trace ID of the operation. |
| COST_TIME | bigint(20) | YES | The time taken to execute the operation. |
| RET_CODE | bigint(20) | YES | The error code for the operation. The value 0 indicates that the operation was successfully executed. |
| ERROR_MSG | varchar(512) | YES | The error message. |
Typical tenant events
Typical tenant events belong to the TENANT ROLE CHANGE and SERVICE NAME modules.
When you perform operations of different modules, the NAME and VALUE attributes of the events vary.
TENANT ROLE CHANGE
The TENANT ROLE CHANGE module contains three operations: FAILOVER TO PRIMARY, SWITCHOVER TO PRIMARY, and SWITCHOVER TO STANDBY.
FAILOVER TO PRIMARY
When you initiate the
FAILOVER TO PRIMARYoperation, the tenant event record table records the following events:FAILOVER TO PRIMARY START
This event records the time when the
ALTER SYSTEM ACTIVATE STANDBYstatement was executed and the tenant information.Attribute Value NAME1:STMT_STR VALUE1: the statement that you entered.NAME2:TENANT_INFO VALUE2: the status or information of the tenant when the statement was initiated.FAILOVER TO PRIMARY END
This event records the time when the execution of the
ALTER SYSTEM ACTIVATE STANDBYstatement was completed, information of the tenant where the operation was performed, final status of the log stream, and time taken by key steps.Attribute Value NAME1:STMT_STR VALUE1: the statement that you entered.NAME2:TENANT_INFO VALUE2: the status or information of the tenant when the execution of the statement was completed.NAME3:FAILOVER_SCN VALUE3: the synchronization system change number (SCN) of the tenant after the failover.NAME4:COST_DETAIL VALUE4: the time taken by each phase during the execution of the statement, in μs.NAME5:ALL_LS VALUE5: the status of all log streams of the tenant whenACCESS MODEis modified.
SWITCHOVER TO PRIMARY
When you initiate the
SWITCHOVER TO PRIMARYoperation, the tenant event record table records the following major events:SWITCHOVER TO PRIMARY START
This event records the time when the
ALTER SYSTEM SWITCHOVER TO PRIMARYstatement was executed and the tenant information.Attribute Value NAME1:STMT_STR VALUE1: the statement that you entered.NAME2:TENANT_INFO VALUE2: the status or information of the tenant when the statement was initiated.WAIT LOG SYNC
This event records the log synchronization information of the tenant. When you execute the
ALTER SYSTEM SWITCHOVER TO PRIMARYstatement, the tenant waits until all latest log records are synchronized from the current primary tenant, to ensure data consistency and integrity.Attribute Value NAME1:IS_SYS_LS_SYNCED VALUE1: indicates whether the system log streams of the tenant are synchronized.NAME2:IS_ALL_LS_SYNCED VALUE2: indicates whether all log streams of the tenant are synchronized.NAME3:NON_SYNC_INFO VALUE3: the number of log streams that are not synchronized and the information about five log streams that are synchronized most slowly.SWITCHOVER_TO_PRIMARY_END
This event records the time when the execution of the
ALTER SYSTEM SWITCHOVER TO PRIMARYstatement was completed, information of the tenant where the operation was performed, final status of the log stream, and time taken by key steps.Attribute Value NAME1:STMT_STR VALUE1: the statement that you entered.NAME2:TENANT_INFO VALUE2: the status or information of the tenant when the execution of the statement was completed.NAME3:SWITCHOVER_SCN VALUE3: the synchronization SCN of the tenant after the switchover.NAME4:COST_DETAIL VALUE4: the time taken by each phase during the execution of the statement, in μs.NAME5:ALL_LS VALUE5: the status of all log streams of the tenant whenACCESS MODEis modified.
SWITCHOVER TO STANDBY
When you initiate the
SWITCHOVER TO STANDBYoperation, the tenant event record table records the following major events:SWITCHOVER TO STANDBY START
This event records the time when the
ALTER SYSTEM SWITCHOVER TO STANDBYstatement was executed and the tenant information.Attribute Value NAME1:STMT_STR VALUE1: the statement that you entered.NAME2:TENANT_INFO VALUE2: the status or information of the tenant when the statement was initiated.SWITCHOVER TO STANDBY END
This event records the time when the execution of the
ALTER SYSTEM SWITCHOVER TO STANDBYstatement was completed, information of the tenant where the operation was performed, final status of the log stream, and time taken by key steps.Attribute Value NAME1:STMT_STR VALUE1: the statement that you entered.NAME2:TENANT_INFO VALUE2: the status or information of the tenant when the execution of the statement was completed.NAME3:SWITCHOVER_SCN VALUE3: the synchronization SCN of the tenant after the switchover.NAME4:COST_DETAIL VALUE4: the time taken by each phase during the execution of the statement, in μs.NAME5:ALL_LS VALUE5: the status of all log streams of the tenant whenACCESS MODEis modified.
SERVICE NAME
The SERVICE NAME module contains four operations: CREATE SERVICE, DELETE SERVICE, START SERVICE, and STOP SERVICE.
You can query these operations by TRACE_ID. For example, you can query whether a broadcast was triggered when a service was created based on the TRACE_ID value of the service creation event.
CREATE SERVICE
When you initiate the
CREATE SERVICEoperation for a user tenant, the following events are recorded:BROADCAST SERVICE NAME
This event records the broadcast content, list of target OBServer nodes, and list of OBServer nodes that successfully received the broadcast. When you execute the
ALTER SYSTEM CREATE SERVICEstatement on an OBServer node, the node broadcasts the current service names of the tenant to all OBServer nodes where the units of the tenant reside.Attribute Value NAME1:EPOCH VALUE1: the versions of all the current service names of the tenant in the current broadcast.NAME2:TARGET_SERVICE_NAME_ID VALUE2: the ID of the service name that triggered the broadcast event.NAME3:SERVICE_NAME_LIST VALUE3: all the current service names of the tenant.NAME4:SERVICE_NAME_COMMAND_TYPE VALUE4: the type of the operation that triggered the broadcast event.NAME5:TARGET_SERVERS_LIST VALUE5: the target OBServer nodes of the broadcast, which are all the non-permanently-offline OBServer nodes where the units of the tenant reside.NAME6:SUCCESS_SERVERS_LIST VALUE6: the OBServer nodes that successfully received the broadcast.CREATE SERVICE
This event records the name of the service to be created and the information about the created service name. It is generated after the execution of the
ALTER SYSTEM CREATE SERVICEstatement is completed.Attribute Value NAME1:SERVICE_NAME_STRING VALUE1: the name of the service to be created.NAME2:CREATED_SERVICE_NAME VALUE2: the information about the created service name.
DELETE SERVICE
When you initiate the
DELETE SERVICEoperation for a user tenant, the following event is recorded:DELETE SERVICE
This event records the information at the time when the statement was initiated. It is generated after the execution of the
ALTER SYSTEM DELETE SERVICEstatement is completed.Attribute Value NAME1:DELETED_SERVICE_NAME VALUE1: the name of the service to be deleted.
START SERVICE
When you initiate the
START SERVICEoperation for a user tenant, the following events are recorded:BROADCAST SERVICE NAME
This event records the broadcast content, list of target OBServer nodes, and list of OBServer nodes that successfully received the broadcast. When you execute the
ALTER SYSTEM SERVICE NAMEstatement on an OBServer node, the node broadcasts the current service names of the tenant to all OBServer nodes where the units of the tenant reside.Attribute Value NAME1:EPOCH VALUE1: the versions of all the current service names of the tenant in the current broadcast.NAME2:TARGET_SERVICE_NAME_ID VALUE2: the ID of the service name that triggered the broadcast event.NAME3:SERVICE_NAME_LIST VALUE3: all the current service names of the tenant.NAME4:SERVICE_NAME_COMMAND_TYPE VALUE4: the type of the operation that triggered the broadcast event.NAME5:TARGET_SERVERS_LIST VALUE5: the target OBServer nodes of the broadcast, which are all the non-permanently-offline OBServer nodes where the units of the tenant reside.NAME6:SUCCESS_SERVERS_LIST VALUE6: the OBServer nodes that successfully received the broadcast.START SERVICE
This event records the information at the time when the statement was initiated and when the execution of the statement was completed. It is generated after the execution of the
ALTER SYSTEM START SERVICEstatement is completed.Attribute Value NAME1:SERVICE_NAME_BEFORE VALUE1: the service name before the service was started.NAME2:SERVICE_NAME_AFTER VALUE2: the service name after the service was started.
STOP SERVICE
When you initiate the
STOP SERVICEoperation for a user tenant, the following events are recorded:KILL CONNECTIONS OF SERVICE NAME
When you execute the
ALTER SYSTEM SERVICE NAMEstatement, all OBServer nodes where the units of the tenant reside close the connections established on them based on the service name, and an event is recorded for each of the OBServer nodes in the tenant event view. If no connection established based on the service name exists on an OBServer node, this event is not recorded for the OBServer node.Attribute Value NAME1:SERVICE_NAME VALUE1: the name of the service to be stopped.NAME2:KILLED_CONNECTIONS_COUNT VALUE2: the number of connections closed.NAME3:KILLED_CONNECTIONS_LIST VALUE3: the IDs of the connections closed.BROADCAST SERVICE NAME
This event records the broadcast content, list of target OBServer nodes, and list of OBServer nodes that successfully received the broadcast. When you execute the
ALTER SYSTEM STOP SERVICEstatement on an OBServer node, the node broadcasts the current service names of the tenant to all OBServer nodes where the units of the tenant reside.Attribute Value NAME1:EPOCH VALUE1: the versions of all the current service names of the tenant in the current broadcast.NAME2:TARGET_SERVICE_NAME _ID VALUE2: the ID of the service name that triggered the broadcast event.NAME3:SERVICE_NAME_LIST VALUE3: all the current service names of the tenant.NAME4:SERVICE_NAME_COMMAND_TYPE VALUE4: the type of the operation that triggered the broadcast event.NAME5:TARGET_SERVERS_LIST VALUE5: the target OBServer nodes of the broadcast, which are all the non-permanently-offline OBServer nodes where the units of the tenant reside.NAME6:SUCCESS_SERVERS_LIST VALUE6: the OBServer nodes that successfully received the broadcast.STOP SERVICE
This event records the information at the time when the statement was initiated and when the execution of the statement was completed. It is generated after the execution of the
ALTER SYSTEM STOP SERVICEstatement is completed.Attribute Value NAME1:SERVICE_NAME_BEFORE VALUE1: the service name before the service was stopped.NAME2:SERVICE_NAME_AFTER VALUE2: the service name after the service was stopped.
Sample query
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