From 2119f0c8f820fb96b150c45c34bef46e5a0de60c Mon Sep 17 00:00:00 2001 From: AntiTopQuark Date: Tue, 30 Jul 2024 08:07:11 +0000 Subject: [PATCH] place holder for ash and wr --- .../src/lib/ash/ob_active_session_guard.h | 8 ++++ deps/oblib/src/lib/wait_event/ob_wait_event.h | 12 +++++- src/observer/virtual_table/ob_virtual_ash.cpp | 4 ++ src/observer/virtual_table/ob_virtual_ash.h | 1 + .../ob_inner_table_schema.12301_12350.cpp | 34 ++++++++++++++- .../ob_inner_table_schema.12351_12400.cpp | 15 +++++++ .../ob_inner_table_schema.15201_15250.cpp | 34 ++++++++++++++- .../ob_inner_table_schema.15251_15300.cpp | 15 +++++++ .../ob_inner_table_schema.21351_21400.cpp | 4 +- .../ob_inner_table_schema.25201_25250.cpp | 2 +- .../ob_inner_table_schema.451_500.cpp | 15 +++++++ .../inner_table/ob_inner_table_schema_def.py | 42 ++++++++++++++----- .../r/mysql/desc_sys_views_in_mysql.result | 4 +- .../r/mysql/desc_sys_views_in_sys.result | 8 ++-- .../mysql/desc_virtual_table_in_mysql.result | 2 + .../r/mysql/desc_virtual_table_in_sys.result | 2 + 16 files changed, 179 insertions(+), 23 deletions(-) diff --git a/deps/oblib/src/lib/ash/ob_active_session_guard.h b/deps/oblib/src/lib/ash/ob_active_session_guard.h index c3f7ab8757..784c3dda1b 100644 --- a/deps/oblib/src/lib/ash/ob_active_session_guard.h +++ b/deps/oblib/src/lib/ash/ob_active_session_guard.h @@ -99,6 +99,7 @@ public: union { uint64_t time_model_; // phase of execution bitmap struct { + // NEED placehold uint64_t in_parse_ : 1; uint64_t in_pl_parse_ : 1; uint64_t in_get_plan_cache_ : 1; @@ -110,6 +111,13 @@ public: uint64_t in_storage_read_ : 1; uint64_t in_storage_write_ : 1; uint64_t in_das_remote_exec_: 1; + uint64_t in_plsql_compilation_ : 1; + uint64_t in_plsql_execution_ : 1; + uint64_t in_filter_rows_: 1; + uint64_t in_rpc_encode_ : 1; + uint64_t in_rpc_decode_ : 1; + uint64_t in_connection_mgr_ : 1; + uint64_t in_check_row_confliction_: 1; }; }; diff --git a/deps/oblib/src/lib/wait_event/ob_wait_event.h b/deps/oblib/src/lib/wait_event/ob_wait_event.h index aa4bec4470..2bbf99c39e 100644 --- a/deps/oblib/src/lib/wait_event/ob_wait_event.h +++ b/deps/oblib/src/lib/wait_event/ob_wait_event.h @@ -59,7 +59,8 @@ WAIT_EVENT_DEF(NETWORK_QUEUE_WAIT, 13004, "wait for network request in queue", " // APPLICATION 14001-14999 WAIT_EVENT_DEF(MT_READ_LOCK_WAIT,14001,"memstore read lock wait","lock","waiter","owner",APPLICATION,false, true) WAIT_EVENT_DEF(MT_WRITE_LOCK_WAIT,14002,"memstore write lock wait","lock","waiter","owner",APPLICATION,false, false) -WAIT_EVENT_DEF(ROW_LOCK_WAIT,14003,"row lock wait","lock","waiter","owner",APPLICATION,false, false) +WAIT_EVENT_DEF(ROW_LOCK_WAIT,14003,"row lock wait","lock holder's tx id","data seq number","hold time",APPLICATION,false, false) +WAIT_EVENT_DEF(ROW_LOCK_RETRY, 14004, "retry wait because of row lock wait", "lock holder's tx id","data seq number","hold time", APPLICATION, false , false) // CONCURRENCY // condition wait has one parameter e.g. address of the condition variable @@ -153,10 +154,19 @@ WAIT_EVENT_DEF(INNER_SESSION_IDLE_WAIT, 30001, "inner session wait to be called" WAIT_EVENT_DEF(WAIT_REFRESH_SCHEMA, 30100, "sleep: wait refresh schema", "sleep_interval", "schema_version", "", CONFIGURATION, true, true) WAIT_EVENT_DEF(PALF_THROTTLING, 30101, "palf throttling sleep", "sleep_interval", "", "", USER_IO, false, true) WAIT_EVENT_DEF(SLOG_NORMAL_RETRY_SLEEP, 30102, "sleep: slog has io error and retrying", "sleep_interval", "", "", USER_IO, true, true) +WAIT_EVENT_DEF(INSUFFICIENT_PX_WORKER_RETRY_WAIT, 30103, "retry wait event because of insufficient px worker", "parallel level", "number of px workers required", "the total number of idle PX workers currently", CONFIGURATION, true, false) // sleep 31000-31999 WAIT_EVENT_DEF(GARBAGE_COLLECTOR_SLEEP, 31000, "sleep: wait log callback sleep wait", "sleep_interval", "", "", SYSTEM_IO, true, true) +// cluster 32000-32999 +WAIT_EVENT_DEF(GTS_NOT_READEY_RETRY_WAIT, 32000, "retry wait because of GTS service not ready", "error code", "ls leader addr", "ls leader port", CLUSTER, true, false) +WAIT_EVENT_DEF(REPLICA_NOT_READABLE_RETRY_WAIT, 32001, "retry wait because of replica not readable", "ls_id", "", "", CLUSTER, true, false) +WAIT_EVENT_DEF(SCHEMA_RETRY_WAIT, 32002, "retry wait because of schema", "error code", "table id", "table schema version", CLUSTER, true, false) +WAIT_EVENT_DEF(LOCATION_RETRY_WAIT, 32003, "retry wait because of location", "error", "ls_id", "", CLUSTER, true, false) +WAIT_EVENT_DEF(OTHER_RETRY_WAIT, 32004, "retry wait because of other", "error", "", "", CLUSTER, true, false) + + // END. DO NOT MODIFY. WAIT_EVENT_DEF(WAIT_EVENT_DEF_END, 99999, "event end", "", "", "", OTHER, false, true) #endif diff --git a/src/observer/virtual_table/ob_virtual_ash.cpp b/src/observer/virtual_table/ob_virtual_ash.cpp index 2eb75f8def..429e3510f0 100644 --- a/src/observer/virtual_table/ob_virtual_ash.cpp +++ b/src/observer/virtual_table/ob_virtual_ash.cpp @@ -353,6 +353,10 @@ int ObVirtualASH::convert_node_to_row(const ActiveSessionStat &node, ObNewRow *& cells[cell_idx].set_null(); break; } + case TABLET_ID: { + cells[cell_idx].set_null(); + break; + } default: { ret = OB_ERR_UNEXPECTED; SERVER_LOG(WARN, "invalid column id", K(column_id), K(cell_idx), diff --git a/src/observer/virtual_table/ob_virtual_ash.h b/src/observer/virtual_table/ob_virtual_ash.h index 85ee6f2c16..a5a3286da6 100644 --- a/src/observer/virtual_table/ob_virtual_ash.h +++ b/src/observer/virtual_table/ob_virtual_ash.h @@ -97,6 +97,7 @@ protected: PLAN_HASH, THREAD_ID, STMT_TYPE, + TABLET_ID, }; DISALLOW_COPY_AND_ASSIGN(ObVirtualASH); share::ObActiveSessHistList::Iterator iterator_; diff --git a/src/share/inner_table/ob_inner_table_schema.12301_12350.cpp b/src/share/inner_table/ob_inner_table_schema.12301_12350.cpp index a0abcfb74a..e9936360d1 100644 --- a/src/share/inner_table/ob_inner_table_schema.12301_12350.cpp +++ b/src/share/inner_table/ob_inner_table_schema.12301_12350.cpp @@ -1410,6 +1410,21 @@ int ObInnerTableSchema::all_virtual_ash_schema(ObTableSchema &table_schema) true, //is_nullable false); //is_autoincrement } + + if (OB_SUCC(ret)) { + ADD_COLUMN_SCHEMA("TABLET_ID", //column_name + ++column_id, //column_id + 0, //rowkey_id + 0, //index_id + 0, //part_key_pos + ObIntType, //column_type + CS_TYPE_INVALID, //column_collation_type + sizeof(int64_t), //column_length + -1, //column_precision + -1, //column_scale + true, //is_nullable + false); //is_autoincrement + } if (OB_SUCC(ret)) { table_schema.get_part_option().set_part_num(1); table_schema.set_part_level(PARTITION_LEVEL_ONE); @@ -2446,7 +2461,24 @@ int ObInnerTableSchema::all_virtual_ash_all_virtual_ash_i1_schema(ObTableSchema true);//is_storing_column } - table_schema.set_max_used_column_id(column_id + 55); + if (OB_SUCC(ret)) { + ADD_COLUMN_SCHEMA_WITH_COLUMN_FLAGS("TABLET_ID", //column_name + column_id + 56, //column_id + 0, //rowkey_id + 0, //index_id + 0, //part_key_pos + ObIntType, //column_type + CS_TYPE_INVALID, //column_collation_type + sizeof(int64_t), //column_length + -1, //column_precision + -1, //column_scale + true,//is_nullable + false,//is_autoincrement + false,//is_hidden + true);//is_storing_column + } + + table_schema.set_max_used_column_id(column_id + 56); return ret; } diff --git a/src/share/inner_table/ob_inner_table_schema.12351_12400.cpp b/src/share/inner_table/ob_inner_table_schema.12351_12400.cpp index e44649e7f9..340dc20db6 100644 --- a/src/share/inner_table/ob_inner_table_schema.12351_12400.cpp +++ b/src/share/inner_table/ob_inner_table_schema.12351_12400.cpp @@ -7369,6 +7369,21 @@ int ObInnerTableSchema::all_virtual_wr_active_session_history_schema(ObTableSche true, //is_nullable false); //is_autoincrement } + + if (OB_SUCC(ret)) { + ADD_COLUMN_SCHEMA("tablet_id", //column_name + ++column_id, //column_id + 0, //rowkey_id + 0, //index_id + 0, //part_key_pos + ObIntType, //column_type + CS_TYPE_INVALID, //column_collation_type + sizeof(int64_t), //column_length + -1, //column_precision + -1, //column_scale + true, //is_nullable + false); //is_autoincrement + } table_schema.set_index_using_type(USING_BTREE); table_schema.set_row_store_type(ENCODING_ROW_STORE); table_schema.set_store_format(OB_STORE_FORMAT_DYNAMIC_MYSQL); diff --git a/src/share/inner_table/ob_inner_table_schema.15201_15250.cpp b/src/share/inner_table/ob_inner_table_schema.15201_15250.cpp index 9abc374fd8..84784421a6 100644 --- a/src/share/inner_table/ob_inner_table_schema.15201_15250.cpp +++ b/src/share/inner_table/ob_inner_table_schema.15201_15250.cpp @@ -14227,6 +14227,21 @@ int ObInnerTableSchema::all_virtual_ash_ora_schema(ObTableSchema &table_schema) true, //is_nullable false); //is_autoincrement } + + if (OB_SUCC(ret)) { + ADD_COLUMN_SCHEMA("TABLET_ID", //column_name + ++column_id, //column_id + 0, //rowkey_id + 0, //index_id + 0, //part_key_pos + ObNumberType, //column_type + CS_TYPE_INVALID, //column_collation_type + 38, //column_length + 38, //column_precision + 0, //column_scale + true, //is_nullable + false); //is_autoincrement + } if (OB_SUCC(ret)) { table_schema.get_part_option().set_part_num(1); table_schema.set_part_level(PARTITION_LEVEL_ONE); @@ -15234,7 +15249,24 @@ int ObInnerTableSchema::all_virtual_ash_ora_all_virtual_ash_i1_schema(ObTableSch true);//is_storing_column } - table_schema.set_max_used_column_id(column_id + 55); + if (OB_SUCC(ret)) { + ADD_COLUMN_SCHEMA_WITH_COLUMN_FLAGS("TABLET_ID", //column_name + column_id + 56, //column_id + 0, //rowkey_id + 0, //index_id + 0, //part_key_pos + ObNumberType, //column_type + CS_TYPE_INVALID, //column_collation_type + 38, //column_length + 38, //column_precision + 0, //column_scale + true,//is_nullable + false,//is_autoincrement + false,//is_hidden + true);//is_storing_column + } + + table_schema.set_max_used_column_id(column_id + 56); return ret; } diff --git a/src/share/inner_table/ob_inner_table_schema.15251_15300.cpp b/src/share/inner_table/ob_inner_table_schema.15251_15300.cpp index b053ec26d9..955e60c598 100644 --- a/src/share/inner_table/ob_inner_table_schema.15251_15300.cpp +++ b/src/share/inner_table/ob_inner_table_schema.15251_15300.cpp @@ -11767,6 +11767,21 @@ int ObInnerTableSchema::all_virtual_wr_active_session_history_ora_schema(ObTable true, //is_nullable false); //is_autoincrement } + + if (OB_SUCC(ret)) { + ADD_COLUMN_SCHEMA("TABLET_ID", //column_name + ++column_id, //column_id + 0, //rowkey_id + 0, //index_id + 0, //part_key_pos + ObNumberType, //column_type + CS_TYPE_INVALID, //column_collation_type + 38, //column_length + 38, //column_precision + 0, //column_scale + true, //is_nullable + false); //is_autoincrement + } table_schema.set_index_using_type(USING_BTREE); table_schema.set_row_store_type(ENCODING_ROW_STORE); table_schema.set_store_format(OB_STORE_FORMAT_DYNAMIC_MYSQL); diff --git a/src/share/inner_table/ob_inner_table_schema.21351_21400.cpp b/src/share/inner_table/ob_inner_table_schema.21351_21400.cpp index 93d0e2934d..8dc49828d0 100644 --- a/src/share/inner_table/ob_inner_table_schema.21351_21400.cpp +++ b/src/share/inner_table/ob_inner_table_schema.21351_21400.cpp @@ -1660,7 +1660,7 @@ int ObInnerTableSchema::dba_wr_active_session_history_schema(ObTableSchema &tabl table_schema.set_collation_type(ObCharset::get_default_collation(ObCharset::get_default_charset())); if (OB_SUCC(ret)) { - if (OB_FAIL(table_schema.set_view_definition(R"__( SELECT ASH.CLUSTER_ID AS CLUSTER_ID, ASH.TENANT_ID AS TENANT_ID, ASH.SNAP_ID AS SNAP_ID, ASH.SVR_IP AS SVR_IP, ASH.SVR_PORT AS SVR_PORT, ASH.SAMPLE_ID AS SAMPLE_ID, ASH.SESSION_ID AS SESSION_ID, ASH.SAMPLE_TIME AS SAMPLE_TIME, ASH.USER_ID AS USER_ID, ASH.SESSION_TYPE AS SESSION_TYPE, CAST(IF (ASH.EVENT_NO = 0, 'ON CPU', 'WAITING') AS CHAR(7)) AS SESSION_STATE, ASH.SQL_ID AS SQL_ID, ASH.TRACE_ID AS TRACE_ID, ASH.EVENT_NO AS EVENT_NO, ASH.EVENT_ID AS EVENT_ID, ASH.TIME_WAITED AS TIME_WAITED, ASH.P1 AS P1, ASH.P2 AS P2, ASH.P3 AS P3, ASH.SQL_PLAN_LINE_ID AS SQL_PLAN_LINE_ID, ASH.GROUP_ID AS GROUP_ID, ASH.TX_ID AS TX_ID, ASH.BLOCKING_SESSION_ID AS BLOCKING_SESSION_ID, ASH.TIME_MODEL AS TIME_MODEL, CAST(CASE WHEN (ASH.TIME_MODEL & 1) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_PARSE, CAST(CASE WHEN (ASH.TIME_MODEL & 2) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_PL_PARSE, CAST(CASE WHEN (ASH.TIME_MODEL & 4) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_PLAN_CACHE, CAST(CASE WHEN (ASH.TIME_MODEL & 8) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_SQL_OPTIMIZE, CAST(CASE WHEN (ASH.TIME_MODEL & 16) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_SQL_EXECUTION, CAST(CASE WHEN (ASH.TIME_MODEL & 32) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_PX_EXECUTION, CAST(CASE WHEN (ASH.TIME_MODEL & 64) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_SEQUENCE_LOAD, CAST(CASE WHEN (ASH.TIME_MODEL & 128) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_COMMITTING, CAST(CASE WHEN (ASH.TIME_MODEL & 256) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_STORAGE_READ, CAST(CASE WHEN (ASH.TIME_MODEL & 512) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_STORAGE_WRITE, CAST(CASE WHEN (ASH.TIME_MODEL & 1024) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_REMOTE_DAS_EXECUTION, CAST(CASE WHEN (ASH.TIME_MODEL & 2048) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_FILTER_ROWS, ASH.PROGRAM AS PROGRAM, ASH.MODULE AS MODULE, ASH.ACTION AS ACTION, ASH.CLIENT_ID AS CLIENT_ID, ASH.BACKTRACE AS BACKTRACE, ASH.PLAN_ID AS PLAN_ID, ASH.TM_DELTA_TIME AS TM_DELTA_TIME, ASH.TM_DELTA_CPU_TIME AS TM_DELTA_CPU_TIME, ASH.TM_DELTA_DB_TIME AS TM_DELTA_DB_TIME, ASH.TOP_LEVEL_SQL_ID AS TOP_LEVEL_SQL_ID, CAST(CASE WHEN (ASH.TIME_MODEL & 2048) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_PLSQL_COMPILATION, CAST(CASE WHEN (ASH.TIME_MODEL & 4096) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_PLSQL_EXECUTION, ASH.PLSQL_ENTRY_OBJECT_ID AS PLSQL_ENTRY_OBJECT_ID, ASH.PLSQL_ENTRY_SUBPROGRAM_ID AS PLSQL_ENTRY_SUBPROGRAM_ID, ASH.PLSQL_ENTRY_SUBPROGRAM_NAME AS PLSQL_ENTRY_SUBPROGRAM_NAME, ASH.PLSQL_OBJECT_ID AS PLSQL_OBJECT_ID, ASH.PLSQL_SUBPROGRAM_ID AS PLSQL_SUBPROGRAM_ID, ASH.PLSQL_SUBPROGRAM_NAME AS PLSQL_SUBPROGRAM_NAME FROM ( OCEANBASE.__ALL_VIRTUAL_WR_ACTIVE_SESSION_HISTORY ASH JOIN OCEANBASE.__ALL_VIRTUAL_WR_SNAPSHOT SNAP ON ASH.CLUSTER_ID = SNAP.CLUSTER_ID AND ASH.TENANT_ID = SNAP.TENANT_ID AND ASH.SNAP_ID = SNAP.SNAP_ID ) WHERE ASH.TENANT_ID = EFFECTIVE_TENANT_ID() AND SNAP.STATUS = 0; )__"))) { + if (OB_FAIL(table_schema.set_view_definition(R"__( SELECT ASH.CLUSTER_ID AS CLUSTER_ID, ASH.TENANT_ID AS TENANT_ID, ASH.SNAP_ID AS SNAP_ID, ASH.SVR_IP AS SVR_IP, ASH.SVR_PORT AS SVR_PORT, ASH.SAMPLE_ID AS SAMPLE_ID, ASH.SESSION_ID AS SESSION_ID, ASH.SAMPLE_TIME AS SAMPLE_TIME, ASH.USER_ID AS USER_ID, ASH.SESSION_TYPE AS SESSION_TYPE, CAST(IF (ASH.EVENT_NO = 0, 'ON CPU', 'WAITING') AS CHAR(7)) AS SESSION_STATE, ASH.SQL_ID AS SQL_ID, ASH.TRACE_ID AS TRACE_ID, ASH.EVENT_NO AS EVENT_NO, ASH.EVENT_ID AS EVENT_ID, ASH.TIME_WAITED AS TIME_WAITED, ASH.P1 AS P1, ASH.P2 AS P2, ASH.P3 AS P3, ASH.SQL_PLAN_LINE_ID AS SQL_PLAN_LINE_ID, ASH.GROUP_ID AS GROUP_ID, ASH.TX_ID AS TX_ID, ASH.BLOCKING_SESSION_ID AS BLOCKING_SESSION_ID, ASH.TIME_MODEL AS TIME_MODEL, CAST(CASE WHEN (ASH.TIME_MODEL & 1) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_PARSE, CAST(CASE WHEN (ASH.TIME_MODEL & 2) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_PL_PARSE, CAST(CASE WHEN (ASH.TIME_MODEL & 4) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_PLAN_CACHE, CAST(CASE WHEN (ASH.TIME_MODEL & 8) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_SQL_OPTIMIZE, CAST(CASE WHEN (ASH.TIME_MODEL & 16) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_SQL_EXECUTION, CAST(CASE WHEN (ASH.TIME_MODEL & 32) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_PX_EXECUTION, CAST(CASE WHEN (ASH.TIME_MODEL & 64) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_SEQUENCE_LOAD, CAST(CASE WHEN (ASH.TIME_MODEL & 128) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_COMMITTING, CAST(CASE WHEN (ASH.TIME_MODEL & 256) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_STORAGE_READ, CAST(CASE WHEN (ASH.TIME_MODEL & 512) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_STORAGE_WRITE, CAST(CASE WHEN (ASH.TIME_MODEL & 1024) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_REMOTE_DAS_EXECUTION, CAST(CASE WHEN (ASH.TIME_MODEL & 2048) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_PLSQL_COMPILATION, CAST(CASE WHEN (ASH.TIME_MODEL & 4096) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_PLSQL_EXECUTION, CAST(CASE WHEN (ASH.TIME_MODEL & 8192) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_FILTER_ROWS, ASH.PROGRAM AS PROGRAM, ASH.MODULE AS MODULE, ASH.ACTION AS ACTION, ASH.CLIENT_ID AS CLIENT_ID, ASH.BACKTRACE AS BACKTRACE, ASH.PLAN_ID AS PLAN_ID, ASH.TM_DELTA_TIME AS TM_DELTA_TIME, ASH.TM_DELTA_CPU_TIME AS TM_DELTA_CPU_TIME, ASH.TM_DELTA_DB_TIME AS TM_DELTA_DB_TIME, ASH.TOP_LEVEL_SQL_ID AS TOP_LEVEL_SQL_ID, ASH.PLSQL_ENTRY_OBJECT_ID AS PLSQL_ENTRY_OBJECT_ID, ASH.PLSQL_ENTRY_SUBPROGRAM_ID AS PLSQL_ENTRY_SUBPROGRAM_ID, ASH.PLSQL_ENTRY_SUBPROGRAM_NAME AS PLSQL_ENTRY_SUBPROGRAM_NAME, ASH.PLSQL_OBJECT_ID AS PLSQL_OBJECT_ID, ASH.PLSQL_SUBPROGRAM_ID AS PLSQL_SUBPROGRAM_ID, ASH.PLSQL_SUBPROGRAM_NAME AS PLSQL_SUBPROGRAM_NAME FROM ( OCEANBASE.__ALL_VIRTUAL_WR_ACTIVE_SESSION_HISTORY ASH JOIN OCEANBASE.__ALL_VIRTUAL_WR_SNAPSHOT SNAP ON ASH.CLUSTER_ID = SNAP.CLUSTER_ID AND ASH.TENANT_ID = SNAP.TENANT_ID AND ASH.SNAP_ID = SNAP.SNAP_ID ) WHERE ASH.TENANT_ID = EFFECTIVE_TENANT_ID() AND SNAP.STATUS = 0; )__"))) { LOG_ERROR("fail to set view_definition", K(ret)); } } @@ -1710,7 +1710,7 @@ int ObInnerTableSchema::cdb_wr_active_session_history_schema(ObTableSchema &tabl table_schema.set_collation_type(ObCharset::get_default_collation(ObCharset::get_default_charset())); if (OB_SUCC(ret)) { - if (OB_FAIL(table_schema.set_view_definition(R"__( SELECT ASH.CLUSTER_ID AS CLUSTER_ID, ASH.TENANT_ID AS TENANT_ID, ASH.SNAP_ID AS SNAP_ID, ASH.SVR_IP AS SVR_IP, ASH.SVR_PORT AS SVR_PORT, ASH.SAMPLE_ID AS SAMPLE_ID, ASH.SESSION_ID AS SESSION_ID, ASH.SAMPLE_TIME AS SAMPLE_TIME, ASH.USER_ID AS USER_ID, ASH.SESSION_TYPE AS SESSION_TYPE, CAST(IF (ASH.EVENT_NO = 0, 'ON CPU', 'WAITING') AS CHAR(7)) AS SESSION_STATE, ASH.SQL_ID AS SQL_ID, ASH.TRACE_ID AS TRACE_ID, ASH.EVENT_NO AS EVENT_NO, ASH.EVENT_ID AS EVENT_ID, ASH.TIME_WAITED AS TIME_WAITED, ASH.P1 AS P1, ASH.P2 AS P2, ASH.P3 AS P3, ASH.SQL_PLAN_LINE_ID AS SQL_PLAN_LINE_ID, ASH.GROUP_ID AS GROUP_ID, ASH.TX_ID AS TX_ID, ASH.BLOCKING_SESSION_ID AS BLOCKING_SESSION_ID, ASH.TIME_MODEL AS TIME_MODEL, CAST(CASE WHEN (ASH.TIME_MODEL & 1) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_PARSE, CAST(CASE WHEN (ASH.TIME_MODEL & 2) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_PL_PARSE, CAST(CASE WHEN (ASH.TIME_MODEL & 4) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_PLAN_CACHE, CAST(CASE WHEN (ASH.TIME_MODEL & 8) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_SQL_OPTIMIZE, CAST(CASE WHEN (ASH.TIME_MODEL & 16) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_SQL_EXECUTION, CAST(CASE WHEN (ASH.TIME_MODEL & 32) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_PX_EXECUTION, CAST(CASE WHEN (ASH.TIME_MODEL & 64) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_SEQUENCE_LOAD, CAST(CASE WHEN (ASH.TIME_MODEL & 128) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_COMMITTING, CAST(CASE WHEN (ASH.TIME_MODEL & 256) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_STORAGE_READ, CAST(CASE WHEN (ASH.TIME_MODEL & 512) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_STORAGE_WRITE, CAST(CASE WHEN (ASH.TIME_MODEL & 1024) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_REMOTE_DAS_EXECUTION, CAST(CASE WHEN (ASH.TIME_MODEL & 2048) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_FILTER_ROWS, ASH.PROGRAM AS PROGRAM, ASH.MODULE AS MODULE, ASH.ACTION AS ACTION, ASH.CLIENT_ID AS CLIENT_ID, ASH.BACKTRACE AS BACKTRACE, ASH.PLAN_ID AS PLAN_ID, ASH.TM_DELTA_TIME AS TM_DELTA_TIME, ASH.TM_DELTA_CPU_TIME AS TM_DELTA_CPU_TIME, ASH.TM_DELTA_DB_TIME AS TM_DELTA_DB_TIME, ASH.TOP_LEVEL_SQL_ID AS TOP_LEVEL_SQL_ID, CAST(CASE WHEN (ASH.TIME_MODEL & 2048) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_PLSQL_COMPILATION, CAST(CASE WHEN (ASH.TIME_MODEL & 4096) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_PLSQL_EXECUTION, ASH.PLSQL_ENTRY_OBJECT_ID AS PLSQL_ENTRY_OBJECT_ID, ASH.PLSQL_ENTRY_SUBPROGRAM_ID AS PLSQL_ENTRY_SUBPROGRAM_ID, ASH.PLSQL_ENTRY_SUBPROGRAM_NAME AS PLSQL_ENTRY_SUBPROGRAM_NAME, ASH.PLSQL_OBJECT_ID AS PLSQL_OBJECT_ID, ASH.PLSQL_SUBPROGRAM_ID AS PLSQL_SUBPROGRAM_ID, ASH.PLSQL_SUBPROGRAM_NAME AS PLSQL_SUBPROGRAM_NAME FROM ( OCEANBASE.__ALL_VIRTUAL_WR_ACTIVE_SESSION_HISTORY ASH JOIN OCEANBASE.__ALL_VIRTUAL_WR_SNAPSHOT SNAP ON ASH.CLUSTER_ID = SNAP.CLUSTER_ID AND ASH.TENANT_ID = SNAP.TENANT_ID AND ASH.SNAP_ID = SNAP.SNAP_ID ) WHERE SNAP.STATUS = 0; )__"))) { + if (OB_FAIL(table_schema.set_view_definition(R"__( SELECT ASH.CLUSTER_ID AS CLUSTER_ID, ASH.TENANT_ID AS TENANT_ID, ASH.SNAP_ID AS SNAP_ID, ASH.SVR_IP AS SVR_IP, ASH.SVR_PORT AS SVR_PORT, ASH.SAMPLE_ID AS SAMPLE_ID, ASH.SESSION_ID AS SESSION_ID, ASH.SAMPLE_TIME AS SAMPLE_TIME, ASH.USER_ID AS USER_ID, ASH.SESSION_TYPE AS SESSION_TYPE, CAST(IF (ASH.EVENT_NO = 0, 'ON CPU', 'WAITING') AS CHAR(7)) AS SESSION_STATE, ASH.SQL_ID AS SQL_ID, ASH.TRACE_ID AS TRACE_ID, ASH.EVENT_NO AS EVENT_NO, ASH.EVENT_ID AS EVENT_ID, ASH.TIME_WAITED AS TIME_WAITED, ASH.P1 AS P1, ASH.P2 AS P2, ASH.P3 AS P3, ASH.SQL_PLAN_LINE_ID AS SQL_PLAN_LINE_ID, ASH.GROUP_ID AS GROUP_ID, ASH.TX_ID AS TX_ID, ASH.BLOCKING_SESSION_ID AS BLOCKING_SESSION_ID, ASH.TIME_MODEL AS TIME_MODEL, CAST(CASE WHEN (ASH.TIME_MODEL & 1) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_PARSE, CAST(CASE WHEN (ASH.TIME_MODEL & 2) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_PL_PARSE, CAST(CASE WHEN (ASH.TIME_MODEL & 4) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_PLAN_CACHE, CAST(CASE WHEN (ASH.TIME_MODEL & 8) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_SQL_OPTIMIZE, CAST(CASE WHEN (ASH.TIME_MODEL & 16) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_SQL_EXECUTION, CAST(CASE WHEN (ASH.TIME_MODEL & 32) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_PX_EXECUTION, CAST(CASE WHEN (ASH.TIME_MODEL & 64) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_SEQUENCE_LOAD, CAST(CASE WHEN (ASH.TIME_MODEL & 128) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_COMMITTING, CAST(CASE WHEN (ASH.TIME_MODEL & 256) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_STORAGE_READ, CAST(CASE WHEN (ASH.TIME_MODEL & 512) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_STORAGE_WRITE, CAST(CASE WHEN (ASH.TIME_MODEL & 1024) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_REMOTE_DAS_EXECUTION, CAST(CASE WHEN (ASH.TIME_MODEL & 2048) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_PLSQL_COMPILATION, CAST(CASE WHEN (ASH.TIME_MODEL & 4096) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_PLSQL_EXECUTION, CAST(CASE WHEN (ASH.TIME_MODEL & 8192) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_FILTER_ROWS, ASH.PROGRAM AS PROGRAM, ASH.MODULE AS MODULE, ASH.ACTION AS ACTION, ASH.CLIENT_ID AS CLIENT_ID, ASH.BACKTRACE AS BACKTRACE, ASH.PLAN_ID AS PLAN_ID, ASH.TM_DELTA_TIME AS TM_DELTA_TIME, ASH.TM_DELTA_CPU_TIME AS TM_DELTA_CPU_TIME, ASH.TM_DELTA_DB_TIME AS TM_DELTA_DB_TIME, ASH.TOP_LEVEL_SQL_ID AS TOP_LEVEL_SQL_ID, ASH.PLSQL_ENTRY_OBJECT_ID AS PLSQL_ENTRY_OBJECT_ID, ASH.PLSQL_ENTRY_SUBPROGRAM_ID AS PLSQL_ENTRY_SUBPROGRAM_ID, ASH.PLSQL_ENTRY_SUBPROGRAM_NAME AS PLSQL_ENTRY_SUBPROGRAM_NAME, ASH.PLSQL_OBJECT_ID AS PLSQL_OBJECT_ID, ASH.PLSQL_SUBPROGRAM_ID AS PLSQL_SUBPROGRAM_ID, ASH.PLSQL_SUBPROGRAM_NAME AS PLSQL_SUBPROGRAM_NAME FROM ( OCEANBASE.__ALL_VIRTUAL_WR_ACTIVE_SESSION_HISTORY ASH JOIN OCEANBASE.__ALL_VIRTUAL_WR_SNAPSHOT SNAP ON ASH.CLUSTER_ID = SNAP.CLUSTER_ID AND ASH.TENANT_ID = SNAP.TENANT_ID AND ASH.SNAP_ID = SNAP.SNAP_ID ) WHERE SNAP.STATUS = 0; )__"))) { LOG_ERROR("fail to set view_definition", K(ret)); } } diff --git a/src/share/inner_table/ob_inner_table_schema.25201_25250.cpp b/src/share/inner_table/ob_inner_table_schema.25201_25250.cpp index 6e797f3502..86e823ab4f 100644 --- a/src/share/inner_table/ob_inner_table_schema.25201_25250.cpp +++ b/src/share/inner_table/ob_inner_table_schema.25201_25250.cpp @@ -1410,7 +1410,7 @@ int ObInnerTableSchema::dba_wr_active_session_history_ora_schema(ObTableSchema & table_schema.set_collation_type(ObCharset::get_default_collation(ObCharset::get_default_charset())); if (OB_SUCC(ret)) { - if (OB_FAIL(table_schema.set_view_definition(R"__( SELECT ASH.CLUSTER_ID AS CLUSTER_ID, ASH.TENANT_ID AS TENANT_ID, ASH.SNAP_ID AS SNAP_ID, ASH.SVR_IP AS SVR_IP, ASH.SVR_PORT AS SVR_PORT, ASH.SAMPLE_ID AS SAMPLE_ID, ASH.SESSION_ID AS SESSION_ID, ASH.SAMPLE_TIME AS SAMPLE_TIME, ASH.USER_ID AS USER_ID, ASH.SESSION_TYPE AS SESSION_TYPE, CAST(DECODE(ASH.EVENT_NO, 0, 'ON CPU', 'WAITING') AS VARCHAR2(7)) AS SESSION_STATE, ASH.SQL_ID AS SQL_ID, ASH.TRACE_ID AS TRACE_ID, ASH.EVENT_NO AS EVENT_NO, ASH.EVENT_ID AS EVENT_ID, ASH.TIME_WAITED AS TIME_WAITED, ASH.P1 AS P1, ASH.P2 AS P2, ASH.P3 AS P3, ASH.SQL_PLAN_LINE_ID AS SQL_PLAN_LINE_ID, ASH.GROUP_ID AS GROUP_ID, ASH.TX_ID AS TX_ID, ASH.BLOCKING_SESSION_ID AS BLOCKING_SESSION_ID, ASH.TIME_MODEL AS TIME_MODEL, CAST(CASE WHEN BITAND(ASH.TIME_MODEL , 1) > 0 THEN 'Y' ELSE 'N' END AS VARCHAR2(1)) AS IN_PARSE, CAST(CASE WHEN BITAND(ASH.TIME_MODEL , 2) > 0 THEN 'Y' ELSE 'N' END AS VARCHAR2(1)) AS IN_PL_PARSE, CAST(CASE WHEN BITAND(ASH.TIME_MODEL , 4) > 0 THEN 'Y' ELSE 'N' END AS VARCHAR2(1)) AS IN_PLAN_CACHE, CAST(CASE WHEN BITAND(ASH.TIME_MODEL , 8) > 0 THEN 'Y' ELSE 'N' END AS VARCHAR2(1)) AS IN_SQL_OPTIMIZE, CAST(CASE WHEN BITAND(ASH.TIME_MODEL , 16) > 0 THEN 'Y' ELSE 'N' END AS VARCHAR2(1)) AS IN_SQL_EXECUTION, CAST(CASE WHEN BITAND(ASH.TIME_MODEL , 32) > 0 THEN 'Y' ELSE 'N' END AS VARCHAR2(1)) AS IN_PX_EXECUTION, CAST(CASE WHEN BITAND(ASH.TIME_MODEL , 64) > 0 THEN 'Y' ELSE 'N' END AS VARCHAR2(1)) AS IN_SEQUENCE_LOAD, CAST(CASE WHEN BITAND(ASH.TIME_MODEL , 128) > 0 THEN 'Y' ELSE 'N' END AS VARCHAR2(1)) AS IN_COMMITTING, CAST(CASE WHEN BITAND(ASH.TIME_MODEL , 256) > 0 THEN 'Y' ELSE 'N' END AS VARCHAR2(1)) AS IN_STORAGE_READ, CAST(CASE WHEN BITAND(ASH.TIME_MODEL , 512) > 0 THEN 'Y' ELSE 'N' END AS VARCHAR2(1)) AS IN_STORAGE_WRITE, CAST(CASE WHEN BITAND(ASH.TIME_MODEL , 1024) > 0 THEN 'Y' ELSE 'N' END AS VARCHAR2(1)) AS IN_REMOTE_DAS_EXECUTION, CAST(CASE WHEN BITAND(ASH.TIME_MODEL , 2048) > 0 THEN 'Y' ELSE 'N' END AS VARCHAR2(1)) AS IN_FILTER_ROWS, ASH.PROGRAM AS PROGRAM, ASH.MODULE AS MODULE, ASH.ACTION AS ACTION, ASH.CLIENT_ID AS CLIENT_ID, ASH.BACKTRACE AS BACKTRACE, ASH.PLAN_ID AS PLAN_ID, ASH.TM_DELTA_TIME AS TM_DELTA_TIME, ASH.TM_DELTA_CPU_TIME AS TM_DELTA_CPU_TIME, ASH.TM_DELTA_DB_TIME AS TM_DELTA_DB_TIME, ASH.TOP_LEVEL_SQL_ID AS TOP_LEVEL_SQL_ID, CAST(CASE WHEN BITAND(ASH.TIME_MODEL , 2048) > 0 THEN 'Y' ELSE 'N' END AS VARCHAR2(1)) AS IN_PLSQL_COMPILATION, CAST(CASE WHEN BITAND(ASH.TIME_MODEL , 4096) > 0 THEN 'Y' ELSE 'N' END AS VARCHAR2(1)) AS IN_PLSQL_EXECUTION, ASH.PLSQL_ENTRY_OBJECT_ID AS PLSQL_ENTRY_OBJECT_ID, ASH.PLSQL_ENTRY_SUBPROGRAM_ID AS PLSQL_ENTRY_SUBPROGRAM_ID, ASH.PLSQL_ENTRY_SUBPROGRAM_NAME AS PLSQL_ENTRY_SUBPROGRAM_NAME, ASH.PLSQL_OBJECT_ID AS PLSQL_OBJECT_ID, ASH.PLSQL_SUBPROGRAM_ID AS PLSQL_SUBPROGRAM_ID, ASH.PLSQL_SUBPROGRAM_NAME AS PLSQL_SUBPROGRAM_NAME FROM SYS.ALL_VIRTUAL_WR_ACTIVE_SESSION_HISTORY ASH, SYS.ALL_VIRTUAL_WR_SNAPSHOT SNAP WHERE ASH.TENANT_ID = EFFECTIVE_TENANT_ID() AND ASH.CLUSTER_ID = SNAP.CLUSTER_ID AND ASH.TENANT_ID = SNAP.TENANT_ID AND ASH.SNAP_ID = SNAP.SNAP_ID AND SNAP.STATUS = 0; )__"))) { + if (OB_FAIL(table_schema.set_view_definition(R"__( SELECT ASH.CLUSTER_ID AS CLUSTER_ID, ASH.TENANT_ID AS TENANT_ID, ASH.SNAP_ID AS SNAP_ID, ASH.SVR_IP AS SVR_IP, ASH.SVR_PORT AS SVR_PORT, ASH.SAMPLE_ID AS SAMPLE_ID, ASH.SESSION_ID AS SESSION_ID, ASH.SAMPLE_TIME AS SAMPLE_TIME, ASH.USER_ID AS USER_ID, ASH.SESSION_TYPE AS SESSION_TYPE, CAST(DECODE(ASH.EVENT_NO, 0, 'ON CPU', 'WAITING') AS VARCHAR2(7)) AS SESSION_STATE, ASH.SQL_ID AS SQL_ID, ASH.TRACE_ID AS TRACE_ID, ASH.EVENT_NO AS EVENT_NO, ASH.EVENT_ID AS EVENT_ID, ASH.TIME_WAITED AS TIME_WAITED, ASH.P1 AS P1, ASH.P2 AS P2, ASH.P3 AS P3, ASH.SQL_PLAN_LINE_ID AS SQL_PLAN_LINE_ID, ASH.GROUP_ID AS GROUP_ID, ASH.TX_ID AS TX_ID, ASH.BLOCKING_SESSION_ID AS BLOCKING_SESSION_ID, ASH.TIME_MODEL AS TIME_MODEL, CAST(CASE WHEN BITAND(ASH.TIME_MODEL , 1) > 0 THEN 'Y' ELSE 'N' END AS VARCHAR2(1)) AS IN_PARSE, CAST(CASE WHEN BITAND(ASH.TIME_MODEL , 2) > 0 THEN 'Y' ELSE 'N' END AS VARCHAR2(1)) AS IN_PL_PARSE, CAST(CASE WHEN BITAND(ASH.TIME_MODEL , 4) > 0 THEN 'Y' ELSE 'N' END AS VARCHAR2(1)) AS IN_PLAN_CACHE, CAST(CASE WHEN BITAND(ASH.TIME_MODEL , 8) > 0 THEN 'Y' ELSE 'N' END AS VARCHAR2(1)) AS IN_SQL_OPTIMIZE, CAST(CASE WHEN BITAND(ASH.TIME_MODEL , 16) > 0 THEN 'Y' ELSE 'N' END AS VARCHAR2(1)) AS IN_SQL_EXECUTION, CAST(CASE WHEN BITAND(ASH.TIME_MODEL , 32) > 0 THEN 'Y' ELSE 'N' END AS VARCHAR2(1)) AS IN_PX_EXECUTION, CAST(CASE WHEN BITAND(ASH.TIME_MODEL , 64) > 0 THEN 'Y' ELSE 'N' END AS VARCHAR2(1)) AS IN_SEQUENCE_LOAD, CAST(CASE WHEN BITAND(ASH.TIME_MODEL , 128) > 0 THEN 'Y' ELSE 'N' END AS VARCHAR2(1)) AS IN_COMMITTING, CAST(CASE WHEN BITAND(ASH.TIME_MODEL , 256) > 0 THEN 'Y' ELSE 'N' END AS VARCHAR2(1)) AS IN_STORAGE_READ, CAST(CASE WHEN BITAND(ASH.TIME_MODEL , 512) > 0 THEN 'Y' ELSE 'N' END AS VARCHAR2(1)) AS IN_STORAGE_WRITE, CAST(CASE WHEN BITAND(ASH.TIME_MODEL , 1024) > 0 THEN 'Y' ELSE 'N' END AS VARCHAR2(1)) AS IN_REMOTE_DAS_EXECUTION, CAST(CASE WHEN BITAND(ASH.TIME_MODEL , 2048) > 0 THEN 'Y' ELSE 'N' END AS VARCHAR2(1)) AS IN_PLSQL_COMPILATION, CAST(CASE WHEN BITAND(ASH.TIME_MODEL , 4096) > 0 THEN 'Y' ELSE 'N' END AS VARCHAR2(1)) AS IN_PLSQL_EXECUTION, CAST(CASE WHEN BITAND(ASH.TIME_MODEL , 8192) > 0 THEN 'Y' ELSE 'N' END AS VARCHAR2(1)) AS IN_FILTER_ROWS, ASH.PROGRAM AS PROGRAM, ASH.MODULE AS MODULE, ASH.ACTION AS ACTION, ASH.CLIENT_ID AS CLIENT_ID, ASH.BACKTRACE AS BACKTRACE, ASH.PLAN_ID AS PLAN_ID, ASH.TM_DELTA_TIME AS TM_DELTA_TIME, ASH.TM_DELTA_CPU_TIME AS TM_DELTA_CPU_TIME, ASH.TM_DELTA_DB_TIME AS TM_DELTA_DB_TIME, ASH.TOP_LEVEL_SQL_ID AS TOP_LEVEL_SQL_ID, ASH.PLSQL_ENTRY_OBJECT_ID AS PLSQL_ENTRY_OBJECT_ID, ASH.PLSQL_ENTRY_SUBPROGRAM_ID AS PLSQL_ENTRY_SUBPROGRAM_ID, ASH.PLSQL_ENTRY_SUBPROGRAM_NAME AS PLSQL_ENTRY_SUBPROGRAM_NAME, ASH.PLSQL_OBJECT_ID AS PLSQL_OBJECT_ID, ASH.PLSQL_SUBPROGRAM_ID AS PLSQL_SUBPROGRAM_ID, ASH.PLSQL_SUBPROGRAM_NAME AS PLSQL_SUBPROGRAM_NAME FROM SYS.ALL_VIRTUAL_WR_ACTIVE_SESSION_HISTORY ASH, SYS.ALL_VIRTUAL_WR_SNAPSHOT SNAP WHERE ASH.TENANT_ID = EFFECTIVE_TENANT_ID() AND ASH.CLUSTER_ID = SNAP.CLUSTER_ID AND ASH.TENANT_ID = SNAP.TENANT_ID AND ASH.SNAP_ID = SNAP.SNAP_ID AND SNAP.STATUS = 0; )__"))) { LOG_ERROR("fail to set view_definition", K(ret)); } } diff --git a/src/share/inner_table/ob_inner_table_schema.451_500.cpp b/src/share/inner_table/ob_inner_table_schema.451_500.cpp index fc339733cd..406abf3d9e 100644 --- a/src/share/inner_table/ob_inner_table_schema.451_500.cpp +++ b/src/share/inner_table/ob_inner_table_schema.451_500.cpp @@ -1403,6 +1403,21 @@ int ObInnerTableSchema::wr_active_session_history_schema(ObTableSchema &table_sc true, //is_nullable false); //is_autoincrement } + + if (OB_SUCC(ret)) { + ADD_COLUMN_SCHEMA("tablet_id", //column_name + ++column_id, //column_id + 0, //rowkey_id + 0, //index_id + 0, //part_key_pos + ObIntType, //column_type + CS_TYPE_INVALID, //column_collation_type + sizeof(int64_t), //column_length + -1, //column_precision + -1, //column_scale + true, //is_nullable + false); //is_autoincrement + } table_schema.set_index_using_type(USING_BTREE); table_schema.set_row_store_type(ENCODING_ROW_STORE); table_schema.set_store_format(OB_STORE_FORMAT_DYNAMIC_MYSQL); diff --git a/src/share/inner_table/ob_inner_table_schema_def.py b/src/share/inner_table/ob_inner_table_schema_def.py index 09f4d77349..bb8aa40b5d 100644 --- a/src/share/inner_table/ob_inner_table_schema_def.py +++ b/src/share/inner_table/ob_inner_table_schema_def.py @@ -6008,6 +6008,7 @@ def_table_schema( ('plan_hash', 'uint', 'true'), ('thread_id', 'int', 'true'), ('stmt_type', 'int', 'true'), + ('tablet_id', 'int', 'true'), ], ) @@ -7305,6 +7306,8 @@ def_table_schema( # 522 : __all_pkg_type # 523 : __all_pkg_type_attr # 524 : __all_pkg_coll_type +# 525: __wr_sql_plan +# 526: __wr_res_mgr_sysstat # 余留位置(此行之前占位) # 本区域占位建议:采用真实表名进行占位 @@ -10029,6 +10032,8 @@ def_table_schema( vtable_route_policy = 'distributed', ) +#11120: __all_virtual_res_mgr_sysstat + ################################################################ # INFORMATION SCHEMA ################################################################ @@ -12633,6 +12638,7 @@ def_table_schema( ('PLAN_HASH', 'uint', 'true'), ('THREAD_ID', 'int', 'true'), ('STMT_TYPE', 'int', 'true'), + ('TABLET_ID', 'int', 'true'), ], partition_columns = ['SVR_IP', 'SVR_PORT'], vtable_route_policy = 'distributed', @@ -14603,7 +14609,8 @@ def_table_schema(**gen_iterate_virtual_table_def( # 12498: __all_virtual_pkg_type_attr # 12499: __all_virtual_pkg_coll_type # 12500: __all_virtual_kv_client_info - +# 12501: __all_virtual_wr_sql_plan +# 12502: __all_virtual_wr_res_mgr_sysstat # 余留位置(此行之前占位) # 本区域占位建议:采用真实表名进行占位 ################################################################################ @@ -15108,7 +15115,10 @@ def_table_schema(**no_direct_access(gen_oracle_mapping_real_virtual_table_def('1 # 15478: __all_pkg_coll_type # 15479: __all_pkg_coll_type # 15480: __all_virtual_kv_client_info -# +# 15481: __all_virtual_wr_sql_plan +# 15482: __all_virtual_res_mgr_sysstat +# 15483: __all_virtual_wr_res_mgr_sysstat + # 余留位置(此行之前占位) # 本区域定义的Oracle表名比较复杂,一般都采用gen_xxx_table_def()方式定义,占位建议采用基表表名占位 # - 示例:def_table_schema(**no_direct_access(gen_oracle_mapping_virtual_table_def('15009', all_def_keywords['__all_virtual_sql_audit']))) @@ -30813,7 +30823,9 @@ def_table_schema( CAST(CASE WHEN (ASH.TIME_MODEL & 256) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_STORAGE_READ, CAST(CASE WHEN (ASH.TIME_MODEL & 512) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_STORAGE_WRITE, CAST(CASE WHEN (ASH.TIME_MODEL & 1024) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_REMOTE_DAS_EXECUTION, - CAST(CASE WHEN (ASH.TIME_MODEL & 2048) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_FILTER_ROWS, + CAST(CASE WHEN (ASH.TIME_MODEL & 2048) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_PLSQL_COMPILATION, + CAST(CASE WHEN (ASH.TIME_MODEL & 4096) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_PLSQL_EXECUTION, + CAST(CASE WHEN (ASH.TIME_MODEL & 8192) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_FILTER_ROWS, ASH.PROGRAM AS PROGRAM, ASH.MODULE AS MODULE, ASH.ACTION AS ACTION, @@ -30824,8 +30836,6 @@ def_table_schema( ASH.TM_DELTA_CPU_TIME AS TM_DELTA_CPU_TIME, ASH.TM_DELTA_DB_TIME AS TM_DELTA_DB_TIME, ASH.TOP_LEVEL_SQL_ID AS TOP_LEVEL_SQL_ID, - CAST(CASE WHEN (ASH.TIME_MODEL & 2048) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_PLSQL_COMPILATION, - CAST(CASE WHEN (ASH.TIME_MODEL & 4096) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_PLSQL_EXECUTION, ASH.PLSQL_ENTRY_OBJECT_ID AS PLSQL_ENTRY_OBJECT_ID, ASH.PLSQL_ENTRY_SUBPROGRAM_ID AS PLSQL_ENTRY_SUBPROGRAM_ID, ASH.PLSQL_ENTRY_SUBPROGRAM_NAME AS PLSQL_ENTRY_SUBPROGRAM_NAME, @@ -30892,7 +30902,9 @@ def_table_schema( CAST(CASE WHEN (ASH.TIME_MODEL & 256) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_STORAGE_READ, CAST(CASE WHEN (ASH.TIME_MODEL & 512) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_STORAGE_WRITE, CAST(CASE WHEN (ASH.TIME_MODEL & 1024) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_REMOTE_DAS_EXECUTION, - CAST(CASE WHEN (ASH.TIME_MODEL & 2048) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_FILTER_ROWS, + CAST(CASE WHEN (ASH.TIME_MODEL & 2048) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_PLSQL_COMPILATION, + CAST(CASE WHEN (ASH.TIME_MODEL & 4096) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_PLSQL_EXECUTION, + CAST(CASE WHEN (ASH.TIME_MODEL & 8192) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_FILTER_ROWS, ASH.PROGRAM AS PROGRAM, ASH.MODULE AS MODULE, ASH.ACTION AS ACTION, @@ -30903,8 +30915,6 @@ def_table_schema( ASH.TM_DELTA_CPU_TIME AS TM_DELTA_CPU_TIME, ASH.TM_DELTA_DB_TIME AS TM_DELTA_DB_TIME, ASH.TOP_LEVEL_SQL_ID AS TOP_LEVEL_SQL_ID, - CAST(CASE WHEN (ASH.TIME_MODEL & 2048) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_PLSQL_COMPILATION, - CAST(CASE WHEN (ASH.TIME_MODEL & 4096) > 0 THEN 'Y' ELSE 'N' END AS CHAR(1)) AS IN_PLSQL_EXECUTION, ASH.PLSQL_ENTRY_OBJECT_ID AS PLSQL_ENTRY_OBJECT_ID, ASH.PLSQL_ENTRY_SUBPROGRAM_ID AS PLSQL_ENTRY_SUBPROGRAM_ID, ASH.PLSQL_ENTRY_SUBPROGRAM_NAME AS PLSQL_ENTRY_SUBPROGRAM_NAME, @@ -35650,6 +35660,12 @@ def_table_schema( # 21607: GV$OB_KV_CLIENT_INFO # 21608: V$OB_KV_CLIENT_INFO # 21609: V$OB_VARIABLES_BY_SESSION +# 21610: GV$OB_RES_MGR_SYSSTAT +# 21611: V$OB_RES_MGR_SYSSTAT +# 21612: DBA_WR_SQL_PLAN +# 21613: CDB_WR_SQL_PLAN +# 21614: DBA_WR_RES_MGR_SYSSTAT +# 21615: CDB_WR_RES_MGR_SYSSTAT # 余留位置(此行之前占位) # 本区域占位建议:采用真实视图名进行占位 ################################################################################ @@ -53387,7 +53403,9 @@ def_table_schema( CAST(CASE WHEN BITAND(ASH.TIME_MODEL , 256) > 0 THEN 'Y' ELSE 'N' END AS VARCHAR2(1)) AS IN_STORAGE_READ, CAST(CASE WHEN BITAND(ASH.TIME_MODEL , 512) > 0 THEN 'Y' ELSE 'N' END AS VARCHAR2(1)) AS IN_STORAGE_WRITE, CAST(CASE WHEN BITAND(ASH.TIME_MODEL , 1024) > 0 THEN 'Y' ELSE 'N' END AS VARCHAR2(1)) AS IN_REMOTE_DAS_EXECUTION, - CAST(CASE WHEN BITAND(ASH.TIME_MODEL , 2048) > 0 THEN 'Y' ELSE 'N' END AS VARCHAR2(1)) AS IN_FILTER_ROWS, + CAST(CASE WHEN BITAND(ASH.TIME_MODEL , 2048) > 0 THEN 'Y' ELSE 'N' END AS VARCHAR2(1)) AS IN_PLSQL_COMPILATION, + CAST(CASE WHEN BITAND(ASH.TIME_MODEL , 4096) > 0 THEN 'Y' ELSE 'N' END AS VARCHAR2(1)) AS IN_PLSQL_EXECUTION, + CAST(CASE WHEN BITAND(ASH.TIME_MODEL , 8192) > 0 THEN 'Y' ELSE 'N' END AS VARCHAR2(1)) AS IN_FILTER_ROWS, ASH.PROGRAM AS PROGRAM, ASH.MODULE AS MODULE, ASH.ACTION AS ACTION, @@ -53398,8 +53416,6 @@ def_table_schema( ASH.TM_DELTA_CPU_TIME AS TM_DELTA_CPU_TIME, ASH.TM_DELTA_DB_TIME AS TM_DELTA_DB_TIME, ASH.TOP_LEVEL_SQL_ID AS TOP_LEVEL_SQL_ID, - CAST(CASE WHEN BITAND(ASH.TIME_MODEL , 2048) > 0 THEN 'Y' ELSE 'N' END AS VARCHAR2(1)) AS IN_PLSQL_COMPILATION, - CAST(CASE WHEN BITAND(ASH.TIME_MODEL , 4096) > 0 THEN 'Y' ELSE 'N' END AS VARCHAR2(1)) AS IN_PLSQL_EXECUTION, ASH.PLSQL_ENTRY_OBJECT_ID AS PLSQL_ENTRY_OBJECT_ID, ASH.PLSQL_ENTRY_SUBPROGRAM_ID AS PLSQL_ENTRY_SUBPROGRAM_ID, ASH.PLSQL_ENTRY_SUBPROGRAM_NAME AS PLSQL_ENTRY_SUBPROGRAM_NAME, @@ -63547,6 +63563,10 @@ left join # 28254: GV$OB_KV_CLIENT_INFO # 28255: V$OB_KV_CLIENT_INFO # 28256: V$OB_VARIABLES_BY_SESSION +# 28257: GV$OB_RES_MGR_SYSSTAT +# 28258: V$OB_RES_MGR_SYSSTAT +# 28259: DBA_WR_SQL_PLAN +# 28260: DBA_WR_RES_MGR_SYSSTAT # 余留位置(此行之前占位) # 本区域占位建议:采用真实视图名进行占位 diff --git a/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/desc_sys_views_in_mysql.result b/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/desc_sys_views_in_mysql.result index a9b2642ba7..9fcd500d00 100644 --- a/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/desc_sys_views_in_mysql.result +++ b/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/desc_sys_views_in_mysql.result @@ -5079,6 +5079,8 @@ IN_COMMITTING varchar(1) NO IN_STORAGE_READ varchar(1) NO IN_STORAGE_WRITE varchar(1) NO IN_REMOTE_DAS_EXECUTION varchar(1) NO +IN_PLSQL_COMPILATION varchar(1) NO +IN_PLSQL_EXECUTION varchar(1) NO IN_FILTER_ROWS varchar(1) NO PROGRAM varchar(64) YES NULL MODULE varchar(64) YES NULL @@ -5090,8 +5092,6 @@ TM_DELTA_TIME bigint(20) YES NULL TM_DELTA_CPU_TIME bigint(20) YES NULL TM_DELTA_DB_TIME bigint(20) YES NULL TOP_LEVEL_SQL_ID varchar(32) YES NULL -IN_PLSQL_COMPILATION varchar(1) NO -IN_PLSQL_EXECUTION varchar(1) NO PLSQL_ENTRY_OBJECT_ID bigint(20) YES NULL PLSQL_ENTRY_SUBPROGRAM_ID bigint(20) YES NULL PLSQL_ENTRY_SUBPROGRAM_NAME varchar(32) YES NULL diff --git a/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/desc_sys_views_in_sys.result b/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/desc_sys_views_in_sys.result index fed71d26a0..64ea006f85 100644 --- a/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/desc_sys_views_in_sys.result +++ b/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/desc_sys_views_in_sys.result @@ -6995,6 +6995,8 @@ IN_COMMITTING varchar(1) NO IN_STORAGE_READ varchar(1) NO IN_STORAGE_WRITE varchar(1) NO IN_REMOTE_DAS_EXECUTION varchar(1) NO +IN_PLSQL_COMPILATION varchar(1) NO +IN_PLSQL_EXECUTION varchar(1) NO IN_FILTER_ROWS varchar(1) NO PROGRAM varchar(64) YES NULL MODULE varchar(64) YES NULL @@ -7006,8 +7008,6 @@ TM_DELTA_TIME bigint(20) YES NULL TM_DELTA_CPU_TIME bigint(20) YES NULL TM_DELTA_DB_TIME bigint(20) YES NULL TOP_LEVEL_SQL_ID varchar(32) YES NULL -IN_PLSQL_COMPILATION varchar(1) NO -IN_PLSQL_EXECUTION varchar(1) NO PLSQL_ENTRY_OBJECT_ID bigint(20) YES NULL PLSQL_ENTRY_SUBPROGRAM_ID bigint(20) YES NULL PLSQL_ENTRY_SUBPROGRAM_NAME varchar(32) YES NULL @@ -7054,6 +7054,8 @@ IN_COMMITTING varchar(1) NO IN_STORAGE_READ varchar(1) NO IN_STORAGE_WRITE varchar(1) NO IN_REMOTE_DAS_EXECUTION varchar(1) NO +IN_PLSQL_COMPILATION varchar(1) NO +IN_PLSQL_EXECUTION varchar(1) NO IN_FILTER_ROWS varchar(1) NO PROGRAM varchar(64) YES NULL MODULE varchar(64) YES NULL @@ -7065,8 +7067,6 @@ TM_DELTA_TIME bigint(20) YES NULL TM_DELTA_CPU_TIME bigint(20) YES NULL TM_DELTA_DB_TIME bigint(20) YES NULL TOP_LEVEL_SQL_ID varchar(32) YES NULL -IN_PLSQL_COMPILATION varchar(1) NO -IN_PLSQL_EXECUTION varchar(1) NO PLSQL_ENTRY_OBJECT_ID bigint(20) YES NULL PLSQL_ENTRY_SUBPROGRAM_ID bigint(20) YES NULL PLSQL_ENTRY_SUBPROGRAM_NAME varchar(32) YES NULL diff --git a/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/desc_virtual_table_in_mysql.result b/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/desc_virtual_table_in_mysql.result index 5a78201dee..3ab33c2105 100644 --- a/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/desc_virtual_table_in_mysql.result +++ b/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/desc_virtual_table_in_mysql.result @@ -3159,6 +3159,7 @@ BLOCKING_SESSION_ID bigint(20) YES NULL PLAN_HASH bigint(20) unsigned YES NULL THREAD_ID bigint(20) YES NULL STMT_TYPE bigint(20) YES NULL +TABLET_ID bigint(20) YES NULL select /*+QUERY_TIMEOUT(60000000)*/ IF(count(*) >= 0, 1, 0) from oceanbase.__all_virtual_ash; IF(count(*) >= 0, 1, 0) 1 @@ -3950,6 +3951,7 @@ blocking_session_id bigint(20) YES NULL plan_hash bigint(20) unsigned YES NULL thread_id bigint(20) YES NULL stmt_type bigint(20) YES NULL +tablet_id bigint(20) YES NULL select /*+QUERY_TIMEOUT(60000000)*/ IF(count(*) >= 0, 1, 0) from oceanbase.__all_virtual_wr_active_session_history; IF(count(*) >= 0, 1, 0) 1 diff --git a/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/desc_virtual_table_in_sys.result b/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/desc_virtual_table_in_sys.result index 0236969a8f..950f08c520 100644 --- a/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/desc_virtual_table_in_sys.result +++ b/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/desc_virtual_table_in_sys.result @@ -6834,6 +6834,7 @@ BLOCKING_SESSION_ID bigint(20) YES NULL PLAN_HASH bigint(20) unsigned YES NULL THREAD_ID bigint(20) YES NULL STMT_TYPE bigint(20) YES NULL +TABLET_ID bigint(20) YES NULL select /*+QUERY_TIMEOUT(60000000)*/ IF(count(*) >= 0, 1, 0) from oceanbase.__all_virtual_ash; IF(count(*) >= 0, 1, 0) 1 @@ -8211,6 +8212,7 @@ blocking_session_id bigint(20) YES NULL plan_hash bigint(20) unsigned YES NULL thread_id bigint(20) YES NULL stmt_type bigint(20) YES NULL +tablet_id bigint(20) YES NULL select /*+QUERY_TIMEOUT(60000000)*/ IF(count(*) >= 0, 1, 0) from oceanbase.__all_virtual_wr_active_session_history; IF(count(*) >= 0, 1, 0) 1