From ca6af6b8c8d4d4457db1320bfe79fbd1cb2e93ba Mon Sep 17 00:00:00 2001 From: obdev Date: Wed, 7 Feb 2024 18:58:54 +0000 Subject: [PATCH] [CP] Reset the system view status when restarting the server to ensure the eventual consistency of the system vie --- .../virtual_table/ob_information_columns_table.cpp | 5 ++++- src/sql/ob_sql_utils.cpp | 9 +++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/observer/virtual_table/ob_information_columns_table.cpp b/src/observer/virtual_table/ob_information_columns_table.cpp index accfd1810..64c916ab9 100644 --- a/src/observer/virtual_table/ob_information_columns_table.cpp +++ b/src/observer/virtual_table/ob_information_columns_table.cpp @@ -235,7 +235,10 @@ int ObInfoSchemaColumnsTable::iterate_table_schema_array(const bool is_filter_ta } // for system view, its column info depend on hard code, so its valid by default, but do not have column meta // status default value is valid, old version also work whether what status it read because its column count = 0 - bool view_is_invalid = (0 == table_schema->get_object_status() || 0 == table_schema->get_column_count()); + bool view_is_invalid = (0 == table_schema->get_object_status() + || 0 == table_schema->get_column_count() + || (table_schema->is_sys_view() + && table_schema->get_schema_version() <= GCTX.start_time_)); if (OB_FAIL(ret)) { } else if (is_normal_view && view_is_invalid) { mem_context_->reset_remain_one_page(); diff --git a/src/sql/ob_sql_utils.cpp b/src/sql/ob_sql_utils.cpp index 747b3d78b..3fd5a9ae1 100644 --- a/src/sql/ob_sql_utils.cpp +++ b/src/sql/ob_sql_utils.cpp @@ -5193,8 +5193,13 @@ int ObSQLUtils::async_recompile_view(const share::schema::ObTableSchema &old_vie } else if (OB_ISNULL(GCTX.sql_engine_)) { ret = OB_ERR_UNEXPECTED; LOG_WARN("failed to get sql engine", K(ret)); - } else if ((0 == old_view_schema.get_object_status() || 0 == old_view_schema.get_column_count())) { - if (!reset_column_infos) { + } else if ((0 == old_view_schema.get_object_status() + || 0 == old_view_schema.get_column_count() + || (old_view_schema.is_sys_view() + && old_view_schema.get_schema_version() <= GCTX.start_time_))) { + if (old_view_schema.is_sys_view() && GCONF.in_upgrade_mode()) { + //do not recompile sys view until upgrade finish + } else if (!reset_column_infos) { ObArray dummy_column_list; if (OB_ISNULL(select_stmt)) { ret = OB_ERR_UNEXPECTED;