Note
This view is available starting with V4.2.0.
Purpose
The 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 tenant ID. |
| TIMESTAMP | timestamp(6) | NO | The execution time, in microseconds. |
| MODULE | varchar(256) | NO | The module name. |
| EVENT | varchar(256) | NO | The event name. |
| 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 | Additional information. |
| SVR_IP | varchar(46) | YES | The IP address of the OBServer node where the action was executed. |
| SVR_PORT | bigint(20) | YES | The port number of the OBServer node where the action was executed. |
| TRACE_ID | varchar(64) | YES | The Trace ID of the action. |
| COST_TIME | bigint(20) | YES | The time consumed by the action. |
| RET_CODE | bigint(20) | YES | The error code of the action. If the value is 0, the action is successful. |
| ERROR_MSG | varchar(512) | YES | The error message returned when the action failed. |
Example of a typical tenant event
The typical tenant event module includes: TENANT ROLE CHANGE (tenant role change) and SERVICE NAME (service name).
When users perform different operations on different modules, the corresponding event NAME and VALUE values vary.
TENANT ROLE CHANGE
TENANT ROLE CHANGE module contains three operations: FAILOVER TO PRIMARY, SWITCHOVER TO PRIMARY, and SWITCHOVER TO STANDBY.
FAILOVER TO PRIMARY operation
When you execute the
FAILOVER TO PRIMARYoperation, the tenant event record table records the following important events.FAILOVER TO PRIMARY START
This event records the specific time when the
ALTER SYSTEM ACTIVATE STANDBYcommand is executed and the related tenant information.Attribute Attribute Value NAME1: STMT_STR VALUE1: the command text entered by the user NAME2: TENANT_INFO VALUE2: the status or information of the tenant at the time the command is initiated FAILOVER TO PRIMARY END
This event records the exact time when the
ALTER SYSTEM ACTIVATE STANDBYcommand is completed, including the related information of the tenant that executed the operation, the final status of the log stream, and the time spent in key steps.Attribute Attribute Value NAME1: STMT_STR VALUE1: the command text entered by the user NAME2: TENANT_INFO VALUE2: the status or information of the tenant at the end of the command NAME3: FAILOVER_SCN VALUE3: the synchronization point after the tenant fails over NAME4: COST_DETAIL VALUE4: the time spent in each phase of the command execution, in microseconds NAME5: ALL_LS VALUE5: the status of all log streams when the tenant modifies the ACCESS MODE
SWITCHOVER TO PRIMARY operation
When you execute the
SWITCHOVER TO PRIMARYoperation, the tenant event record table records the following important events.SWITCHOVER TO PRIMARY START
This event records the specific time when the
ALTER SYSTEM SWITCHOVER TO PRIMARYcommand is executed and the related tenant information.Attribute Attribute Value NAME1: STMT_STR VALUE1: the command text entered by the user NAME2: TENANT_INFO VALUE2: the status or information of the tenant at the time the command is initiated WAIT LOG SYNC
This event records the information about log synchronization. When you execute 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.Attribute Attribute Value NAME1: IS_SYS_LS_SYNCED VALUE1: whether the system log stream of the tenant 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 unsynchronized log streams, the system displays the number of unsynchronized log streams and provides information about the five log streams with the slowest synchronization speed. SWITCHOVER_TO_PRIMARY_END
This event records the exact time when the
ALTER SYSTEM SWITCHOVER TO PRIMARYcommand is completed, including the related information of the tenant that executed the operation, the final status of the log stream, and the time spent in key steps.Attribute Attribute Value NAME1: STMT_STR VALUE1: the command text entered by the user NAME2: TENANT_INFO VALUE2: the status or information of the tenant at the end of the command NAME3: SWITCHOVER_SCN VALUE3: the synchronization point after the tenant is switched over NAME4: COST_DETAIL VALUE4: the time spent in each phase of the command execution, in microseconds NAME5: ALL_LS VALUE5: the status of all log streams when the tenant modifies the ACCESS MODE
SWITCHOVER TO STANDBY operation
When you execute the
SWITCHOVER TO STANDBYoperation, the tenant event record table records the following important events.SWITCHOVER TO STANDBY START
This event records the specific time when the
ALTER SYSTEM SWITCHOVER TO STANDBYcommand is executed and the related tenant information.Attribute Attribute Value NAME1: STMT_STR VALUE1: the command text entered by the user NAME2: TENANT_INFO VALUE2: the status or information of the tenant at the time the command is initiated SWITCHOVER TO STANDBY END
This event records the exact time when the
ALTER SYSTEM SWITCHOVER TO STANDBYcommand is completed, including the related information of the tenant that executed the operation, the final status of the log stream, and the time spent in key steps.Attribute Attribute Value NAME1: STMT_STR VALUE1: the command text entered by the user NAME2: TENANT_INFO VALUE2: the status or information of the tenant at the end of the command NAME3: SWITCHOVER_SCN VALUE3: the synchronization point after the tenant is switched over NAME4: COST_DETAIL VALUE4: the time spent in each phase of the command execution, in microseconds NAME5: ALL_LS VALUE5: the status of all log streams when the tenant modifies the ACCESS MODE
SERVICE NAME
The SERVICE NAME module provides the CREATE SERVICE, DELETE SERVICE, START SERVICE, and STOP SERVICE operations.
You can use the TRACE_ID to trace the events of these operations. For example, you can find the event of creating a service and then trace the TRACE_ID of the event to find out whether the service creation triggers a broadcast.
CREATE SERVICE
When a user tenant is created, the system records the following event.
BROADCAST SERVICE NAME
This event records the content of the broadcast, the list of OBServer nodes to which the broadcast is sent, and the list of OBServer nodes that successfully receive the broadcast. When you execute the
ALTER SYSTEM CREATE SERVICEcommand, the OBServer node that initiates the command broadcasts the current service name of the tenant to all OBServer nodes where the units of the tenant are located.Property Value NAME1: EPOCH VALUE1: The version of the current service name of the tenant for the broadcast. NAME2: TARGET_SERVICE_NAME_ID VALUE2: The service_name_idthat triggers the broadcast event.NAME3: SERVICE_NAME_LIST VALUE3: The current service name of the tenant. NAME4: SERVICE_NAME_COMMAND_TYPE VALUE4: The type of the operation that triggers the broadcast event. NAME5: TARGET_SERVERS_LIST VALUE5: The OBServer nodes to which the broadcast is sent. These nodes are not permanently offline and host the units of the tenant. NAME6: SUCCESS_SERVERS_LIST VALUE6: The OBServer nodes that successfully receive the broadcast. CREATE SERVICE
This event records the name of the service to be created and the detailed information about the service after it is created. After you execute the
ALTER SYSTEM CREATE SERVICEcommand, the system generates this event.Property 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 a user tenant is deleted, the system records the following event.
DELETE SERVICE
This event records the information about the service to be deleted. After you execute the
ALTER SYSTEM DELETE SERVICEcommand, the system generates this event.Property Value NAME1: DELETED_SERVICE_NAME VALUE1: The information about the service to be deleted.
START SERVICE
When a user tenant is started, the system records the following event.
BROADCAST SERVICE NAME
This event records the content of the broadcast, the list of OBServer nodes to which the broadcast is sent, and the list of OBServer nodes that successfully receive the broadcast. When you execute the
ALTER SYSTEM SERVICE NAMEcommand, the OBServer node that initiates the command broadcasts the current service name of the tenant to all OBServer nodes where the units of the tenant are located.Property Value NAME1: EPOCH VALUE1: The version of the current service name of the tenant for the broadcast. NAME2: TARGET_SERVICE_NAME_ID VALUE2: The service _name _idthat triggers the broadcast event.NAME3: SERVICE_NAME_LIST VALUE3: The current service_nameof the tenant.NAME4: SERVICE_NAME_COMMAND_TYPE VALUE4: The type of the operation that triggers the broadcast event. NAME5: TARGET_SERVERS_LIST VALUE5: The OBServer nodes to which the broadcast is sent. These nodes are not permanently offline and host the units of the tenant. NAME6: SUCCESS_SERVERS_LIST VALUE6: The OBServer nodes that successfully receive the broadcast. START SERVICE
This event records the information about the service before and after it is started. After you execute the
ALTER SYSTEM START SERVICEcommand, the system generates this event.Property Value NAME1: SERVICE_NAME_BEFORE VALUE1: The information about the service name before the service is started. NAME2: SERVICE_NAME_AFTER VALUE2: The information about the service name after the service is started.
STOP SERVICE
When a user tenant is stopped, the system records the following event.
KILL CONNECTIONS OF SERVICE NAME
Each OBServer node terminates the connections established through the service name that is stopped and generates a record in the tenant event view. If no connections are established through the service name that is stopped on an OBServer node, the system does not record this event in the table.
Property Value NAME1: SERVICE_NAME VALUE1: The information about the service name that is stopped. NAME2: KILLED_CONNECTIONS_COUNT VALUE2: The number of terminated connections. NAME3: KILLED_CONNECTIONS_LIST VALUE3: The IDs of the terminated connections. BROADCAST SERVICE NAME
This event records the content of the broadcast, the list of OBServer nodes to which the broadcast is sent, and the list of OBServer nodes that successfully receive the broadcast. When you execute the
ALTER SYSTEM STOP SERVICEcommand, the OBServer node that initiates the command broadcasts the current service name of the tenant to all OBServer nodes where the units of the tenant are located.Property Value NAME1: EPOCH VALUE1: The version of the current service name of the tenant for the broadcast. NAME2: TARGET_SERVICE_NAME _ID VALUE2: The service _name _idthat triggers the broadcast event.NAME3: SERVICE_NAME_LIST VALUE3: The current service_nameof the tenant.NAME4: SERVICE_NAME_COMMAND_TYPE VALUE4: The type of the operation that triggers the broadcast event. NAME5: TARGET_SERVERS_LIST VALUE5: The OBServer nodes to which the broadcast is sent. These nodes are not permanently offline and host the units of the tenant. NAME6: SUCCESS_SERVERS_LIST VALUE6: The OBServer nodes that successfully receive the broadcast. STOP SERVICE
This event records the information about the service before and after it is stopped. After you execute the
ALTER SYSTEM STOP SERVICEcommand, the system generates this event.Attribute Attribute value NAME1: SERVICE_NAME_BEFORE VALUE1: Information about the service name before the service is stopped. NAME2: SERVICE_NAME_AFTER VALUE2: Information about the service name after the service is stopped.
Sample query
Query the historical operation records of tenant 1002 in the current 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