From 69c03f57902dd6993c7eb415ec3d38b49e3d0b1c Mon Sep 17 00:00:00 2001 From: seuwebber Date: Wed, 23 Nov 2022 13:35:36 +0000 Subject: [PATCH] [CP] [to #45091799]fix bug schema_gaurd not inited --- asan_ignore_list.txt | 0 src/sql/ob_spi.cpp | 7 +++++-- src/sql/ob_spi.h | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 asan_ignore_list.txt diff --git a/asan_ignore_list.txt b/asan_ignore_list.txt new file mode 100644 index 000000000..e69de29bb diff --git a/src/sql/ob_spi.cpp b/src/sql/ob_spi.cpp index e3ec2ff14..815936700 100644 --- a/src/sql/ob_spi.cpp +++ b/src/sql/ob_spi.cpp @@ -1708,6 +1708,7 @@ int ObSPIService::spi_prepare(common::ObIAllocator &allocator, spi_resolve_prepare(allocator, session, sql_proxy, + schema_guard, expr_factory, sql, is_cursor, @@ -1807,6 +1808,7 @@ int ObSPIService::spi_parse_prepare(common::ObIAllocator &allocator, int ObSPIService::spi_build_record_type_by_result_set(common::ObIAllocator &allocator, ObSQLSessionInfo &session, + share::schema::ObSchemaGetterGuard &schema_guard, const sql::ObResultSet &result_set, int64_t hidden_column_count, ObRecordType *&record_type, @@ -1854,8 +1856,6 @@ int ObSPIService::spi_build_record_type_by_result_set(common::ObIAllocator &allo if (OB_SUCC(ret) && 1 == hidden_column_count) { const common::ObField &field = columns->at(columns->count() - 1); uint64_t table_id = OB_INVALID_ID; - share::schema::ObSchemaGetterGuard schema_guard; - OZ (GCTX.schema_service_->get_tenant_schema_guard(session.get_effective_tenant_id(), schema_guard)); OZ (schema_guard.get_table_id(session.get_effective_tenant_id(), field.dname_, field.org_tname_, false, ObSchemaGetterGuard::ALL_NON_HIDDEN_TYPES, table_id)); OX (rowid_table_id = table_id); @@ -1869,6 +1869,7 @@ int ObSPIService::spi_build_record_type_by_result_set(common::ObIAllocator &allo int ObSPIService::spi_resolve_prepare(common::ObIAllocator &allocator, ObSQLSessionInfo &session, ObMySQLProxy &sql_proxy, + share::schema::ObSchemaGetterGuard &schema_guard, sql::ObRawExprFactory &expr_factory, const ObString &sql, bool is_cursor, @@ -1921,6 +1922,7 @@ int ObSPIService::spi_resolve_prepare(common::ObIAllocator &allocator, && inner_result->result_set().get_field_columns()->count() > 0) { OZ (spi_build_record_type_by_result_set(allocator, session, + schema_guard, inner_result->result_set(), prepare_result.has_hidden_rowid_ ? 1 : 0, prepare_result.record_type_, @@ -1948,6 +1950,7 @@ int ObSPIService::spi_resolve_prepare(common::ObIAllocator &allocator, CK (OB_NOT_NULL(result = static_cast(proxy_result.get_result()))); OZ (spi_build_record_type_by_result_set(allocator, session, + schema_guard, result->result_set(), prepare_result.has_hidden_rowid_ ? 1 : 0, prepare_result.record_type_, diff --git a/src/sql/ob_spi.h b/src/sql/ob_spi.h index 4f7cfede2..9a2d0691a 100644 --- a/src/sql/ob_spi.h +++ b/src/sql/ob_spi.h @@ -425,6 +425,7 @@ public: static int spi_build_record_type_by_result_set(common::ObIAllocator &allocator, ObSQLSessionInfo &session, + share::schema::ObSchemaGetterGuard &schema_guard, const sql::ObResultSet &result_set, int64_t hidden_column_count, pl::ObRecordType *&record_type, @@ -577,6 +578,7 @@ private: static int spi_resolve_prepare(common::ObIAllocator &allocator, ObSQLSessionInfo &session, ObMySQLProxy &sql_proxy, + share::schema::ObSchemaGetterGuard &schema_guard, sql::ObRawExprFactory &expr_factory, const ObString &sql, bool is_cursor,