diff --git a/src/rootserver/ddl_task/ob_ddl_redefinition_task.cpp b/src/rootserver/ddl_task/ob_ddl_redefinition_task.cpp index 306ac691a3..d47a294146 100644 --- a/src/rootserver/ddl_task/ob_ddl_redefinition_task.cpp +++ b/src/rootserver/ddl_task/ob_ddl_redefinition_task.cpp @@ -198,35 +198,7 @@ int ObDDLRedefinitionSSTableBuildTask::process() LOG_WARN("ddl sim failure", K(ret), K(tenant_id_), K(task_id_)); } else if (OB_FAIL(user_sql_proxy->write(tenant_id_, sql_string.ptr(), affected_rows, oracle_mode ? ObCompatibilityMode::ORACLE_MODE : ObCompatibilityMode::MYSQL_MODE, &session_param, sql_exec_addr))) { - if (ret == OB_SERVER_OUTOF_DISK_SPACE && - data_format_version_ >= DATA_VERSION_4_3_0_0) { - // if version >= 4.3.0, would retry with compression. - int tmp_ret = OB_SUCCESS; - sql_string.reuse(); - SortCompactLevel compress_level = SORT_COMPRESSION_LEVEL; - if (OB_SUCCESS != (tmp_ret = ObDDLUtil::generate_build_replica_sql(tenant_id_, data_table_id_, - dest_table_id_, - data_table_schema->get_schema_version(), - snapshot_version_, - execution_id_, - task_id_, - parallelism_, - use_heap_table_ddl_plan_, - true, - &col_name_map_, - sql_string, - compress_level))) { - LOG_WARN("fail to generate build replica sql", K(tmp_ret)); - } else if (OB_SUCCESS != (tmp_ret = user_sql_proxy->write(tenant_id_, sql_string.ptr(), affected_rows, - oracle_mode ? ObCompatibilityMode::ORACLE_MODE : ObCompatibilityMode::MYSQL_MODE, - &session_param, sql_exec_addr))) { - LOG_WARN("fail to execute build replica sql", K(tmp_ret), K(tenant_id_)); - } else { - ret = OB_SUCCESS; - } - } else { - LOG_WARN("fail to execute build replica sql", K(ret), K(tenant_id_)); - } + LOG_WARN("fail to execute build replica sql", K(ret), K(tenant_id_)); } if (OB_SUCC(ret)) { if (OB_FAIL(ObCheckTabletDataComplementOp::check_finish_report_checksum(tenant_id_, dest_table_id_, execution_id_, task_id_))) { diff --git a/src/rootserver/ddl_task/ob_index_build_task.cpp b/src/rootserver/ddl_task/ob_index_build_task.cpp index 4f4640da7c..6ec5902335 100755 --- a/src/rootserver/ddl_task/ob_index_build_task.cpp +++ b/src/rootserver/ddl_task/ob_index_build_task.cpp @@ -104,8 +104,7 @@ int ObIndexSSTableBuildTask::process() false/*use_heap_table_ddl*/, !data_schema->is_user_hidden_table()/*use_schema_version_hint_for_src_table*/, nullptr, - sql_string, - compact_level_))) { + sql_string))) { LOG_WARN("fail to generate build replica sql", K(ret)); } else if (OB_FAIL(data_schema->is_need_padding_for_generated_column(need_padding))) { LOG_WARN("fail to check need padding", K(ret)); @@ -149,54 +148,7 @@ int ObIndexSSTableBuildTask::process() LOG_WARN("ddl sim failure: create index build sstable failed", K(ret), K(tenant_id_), K(task_id_)); } else if (OB_FAIL(user_sql_proxy->write(tenant_id_, sql_string.ptr(), affected_rows, oracle_mode ? ObCompatibilityMode::ORACLE_MODE : ObCompatibilityMode::MYSQL_MODE, &session_param, sql_exec_addr))) { - if (ret == OB_SERVER_OUTOF_DISK_SPACE && - data_format_version_ >= DATA_VERSION_4_3_0_0) { - // if version >= 4.3.0, would retry with compression. - // use tmp_ret to avoid ret being reset. - int tmp_ret = OB_SUCCESS; - sql_string.reuse(); - SortCompactLevel compress_level = SORT_DEFAULT_LEVEL; - switch (compact_level_) { - case share::SORT_DEFAULT_LEVEL: { - compress_level = share::SORT_COMPRESSION_LEVEL; - break; - } - case share::SORT_COMPACT_LEVEL: { - compress_level = share::SORT_COMPRESSION_COMPACT_LEVEL; - break; - } - case share::SORT_ENCODE_LEVEL: { - compress_level = share::SORT_COMPRESSION_ENCODE_LEVEL; - break; - } - default: { - tmp_ret = OB_ERR_UNEXPECTED; - LOG_WARN("get unexpected compact level", K(tmp_ret), K(compact_level_)); - } - } - if (tmp_ret != OB_SUCCESS) { - } else if (OB_SUCCESS != (tmp_ret = ObDDLUtil::generate_build_replica_sql(tenant_id_, data_table_id_, - dest_table_id_, - data_schema->get_schema_version(), - snapshot_version_, - execution_id_, - task_id_, - parallelism_, - false/*use_heap_table_ddl*/, - !data_schema->is_user_hidden_table()/*use_schema_version_hint_for_src_table*/, - nullptr, - sql_string, - compress_level))) { - LOG_WARN("fail to generate build replica sql", K(tmp_ret)); - } else if (OB_SUCCESS != (tmp_ret = user_sql_proxy->write(tenant_id_, sql_string.ptr(), affected_rows, - oracle_mode ? ObCompatibilityMode::ORACLE_MODE : ObCompatibilityMode::MYSQL_MODE, &session_param, sql_exec_addr))) { - LOG_WARN("fail to execute build replica sql", K(tmp_ret), K(tenant_id_)); - } else { - ret = OB_SUCCESS; - } - } else { - LOG_WARN("fail to execute build replica sql", K(ret), K(tenant_id_)); - } + LOG_WARN("fail to execute build replica sql", K(ret), K(tenant_id_)); } if (OB_SUCC(ret)) { if (OB_FAIL(ObCheckTabletDataComplementOp::check_finish_report_checksum(tenant_id_, dest_table_id_, execution_id_, task_id_))) { @@ -252,9 +204,7 @@ ObAsyncTask *ObIndexSSTableBuildTask::deep_copy(char *buf, const int64_t buf_siz trace_id_, parallelism_, root_service_, - inner_sql_exec_addr_, - compact_level_, - data_format_version_); + inner_sql_exec_addr_); if (OB_SUCCESS != (task->set_nls_format(nls_date_format_, nls_timestamp_format_, nls_timestamp_tz_format_))) { task->~ObIndexSSTableBuildTask(); task = nullptr; @@ -924,9 +874,7 @@ int ObIndexBuildTask::send_build_single_replica_request() trace_id_, parallelism_, root_service_, - create_index_arg_.inner_sql_exec_addr_, - create_index_arg_.compact_level_, - data_format_version_); + create_index_arg_.inner_sql_exec_addr_); if (OB_FAIL(task.set_nls_format(create_index_arg_.nls_date_format_, create_index_arg_.nls_timestamp_format_, create_index_arg_.nls_timestamp_tz_format_))) { diff --git a/src/rootserver/ddl_task/ob_index_build_task.h b/src/rootserver/ddl_task/ob_index_build_task.h index 6a18023691..c9bebcc4f9 100644 --- a/src/rootserver/ddl_task/ob_index_build_task.h +++ b/src/rootserver/ddl_task/ob_index_build_task.h @@ -35,14 +35,11 @@ public: const common::ObCurTraceId::TraceId &trace_id, const int64_t parallelism, ObRootService *root_service, - const common::ObAddr &inner_sql_exec_addr, - const share::SortCompactLevel compact_level = share::SORT_DEFAULT_LEVEL, - const int64_t data_format_version = 0) + const common::ObAddr &inner_sql_exec_addr) : task_id_(task_id), tenant_id_(tenant_id), data_table_id_(data_table_id), dest_table_id_(dest_table_id), schema_version_(schema_version), snapshot_version_(snapshot_version), execution_id_(execution_id), consumer_group_id_(consumer_group_id), trace_id_(trace_id), parallelism_(parallelism), allocator_("IdxSSTBuildTask"), - root_service_(root_service), inner_sql_exec_addr_(inner_sql_exec_addr), compact_level_(compact_level), - data_format_version_(data_format_version) + root_service_(root_service), inner_sql_exec_addr_(inner_sql_exec_addr) { set_retry_times(0); } @@ -58,7 +55,7 @@ public: void add_event_info(const int ret, const ObString &ddl_event_stmt); TO_STRING_KV(K_(data_table_id), K_(dest_table_id), K_(schema_version), K_(snapshot_version), K_(execution_id), K_(consumer_group_id), K_(trace_id), K_(parallelism), K_(nls_date_format), - K_(nls_timestamp_format), K_(nls_timestamp_tz_format), K_(compact_level), K_(data_format_version)); + K_(nls_timestamp_format), K_(nls_timestamp_tz_format)); private: int64_t task_id_; @@ -77,9 +74,6 @@ private: ObString nls_timestamp_tz_format_; ObRootService *root_service_; common::ObAddr inner_sql_exec_addr_; - share::SortCompactLevel compact_level_; - int64_t data_format_version_; - DISALLOW_COPY_AND_ASSIGN(ObIndexSSTableBuildTask); }; class ObIndexBuildTask : public ObDDLTask diff --git a/src/share/config/ob_config_helper.cpp b/src/share/config/ob_config_helper.cpp index e1582c832f..2b2b7e6bb1 100644 --- a/src/share/config/ob_config_helper.cpp +++ b/src/share/config/ob_config_helper.cpp @@ -32,6 +32,7 @@ #include "share/table/ob_table_config_util.h" #include "share/config/ob_config_mode_name_def.h" #include "share/schema/ob_schema_struct.h" +#include "share/ob_ddl_common.h" namespace oceanbase { using namespace share; @@ -335,6 +336,17 @@ bool ObConfigResourceLimitSpecChecker::check(const ObConfigItem &t) const return OB_SUCCESS == ret; } +bool ObConfigTempStoreFormatChecker::check(const ObConfigItem &t) const +{ + bool is_valid = false; + for (int i = 0; i < ARRAYSIZEOF(share::temp_store_format_options) && !is_valid; ++i) { + if (0 == ObString::make_string(temp_store_format_options[i]).case_compare(t.str())) { + is_valid = true; + } + } + return is_valid; +} + bool ObConfigPxBFGroupSizeChecker::check(const ObConfigItem &t) const { bool is_valid = false; diff --git a/src/share/config/ob_config_helper.h b/src/share/config/ob_config_helper.h index 4ae974210b..d330d668b8 100644 --- a/src/share/config/ob_config_helper.h +++ b/src/share/config/ob_config_helper.h @@ -213,6 +213,17 @@ private: DISALLOW_COPY_AND_ASSIGN(ObConfigResourceLimitSpecChecker); }; +class ObConfigTempStoreFormatChecker + : public ObConfigChecker +{ +public: + ObConfigTempStoreFormatChecker() {} + virtual ~ObConfigTempStoreFormatChecker() {} + bool check(const ObConfigItem &t) const; +private: + DISALLOW_COPY_AND_ASSIGN(ObConfigTempStoreFormatChecker); +}; + class ObConfigPxBFGroupSizeChecker : public ObConfigChecker { diff --git a/src/share/ob_ddl_common.cpp b/src/share/ob_ddl_common.cpp index 5a9f1cbf28..ae3b6f68cf 100644 --- a/src/share/ob_ddl_common.cpp +++ b/src/share/ob_ddl_common.cpp @@ -773,8 +773,7 @@ int ObDDLUtil::generate_build_replica_sql( const bool use_heap_table_ddl_plan, const bool use_schema_version_hint_for_src_table, const ObColumnNameMap *col_name_map, - ObSqlString &sql_string, - const SortCompactLevel compact_level) + ObSqlString &sql_string) { int ret = OB_SUCCESS; ObSchemaGetterGuard schema_guard; @@ -1023,8 +1022,8 @@ int ObDDLUtil::generate_build_replica_sql( } if (OB_FAIL(ret)) { } else if (oracle_mode) { - if (OB_FAIL(sql_string.assign_fmt("INSERT /*+ monitor enable_parallel_dml parallel(%ld) opt_param('ddl_execution_id', %ld) opt_param('ddl_task_id', %ld) opt_param('compact_sort_level', %ld) opt_param('enable_newsort', 'false') use_px */INTO \"%.*s\".\"%.*s\"(%.*s) SELECT /*+ index(\"%.*s\" primary) %.*s */ %.*s from \"%.*s\".\"%.*s\" as of scn %ld %.*s", - real_parallelism, execution_id, task_id, static_cast(compact_level), + if (OB_FAIL(sql_string.assign_fmt("INSERT /*+ monitor enable_parallel_dml parallel(%ld) opt_param('ddl_execution_id', %ld) opt_param('ddl_task_id', %ld) opt_param('enable_newsort', 'false') use_px */INTO \"%.*s\".\"%.*s\"(%.*s) SELECT /*+ index(\"%.*s\" primary) %.*s */ %.*s from \"%.*s\".\"%.*s\" as of scn %ld %.*s", + real_parallelism, execution_id, task_id, static_cast(new_dest_database_name.length()), new_dest_database_name.ptr(), static_cast(new_dest_table_name.length()), new_dest_table_name.ptr(), static_cast(insert_column_sql_string.length()), insert_column_sql_string.ptr(), static_cast(new_source_table_name.length()), new_source_table_name.ptr(), @@ -1035,8 +1034,8 @@ int ObDDLUtil::generate_build_replica_sql( LOG_WARN("fail to assign sql string", K(ret)); } } else { - if (OB_FAIL(sql_string.assign_fmt("INSERT /*+ monitor enable_parallel_dml parallel(%ld) opt_param('ddl_execution_id', %ld) opt_param('ddl_task_id', %ld) opt_param('compact_sort_level', %ld), opt_param('enable_newsort', 'false') use_px */INTO `%.*s`.`%.*s`(%.*s) SELECT /*+ index(`%.*s` primary) %.*s */ %.*s from `%.*s`.`%.*s` as of snapshot %ld %.*s", - real_parallelism, execution_id, task_id, static_cast(compact_level), + if (OB_FAIL(sql_string.assign_fmt("INSERT /*+ monitor enable_parallel_dml parallel(%ld) opt_param('ddl_execution_id', %ld) opt_param('ddl_task_id', %ld) opt_param('enable_newsort', 'false') use_px */INTO `%.*s`.`%.*s`(%.*s) SELECT /*+ index(`%.*s` primary) %.*s */ %.*s from `%.*s`.`%.*s` as of snapshot %ld %.*s", + real_parallelism, execution_id, task_id, static_cast(new_dest_database_name.length()), new_dest_database_name.ptr(), static_cast(new_dest_table_name.length()), new_dest_table_name.ptr(), static_cast(insert_column_sql_string.length()), insert_column_sql_string.ptr(), static_cast(new_source_table_name.length()), new_source_table_name.ptr(), @@ -1774,6 +1773,38 @@ bool ObDDLUtil::reach_time_interval(const int64_t i, volatile int64_t &last_time } return bret; } +int ObDDLUtil::get_temp_store_compress_type(const ObCompressorType schema_compr_type, + const int64_t parallel, + ObCompressorType &compr_type) +{ + int ret = OB_SUCCESS; + const int64_t COMPRESS_PARALLELISM_THRESHOLD = 8; + omt::ObTenantConfigGuard tenant_config(TENANT_CONF(MTL_ID())); + compr_type = NONE_COMPRESSOR; + if (OB_UNLIKELY(!tenant_config.is_valid())) { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("fail get tenant_config", K(ret), K(MTL_ID())); + } else { + if (0 == tenant_config->_ob_ddl_temp_file_compress_func.get_value_string().case_compare("NONE")) { + compr_type = NONE_COMPRESSOR; + } else if (0 == tenant_config->_ob_ddl_temp_file_compress_func.get_value_string().case_compare("ZSTD")) { + compr_type = ZSTD_COMPRESSOR; + } else if (0 == tenant_config->_ob_ddl_temp_file_compress_func.get_value_string().case_compare("LZ4")) { + compr_type = LZ4_COMPRESSOR; + } else if (0 == tenant_config->_ob_ddl_temp_file_compress_func.get_value_string().case_compare("AUTO")) { + if (parallel >= COMPRESS_PARALLELISM_THRESHOLD) { + compr_type = schema_compr_type; + } else { + compr_type = NONE_COMPRESSOR; + } + } else { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("the temp store format config is unexpected", K(ret), K(tenant_config->_ob_ddl_temp_file_compress_func.get_value_string())); + } + } + LOG_INFO("get compressor type", K(ret), K(compr_type)); + return ret; +} /****************** ObCheckTabletDataComplementOp *************/ diff --git a/src/share/ob_ddl_common.h b/src/share/ob_ddl_common.h index 6030a07522..65c831d729 100644 --- a/src/share/ob_ddl_common.h +++ b/src/share/ob_ddl_common.h @@ -52,7 +52,7 @@ enum ObDDLType { DDL_INVALID = 0, - ///< @note add new normal long running ddl type before this line + ///< @note add new normal long running ddl type before this line DDL_CHECK_CONSTRAINT = 1, DDL_FOREIGN_KEY_CONSTRAINT = 2, DDL_ADD_NOT_NULL_COLUMN = 3, @@ -157,6 +157,14 @@ enum ObDDLTaskStatus { SUCCESS = 100 }; +const char *const temp_store_format_options[] = +{ + "auto", + "zstd", + "lz4", + "none", +}; + enum SortCompactLevel { SORT_DEFAULT_LEVEL = 0, @@ -414,8 +422,7 @@ public: const bool use_heap_table_ddl_plan, const bool use_schema_version_hint_for_src_table, const ObColumnNameMap *col_name_map, - ObSqlString &sql_string, - const share::SortCompactLevel compact_level = share::SORT_DEFAULT_LEVEL); + ObSqlString &sql_string); static int generate_build_mview_replica_sql( const uint64_t tenant_id, @@ -576,9 +583,11 @@ public: static int check_schema_version_refreshed( const uint64_t tenant_id, const int64_t target_schema_version); - static bool reach_time_interval(const int64_t i, volatile int64_t &last_time); + static int get_temp_store_compress_type(const ObCompressorType schema_compr_type, + const int64_t parallel, + ObCompressorType &compr_type); private: static int generate_order_by_str( const ObIArray &select_column_ids, diff --git a/src/share/parameter/ob_parameter_seed.ipp b/src/share/parameter/ob_parameter_seed.ipp index 7a08719552..da293a10f4 100644 --- a/src/share/parameter/ob_parameter_seed.ipp +++ b/src/share/parameter/ob_parameter_seed.ipp @@ -1758,9 +1758,14 @@ DEF_BOOL(_enable_column_store, OB_TENANT_PARAMETER, "True", DEF_BOOL(_enable_skip_index, OB_TENANT_PARAMETER, "True", "enable the skip index in storage engine", ObParameterAttr(Section::TENANT, Source::DEFAULT, EditLevel::DYNAMIC_EFFECTIVE)); -TEMP_DEF_BOOL(v4.3, enable_store_compression, OB_TENANT_PARAMETER, "False", - "enable compression in ObTempBlockStore", - ObParameterAttr(Section::OBSERVER, Source::DEFAULT, EditLevel::DYNAMIC_EFFECTIVE)); +DEF_STR_WITH_CHECKER(_ob_ddl_temp_file_compress_func, OB_TENANT_PARAMETER, "AUTO", + common::ObConfigTempStoreFormatChecker, + "specific compression in ObTempBlockStore."\ + "AUTO: use dop to determine compression;"\ + "ZSTD: use ZSTD compression algorithm;"\ + "LZ4: use LZ4 compression algorithm;"\ + "NONE: do not use compression.", + ObParameterAttr(Section::OBSERVER, Source::DEFAULT, EditLevel::DYNAMIC_EFFECTIVE)); DEF_BOOL(_enable_prefetch_limiting, OB_TENANT_PARAMETER, "False", "enable limiting memory in prefetch for single query", ObParameterAttr(Section::TENANT, Source::DEFAULT, EditLevel::DYNAMIC_EFFECTIVE)); diff --git a/src/sql/code_generator/ob_static_engine_cg.cpp b/src/sql/code_generator/ob_static_engine_cg.cpp index 6c8c970b79..91aa0e2600 100644 --- a/src/sql/code_generator/ob_static_engine_cg.cpp +++ b/src/sql/code_generator/ob_static_engine_cg.cpp @@ -2067,46 +2067,40 @@ int ObStaticEngineCG::generate_spec(ObLogSort &op, ObSortSpec &spec, const bool spec.enable_encode_sortkey_opt_ = op.enable_encode_sortkey_opt(); spec.part_cnt_ = op.get_part_cnt(); LOG_TRACE("trace order by", K(spec.all_exprs_.count()), K(spec.all_exprs_)); - int64_t compact_level = 0; - OZ(op.get_plan()->get_optimizer_context().get_global_hint().opt_params_.get_integer_opt_param(ObOptParamHint::COMPACT_SORT_LEVEL, compact_level)); if (OB_SUCC(ret)) { int64_t tenant_id = op.get_plan()->get_optimizer_context().get_session_info()->get_effective_tenant_id(); - spec.sort_compact_level_ = static_cast(compact_level); - omt::ObTenantConfigGuard tenant_config(TENANT_CONF(tenant_id)); - if (OB_UNLIKELY(!tenant_config.is_valid())) { - ret = OB_ERR_UNEXPECTED; - LOG_WARN("fail get tenant_config", K(ret), K(tenant_id)); - } else if (tenant_config->enable_store_compression || compact_level == SORT_COMPRESSION_LEVEL || - compact_level == SORT_COMPRESSION_ENCODE_LEVEL || - compact_level == SORT_COMPRESSION_COMPACT_LEVEL) { - if (opt_ctx_->is_online_ddl()) { - // for normal sort we use default compress type. for online ddl, we use the compress type in source table - ObLogicalOperator *child_op = op.get_child(0); - while(OB_NOT_NULL(child_op) && child_op->get_type() != log_op_def::LOG_TABLE_SCAN ) { - child_op = child_op->get_child(0); - if (OB_NOT_NULL(child_op) && child_op->get_type() == log_op_def::LOG_TABLE_SCAN ) { - share::schema::ObSchemaGetterGuard *schema_guard = nullptr; - const share::schema::ObTableSchema *table_schema = nullptr; - uint64_t table_id = static_cast(child_op)->get_ref_table_id(); - if (OB_ISNULL(schema_guard = opt_ctx_->get_schema_guard())) { - ret = OB_ERR_UNEXPECTED; - LOG_WARN("fail to get schema guard", K(ret)); - } else if (OB_FAIL(schema_guard->get_table_schema(tenant_id, table_id, table_schema))) { - LOG_WARN("fail to get table schema", K(ret)); - } else if (OB_ISNULL(table_schema)) { - ret = OB_TABLE_NOT_EXIST; - LOG_WARN("can't find table schema", K(ret), K(table_id)); - } else { - spec.compress_type_ = table_schema->get_compressor_type(); - } + if (opt_ctx_->is_online_ddl()) { + // for normal sort we use default compress type. for online ddl, we use the compress type in source table + ObLogicalOperator *child_op = op.get_child(0); + ObCompressorType tmp_compr_type = NONE_COMPRESSOR; + while(OB_SUCC(ret) && OB_NOT_NULL(child_op) && child_op->get_type() != log_op_def::LOG_TABLE_SCAN ) { + child_op = child_op->get_child(0); + if (OB_NOT_NULL(child_op) && child_op->get_type() == log_op_def::LOG_TABLE_SCAN ) { + share::schema::ObSchemaGetterGuard *schema_guard = nullptr; + const share::schema::ObTableSchema *table_schema = nullptr; + uint64_t table_id = static_cast(child_op)->get_ref_table_id(); + if (OB_ISNULL(schema_guard = opt_ctx_->get_schema_guard())) { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("fail to get schema guard", K(ret)); + } else if (OB_FAIL(schema_guard->get_table_schema(tenant_id, table_id, table_schema))) { + LOG_WARN("fail to get table schema", K(ret)); + } else if (OB_ISNULL(table_schema)) { + ret = OB_TABLE_NOT_EXIST; + LOG_WARN("can't find table schema", K(ret), K(table_id)); + } else { + tmp_compr_type = table_schema->get_compressor_type(); } } - LOG_TRACE("compact type is", K(spec.compress_type_)); + } + if (OB_SUCC(ret)) { + if (OB_FAIL(ObDDLUtil::get_temp_store_compress_type(tmp_compr_type, + op.get_parallel(), + spec.compress_type_))) { + LOG_WARN("fail to get compress type", K(ret)); + } } } } - LOG_TRACE("trace order by", K(spec.all_exprs_.count()), K(spec.all_exprs_), - K(compact_level)); } if (OB_SUCC(ret)) { if (spec.sort_collations_.count() != spec.sort_cmp_funs_.count() diff --git a/src/sql/engine/basic/chunk_store/ob_compact_store.cpp b/src/sql/engine/basic/chunk_store/ob_compact_store.cpp index 753d27a40a..4930b61edd 100644 --- a/src/sql/engine/basic/chunk_store/ob_compact_store.cpp +++ b/src/sql/engine/basic/chunk_store/ob_compact_store.cpp @@ -195,7 +195,7 @@ int ObCompactStore::add_batch(const common::ObIArray &exprs, ObEvalCtx int ret = OB_SUCCESS; CK(is_inited()); OZ(init_batch_ctx(exprs.count(), ctx.max_batch_size_)); - bool all_batch_res = (compact_level_ == share::SORT_DEFAULT_LEVEL || compact_level_ == share::SORT_COMPRESSION_LEVEL); + bool all_batch_res = false; for (int64_t i = 0; i < exprs.count() && OB_SUCC(ret); i++) { ObExpr *e = exprs.at(i); if (OB_ISNULL(e)) { @@ -354,21 +354,18 @@ int ObCompactStore::init(const int64_t mem_limit, const bool enable_dump, const uint32_t row_extra_size, const bool enable_trunc, - const share::SortCompactLevel compact_level, const ObCompressorType compress_type, const ExprFixedArray *exprs) { int ret = OB_SUCCESS; - compact_level_ = compact_level; inited_ = true; - if (OB_ISNULL(exprs) || (compact_level != share::SORT_COMPACT_LEVEL && compact_level != share::SORT_COMPRESSION_COMPACT_LEVEL)) { - } else { - OZ(row_meta_.init(*exprs, row_extra_size)); - } OZ(ObTempBlockStore::init(mem_limit, enable_dump, tenant_id, mem_ctx_id, label, compress_type, enable_trunc)); OZ(block_reader_.init(this)); + if (OB_NOT_NULL(exprs)) { + OZ(row_meta_.init(*exprs, row_extra_size)); + } OZ(init_writer_reader()); - LOG_INFO("success to init compact store", K(enable_dump), K(enable_trunc), K(compact_level), K(compress_type), + LOG_INFO("success to init compact store", K(enable_dump), K(enable_trunc), K(compress_type), K(exprs), K(ret)); return ret; } @@ -381,20 +378,15 @@ int ObCompactStore::init(const int64_t mem_limit, const bool enable_dump, const uint32_t row_extra_size, const bool enable_trunc, - const share::SortCompactLevel compact_level, const ObCompressorType compress_type) { int ret = OB_SUCCESS; - compact_level_ = compact_level; inited_ = true; - if (compact_level != share::SORT_COMPACT_LEVEL && compact_level != share::SORT_COMPRESSION_COMPACT_LEVEL) { - } else { - OZ(row_meta_.init(col_array, row_extra_size)); - } + OZ(row_meta_.init(col_array, row_extra_size)); OZ(ObTempBlockStore::init(mem_limit, enable_dump, tenant_id, mem_ctx_id, label, compress_type, enable_trunc)); OZ(block_reader_.init(this)); OZ(init_writer_reader()); - LOG_INFO("success to init compact store", K(enable_dump), K(enable_trunc), K(compact_level), K(compress_type), + LOG_INFO("success to init compact store", K(enable_dump), K(enable_trunc), K(compress_type), K(col_array), K(ret)); return ret; } @@ -409,7 +401,6 @@ void ObCompactStore::reset() writer_->reset(); allocator_->free(writer_); } - compact_level_ = share::SORT_DEFAULT_LEVEL; writer_ = nullptr; reader_ = nullptr; batch_ctx_ = nullptr; @@ -437,45 +428,14 @@ int ObCompactStore::init_writer_reader() int ret = OB_SUCCESS; void *writer_buf = nullptr; void *reader_buf = nullptr; - switch (compact_level_) { - case share::SORT_COMPRESSION_LEVEL: - case share::SORT_DEFAULT_LEVEL: { - writer_buf = allocator_->alloc(sizeof(ObDefaultBlockWriter)); - reader_buf = allocator_->alloc(sizeof(ObDefaultBlockReader)); - if (OB_ISNULL(writer_buf) || OB_ISNULL(reader_buf)) { - ret = OB_ALLOCATE_MEMORY_FAILED; - LOG_WARN("fail to allocate memory for writer", K(ret), KP(writer_buf), KP(reader_buf)); - } else { - writer_ = new (writer_buf)ObDefaultBlockWriter(this); - reader_ = new (reader_buf)ObDefaultBlockReader(this); - } - break; - } - case share::SORT_COMPRESSION_COMPACT_LEVEL: - case share::SORT_COMPACT_LEVEL: { - writer_buf = allocator_->alloc(sizeof(ObCompactBlockWriter)); - reader_buf = allocator_->alloc(sizeof(ObCompactBlockReader)); - if (OB_ISNULL(writer_buf) || OB_ISNULL(reader_buf)) { - ret = OB_ALLOCATE_MEMORY_FAILED; - LOG_WARN("fail to allocate memory for writer", K(ret)); - } else { - writer_ = new (writer_buf)ObCompactBlockWriter(this, &row_meta_); - reader_ = new (reader_buf)ObCompactBlockReader(this, &row_meta_); - } - break; - } - case share::SORT_COMPRESSION_ENCODE_LEVEL: - case share::SORT_ENCODE_LEVEL: { - // TODO - ret = OB_NOT_SUPPORTED; - LOG_WARN("encoding is not supported", K(ret)); - LOG_USER_ERROR(OB_NOT_SUPPORTED, "encoding in chunk store"); - break; - } - default: { - ret = OB_ERR_UNEXPECTED; - LOG_WARN("fail to init reader/writer", K(ret), K(compact_level_)); - } + writer_buf = allocator_->alloc(sizeof(ObCompactBlockWriter)); + reader_buf = allocator_->alloc(sizeof(ObCompactBlockReader)); + if (OB_ISNULL(writer_buf) || OB_ISNULL(reader_buf)) { + ret = OB_ALLOCATE_MEMORY_FAILED; + LOG_WARN("fail to allocate memory for writer", K(ret)); + } else { + writer_ = new (writer_buf)ObCompactBlockWriter(this, &row_meta_); + reader_ = new (reader_buf)ObCompactBlockReader(this, &row_meta_); } return ret; diff --git a/src/sql/engine/basic/chunk_store/ob_compact_store.h b/src/sql/engine/basic/chunk_store/ob_compact_store.h index 762e4a8d5f..39a6220c04 100644 --- a/src/sql/engine/basic/chunk_store/ob_compact_store.h +++ b/src/sql/engine/basic/chunk_store/ob_compact_store.h @@ -20,6 +20,7 @@ #include "sql/engine/basic/chunk_store/ob_block_iwriter.h" #include "sql/engine/basic/chunk_store/ob_chunk_block.h" #include "src/share/ob_ddl_common.h" + namespace oceanbase { namespace storage { @@ -33,7 +34,6 @@ class ObCompactStore final : public ObTempBlockStore OB_UNIS_VERSION_V(1); public: explicit ObCompactStore(common::ObIAllocator *alloc = NULL) : ObTempBlockStore(alloc), - compact_level_(share::SORT_DEFAULT_LEVEL), writer_(nullptr), reader_(nullptr), batch_ctx_(nullptr), row_meta_(*allocator_), row_cnt_(0), block_reader_(), start_iter_(false), cur_blk_id_(0) @@ -49,7 +49,6 @@ public: const bool enable_dump = true, const uint32_t row_extra_size = 0, const bool enable_trunc = true, - const share::SortCompactLevel compact_level = share::SORT_DEFAULT_LEVEL, const ObCompressorType compress_type = NONE_COMPRESSOR, const ExprFixedArray *exprs = nullptr); @@ -61,7 +60,6 @@ public: const bool enable_dump = true, const uint32_t row_extra_size = 0, const bool enable_trunc = true, - const share::SortCompactLevel compact_level = share::SORT_DEFAULT_LEVEL, const ObCompressorType compress_type = NONE_COMPRESSOR); int add_batch(const common::ObIArray &exprs, ObEvalCtx &ctx, const ObBitVector &skip, const int64_t batch_size, @@ -91,7 +89,6 @@ public: int has_next(bool &has_next); ChunkRowMeta *get_row_meta() { return &row_meta_; } void set_meta(ChunkRowMeta *row_meta) { writer_->set_meta(row_meta); reader_->set_meta(row_meta); } - share::SortCompactLevel get_compact_level() { return compact_level_; } void set_blk_holder(ObTempBlockStore::BlockHolder *blk_holder) { block_reader_.set_blk_holder(blk_holder); } protected: int prepare_blk_for_write(Block *) final override; @@ -112,7 +109,6 @@ private: int inner_get_next_row(const ObChunkDatumStore::StoredRow *&sr); private: - share::SortCompactLevel compact_level_; ObBlockIWriter *writer_; ObBlockIReader *reader_; BatchCtx *batch_ctx_; diff --git a/src/sql/engine/cmd/ob_index_executor.cpp b/src/sql/engine/cmd/ob_index_executor.cpp index 32a2cd8561..2aed455a75 100644 --- a/src/sql/engine/cmd/ob_index_executor.cpp +++ b/src/sql/engine/cmd/ob_index_executor.cpp @@ -82,7 +82,6 @@ int ObCreateIndexExecutor::execute(ObExecContext &ctx, ObCreateIndexStmt &stmt) //impossible } else if (FALSE_IT(create_index_arg.is_inner_ = my_session->is_inner())) { } else if (FALSE_IT(create_index_arg.parallelism_ = stmt.get_parallelism())) { - } else if (FALSE_IT(create_index_arg.compact_level_ = stmt.get_compact_level())) { } else if (FALSE_IT(create_index_arg.consumer_group_id_ = THIS_WORKER.get_group_id())) { } else if (OB_FAIL(common_rpc_proxy->create_index(create_index_arg, res))) { //send the signal of creating index to rs LOG_WARN("rpc proxy create index failed", K(create_index_arg), diff --git a/src/sql/engine/sort/ob_sort_op.cpp b/src/sql/engine/sort/ob_sort_op.cpp index befcc41840..e335638a0c 100644 --- a/src/sql/engine/sort/ob_sort_op.cpp +++ b/src/sql/engine/sort/ob_sort_op.cpp @@ -40,7 +40,6 @@ ObSortSpec::ObSortSpec(common::ObIAllocator &alloc, const ObPhyOperatorType type prescan_enabled_(false), enable_encode_sortkey_opt_(false), part_cnt_(0), - sort_compact_level_(share::SORT_DEFAULT_LEVEL), compress_type_(NONE_COMPRESSOR) {} @@ -59,7 +58,6 @@ OB_SERIALIZE_MEMBER((ObSortSpec, ObOpSpec), prescan_enabled_, enable_encode_sortkey_opt_, part_cnt_, - sort_compact_level_, compress_type_); ObSortOp::ObSortOp(ObExecContext &ctx_, const ObOpSpec &spec, ObOpInput *input) @@ -294,7 +292,7 @@ int ObSortOp::scan_all_then_sort() if (OB_FAIL(cache_store.init(2 * 1024 * 1024, ctx_.get_my_session()->get_effective_tenant_id(), ObCtxIds::DEFAULT_CTX_ID, "SORT_CACHE_CTX", true/*enable dump*/, 0, true, - MY_SPEC.sort_compact_level_, MY_SPEC.compress_type_, &MY_SPEC.all_exprs_))) { + MY_SPEC.compress_type_, &MY_SPEC.all_exprs_))) { LOG_WARN("init sample chunk store failed", K(ret)); } else if (OB_FAIL(cache_store.alloc_dir_id())) { LOG_WARN("failed to alloc dir id", K(ret)); @@ -350,7 +348,7 @@ int ObSortOp::scan_all_then_sort_batch() if (OB_FAIL(cache_store.init(2 * 1024 * 1024, ctx_.get_my_session()->get_effective_tenant_id(), ObCtxIds::DEFAULT_CTX_ID, "SORT_CACHE_CTX", true/*enable dump*/, 0, true, - MY_SPEC.sort_compact_level_, MY_SPEC.compress_type_, &MY_SPEC.all_exprs_))) { + MY_SPEC.compress_type_, &MY_SPEC.all_exprs_))) { LOG_WARN("init sample chunk store failed", K(ret)); } else if (OB_FAIL(cache_store.alloc_dir_id())) { LOG_WARN("failed to alloc dir id", K(ret)); @@ -438,7 +436,7 @@ int ObSortOp::init_sort(int64_t tenant_id, OZ(sort_impl_.init(tenant_id, &MY_SPEC.sort_collations_, &MY_SPEC.sort_cmp_funs_, &eval_ctx_, &ctx_, MY_SPEC.enable_encode_sortkey_opt_, MY_SPEC.is_local_merge_sort_, false /* need_rewind */, MY_SPEC.part_cnt_, topn_cnt, MY_SPEC.is_fetch_with_ties_, - ObChunkDatumStore::BLOCK_SIZE, MY_SPEC.sort_compact_level_, MY_SPEC.compress_type_, &MY_SPEC.all_exprs_)); + ObChunkDatumStore::BLOCK_SIZE, MY_SPEC.compress_type_, &MY_SPEC.all_exprs_)); if (is_batch) { read_batch_func_ = &ObSortOp::sort_impl_next_batch; } else { diff --git a/src/sql/engine/sort/ob_sort_op.h b/src/sql/engine/sort/ob_sort_op.h index 24eb3a174d..094869c6e6 100644 --- a/src/sql/engine/sort/ob_sort_op.h +++ b/src/sql/engine/sort/ob_sort_op.h @@ -35,7 +35,7 @@ public: INHERIT_TO_STRING_KV("op_spec", ObOpSpec, K_(topn_expr), K_(topk_limit_expr), K_(topk_offset_expr), K_(prefix_pos), K_(minimum_row_count), K_(topk_precision), K_(prefix_pos), K_(is_local_merge_sort), - K_(prescan_enabled), K_(enable_encode_sortkey_opt), K_(part_cnt), K_(sort_compact_level), + K_(prescan_enabled), K_(enable_encode_sortkey_opt), K_(part_cnt), K_(compress_type)); public: ObExpr *topn_expr_; @@ -59,7 +59,6 @@ public: bool enable_encode_sortkey_opt_; // if use, all_exprs_ is : hash(part_by) + part_by + order_by. int64_t part_cnt_; - share::SortCompactLevel sort_compact_level_; ObCompressorType compress_type_; }; diff --git a/src/sql/engine/sort/ob_sort_op_impl.cpp b/src/sql/engine/sort/ob_sort_op_impl.cpp index d5f0e26b68..dad9508db6 100644 --- a/src/sql/engine/sort/ob_sort_op_impl.cpp +++ b/src/sql/engine/sort/ob_sort_op_impl.cpp @@ -577,7 +577,7 @@ ObSortOpImpl::ObSortOpImpl(ObMonitorNode &op_monitor_info) max_node_cnt_(0), part_cnt_(0), topn_cnt_(INT64_MAX), outputted_rows_cnt_(0), is_fetch_with_ties_(false), topn_heap_(NULL), ties_array_pos_(0), last_ties_row_(NULL), pt_buckets_(NULL), use_partition_topn_sort_(false), heap_nodes_(), cur_heap_idx_(0), - rows_(NULL), sort_compact_level_(share::SORT_DEFAULT_LEVEL), sort_exprs_(nullptr), + rows_(NULL), sort_exprs_(nullptr), compress_type_(NONE_COMPRESSOR) { } @@ -639,7 +639,6 @@ int ObSortOpImpl::init( const int64_t topn_cnt /* = INT64_MAX */, const bool is_fetch_with_ties /* = false */, const int64_t default_block_size /* = 64KB */, - const SortCompactLevel compact_level /* = false */, const ObCompressorType compress_type /* = NONE_COMPRESS */, const ExprFixedArray *exprs /* =nullptr */) { @@ -669,7 +668,6 @@ int ObSortOpImpl::init( exec_ctx_ = exec_ctx; part_cnt_ = part_cnt; topn_cnt_ = topn_cnt; - sort_compact_level_ = compact_level; compress_type_ = compress_type; sort_exprs_ = exprs; use_heap_sort_ = is_topn_sort() && part_cnt_ == 0; @@ -807,7 +805,6 @@ void ObSortOpImpl::reset() is_fetch_with_ties_ = false; rows_ = NULL; ties_array_pos_ = 0; - sort_compact_level_ = share::SORT_DEFAULT_LEVEL; compress_type_ = NONE_COMPRESSOR; sort_exprs_ = nullptr; // for partition topn sort @@ -875,7 +872,7 @@ int ObSortOpImpl::build_chunk(const int64_t level, Input &input, int64_t extra_s } else if (OB_FAIL(chunk->datum_store_.init(1/*+ mem limit, small limit for dump immediately */, tenant_id_, ObCtxIds::WORK_AREA, ObModIds::OB_SQL_SORT_ROW, true/*+ enable dump */, extra_size/* for InMemoryTopnSort */, true, - sort_compact_level_, compress_type_, sort_exprs_))) { + compress_type_, sort_exprs_))) { LOG_WARN("init row store failed", K(ret)); } else { chunk->datum_store_.set_dir_id(sql_mem_processor_.get_dir_id()); @@ -2238,7 +2235,7 @@ int ObSortOpImpl::get_next_batch_stored_rows(int64_t max_cnt, int64_t &read_rows LOG_WARN("fail to get next row", K(ret)); } else { stored_rows_[read_rows++] = const_cast(sr); - if (sort_compact_level_ != share::SORT_DEFAULT_LEVEL && sort_compact_level_ != share::SORT_COMPRESSION_LEVEL) { + if (use_compact_store()) { // can't hold multi rows for get_batch, if we use compact/encoding break; } diff --git a/src/sql/engine/sort/ob_sort_op_impl.h b/src/sql/engine/sort/ob_sort_op_impl.h index a5e54f335f..e0bc88c339 100644 --- a/src/sql/engine/sort/ob_sort_op_impl.h +++ b/src/sql/engine/sort/ob_sort_op_impl.h @@ -110,14 +110,13 @@ public: const bool enable_dump = true, const uint32_t row_extra_size = 0, const bool enable_truncate = true, - const share::SortCompactLevel compact_level = share::SORT_DEFAULT_LEVEL, const ObCompressorType compress_type = NONE_COMPRESSOR, const ExprFixedArray *exprs = nullptr) { int ret = OB_SUCCESS; if (is_compact_) { ret = compact_store_.init(mem_limit, tenant_id, mem_ctx_id, label, enable_dump, row_extra_size, - enable_truncate, compact_level, compress_type, exprs); + enable_truncate, compress_type, exprs); } else { ret = datum_store_.init(mem_limit, tenant_id, mem_ctx_id, label, enable_dump, row_extra_size); } @@ -262,7 +261,6 @@ public: const int64_t topn_cnt = INT64_MAX, const bool is_fetch_with_ties = false, const int64_t default_block_size = ObChunkDatumStore::BLOCK_SIZE, - const share::SortCompactLevel compact_level = share::SORT_DEFAULT_LEVEL, const common::ObCompressorType compressor_type = common::NONE_COMPRESSOR, const ExprFixedArray *exprs = nullptr); @@ -772,7 +770,6 @@ protected: SortStoredRow *&new_row); int generate_last_ties_row(const ObChunkDatumStore::StoredRow *orign_row); int adjust_topn_read_rows(ObChunkDatumStore::StoredRow **stored_rows, int64_t &read_cnt); - bool use_compact_store() { return sort_compact_level_ != SORT_DEFAULT_LEVEL; } // for partition topn int init_partition_topn(); void reuse_part_topn_heap(); @@ -793,6 +790,7 @@ protected: const int64_t batch_size, const uint16_t selector[], const int64_t size); + bool use_compact_store() { return compress_type_ != NONE_COMPRESSOR; } DISALLOW_COPY_AND_ASSIGN(ObSortOpImpl); protected: @@ -861,7 +859,6 @@ protected: common::ObIArray *rows_; ObTempBlockStore::BlockHolder compact_blk_holder_; ObChunkDatumStore::IteratedBlockHolder default_blk_holder_; - share::SortCompactLevel sort_compact_level_; const ExprFixedArray *sort_exprs_; common::ObCompressorType compress_type_; }; diff --git a/src/sql/parser/sql_parser_mysql_mode.l b/src/sql/parser/sql_parser_mysql_mode.l index 5e15deb96e..549ffef878 100644 --- a/src/sql/parser/sql_parser_mysql_mode.l +++ b/src/sql/parser/sql_parser_mysql_mode.l @@ -55,6 +55,7 @@ insert_hint_begin (insert{space}*(\/\*([^+*]|\*+[^*\/])*\*+\/{space}*)*(\/ replace_hint_begin (replace{space}*(\/\*([^+*]|\*+[^*\/])*\*+\/{space}*)*(\/\*\+({space}*hint{space}+)?)) load_data_hint_begin (load{space}+data{space}*(\/\*([^+*]|\*+[^*\/])*\*+\/{space}*)*(\/\*\+({space}*hint{space}+)?)) create_hint_begin (create{space}*(\/\*([^+*]|\*+[^*\/])*\*+\/{space}*)*(\/\*\+({space}*hint{space}+)?)) +alter_hint_begin (alter{space}*(\/\*([^+*]|\*+[^*\/])*\*+\/{space}*)*(\/\*\+({space}*hint{space}+)?)) hint_hint_begin (hint{space}*(\/\*([^+*]|\*+[^*\/])*\*+\/{space}*)*(\/\*\+({space}*hint{space}+)?)) common_hint_begin (\/\*\+({space}*hint{space}+)?) c_cmt_begin \/\* @@ -955,6 +956,12 @@ Timestamp{whitespace}?\"[^\"]*\" { p->is_ignore_token_ = p->is_ignore_hint_; return CREATE_HINT_BEGIN; } +{alter_hint_begin} { + BEGIN(hint); + ParseResult *p = (ParseResult *)yyextra; + p->is_ignore_token_ = p->is_ignore_hint_; + return ALTER_HINT_BEGIN; +} {c_cmt_end} { BEGIN(INITIAL); return HINT_END; diff --git a/src/sql/parser/sql_parser_mysql_mode.y b/src/sql/parser/sql_parser_mysql_mode.y index d4f48d3b2a..382ccb3968 100644 --- a/src/sql/parser/sql_parser_mysql_mode.y +++ b/src/sql/parser/sql_parser_mysql_mode.y @@ -205,7 +205,7 @@ NEG_SIGN %token /*can not be relation name*/ _BINARY _UTF8 _UTF8MB4 _GBK _UTF16 _GB18030 _GB18030_2022 _LATIN1 CNNOP SELECT_HINT_BEGIN UPDATE_HINT_BEGIN DELETE_HINT_BEGIN INSERT_HINT_BEGIN REPLACE_HINT_BEGIN HINT_HINT_BEGIN HINT_END -LOAD_DATA_HINT_BEGIN CREATE_HINT_BEGIN +LOAD_DATA_HINT_BEGIN CREATE_HINT_BEGIN ALTER_HINT_BEGIN END_P SET_VAR DELIMITER /*reserved keyword*/ @@ -456,7 +456,7 @@ END_P SET_VAR DELIMITER %type column_name relation_name function_name column_label var_name relation_name_or_string row_format_option %type audit_stmt audit_clause op_audit_tail_clause audit_operation_clause audit_all_shortcut_list audit_all_shortcut auditing_on_clause auditing_by_user_clause audit_user_list audit_user audit_user_with_host_name %type opt_hint_list hint_option select_with_opt_hint update_with_opt_hint delete_with_opt_hint hint_list_with_end global_hint transform_hint optimize_hint -%type create_index_stmt index_name sort_column_list sort_column_key opt_index_option_list index_option opt_sort_column_key_length opt_index_using_algorithm index_using_algorithm visibility_option opt_constraint_name constraint_name create_with_opt_hint index_expr +%type create_index_stmt index_name sort_column_list sort_column_key opt_index_option_list index_option opt_sort_column_key_length opt_index_using_algorithm index_using_algorithm visibility_option opt_constraint_name constraint_name create_with_opt_hint index_expr alter_with_opt_hint %type opt_when check_state constraint_definition %type create_mlog_stmt opt_mlog_option_list opt_mlog_options mlog_option opt_mlog_with mlog_with_values mlog_with_special_columns mlog_with_reference_columns mlog_with_special_column_list mlog_with_reference_column_list mlog_with_special_column mlog_with_reference_column opt_mlog_new_values mlog_including_or_excluding opt_mlog_purge mlog_purge_values mlog_purge_immediate_sync_or_async mlog_purge_start mlog_purge_next %type drop_mlog_stmt @@ -3793,24 +3793,27 @@ UNIT opt_equal_mark relation_name_or_string ; alter_resource_stmt: -ALTER RESOURCE UNIT relation_name opt_resource_unit_option_list +alter_with_opt_hint RESOURCE UNIT relation_name opt_resource_unit_option_list { + (void)($1); ParseNode *resource_options = NULL; merge_nodes(resource_options, result, T_RESOURCE_UNIT_OPTION_LIST, $5); malloc_non_terminal_node($$, result->malloc_pool_, T_ALTER_RESOURCE_UNIT, 2, $4, /* resource unit name */ resource_options); /* resource opt */ } -| ALTER RESOURCE POOL relation_name alter_resource_pool_option_list +| alter_with_opt_hint RESOURCE POOL relation_name alter_resource_pool_option_list { + (void)($1); ParseNode *resource_pool_options = NULL; merge_nodes(resource_pool_options, result, T_RESOURCE_POOL_OPTION_LIST, $5); malloc_non_terminal_node($$, result->malloc_pool_, T_ALTER_RESOURCE_POOL, 2, $4, /* resource_pool name */ resource_pool_options); /* resource_pool opt */ } -| ALTER RESOURCE POOL relation_name SPLIT INTO '(' resource_pool_list ')' ON '(' zone_list ')' +| alter_with_opt_hint RESOURCE POOL relation_name SPLIT INTO '(' resource_pool_list ')' ON '(' zone_list ')' { + (void)($1); ParseNode *resource_pool_list = NULL; ParseNode *zone_list = NULL; merge_nodes(resource_pool_list, result, T_RESOURCE_POOL_LIST, $8); @@ -3820,8 +3823,9 @@ ALTER RESOURCE UNIT relation_name opt_resource_unit_option_list resource_pool_list, /* new pool names */ zone_list); /* corresponding zones */ } -| ALTER RESOURCE POOL MERGE '(' resource_pool_list ')' INTO '(' resource_pool_list ')' +| alter_with_opt_hint RESOURCE POOL MERGE '(' resource_pool_list ')' INTO '(' resource_pool_list ')' { + (void)($1); ParseNode *old_resource_pool_list = NULL; ParseNode *new_resource_pool_list = NULL; merge_nodes(old_resource_pool_list, result, T_RESOURCE_POOL_LIST, $6); @@ -3830,8 +3834,9 @@ ALTER RESOURCE UNIT relation_name opt_resource_unit_option_list old_resource_pool_list, /* to be merged*/ new_resource_pool_list); /* finish merge*/ } -| ALTER RESOURCE TENANT relation_name UNIT_NUM opt_equal_mark INTNUM opt_shrink_tenant_unit_option +| alter_with_opt_hint RESOURCE TENANT relation_name UNIT_NUM opt_equal_mark INTNUM opt_shrink_tenant_unit_option { + (void)($1); (void)($6); /* make bison mute */ malloc_non_terminal_node($$, result->malloc_pool_, T_ALTER_RESOURCE_TENANT, 3, $4, /* tenant name */ @@ -4046,8 +4051,9 @@ STRING_VALUE ; alter_tenant_stmt: -ALTER TENANT relation_name opt_set opt_tenant_option_list opt_global_sys_vars_set +alter_with_opt_hint TENANT relation_name opt_set opt_tenant_option_list opt_global_sys_vars_set { + (void)($1); if ($4 == NULL && $5 == NULL && $6 == NULL) { YYERROR; } else { @@ -4061,8 +4067,9 @@ ALTER TENANT relation_name opt_set opt_tenant_option_list opt_global_sys_vars_se NULL); /* new tenant name */ } } -| ALTER TENANT ALL opt_set opt_tenant_option_list opt_global_sys_vars_set +| alter_with_opt_hint TENANT ALL opt_set opt_tenant_option_list opt_global_sys_vars_set { + (void)($1); if ($4 == NULL && $5 == NULL && $6 == NULL) { YYERROR; } else { @@ -4076,16 +4083,18 @@ ALTER TENANT relation_name opt_set opt_tenant_option_list opt_global_sys_vars_se NULL); /* new tenant name */ } } -| ALTER TENANT relation_name RENAME GLOBAL_NAME TO relation_name // add by xiaonfeng +| alter_with_opt_hint TENANT relation_name RENAME GLOBAL_NAME TO relation_name // add by xiaonfeng { + (void)($1); malloc_non_terminal_node($$, result->malloc_pool_, T_MODIFY_TENANT, 4, $3, /* tenant name */ NULL, /* tenant opt */ NULL, /* global sys vars set opt */ $7); /* new tenant name */ } -| ALTER TENANT relation_name lock_spec_mysql57 +| alter_with_opt_hint TENANT relation_name lock_spec_mysql57 { + (void)($1); /*ParseNode *tenant_options = NULL;*/ malloc_non_terminal_node($$, result->malloc_pool_, T_LOCK_TENANT, 2, $3, /* tenant name */ @@ -4385,8 +4394,9 @@ DROP DATABASE database_factor * *****************************************************************************/ alter_database_stmt: -ALTER database_key opt_database_name opt_set database_option_list +alter_with_opt_hint database_key opt_database_name opt_set database_option_list { + (void)($1); (void)($2); (void)($4); ParseNode *database_option = NULL; @@ -7842,21 +7852,24 @@ DROP TABLEGROUP opt_if_exists relation_name * *****************************************************************************/ alter_tablegroup_stmt: -ALTER TABLEGROUP relation_name ADD opt_table table_list +alter_with_opt_hint TABLEGROUP relation_name ADD opt_table table_list { + (void)($1); (void)($5); ParseNode *table_list = NULL; merge_nodes(table_list, result, T_TABLE_LIST, $6); malloc_non_terminal_node($$, result->malloc_pool_, T_ALTER_TABLEGROUP, 2, $3, table_list); } -| ALTER TABLEGROUP relation_name alter_tablegroup_actions +| alter_with_opt_hint TABLEGROUP relation_name alter_tablegroup_actions { + (void)($1); ParseNode *tablegroup_actions = NULL; merge_nodes(tablegroup_actions, result, T_ALTER_TABLEGROUP_ACTION_LIST, $4); malloc_non_terminal_node($$, result->malloc_pool_, T_ALTER_TABLEGROUP, 2, $3, tablegroup_actions); } -| ALTER TABLEGROUP relation_name alter_tg_partition_option +| alter_with_opt_hint TABLEGROUP relation_name alter_tg_partition_option { + (void)($1); ParseNode *partition_options = NULL; malloc_non_terminal_node(partition_options, result->malloc_pool_, T_ALTER_PARTITION_OPTION, 1, $4); malloc_non_terminal_node($$, result->malloc_pool_, T_ALTER_TABLEGROUP, 2, $3, partition_options); @@ -7998,8 +8011,9 @@ create_with_opt_hint opt_replace opt_algorithm opt_definer opt_sql_security VIEW $$->reserved_ = 0; /* is create view */ } // alter view 功能类似于 create or replace view,代码基本可以直接复用,区别仅有在原有视图不存在时需要报错 -| ALTER opt_algorithm opt_definer opt_sql_security VIEW view_name opt_column_list opt_table_id AS view_select_stmt opt_check_option +| alter_with_opt_hint opt_algorithm opt_definer opt_sql_security VIEW view_name opt_column_list opt_table_id AS view_select_stmt opt_check_option { + (void)($1); UNUSED($2); UNUSED($3); UNUSED($4); @@ -8302,6 +8316,12 @@ CREATE {$$ = NULL;} {$$ = $2;} ; +alter_with_opt_hint: +ALTER {$$ = NULL;} +| ALTER_HINT_BEGIN hint_list_with_end +{$$ = $2;} +; + opt_index_keyname: SPATIAL { $$[0] = 2; } | UNIQUE { $$[0] = 1; } @@ -12678,8 +12698,9 @@ create_with_opt_hint opt_replace OUTLINE relation_name ON STRING_VALUE USING HIN * *****************************************************************************/ alter_outline_stmt: -ALTER OUTLINE relation_name ADD explainable_stmt opt_outline_target +alter_with_opt_hint OUTLINE relation_name ADD explainable_stmt opt_outline_target { + (void)($1); ParseNode *name_node = NULL; malloc_non_terminal_node(name_node, result->malloc_pool_, T_RELATION_FACTOR, 2, NULL, $3); dup_node_string($3, name_node, result->malloc_pool_); @@ -13561,15 +13582,17 @@ opt_set permanent_tablespace_option ; alter_tablespace_stmt: -ALTER TABLESPACE tablespace alter_tablespace_actions +alter_with_opt_hint TABLESPACE tablespace alter_tablespace_actions { + (void)($1); malloc_non_terminal_node($$, result->malloc_pool_, T_ALTER_TABLESPACE, 2, $3, $4); } ; rotate_master_key_stmt: -ALTER INSTANCE ROTATE INNODB MASTER KEY +alter_with_opt_hint INSTANCE ROTATE INNODB MASTER KEY { + (void)($1); malloc_terminal_node($$, result->malloc_pool_, T_ALTER_KEYSTORE_SET_KEY); } ; @@ -13853,21 +13876,24 @@ SET PASSWORD opt_for_user COMP_EQ STRING_VALUE need_enc_node->value_ = 1; malloc_non_terminal_node($$, result->malloc_pool_, T_SET_PASSWORD, 5, $3, $7, need_enc_node, NULL, NULL); } -| ALTER USER user_with_host_name IDENTIFIED opt_auth_plugin BY password +| alter_with_opt_hint USER user_with_host_name IDENTIFIED opt_auth_plugin BY password { + (void)($1); ParseNode *need_enc_node = NULL; malloc_terminal_node(need_enc_node, result->malloc_pool_, T_BOOL); need_enc_node->value_ = 1; malloc_non_terminal_node($$, result->malloc_pool_, T_SET_PASSWORD, 5, $3, $7, need_enc_node, NULL, $5); } -| ALTER USER user_with_host_name require_specification +| alter_with_opt_hint USER user_with_host_name require_specification { + (void)($1); ParseNode *require_node = NULL; merge_nodes(require_node, result, T_TLS_OPTIONS, $4); malloc_non_terminal_node($$, result->malloc_pool_, T_SET_PASSWORD, 5, $3, NULL, NULL, require_node, NULL); } -| ALTER USER user_with_host_name WITH resource_option_list +| alter_with_opt_hint USER user_with_host_name WITH resource_option_list { + (void)($1); ParseNode *res_opt_node = NULL; merge_nodes(res_opt_node, result, T_USER_RESOURCE_OPTIONS, $5); malloc_non_terminal_node($$, result->malloc_pool_, T_SET_PASSWORD, 5, $3, NULL, NULL, res_opt_node, NULL); @@ -13921,8 +13947,9 @@ rename_info * *****************************************************************************/ lock_user_stmt: -ALTER USER user_list ACCOUNT lock_spec_mysql57 +alter_with_opt_hint USER user_list ACCOUNT lock_spec_mysql57 { + (void)($1); ParseNode *users_node = NULL; merge_nodes(users_node, result, T_USERS, $3); malloc_non_terminal_node($$, result->malloc_pool_, T_LOCK_USER, 2, users_node, $5); @@ -14188,8 +14215,9 @@ DROP SEQUENCE opt_if_exists relation_factor ; alter_sequence_stmt: -ALTER SEQUENCE relation_factor opt_sequence_option_list +alter_with_opt_hint SEQUENCE relation_factor opt_sequence_option_list { + (void)($1); ParseNode *sequence_option = NULL; merge_nodes(sequence_option, result, T_SEQUENCE_OPTION_LIST, $4); malloc_non_terminal_node($$, result->malloc_pool_, T_ALTER_SEQUENCE, 2, $3, sequence_option); @@ -14469,8 +14497,9 @@ priv_type ; priv_type: -ALTER +alter_with_opt_hint { + (void)($1); malloc_terminal_node($$, result->malloc_pool_, T_PRIV_TYPE); $$->value_ = OB_PRIV_ALTER; } @@ -14557,13 +14586,15 @@ ALTER malloc_terminal_node($$, result->malloc_pool_, T_PRIV_TYPE); $$->value_ = OB_PRIV_FILE; } -| ALTER TENANT +| alter_with_opt_hint TENANT { + (void)($1); malloc_terminal_node($$, result->malloc_pool_, T_PRIV_TYPE); $$->value_ = OB_PRIV_ALTER_TENANT; } -| ALTER SYSTEM +| alter_with_opt_hint SYSTEM { + (void)($1); malloc_terminal_node($$, result->malloc_pool_, T_PRIV_TYPE); $$->value_ = OB_PRIV_ALTER_SYSTEM; } @@ -15106,8 +15137,9 @@ WHENEVER NOT SUCCESSFUL { $$[0] = 1;} audit_all_shortcut: -ALTER SYSTEM +alter_with_opt_hint SYSTEM { + (void)($1); malloc_terminal_node($$, result->malloc_pool_, T_AUDIT_ALTER_SYSTEM); } | CLUSTER @@ -15174,8 +15206,9 @@ ALTER SYSTEM { malloc_terminal_node($$, result->malloc_pool_, T_AUDIT_VIEW); } -| ALTER TABLE +| alter_with_opt_hint TABLE { + (void)($1); malloc_terminal_node($$, result->malloc_pool_, T_AUDIT_ALTER_TABLE); } | COMMENT TABLE @@ -15214,8 +15247,9 @@ ALTER SYSTEM { malloc_terminal_node($$, result->malloc_pool_, T_AUDIT_UPDATE_TABLE); } -| ALTER +| alter_with_opt_hint { + (void)($1); malloc_terminal_node($$, result->malloc_pool_, T_AUDIT_ALTER); } | AUDIT @@ -15307,29 +15341,29 @@ relation_factor TO relation_factor * *****************************************************************************/ alter_table_stmt: -ALTER TABLE relation_factor alter_table_actions +alter_with_opt_hint TABLE relation_factor alter_table_actions { ParseNode *table_actions = NULL; merge_nodes(table_actions, result, T_ALTER_TABLE_ACTION_LIST, $4); - malloc_non_terminal_node($$, result->malloc_pool_, T_ALTER_TABLE, 3, $3, table_actions, NULL); + malloc_non_terminal_node($$, result->malloc_pool_, T_ALTER_TABLE, 4, $3, table_actions, NULL, $1); $$->value_ = 0; } | -ALTER EXTERNAL TABLE relation_factor alter_table_actions +alter_with_opt_hint EXTERNAL TABLE relation_factor alter_table_actions { ParseNode *table_actions = NULL; merge_nodes(table_actions, result, T_ALTER_TABLE_ACTION_LIST, $5); ParseNode *external_node = NULL; malloc_terminal_node(external_node, result->malloc_pool_, T_EXTERNAL); - malloc_non_terminal_node($$, result->malloc_pool_, T_ALTER_TABLE, 3, $4, table_actions, external_node); + malloc_non_terminal_node($$, result->malloc_pool_, T_ALTER_TABLE, 4, $4, table_actions, external_node, $1); $$->value_ = 0; } | -ALTER TABLE relation_factor alter_column_group_option +alter_with_opt_hint TABLE relation_factor alter_column_group_option { ParseNode *table_actions = NULL; merge_nodes(table_actions, result, T_ALTER_TABLE_ACTION_LIST, $4); - malloc_non_terminal_node($$, result->malloc_pool_, T_ALTER_TABLE, 3, $3, table_actions, NULL); + malloc_non_terminal_node($$, result->malloc_pool_, T_ALTER_TABLE, 4, $3, table_actions, NULL, $1); $$->value_ = 0; } ; @@ -15623,8 +15657,9 @@ ADD add_key_or_index_opt { malloc_terminal_node($$, result->malloc_pool_, T_PRIMARY_KEY_DROP); } -| ALTER INDEX index_name visibility_option +| alter_with_opt_hint INDEX index_name visibility_option { + (void)($1); // TODO malloc_non_terminal_node($$, result->malloc_pool_, T_INDEX_ALTER, 2, $3, $4); } | RENAME key_or_index index_name TO index_name @@ -15632,17 +15667,20 @@ ADD add_key_or_index_opt (void)($2); malloc_non_terminal_node($$, result->malloc_pool_, T_INDEX_RENAME, 2, $3, $5); } -| ALTER INDEX index_name parallel_option +| alter_with_opt_hint INDEX index_name parallel_option { + (void)($1); malloc_non_terminal_node($$, result->malloc_pool_, T_INDEX_ALTER_PARALLEL, 2, $3, $4); } -| ALTER CONSTRAINT constraint_name check_state +| alter_with_opt_hint CONSTRAINT constraint_name check_state { + (void)($1); malloc_non_terminal_node($$, result->malloc_pool_, T_MODIFY_CONSTRAINT_OPTION, 2, $3, $4); $$->value_ = 0; // alter state of a check constraint or foreign key } -| ALTER CHECK constraint_name check_state +| alter_with_opt_hint CHECK constraint_name check_state { + (void)($1); malloc_non_terminal_node($$, result->malloc_pool_, T_MODIFY_CONSTRAINT_OPTION, 2, $3, $4); $$->value_ = 1; // alter state of a check constraint } @@ -15916,13 +15954,15 @@ ADD COLUMN column_definition malloc_non_terminal_node($$, result->malloc_pool_, T_COLUMN_DROP, 1, $3); $$->value_ = $4[0]; } -| ALTER COLUMN column_definition_ref alter_column_behavior +| alter_with_opt_hint COLUMN column_definition_ref alter_column_behavior { + (void)($1); (void)($2); /* make bison mute */ malloc_non_terminal_node($$, result->malloc_pool_, T_COLUMN_ALTER, 2, $3, $4); } -| ALTER column_definition_ref alter_column_behavior +| alter_with_opt_hint column_definition_ref alter_column_behavior { + (void)($1); malloc_non_terminal_node($$, result->malloc_pool_, T_COLUMN_ALTER, 2, $2, $3); } | CHANGE COLUMN column_definition_ref column_definition @@ -16169,146 +16209,171 @@ DUMP MEMORY LEAK * *****************************************************************************/ alter_system_stmt: -ALTER SYSTEM BOOTSTRAP server_info_list +alter_with_opt_hint SYSTEM BOOTSTRAP server_info_list { + (void)($1); ParseNode *server_list = NULL; merge_nodes(server_list, result, T_SERVER_INFO_LIST, $4); malloc_non_terminal_node($$, result->malloc_pool_, T_BOOTSTRAP, 1, server_list); } | -ALTER SYSTEM FLUSH cache_type CACHE opt_namespace opt_sql_id_or_schema_id opt_databases opt_tenant_list flush_scope +alter_with_opt_hint SYSTEM FLUSH cache_type CACHE opt_namespace opt_sql_id_or_schema_id opt_databases opt_tenant_list flush_scope { + (void)($1); // system tenant use only. malloc_non_terminal_node($$, result->malloc_pool_, T_FLUSH_CACHE, 6, $4, $6, $7, $8, $9, $10); } | // this just is a Syntactic sugar, only used to be compatible to plan cache's Grammar -ALTER SYSTEM FLUSH SQL cache_type opt_tenant_list flush_scope +alter_with_opt_hint SYSTEM FLUSH SQL cache_type opt_tenant_list flush_scope { + (void)($1); malloc_non_terminal_node($$, result->malloc_pool_, T_FLUSH_CACHE, 6, $5, NULL, NULL, NULL, $6, $7); } | -ALTER SYSTEM FLUSH KVCACHE opt_tenant_name opt_cache_name +alter_with_opt_hint SYSTEM FLUSH KVCACHE opt_tenant_name opt_cache_name { + (void)($1); malloc_non_terminal_node($$, result->malloc_pool_, T_FLUSH_KVCACHE, 2, $5, $6); } | -ALTER SYSTEM FLUSH DAG WARNINGS +alter_with_opt_hint SYSTEM FLUSH DAG WARNINGS { + (void)($1); malloc_terminal_node($$, result->malloc_pool_, T_FLUSH_DAG_WARNINGS); } | -ALTER SYSTEM FLUSH ILOGCACHE opt_file_id +alter_with_opt_hint SYSTEM FLUSH ILOGCACHE opt_file_id { + (void)($1); malloc_non_terminal_node($$, result->malloc_pool_, T_FLUSH_ILOGCACHE, 1, $5); } | -ALTER SYSTEM SWITCH REPLICA ls_role ls_server_or_server_or_zone_or_tenant +alter_with_opt_hint SYSTEM SWITCH REPLICA ls_role ls_server_or_server_or_zone_or_tenant { + (void)($1); malloc_non_terminal_node($$, result->malloc_pool_, T_SWITCH_REPLICA_ROLE, 2, $5, $6); } | -ALTER SYSTEM SWITCH ROOTSERVICE partition_role server_or_zone +alter_with_opt_hint SYSTEM SWITCH ROOTSERVICE partition_role server_or_zone { + (void)($1); malloc_non_terminal_node($$, result->malloc_pool_, T_SWITCH_RS_ROLE, 2, $5, $6); } | -ALTER SYSTEM REPORT REPLICA opt_server_or_zone +alter_with_opt_hint SYSTEM REPORT REPLICA opt_server_or_zone { + (void)($1); malloc_non_terminal_node($$, result->malloc_pool_, T_REPORT_REPLICA, 1, $5); } | -ALTER SYSTEM RECYCLE REPLICA opt_server_or_zone +alter_with_opt_hint SYSTEM RECYCLE REPLICA opt_server_or_zone { + (void)($1); malloc_non_terminal_node($$, result->malloc_pool_, T_RECYCLE_REPLICA, 1, $5); } | -ALTER SYSTEM START MERGE zone_desc +alter_with_opt_hint SYSTEM START MERGE zone_desc { + (void)($1); ParseNode *start = NULL; malloc_terminal_node(start, result->malloc_pool_, T_INT); start->value_ = 1; malloc_non_terminal_node($$, result->malloc_pool_, T_MERGE_CONTROL, 2, start, $5); } | -ALTER SYSTEM suspend_or_resume MERGE opt_tenant_list_v2 +alter_with_opt_hint SYSTEM suspend_or_resume MERGE opt_tenant_list_v2 { + (void)($1); malloc_non_terminal_node($$, result->malloc_pool_, T_MERGE_CONTROL, 2, $3, $5); } | -ALTER SYSTEM suspend_or_resume RECOVERY opt_zone_desc +alter_with_opt_hint SYSTEM suspend_or_resume RECOVERY opt_zone_desc { + (void)($1); malloc_non_terminal_node($$, result->malloc_pool_, T_RECOVERY_CONTROL, 2, $3, $5); } | -ALTER SYSTEM CLEAR MERGE ERROR_P opt_tenant_list_v2 +alter_with_opt_hint SYSTEM CLEAR MERGE ERROR_P opt_tenant_list_v2 { + (void)($1); malloc_non_terminal_node($$, result->malloc_pool_, T_CLEAR_MERGE_ERROR, 1, $6); } | -ALTER SYSTEM ADD ARBITRATION SERVICE STRING_VALUE +alter_with_opt_hint SYSTEM ADD ARBITRATION SERVICE STRING_VALUE { + (void)($1); malloc_non_terminal_node($$, result->malloc_pool_, T_ADD_ARBITRATION_SERVICE, 1, $6); } | -ALTER SYSTEM REMOVE ARBITRATION SERVICE STRING_VALUE +alter_with_opt_hint SYSTEM REMOVE ARBITRATION SERVICE STRING_VALUE { + (void)($1); malloc_non_terminal_node($$, result->malloc_pool_, T_REMOVE_ARBITRATION_SERVICE, 1, $6); } | -ALTER SYSTEM REPLACE ARBITRATION SERVICE STRING_VALUE WITH STRING_VALUE +alter_with_opt_hint SYSTEM REPLACE ARBITRATION SERVICE STRING_VALUE WITH STRING_VALUE { + (void)($1); malloc_non_terminal_node($$, result->malloc_pool_, T_REPLACE_ARBITRATION_SERVICE, 2, $6, $8); } | -ALTER SYSTEM CANCEL cancel_task_type TASK STRING_VALUE +alter_with_opt_hint SYSTEM CANCEL cancel_task_type TASK STRING_VALUE { + (void)($1); malloc_non_terminal_node($$, result->malloc_pool_, T_CANCEL_TASK, 2, $4, $6); } | -ALTER SYSTEM MAJOR FREEZE opt_tenant_list_or_ls_or_tablet_id opt_rebuild_column_store +alter_with_opt_hint SYSTEM MAJOR FREEZE opt_tenant_list_or_ls_or_tablet_id opt_rebuild_column_store { + (void)($1); ParseNode *type = NULL; malloc_terminal_node(type, result->malloc_pool_, T_INT); type->value_ = 1; malloc_non_terminal_node($$, result->malloc_pool_, T_FREEZE, 3, type, $5, $6); } | -ALTER SYSTEM CHECKPOINT +alter_with_opt_hint SYSTEM CHECKPOINT { + (void)($1); ParseNode *type = NULL; malloc_terminal_node(type, result->malloc_pool_, T_INT); type->value_ = 1; malloc_non_terminal_node($$, result->malloc_pool_, T_FREEZE, 3, type, NULL, NULL); } | -ALTER SYSTEM MINOR FREEZE opt_tenant_list_or_ls_or_tablet_id opt_server_list opt_zone_desc +alter_with_opt_hint SYSTEM MINOR FREEZE opt_tenant_list_or_ls_or_tablet_id opt_server_list opt_zone_desc { + (void)($1); ParseNode *type = NULL; malloc_terminal_node(type, result->malloc_pool_, T_INT); type->value_ = 2; malloc_non_terminal_node($$, result->malloc_pool_, T_FREEZE, 4, type, $5, $6, $7); } | -ALTER SYSTEM CHECKPOINT SLOG opt_tenant_info ip_port +alter_with_opt_hint SYSTEM CHECKPOINT SLOG opt_tenant_info ip_port { + (void)($1); malloc_non_terminal_node($$, result->malloc_pool_, T_CHECKPOINT_SLOG, 2, $5, $6); } | -ALTER SYSTEM CLEAR ROOTTABLE opt_tenant_name +alter_with_opt_hint SYSTEM CLEAR ROOTTABLE opt_tenant_name { + (void)($1); malloc_non_terminal_node($$, result->malloc_pool_, T_CLEAR_ROOT_TABLE, 1, $5); } | -ALTER SYSTEM server_action SERVER server_list opt_zone_desc +alter_with_opt_hint SYSTEM server_action SERVER server_list opt_zone_desc { + (void)($1); ParseNode *server_list = NULL; merge_nodes(server_list, result, T_SERVER_LIST, $5); malloc_non_terminal_node($$, result->malloc_pool_, T_ADMIN_SERVER, 3, $3, server_list, $6); } | -ALTER SYSTEM ADD ZONE relation_name_or_string add_or_alter_zone_options +alter_with_opt_hint SYSTEM ADD ZONE relation_name_or_string add_or_alter_zone_options { + (void)($1); ParseNode *zone_action = NULL; malloc_terminal_node(zone_action, result->malloc_pool_, T_INT); ParseNode *zone_options = NULL; @@ -16317,13 +16382,15 @@ ALTER SYSTEM ADD ZONE relation_name_or_string add_or_alter_zone_options malloc_non_terminal_node($$, result->malloc_pool_, T_ADMIN_ZONE, 3, zone_action, $5, zone_options); } | -ALTER SYSTEM zone_action ZONE relation_name_or_string +alter_with_opt_hint SYSTEM zone_action ZONE relation_name_or_string { + (void)($1); malloc_non_terminal_node($$, result->malloc_pool_, T_ADMIN_ZONE, 3, $3, $5, NULL); } | -ALTER SYSTEM alter_or_change_or_modify ZONE relation_name_or_string opt_set add_or_alter_zone_options +alter_with_opt_hint SYSTEM alter_or_change_or_modify ZONE relation_name_or_string opt_set add_or_alter_zone_options { + (void)($1); (void)($3); (void)($6); ParseNode *zone_action = NULL; @@ -16334,207 +16401,245 @@ ALTER SYSTEM alter_or_change_or_modify ZONE relation_name_or_string opt_set add_ malloc_non_terminal_node($$, result->malloc_pool_, T_ADMIN_ZONE, 3, zone_action, $5, zone_options); } | -ALTER SYSTEM REFRESH SCHEMA opt_server_or_zone +alter_with_opt_hint SYSTEM REFRESH SCHEMA opt_server_or_zone { + (void)($1); malloc_non_terminal_node($$, result->malloc_pool_, T_REFRESH_SCHEMA, 1, $5); } | -ALTER SYSTEM REFRESH MEMORY STAT opt_server_or_zone +alter_with_opt_hint SYSTEM REFRESH MEMORY STAT opt_server_or_zone { + (void)($1); malloc_non_terminal_node($$, result->malloc_pool_, T_REFRESH_MEMORY_STAT, 1, $6); } | -ALTER SYSTEM WASH MEMORY FRAGMENTATION opt_server_or_zone +alter_with_opt_hint SYSTEM WASH MEMORY FRAGMENTATION opt_server_or_zone { + (void)($1); malloc_non_terminal_node($$, result->malloc_pool_, T_WASH_MEMORY_FRAGMENTATION, 1, $6); } | -ALTER SYSTEM REFRESH IO CALIBRATION opt_storage_name opt_calibration_list opt_server_or_zone +alter_with_opt_hint SYSTEM REFRESH IO CALIBRATION opt_storage_name opt_calibration_list opt_server_or_zone { + (void)($1); malloc_non_terminal_node($$, result->malloc_pool_, T_REFRESH_IO_CALIBRATION, 3, $6, $7, $8); } | -ALTER SYSTEM opt_set alter_system_set_parameter_actions +alter_with_opt_hint SYSTEM opt_set alter_system_set_parameter_actions { + (void)($1); (void)$3; result->contain_sensitive_data_ = true; merge_nodes($$, result, T_SYTEM_ACTION_LIST, $4); malloc_non_terminal_node($$, result->malloc_pool_, T_ALTER_SYSTEM_SET_PARAMETER, 1, $$); } | -ALTER SYSTEM SET_TP alter_system_settp_actions opt_server_or_zone +alter_with_opt_hint SYSTEM SET_TP alter_system_settp_actions opt_server_or_zone { + (void)($1); merge_nodes($$, result, T_SYTEM_SETTP_LIST, $4); malloc_non_terminal_node($$, result->malloc_pool_, T_ALTER_SYSTEM_SETTP, 2, $$, $5); } | -ALTER SYSTEM CLEAR LOCATION CACHE opt_server_or_zone +alter_with_opt_hint SYSTEM CLEAR LOCATION CACHE opt_server_or_zone { + (void)($1); malloc_non_terminal_node($$, result->malloc_pool_, T_CLEAR_LOCATION_CACHE, 1, $6); } | -ALTER SYSTEM REMOVE BALANCE TASK opt_tenant_list opt_zone_list opt_balance_task_type +alter_with_opt_hint SYSTEM REMOVE BALANCE TASK opt_tenant_list opt_zone_list opt_balance_task_type { + (void)($1); malloc_non_terminal_node($$, result->malloc_pool_, T_CLEAR_BALANCE_TASK, 3, $6, $7, $8); } | -ALTER SYSTEM RELOAD GTS +alter_with_opt_hint SYSTEM RELOAD GTS { + (void)($1); malloc_terminal_node($$, result->malloc_pool_, T_RELOAD_GTS); } | -ALTER SYSTEM RELOAD UNIT +alter_with_opt_hint SYSTEM RELOAD UNIT { + (void)($1); malloc_terminal_node($$, result->malloc_pool_, T_RELOAD_UNIT); } | -ALTER SYSTEM RELOAD SERVER +alter_with_opt_hint SYSTEM RELOAD SERVER { + (void)($1); malloc_terminal_node($$, result->malloc_pool_, T_RELOAD_SERVER); } | -ALTER SYSTEM RELOAD ZONE +alter_with_opt_hint SYSTEM RELOAD ZONE { + (void)($1); malloc_terminal_node($$, result->malloc_pool_, T_RELOAD_ZONE); } | -ALTER SYSTEM MIGRATE UNIT opt_equal_mark INTNUM DESTINATION opt_equal_mark STRING_VALUE +alter_with_opt_hint SYSTEM MIGRATE UNIT opt_equal_mark INTNUM DESTINATION opt_equal_mark STRING_VALUE { + (void)($1); (void)($5); (void)($8); malloc_non_terminal_node($$, result->malloc_pool_, T_MIGRATE_UNIT, 2, $6, $9); } | -ALTER SYSTEM CANCEL MIGRATE UNIT INTNUM +alter_with_opt_hint SYSTEM CANCEL MIGRATE UNIT INTNUM { + (void)($1); malloc_non_terminal_node($$, result->malloc_pool_, T_MIGRATE_UNIT, 2, $6, NULL); } | -ALTER SYSTEM UPGRADE VIRTUAL SCHEMA +alter_with_opt_hint SYSTEM UPGRADE VIRTUAL SCHEMA { + (void)($1); malloc_terminal_node($$, result->malloc_pool_, T_UPGRADE_VIRTUAL_SCHEMA); } | -ALTER SYSTEM RUN JOB STRING_VALUE opt_server_or_zone +alter_with_opt_hint SYSTEM RUN JOB STRING_VALUE opt_server_or_zone { + (void)($1); malloc_non_terminal_node($$, result->malloc_pool_, T_RUN_JOB, 2, $5, $6); } | -ALTER SYSTEM upgrade_action UPGRADE +alter_with_opt_hint SYSTEM upgrade_action UPGRADE { + (void)($1); malloc_non_terminal_node($$, result->malloc_pool_, T_ADMIN_UPGRADE_CMD, 1, $3); } | -ALTER SYSTEM RUN UPGRADE JOB STRING_VALUE opt_tenant_list_v2 +alter_with_opt_hint SYSTEM RUN UPGRADE JOB STRING_VALUE opt_tenant_list_v2 { + (void)($1); malloc_non_terminal_node($$, result->malloc_pool_, T_ADMIN_RUN_UPGRADE_JOB, 2, $6, $7); } | -ALTER SYSTEM STOP UPGRADE JOB +alter_with_opt_hint SYSTEM STOP UPGRADE JOB { + (void)($1); malloc_terminal_node($$, result->malloc_pool_, T_ADMIN_STOP_UPGRADE_JOB); } | -ALTER SYSTEM upgrade_action ROLLING UPGRADE +alter_with_opt_hint SYSTEM upgrade_action ROLLING UPGRADE { + (void)($1); malloc_non_terminal_node($$, result->malloc_pool_, T_ADMIN_ROLLING_UPGRADE_CMD, 1, $3); } | -ALTER SYSTEM REFRESH TIME_ZONE_INFO +alter_with_opt_hint SYSTEM REFRESH TIME_ZONE_INFO { + (void)($1); malloc_terminal_node($$, result->malloc_pool_, T_REFRESH_TIME_ZONE_INFO); } | -ALTER SYSTEM ENABLE SQL THROTTLE opt_sql_throttle_for_priority opt_sql_throttle_using_cond +alter_with_opt_hint SYSTEM ENABLE SQL THROTTLE opt_sql_throttle_for_priority opt_sql_throttle_using_cond { + (void)($1); malloc_non_terminal_node($$, result->malloc_pool_, T_ENABLE_SQL_THROTTLE, 2, $6, $7); } | -ALTER SYSTEM DISABLE SQL THROTTLE +alter_with_opt_hint SYSTEM DISABLE SQL THROTTLE { + (void)($1); malloc_terminal_node($$, result->malloc_pool_, T_DISABLE_SQL_THROTTLE); } | -ALTER SYSTEM SET DISK VALID ip_port +alter_with_opt_hint SYSTEM SET DISK VALID ip_port { + (void)($1); malloc_non_terminal_node($$, result->malloc_pool_, T_SET_DISK_VALID, 1, $6); } | -ALTER SYSTEM SET NETWORK BANDWIDTH REGION relation_name_or_string TO relation_name_or_string conf_const +alter_with_opt_hint SYSTEM SET NETWORK BANDWIDTH REGION relation_name_or_string TO relation_name_or_string conf_const { + (void)($1); malloc_non_terminal_node($$, result->malloc_pool_, T_SET_REGION_NETWORK_BANDWIDTH, 3, $7, $9, $10); } | -ALTER SYSTEM ADD RESTORE SOURCE STRING_VALUE +alter_with_opt_hint SYSTEM ADD RESTORE SOURCE STRING_VALUE { + (void)($1); malloc_non_terminal_node($$, result->malloc_pool_, T_ADD_RESTORE_SOURCE, 1, $6); } | -ALTER SYSTEM CLEAR RESTORE SOURCE +alter_with_opt_hint SYSTEM CLEAR RESTORE SOURCE { + (void)($1); malloc_terminal_node($$, result->malloc_pool_, T_CLEAR_RESTORE_SOURCE); } | -ALTER SYSTEM RECOVER TABLE { result->is_for_remap_ = 1; } recover_table_list opt_recover_tenant opt_backup_dest opt_restore_until WITH STRING_VALUE opt_encrypt_key opt_backup_key_info opt_recover_remap_item_list opt_description +alter_with_opt_hint SYSTEM RECOVER TABLE { result->is_for_remap_ = 1; } recover_table_list opt_recover_tenant opt_backup_dest opt_restore_until WITH STRING_VALUE opt_encrypt_key opt_backup_key_info opt_recover_remap_item_list opt_description { + (void)($1); ParseNode *tables = NULL; merge_nodes(tables, result, T_TABLE_LIST, $6); malloc_non_terminal_node($$, result->malloc_pool_, T_RECOVER_TABLE, 9, $7, $8, $9, $11, tables, $12, $13, $14, $15); } | -ALTER SYSTEM RESTORE FROM STRING_VALUE opt_restore_until PREVIEW +alter_with_opt_hint SYSTEM RESTORE FROM STRING_VALUE opt_restore_until PREVIEW { + (void)($1); malloc_non_terminal_node($$, result->malloc_pool_, T_PHYSICAL_RESTORE_TENANT, 2, $5, $6); } | -ALTER SYSTEM RESTORE relation_name opt_backup_dest opt_restore_until WITH STRING_VALUE opt_encrypt_key opt_backup_key_info opt_description +alter_with_opt_hint SYSTEM RESTORE relation_name opt_backup_dest opt_restore_until WITH STRING_VALUE opt_encrypt_key opt_backup_key_info opt_description { + (void)($1); malloc_non_terminal_node($$, result->malloc_pool_, T_PHYSICAL_RESTORE_TENANT, 7, $4, $5, $6, $8, $9, $10, $11); } | -ALTER SYSTEM CHANGE TENANT change_tenant_name_or_tenant_id +alter_with_opt_hint SYSTEM CHANGE TENANT change_tenant_name_or_tenant_id { + (void)($1); malloc_non_terminal_node($$, result->malloc_pool_, T_CHANGE_TENANT, 1, $5); } | -ALTER SYSTEM DROP TABLES IN SESSION INTNUM +alter_with_opt_hint SYSTEM DROP TABLES IN SESSION INTNUM { + (void)($1); malloc_non_terminal_node($$, result->malloc_pool_, T_ALTER_SYSTEM_DROP_TEMP_TABLE, 1, $7); } | -ALTER SYSTEM REFRESH TABLES IN SESSION INTNUM +alter_with_opt_hint SYSTEM REFRESH TABLES IN SESSION INTNUM { + (void)($1); malloc_non_terminal_node($$, result->malloc_pool_, T_ALTER_SYSTEM_REFRESH_TEMP_TABLE, 1, $7); } | -ALTER DISKGROUP relation_name ADD DISK STRING_VALUE opt_disk_alias ip_port opt_zone_desc +alter_with_opt_hint DISKGROUP relation_name ADD DISK STRING_VALUE opt_disk_alias ip_port opt_zone_desc { + (void)($1); malloc_non_terminal_node($$, result->malloc_pool_, T_ALTER_DISKGROUP_ADD_DISK, 5, $3, $6, $7, $8, $9); } | -ALTER DISKGROUP relation_name DROP DISK STRING_VALUE ip_port opt_zone_desc +alter_with_opt_hint DISKGROUP relation_name DROP DISK STRING_VALUE ip_port opt_zone_desc { + (void)($1); malloc_non_terminal_node($$, result->malloc_pool_, T_ALTER_DISKGROUP_DROP_DISK, 4, $3, $6, $7, $8); } | -ALTER SYSTEM ARCHIVELOG opt_backup_tenant_list opt_description +alter_with_opt_hint SYSTEM ARCHIVELOG opt_backup_tenant_list opt_description { + (void)($1); ParseNode *enable = NULL; malloc_terminal_node(enable, result->malloc_pool_, T_INT); enable->value_ = 1; malloc_non_terminal_node($$, result->malloc_pool_, T_ARCHIVE_LOG, 3, enable, $4, $5); } | -ALTER SYSTEM NOARCHIVELOG opt_backup_tenant_list opt_description +alter_with_opt_hint SYSTEM NOARCHIVELOG opt_backup_tenant_list opt_description { + (void)($1); ParseNode *enable = NULL; malloc_terminal_node(enable, result->malloc_pool_, T_INT); enable->value_ = 0; malloc_non_terminal_node($$, result->malloc_pool_, T_ARCHIVE_LOG, 3, enable, $4, $5); } | -ALTER SYSTEM BACKUP DATABASE opt_backup_to opt_description +alter_with_opt_hint SYSTEM BACKUP DATABASE opt_backup_to opt_description { + (void)($1); ParseNode *incremental = NULL; malloc_terminal_node(incremental, result->malloc_pool_, T_INT); incremental->value_ = 0; @@ -16547,8 +16652,9 @@ ALTER SYSTEM BACKUP DATABASE opt_backup_to opt_description malloc_non_terminal_node($$, result->malloc_pool_, T_BACKUP_DATABASE, 5, tenant, compl_log, incremental, $5, $6); } | -ALTER SYSTEM BACKUP INCREMENTAL DATABASE opt_backup_to opt_description +alter_with_opt_hint SYSTEM BACKUP INCREMENTAL DATABASE opt_backup_to opt_description { + (void)($1); ParseNode *incremental = NULL; malloc_terminal_node(incremental, result->malloc_pool_, T_INT); incremental->value_ = 1; @@ -16562,8 +16668,9 @@ ALTER SYSTEM BACKUP INCREMENTAL DATABASE opt_backup_to opt_description malloc_non_terminal_node($$, result->malloc_pool_, T_BACKUP_DATABASE, 5, tenant, compl_log, incremental, $6, $7); } | -ALTER SYSTEM BACKUP opt_backup_tenant_list opt_backup_to opt_description +alter_with_opt_hint SYSTEM BACKUP opt_backup_tenant_list opt_backup_to opt_description { + (void)($1); ParseNode *incremental = NULL; malloc_terminal_node(incremental, result->malloc_pool_, T_INT); incremental->value_ = 0; @@ -16576,8 +16683,9 @@ ALTER SYSTEM BACKUP opt_backup_tenant_list opt_backup_to opt_description malloc_non_terminal_node($$, result->malloc_pool_, T_BACKUP_DATABASE, 6, tenant, compl_log, incremental, $4, $5, $6); } | -ALTER SYSTEM BACKUP INCREMENTAL opt_backup_tenant_list opt_backup_to opt_description +alter_with_opt_hint SYSTEM BACKUP INCREMENTAL opt_backup_tenant_list opt_backup_to opt_description { + (void)($1); ParseNode *incremental = NULL; malloc_terminal_node(incremental, result->malloc_pool_, T_INT); incremental->value_ = 1; @@ -16590,8 +16698,9 @@ ALTER SYSTEM BACKUP INCREMENTAL opt_backup_tenant_list opt_backup_to opt_descrip malloc_non_terminal_node($$, result->malloc_pool_, T_BACKUP_DATABASE, 6, tenant, compl_log, incremental, $5, $6, $7); } | -ALTER SYSTEM BACKUP DATABASE opt_backup_to PLUS ARCHIVELOG opt_description +alter_with_opt_hint SYSTEM BACKUP DATABASE opt_backup_to PLUS ARCHIVELOG opt_description { + (void)($1); ParseNode *incremental = NULL; malloc_terminal_node(incremental, result->malloc_pool_, T_INT); incremental->value_ = 0; @@ -16604,8 +16713,9 @@ ALTER SYSTEM BACKUP DATABASE opt_backup_to PLUS ARCHIVELOG opt_description malloc_non_terminal_node($$, result->malloc_pool_, T_BACKUP_DATABASE, 5, tenant, compl_log, incremental, $5, $8); } | -ALTER SYSTEM BACKUP INCREMENTAL DATABASE opt_backup_to PLUS ARCHIVELOG opt_description +alter_with_opt_hint SYSTEM BACKUP INCREMENTAL DATABASE opt_backup_to PLUS ARCHIVELOG opt_description { + (void)($1); ParseNode *incremental = NULL; malloc_terminal_node(incremental, result->malloc_pool_, T_INT); incremental->value_ = 1; @@ -16618,8 +16728,9 @@ ALTER SYSTEM BACKUP INCREMENTAL DATABASE opt_backup_to PLUS ARCHIVELOG opt_descr malloc_non_terminal_node($$, result->malloc_pool_, T_BACKUP_DATABASE, 5, tenant, compl_log, incremental, $6, $9); } | -ALTER SYSTEM BACKUP opt_backup_tenant_list opt_backup_to PLUS ARCHIVELOG opt_description +alter_with_opt_hint SYSTEM BACKUP opt_backup_tenant_list opt_backup_to PLUS ARCHIVELOG opt_description { + (void)($1); ParseNode *incremental = NULL; malloc_terminal_node(incremental, result->malloc_pool_, T_INT); incremental->value_ = 0; @@ -16632,8 +16743,9 @@ ALTER SYSTEM BACKUP opt_backup_tenant_list opt_backup_to PLUS ARCHIVELOG opt_des malloc_non_terminal_node($$, result->malloc_pool_, T_BACKUP_DATABASE, 6, tenant, compl_log, incremental, $4, $5, $8); } | -ALTER SYSTEM BACKUP INCREMENTAL opt_backup_tenant_list opt_backup_to PLUS ARCHIVELOG opt_description +alter_with_opt_hint SYSTEM BACKUP INCREMENTAL opt_backup_tenant_list opt_backup_to PLUS ARCHIVELOG opt_description { + (void)($1); ParseNode *incremental = NULL; malloc_terminal_node(incremental, result->malloc_pool_, T_INT); incremental->value_ = 1; @@ -16646,24 +16758,27 @@ ALTER SYSTEM BACKUP INCREMENTAL opt_backup_tenant_list opt_backup_to PLUS ARCHIV malloc_non_terminal_node($$, result->malloc_pool_, T_BACKUP_DATABASE, 6, tenant, compl_log, incremental, $5, $6, $9); } | -ALTER SYSTEM BACKUP KEY opt_backup_to opt_encrypt_key +alter_with_opt_hint SYSTEM BACKUP KEY opt_backup_to opt_encrypt_key { + (void)($1); ParseNode *tenant = NULL; malloc_terminal_node(tenant, result->malloc_pool_, T_INT); tenant->value_ = 0; malloc_non_terminal_node($$, result->malloc_pool_, T_BACKUP_KEY, 3, tenant, $5, $6); } | -ALTER SYSTEM BACKUP KEY tenant_list_tuple opt_backup_to opt_encrypt_key +alter_with_opt_hint SYSTEM BACKUP KEY tenant_list_tuple opt_backup_to opt_encrypt_key { + (void)($1); ParseNode *tenant = NULL; malloc_terminal_node(tenant, result->malloc_pool_, T_INT); tenant->value_ = 1; malloc_non_terminal_node($$, result->malloc_pool_, T_BACKUP_KEY, 4, tenant, $5, $6, $7); } | -ALTER SYSTEM CANCEL BACKUP opt_backup_tenant_list +alter_with_opt_hint SYSTEM CANCEL BACKUP opt_backup_tenant_list { + (void)($1); ParseNode *type = NULL; malloc_terminal_node(type, result->malloc_pool_, T_INT); type->value_ = 0; @@ -16679,18 +16794,21 @@ ALTER SYSTEM CANCEL BACKUP opt_backup_tenant_list malloc_non_terminal_node($$, result->malloc_pool_, T_BACKUP_MANAGE, 4, type, value, tenant, $5); } | -ALTER SYSTEM CANCEL RESTORE relation_name +alter_with_opt_hint SYSTEM CANCEL RESTORE relation_name { + (void)($1); malloc_non_terminal_node($$, result->malloc_pool_, T_CANCEL_RESTORE, 1, $5); } | -ALTER SYSTEM CANCEL RECOVER TABLE relation_name +alter_with_opt_hint SYSTEM CANCEL RECOVER TABLE relation_name { + (void)($1); malloc_non_terminal_node($$, result->malloc_pool_, T_CANCEL_RECOVER_TABLE, 1, $6); } | -ALTER SYSTEM SUSPEND BACKUP +alter_with_opt_hint SYSTEM SUSPEND BACKUP { + (void)($1); ParseNode *type = NULL; malloc_terminal_node(type, result->malloc_pool_, T_INT); type->value_ = 1; @@ -16702,8 +16820,9 @@ ALTER SYSTEM SUSPEND BACKUP malloc_non_terminal_node($$, result->malloc_pool_, T_BACKUP_MANAGE, 2, type, value); } | -ALTER SYSTEM RESUME BACKUP +alter_with_opt_hint SYSTEM RESUME BACKUP { + (void)($1); ParseNode *type = NULL; malloc_terminal_node(type, result->malloc_pool_, T_INT); type->value_ = 2; @@ -16715,40 +16834,45 @@ ALTER SYSTEM RESUME BACKUP malloc_non_terminal_node($$, result->malloc_pool_, T_BACKUP_MANAGE, 2, type, value); } | -ALTER SYSTEM TRIGGER TTL opt_tenant_list_v2 +alter_with_opt_hint SYSTEM TRIGGER TTL opt_tenant_list_v2 { + (void)($1); ParseNode *type = NULL; malloc_terminal_node(type, result->malloc_pool_, T_INT); type->value_ = 0; malloc_non_terminal_node($$, result->malloc_pool_, T_TABLE_TTL, 2, type, $5); } | -ALTER SYSTEM SUSPEND TTL opt_tenant_list_v2 +alter_with_opt_hint SYSTEM SUSPEND TTL opt_tenant_list_v2 { + (void)($1); ParseNode *type = NULL; malloc_terminal_node(type, result->malloc_pool_, T_INT); type->value_ = 1; malloc_non_terminal_node($$, result->malloc_pool_, T_TABLE_TTL, 2, type, $5); } | -ALTER SYSTEM RESUME TTL opt_tenant_list_v2 +alter_with_opt_hint SYSTEM RESUME TTL opt_tenant_list_v2 { + (void)($1); ParseNode *type = NULL; malloc_terminal_node(type, result->malloc_pool_, T_INT); type->value_ = 2; malloc_non_terminal_node($$, result->malloc_pool_, T_TABLE_TTL, 2, type, $5); } | -ALTER SYSTEM CANCEL TTL opt_tenant_list_v2 +alter_with_opt_hint SYSTEM CANCEL TTL opt_tenant_list_v2 { + (void)($1); ParseNode *type = NULL; malloc_terminal_node(type, result->malloc_pool_, T_INT); type->value_ = 3; malloc_non_terminal_node($$, result->malloc_pool_, T_TABLE_TTL, 2, type, $5); } | -ALTER SYSTEM VALIDATE DATABASE opt_copy_id +alter_with_opt_hint SYSTEM VALIDATE DATABASE opt_copy_id { + (void)($1); ParseNode *type = NULL; malloc_terminal_node(type, result->malloc_pool_, T_INT); type->value_ = 5; @@ -16760,8 +16884,9 @@ ALTER SYSTEM VALIDATE DATABASE opt_copy_id malloc_non_terminal_node($$, result->malloc_pool_, T_BACKUP_MANAGE, 3, type, value, $5); } | -ALTER SYSTEM VALIDATE BACKUPSET INTNUM opt_copy_id +alter_with_opt_hint SYSTEM VALIDATE BACKUPSET INTNUM opt_copy_id { + (void)($1); ParseNode *type = NULL; malloc_terminal_node(type, result->malloc_pool_, T_INT); type->value_ = 6; @@ -16773,8 +16898,9 @@ ALTER SYSTEM VALIDATE BACKUPSET INTNUM opt_copy_id malloc_non_terminal_node($$, result->malloc_pool_, T_BACKUP_MANAGE, 3, type, value, $6); } | -ALTER SYSTEM CANCEL VALIDATE INTNUM opt_copy_id +alter_with_opt_hint SYSTEM CANCEL VALIDATE INTNUM opt_copy_id { + (void)($1); ParseNode *type = NULL; malloc_terminal_node(type, result->malloc_pool_, T_INT); type->value_ = 7; @@ -16786,8 +16912,9 @@ ALTER SYSTEM CANCEL VALIDATE INTNUM opt_copy_id malloc_non_terminal_node($$, result->malloc_pool_, T_BACKUP_MANAGE, 3, type, value, $6); } | -ALTER SYSTEM CANCEL BACKUP BACKUPSET +alter_with_opt_hint SYSTEM CANCEL BACKUP BACKUPSET { + (void)($1); ParseNode *type = NULL; malloc_terminal_node(type, result->malloc_pool_, T_INT); type->value_ = 9; @@ -16797,8 +16924,9 @@ ALTER SYSTEM CANCEL BACKUP BACKUPSET malloc_non_terminal_node($$, result->malloc_pool_, T_BACKUP_MANAGE, 2, type, value); } | -ALTER SYSTEM CANCEL BACKUP BACKUPPIECE +alter_with_opt_hint SYSTEM CANCEL BACKUP BACKUPPIECE { + (void)($1); ParseNode *type = NULL; malloc_terminal_node(type, result->malloc_pool_, T_INT); type->value_ = 13; @@ -16808,8 +16936,9 @@ ALTER SYSTEM CANCEL BACKUP BACKUPPIECE malloc_non_terminal_node($$, result->malloc_pool_, T_BACKUP_MANAGE, 2, type, value); } | -ALTER SYSTEM CANCEL ALL BACKUP FORCE +alter_with_opt_hint SYSTEM CANCEL ALL BACKUP FORCE { + (void)($1); ParseNode *type = NULL; malloc_terminal_node(type, result->malloc_pool_, T_INT); type->value_ = 15; @@ -16819,8 +16948,9 @@ ALTER SYSTEM CANCEL ALL BACKUP FORCE malloc_non_terminal_node($$, result->malloc_pool_, T_BACKUP_MANAGE, 2, type, value); } | -ALTER SYSTEM DELETE BACKUPSET INTNUM opt_copy_id opt_backup_tenant_list opt_description +alter_with_opt_hint SYSTEM DELETE BACKUPSET INTNUM opt_copy_id opt_backup_tenant_list opt_description { + (void)($1); ParseNode *type = NULL; malloc_terminal_node(type, result->malloc_pool_, T_INT); type->value_ = 1; @@ -16832,8 +16962,9 @@ ALTER SYSTEM DELETE BACKUPSET INTNUM opt_copy_id opt_backup_tenant_list opt_desc malloc_non_terminal_node($$, result->malloc_pool_, T_BACKUP_CLEAN, 5, type, value, $8, $6, $7); } | -ALTER SYSTEM DELETE BACKUPPIECE INTNUM opt_copy_id opt_backup_tenant_list opt_description +alter_with_opt_hint SYSTEM DELETE BACKUPPIECE INTNUM opt_copy_id opt_backup_tenant_list opt_description { + (void)($1); ParseNode *type = NULL; malloc_terminal_node(type, result->malloc_pool_, T_INT); type->value_ = 2; @@ -16845,8 +16976,9 @@ ALTER SYSTEM DELETE BACKUPPIECE INTNUM opt_copy_id opt_backup_tenant_list opt_de malloc_non_terminal_node($$, result->malloc_pool_, T_BACKUP_CLEAN, 5, type, value, $8, $6, $7); } | -ALTER SYSTEM DELETE OBSOLETE BACKUP opt_backup_tenant_list opt_description +alter_with_opt_hint SYSTEM DELETE OBSOLETE BACKUP opt_backup_tenant_list opt_description { + (void)($1); ParseNode *type = NULL; malloc_terminal_node(type, result->malloc_pool_, T_INT); type->value_ = 4; @@ -16857,8 +16989,9 @@ ALTER SYSTEM DELETE OBSOLETE BACKUP opt_backup_tenant_list opt_description malloc_non_terminal_node($$, result->malloc_pool_, T_BACKUP_CLEAN, 4, type, value, $7, $6); } | -ALTER SYSTEM CANCEL DELETE BACKUP opt_backup_tenant_list opt_description +alter_with_opt_hint SYSTEM CANCEL DELETE BACKUP opt_backup_tenant_list opt_description { + (void)($1); ParseNode *type = NULL; malloc_terminal_node(type, result->malloc_pool_, T_INT); type->value_ = 6; @@ -16869,24 +17002,27 @@ ALTER SYSTEM CANCEL DELETE BACKUP opt_backup_tenant_list opt_description malloc_non_terminal_node($$, result->malloc_pool_, T_BACKUP_CLEAN, 4, type, value, $7, $6); } | -ALTER SYSTEM ADD DELETE BACKUP policy_name opt_recovery_window opt_redundancy opt_backup_copies opt_backup_tenant_list +alter_with_opt_hint SYSTEM ADD DELETE BACKUP policy_name opt_recovery_window opt_redundancy opt_backup_copies opt_backup_tenant_list { + (void)($1); ParseNode *type = NULL; malloc_terminal_node(type, result->malloc_pool_, T_INT); type->value_ = 0; malloc_non_terminal_node($$, result->malloc_pool_, T_DELETE_POLICY, 6, type, $10, $6, $7, $8, $9); } | -ALTER SYSTEM DROP DELETE BACKUP policy_name opt_backup_tenant_list +alter_with_opt_hint SYSTEM DROP DELETE BACKUP policy_name opt_backup_tenant_list { + (void)($1); ParseNode *type = NULL; malloc_terminal_node(type, result->malloc_pool_, T_INT); type->value_ = 1; malloc_non_terminal_node($$, result->malloc_pool_, T_DELETE_POLICY, 3, type, $7, $6); } | -ALTER SYSTEM BACKUP BACKUPSET ALL opt_tenant_info opt_backup_backup_dest +alter_with_opt_hint SYSTEM BACKUP BACKUPSET ALL opt_tenant_info opt_backup_backup_dest { + (void)($1); ParseNode *backup_set_id = NULL; malloc_terminal_node(backup_set_id, result->malloc_pool_, T_INT); backup_set_id->value_ = 0; @@ -16898,8 +17034,9 @@ ALTER SYSTEM BACKUP BACKUPSET ALL opt_tenant_info opt_backup_backup_dest malloc_non_terminal_node($$, result->malloc_pool_, T_BACKUP_BACKUPSET, 4, backup_set_id, $6, $7, max_backup_times); } | -ALTER SYSTEM BACKUP BACKUPSET opt_equal_mark INTNUM opt_tenant_info opt_backup_backup_dest +alter_with_opt_hint SYSTEM BACKUP BACKUPSET opt_equal_mark INTNUM opt_tenant_info opt_backup_backup_dest { + (void)($1); (void)($5); ParseNode *backup_set_id= NULL; malloc_terminal_node(backup_set_id, result->malloc_pool_, T_INT); @@ -16912,8 +17049,9 @@ ALTER SYSTEM BACKUP BACKUPSET opt_equal_mark INTNUM opt_tenant_info opt_backup_b malloc_non_terminal_node($$, result->malloc_pool_, T_BACKUP_BACKUPSET, 4, backup_set_id, $7, $8, max_backup_times); } | -ALTER SYSTEM BACKUP BACKUPSET ALL NOT BACKED UP INTNUM TIMES opt_tenant_info opt_backup_backup_dest +alter_with_opt_hint SYSTEM BACKUP BACKUPSET ALL NOT BACKED UP INTNUM TIMES opt_tenant_info opt_backup_backup_dest { + (void)($1); ParseNode *backup_set_id = NULL; malloc_terminal_node(backup_set_id, result->malloc_pool_, T_INT); backup_set_id->value_ = 0; @@ -16925,24 +17063,27 @@ ALTER SYSTEM BACKUP BACKUPSET ALL NOT BACKED UP INTNUM TIMES opt_tenant_info opt malloc_non_terminal_node($$, result->malloc_pool_, T_BACKUP_BACKUPSET, 4, backup_set_id, $11, $12, max_backup_times); } | -ALTER SYSTEM START BACKUP ARCHIVELOG +alter_with_opt_hint SYSTEM START BACKUP ARCHIVELOG { + (void)($1); ParseNode *enable = NULL; malloc_terminal_node(enable, result->malloc_pool_, T_INT); enable->value_ = 1; malloc_non_terminal_node($$, result->malloc_pool_, T_BACKUP_ARCHIVELOG, 1, enable); } | -ALTER SYSTEM STOP BACKUP ARCHIVELOG +alter_with_opt_hint SYSTEM STOP BACKUP ARCHIVELOG { + (void)($1); ParseNode *enable = NULL; malloc_terminal_node(enable, result->malloc_pool_, T_INT); enable->value_ = 0; malloc_non_terminal_node($$, result->malloc_pool_, T_BACKUP_ARCHIVELOG, 1, enable); } | -ALTER SYSTEM BACKUP BACKUPPIECE ALL opt_with_active_piece opt_tenant_info opt_backup_backup_dest +alter_with_opt_hint SYSTEM BACKUP BACKUPPIECE ALL opt_with_active_piece opt_tenant_info opt_backup_backup_dest { + (void)($1); ParseNode *piece_id = NULL; malloc_terminal_node(piece_id, result->malloc_pool_, T_INT); piece_id->value_ = 0; @@ -16962,8 +17103,9 @@ ALTER SYSTEM BACKUP BACKUPPIECE ALL opt_with_active_piece opt_tenant_info opt_ba malloc_non_terminal_node($$, result->malloc_pool_, T_BACKUP_BACKUPPIECE, 7, piece_id, backup_all, backup_times, $6, $7, $8, type); } | -ALTER SYSTEM BACKUP BACKUPPIECE opt_equal_mark INTNUM opt_with_active_piece opt_tenant_info opt_backup_backup_dest +alter_with_opt_hint SYSTEM BACKUP BACKUPPIECE opt_equal_mark INTNUM opt_with_active_piece opt_tenant_info opt_backup_backup_dest { + (void)($1); ParseNode *piece_id = NULL; malloc_terminal_node(piece_id, result->malloc_pool_, T_INT); piece_id->value_ = $6->value_; @@ -16984,8 +17126,9 @@ ALTER SYSTEM BACKUP BACKUPPIECE opt_equal_mark INTNUM opt_with_active_piece opt_ malloc_non_terminal_node($$, result->malloc_pool_, T_BACKUP_BACKUPPIECE, 7, piece_id, backup_all, backup_times, $7, $8, $9, type); } | -ALTER SYSTEM BACKUP BACKUPPIECE ALL NOT BACKED UP INTNUM TIMES opt_with_active_piece opt_tenant_info opt_backup_backup_dest +alter_with_opt_hint SYSTEM BACKUP BACKUPPIECE ALL NOT BACKED UP INTNUM TIMES opt_with_active_piece opt_tenant_info opt_backup_backup_dest { + (void)($1); ParseNode *piece_id = NULL; malloc_terminal_node(piece_id, result->malloc_pool_, T_INT); piece_id->value_ = 0; @@ -17022,14 +17165,16 @@ SET DECRYPTION IDENTIFIED BY string_list malloc_non_terminal_node($$, result->malloc_pool_, T_BACKUP_SET_DECRYPTION, 1, string_list_node); } | -ALTER SYSTEM RESET alter_system_reset_parameter_actions +alter_with_opt_hint SYSTEM RESET alter_system_reset_parameter_actions { + (void)($1); (void)$3; merge_nodes($$, result, T_SYTEM_ACTION_LIST, $4); malloc_non_terminal_node($$, result->malloc_pool_, T_ALTER_SYSTEM_RESET_PARAMETER, 1, $$); } -| ALTER SYSTEM CANCEL CLONE relation_name +| alter_with_opt_hint SYSTEM CANCEL CLONE relation_name { + (void)($1); malloc_non_terminal_node($$, result->malloc_pool_, T_CANCEL_CLONE, 1, $5); } ; @@ -17828,8 +17973,9 @@ add_or_alter_zone_option ; alter_or_change_or_modify: -ALTER +alter_with_opt_hint { + (void)($1); $$ = NULL; } | CHANGE @@ -18731,8 +18877,9 @@ RELEASE SAVEPOINT var_name *===========================================================*/ switchover_tenant_stmt: -ALTER SYSTEM switchover_clause opt_verify +alter_with_opt_hint SYSTEM switchover_clause opt_verify { + (void)($1); (void)($2); malloc_non_terminal_node($$, result->malloc_pool_, T_SWITCHOVER, 2, $3, $4); } @@ -18762,8 +18909,9 @@ VERIFY ; recover_tenant_stmt: -ALTER SYSTEM RECOVER STANDBY opt_tenant_name recover_point_clause +alter_with_opt_hint SYSTEM RECOVER STANDBY opt_tenant_name recover_point_clause { + (void)($1); malloc_non_terminal_node($$, result->malloc_pool_, T_RECOVER, 2, $5, $6); } ; diff --git a/src/sql/resolver/ddl/ob_alter_table_resolver.cpp b/src/sql/resolver/ddl/ob_alter_table_resolver.cpp index 52b4ce3920..efadf10c70 100644 --- a/src/sql/resolver/ddl/ob_alter_table_resolver.cpp +++ b/src/sql/resolver/ddl/ob_alter_table_resolver.cpp @@ -359,7 +359,7 @@ int ObAlterTableResolver::resolve(const ParseNode &parse_tree) } } if (OB_SUCC(ret)) { - if (OB_FAIL(resolve_hints(nullptr/*do not use parallel hint in alter table*/, + if (OB_FAIL(resolve_hints(parse_tree.children_[ALTER_HINT], *alter_table_stmt, nullptr == index_schema_ ? *table_schema_ : *index_schema_))) { LOG_WARN("resolve hints failed", K(ret)); } diff --git a/src/sql/resolver/ddl/ob_alter_table_resolver.h b/src/sql/resolver/ddl/ob_alter_table_resolver.h index d4f2d85d73..ca770d1f45 100644 --- a/src/sql/resolver/ddl/ob_alter_table_resolver.h +++ b/src/sql/resolver/ddl/ob_alter_table_resolver.h @@ -36,10 +36,11 @@ typedef common::hash::ObPlacementHashSetvalue_; } - } else if (T_OPT_PARAM_HINT == hint_node->type_) { - ParseNode *child0 = nullptr; - ParseNode *child1 = nullptr; - if (2 != hint_node->num_child_) { - ret = OB_ERR_UNEXPECTED; - // do not raise error, but print a message - LOG_WARN("the opt param hint is illegal", K(ret)); - } else if (OB_ISNULL(child0 = hint_node->children_[0]) || OB_ISNULL(child1 = hint_node->children_[1])) { - ret = OB_ERR_UNEXPECTED; - LOG_WARN("get unexpected null pointer"); - } else if (child0->type_ == T_VARCHAR){ - ObString param_name(child0->str_len_, child0->str_value_); - ObOptParamHint::OptParamType param_type = ObOptParamHint::get_opt_param_value(param_name); - uint64_t data_version = 0; - if (OB_FAIL(GET_MIN_DATA_VERSION(session_info_->get_effective_tenant_id(), data_version))) { - SQL_RESV_LOG(WARN, "fail to get min data version", K(ret)); - } else if (param_type == ObOptParamHint::OptParamType::COMPACT_SORT_LEVEL - && data_version >= DATA_VERSION_4_3_0_0) { - if (T_INT != child1->type_) { - // do not raise error, but print a message - LOG_WARN("the second param is not int"); - } else { - ObObj val; - val.set_int(child1->value_); - if (ObOptParamHint::is_param_val_valid(param_type, val)) { - stmt.set_compact_level(child1->value_); - } - } - } else { - } - } } } } diff --git a/src/sql/resolver/ddl/ob_ddl_stmt.h b/src/sql/resolver/ddl/ob_ddl_stmt.h index 09c111ae68..600a6b8ea4 100644 --- a/src/sql/resolver/ddl/ob_ddl_stmt.h +++ b/src/sql/resolver/ddl/ob_ddl_stmt.h @@ -25,7 +25,7 @@ class ObDDLStmt : public ObStmt, public ObICmd const static int OB_DEFAULT_ARRAY_SIZE = 16; public: ObDDLStmt(common::ObIAllocator *name_pool, stmt::StmtType type) - : ObStmt(name_pool, type), parallelism_(1L), compact_level_(share::SORT_COMPACT_LEVEL) + : ObStmt(name_pool, type), parallelism_(1L) { } explicit ObDDLStmt(stmt::StmtType type): ObStmt(type) @@ -46,15 +46,10 @@ public: virtual int get_first_stmt(common::ObString &first_stmt); void set_parallelism(const int64_t parallelism) { parallelism_ = parallelism; } int64_t &get_parallelism() { return parallelism_; } - void set_compact_level(int64_t compact_level) { - compact_level_ = static_cast(compact_level); - }; - share::SortCompactLevel get_compact_level() { return compact_level_; } protected: ObArenaAllocator allocator_; private: int64_t parallelism_; - share::SortCompactLevel compact_level_; DISALLOW_COPY_AND_ASSIGN(ObDDLStmt); }; diff --git a/src/sql/resolver/dml/ob_hint.cpp b/src/sql/resolver/dml/ob_hint.cpp index 843da780ff..164e7925c9 100644 --- a/src/sql/resolver/dml/ob_hint.cpp +++ b/src/sql/resolver/dml/ob_hint.cpp @@ -772,10 +772,6 @@ bool ObOptParamHint::is_param_val_valid(const OptParamType param_type, const ObO || 0 == val.get_varchar().case_compare("false")); break; } - case COMPACT_SORT_LEVEL: { - is_valid = val.is_int() && (val.get_int() >= 0 && val.get_int() <=5); - break; - } case WORKAREA_SIZE_POLICY: { is_valid = val.is_varchar() && (0 == val.get_varchar().case_compare("MANULE")); break; diff --git a/src/sql/resolver/dml/ob_hint.h b/src/sql/resolver/dml/ob_hint.h index c21f210c58..e82c4f330a 100644 --- a/src/sql/resolver/dml/ob_hint.h +++ b/src/sql/resolver/dml/ob_hint.h @@ -105,7 +105,6 @@ struct ObOptParamHint DEF(USE_DEFAULT_OPT_STAT,) \ DEF(ENABLE_IN_RANGE_OPTIMIZATION,) \ DEF(XSOLAPI_GENERATE_WITH_CLAUSE,) \ - DEF(COMPACT_SORT_LEVEL,) \ DEF(WORKAREA_SIZE_POLICY,) \ DEF(ENABLE_RICH_VECTOR_FORMAT,) \ DEF(_ENABLE_STORAGE_CARDINALITY_ESTIMATION,) \ diff --git a/src/storage/ddl/ob_direct_insert_sstable_ctx_new.cpp b/src/storage/ddl/ob_direct_insert_sstable_ctx_new.cpp index 8ab5051302..c316552be4 100644 --- a/src/storage/ddl/ob_direct_insert_sstable_ctx_new.cpp +++ b/src/storage/ddl/ob_direct_insert_sstable_ctx_new.cpp @@ -1222,7 +1222,8 @@ int ObTabletDirectLoadMgr::open_sstable_slice( } else if (OB_UNLIKELY(!is_valid())) { ret = OB_ERR_UNEXPECTED; LOG_WARN("unexpected err", K(ret), KPC(this)); - } else if (OB_FAIL(prepare_schema_item_on_demand(sqc_build_ctx_.build_param_.runtime_only_param_.table_id_))) { + } else if (OB_FAIL(prepare_schema_item_on_demand(sqc_build_ctx_.build_param_.runtime_only_param_.table_id_, + sqc_build_ctx_.build_param_.runtime_only_param_.parallel_))) { LOG_WARN("prepare table schema item on demand", K(ret), K(sqc_build_ctx_.build_param_)); } else { ObDirectLoadSliceWriter *slice_writer = nullptr; @@ -1247,7 +1248,8 @@ int ObTabletDirectLoadMgr::open_sstable_slice( return ret; } -int ObTabletDirectLoadMgr::prepare_schema_item_on_demand(const uint64_t table_id) +int ObTabletDirectLoadMgr::prepare_schema_item_on_demand(const uint64_t table_id, + const int64_t parallel) { int ret = OB_SUCCESS; bool is_schema_item_ready = ATOMIC_LOAD(&is_schema_item_ready_); @@ -1314,19 +1316,6 @@ int ObTabletDirectLoadMgr::prepare_schema_item_on_demand(const uint64_t table_id } } } - if (OB_SUCC(ret)) { - // get compress type - uint64_t tenant_id = table_schema->get_tenant_id(); - omt::ObTenantConfigGuard tenant_config(TENANT_CONF(tenant_id)); - if (OB_UNLIKELY(!tenant_config.is_valid())) { - //tenant config获取失败时,租户不存在;返回默认值 - ret = OB_ERR_UNEXPECTED; - LOG_WARN("fail get tenant_config", K(ret), K(tenant_id)); - } else if (tenant_config->enable_store_compression) { - schema_item_.compress_type_ = table_schema->get_compressor_type(); - } - LOG_INFO("load compress type is:", K(schema_item_.compress_type_), K(tenant_config->enable_store_compression)); - } } if (OB_SUCC(ret)) { is_schema_item_ready_ = true; @@ -1378,7 +1367,8 @@ int ObTabletDirectLoadMgr::fill_sstable_slice( ret = OB_ERR_UNEXPECTED; LOG_WARN("unexpected err", K(ret), K(slice_info), K(is_schema_item_ready_)); } else if (OB_FAIL(slice_writer->fill_sstable_slice(start_scn, sqc_build_ctx_.build_param_.runtime_only_param_.table_id_, tablet_id_, - tablet_handle_, iter, schema_item_, direct_load_type_, column_items_, dir_id_, affected_rows, insert_monitor))) { + tablet_handle_, iter, schema_item_, direct_load_type_, column_items_, dir_id_, + sqc_build_ctx_.build_param_.runtime_only_param_.parallel_, affected_rows, insert_monitor))) { LOG_WARN("fill sstable slice failed", K(ret), KPC(this)); } } diff --git a/src/storage/ddl/ob_direct_insert_sstable_ctx_new.h b/src/storage/ddl/ob_direct_insert_sstable_ctx_new.h index 30d60b690f..f06f1df305 100644 --- a/src/storage/ddl/ob_direct_insert_sstable_ctx_new.h +++ b/src/storage/ddl/ob_direct_insert_sstable_ctx_new.h @@ -29,6 +29,7 @@ #include "storage/ddl/ob_direct_load_struct.h" #include "storage/meta_mem/ob_tablet_pointer.h" #include "storage/tablet/ob_tablet_meta.h" +#include "src/share/ob_ddl_common.h" namespace oceanbase { @@ -374,7 +375,8 @@ public: K_(direct_load_type), K_(sqc_build_ctx), KPC(lob_mgr_handle_.get_obj()), K_(schema_item), K_(column_items), K_(lob_column_idxs)); private: - int prepare_schema_item_on_demand(const uint64_t table_id); + int prepare_schema_item_on_demand(const uint64_t table_id, + const int64_t parallel); void calc_cg_idx(const int64_t thread_cnt, const int64_t thread_id, int64_t &strat_idx, int64_t &end_idx); int fill_aggregated_column_group( const int64_t start_idx, diff --git a/src/storage/ddl/ob_direct_load_struct.cpp b/src/storage/ddl/ob_direct_load_struct.cpp index f75a4a1518..b6a3e8aa1f 100644 --- a/src/storage/ddl/ob_direct_load_struct.cpp +++ b/src/storage/ddl/ob_direct_load_struct.cpp @@ -357,7 +357,8 @@ ObTabletDDLParam::~ObTabletDDLParam() } int ObChunkSliceStore::init(const int64_t rowkey_column_count, ObTabletHandle &tablet_handle, - ObArenaAllocator &allocator, const ObIArray &col_array, const int64_t dir_id) + ObArenaAllocator &allocator, const ObIArray &col_array, const int64_t dir_id, + const int64_t parallelism) { int ret = OB_SUCCESS; if (OB_UNLIKELY(is_inited_)) { @@ -366,7 +367,7 @@ int ObChunkSliceStore::init(const int64_t rowkey_column_count, ObTabletHandle &t } else if (OB_UNLIKELY(rowkey_column_count <= 0)) { ret = OB_INVALID_ARGUMENT; LOG_WARN("invalida argument", K(ret), K(rowkey_column_count)); - } else if (OB_FAIL(prepare_datum_stores(MTL_ID(), tablet_handle, allocator, col_array, dir_id))) { + } else if (OB_FAIL(prepare_datum_stores(MTL_ID(), tablet_handle, allocator, col_array, dir_id, parallelism))) { LOG_WARN("fail to prepare datum stores"); } else { arena_allocator_ = &allocator; @@ -404,7 +405,8 @@ int64_t ObChunkSliceStore::calc_chunk_limit(const ObStorageColumnGroupSchema &cg return ((cg_schema.column_cnt_ / basic_column_cnt) + 1) * basic_chunk_memory_limit; } -int ObChunkSliceStore::prepare_datum_stores(const uint64_t tenant_id, ObTabletHandle &tablet_handle, ObIAllocator &allocator, const ObIArray &col_array, const int64_t dir_id) +int ObChunkSliceStore::prepare_datum_stores(const uint64_t tenant_id, ObTabletHandle &tablet_handle, ObIAllocator &allocator, + const ObIArray &col_array, const int64_t dir_id, const int64_t parallelism) { int ret = OB_SUCCESS; const int64_t chunk_mem_limit = 64 * 1024L; // 64K @@ -427,6 +429,11 @@ int ObChunkSliceStore::prepare_datum_stores(const uint64_t tenant_id, ObTabletHa const ObStorageColumnGroupSchema &cur_cg_schema = cg_schemas.at(i); ObCompressorType compressor_type = cur_cg_schema.compressor_type_; compressor_type = NONE_COMPRESSOR == compressor_type ? (CS_ENCODING_ROW_STORE == cur_cg_schema.row_store_type_ ? ZSTD_1_3_8_COMPRESSOR : NONE_COMPRESSOR) : compressor_type; + if (OB_FAIL(ObDDLUtil::get_temp_store_compress_type(compressor_type, + parallelism, + compressor_type))) { + LOG_WARN("fail to get temp store compress type", K(ret)); + } if (cur_cg_schema.is_rowkey_column_group() || cur_cg_schema.is_all_column_group()) { target_store_idx_ = i; } @@ -450,7 +457,6 @@ int ObChunkSliceStore::prepare_datum_stores(const uint64_t tenant_id, ObTabletHa if (OB_FAIL(ret)) { } else if (OB_FAIL(datum_store->init(chunk_mem_limit, cur_column_items, tenant_id, ObCtxIds::DEFAULT_CTX_ID, "DL_SLICE_STORE", true/*enable_dump*/, 0, false/*disable truncate*/, - compressor_type == NONE_COMPRESSOR ? SORT_COMPACT_LEVEL : SORT_COMPRESSION_COMPACT_LEVEL, compressor_type))) { LOG_WARN("failed to init chunk datum store", K(ret)); } else { @@ -677,6 +683,7 @@ int ObDirectLoadSliceWriter::prepare_slice_store_if_need( const int64_t schema_rowkey_column_num, const bool is_column_store, const int64_t dir_id, + const int64_t parallelism, ObTabletHandle &tablet_handle, const SCN &start_scn) { @@ -696,7 +703,8 @@ int ObDirectLoadSliceWriter::prepare_slice_store_if_need( } else if (OB_ISNULL(chunk_slice_store = OB_NEWx(ObChunkSliceStore, &allocator_))) { ret = OB_ALLOCATE_MEMORY_FAILED; LOG_WARN("allocate memory for chunk slice store failed", K(ret)); - } else if (OB_FAIL(chunk_slice_store->init(schema_rowkey_column_num + ObMultiVersionRowkeyHelpper::get_extra_rowkey_col_cnt(), tablet_handle, allocator_, tablet_direct_load_mgr_->get_column_info(), dir_id))) { + } else if (OB_FAIL(chunk_slice_store->init(schema_rowkey_column_num + ObMultiVersionRowkeyHelpper::get_extra_rowkey_col_cnt(), + tablet_handle, allocator_, tablet_direct_load_mgr_->get_column_info(), dir_id, parallelism))) { LOG_WARN("init chunk slice store failed", K(ret)); } else { slice_store_ = chunk_slice_store; @@ -911,7 +919,7 @@ int ObDirectLoadSliceWriter::fill_lob_into_macro_block( } else if (OB_FAIL(check_null(false/*is_index_table*/, ObLobMetaUtil::LOB_META_SCHEMA_ROWKEY_COL_CNT, *cur_row))) { LOG_WARN("fail to check null value in row", KR(ret), KPC(cur_row)); } else if (OB_FAIL(prepare_slice_store_if_need(ObLobMetaUtil::LOB_META_SCHEMA_ROWKEY_COL_CNT, - false/*is_column_store*/, 1L/*unsued*/, unused_tablet_handle, start_scn))) { + false/*is_column_store*/, 1L/*unsued*/, 1L/*unused*/, unused_tablet_handle, start_scn))) { LOG_WARN("prepare macro block writer failed", K(ret)); } else if (OB_FAIL(slice_store_->append_row(*cur_row))) { LOG_WARN("macro block writer append row failed", K(ret), KPC(cur_row)); @@ -946,6 +954,7 @@ int ObDirectLoadSliceWriter::fill_sstable_slice( const ObDirectLoadType &direct_load_type, const ObArray &column_items, const int64_t dir_id, + const int64_t parallelism, int64_t &affected_rows, ObInsertMonitor *insert_monitor) { @@ -996,7 +1005,7 @@ int ObDirectLoadSliceWriter::fill_sstable_slice( if (OB_FAIL(ret)) { } else if (OB_FAIL(check_null(schema_item.is_index_table_, schema_item.rowkey_column_num_, *cur_row))) { LOG_WARN("fail to check null value in row", KR(ret), KPC(cur_row)); - } else if (OB_FAIL(prepare_slice_store_if_need(schema_item.rowkey_column_num_, schema_item.is_column_store_, dir_id, tablet_handle, start_scn))) { + } else if (OB_FAIL(prepare_slice_store_if_need(schema_item.rowkey_column_num_, schema_item.is_column_store_, dir_id, parallelism, tablet_handle, start_scn))) { LOG_WARN("prepare macro block writer failed", K(ret)); } else if (OB_FAIL(slice_store_->append_row(*cur_row))) { if (is_full_direct_load_task && OB_ERR_PRIMARY_KEY_DUPLICATE == ret && schema_item.is_unique_index_) { diff --git a/src/storage/ddl/ob_direct_load_struct.h b/src/storage/ddl/ob_direct_load_struct.h index 7247ca4c1f..0cc06e34d8 100644 --- a/src/storage/ddl/ob_direct_load_struct.h +++ b/src/storage/ddl/ob_direct_load_struct.h @@ -217,11 +217,11 @@ struct ObDirectInsertRuntimeOnlyParam final { public: ObDirectInsertRuntimeOnlyParam() - : exec_ctx_(nullptr), task_id_(0), table_id_(OB_INVALID_ID), schema_version_(0), task_cnt_(0), need_online_opt_stat_gather_(false), trans_id_(), seq_no_(0) + : exec_ctx_(nullptr), task_id_(0), table_id_(OB_INVALID_ID), schema_version_(0), task_cnt_(0), need_online_opt_stat_gather_(false), trans_id_(), seq_no_(0), parallel_(1) {} ~ObDirectInsertRuntimeOnlyParam() = default; bool is_valid() const { return OB_INVALID_ID != task_id_ && OB_INVALID_ID != table_id_ && schema_version_ > 0 && task_cnt_ >= 0; } - TO_STRING_KV(KP_(exec_ctx), K_(task_id), K_(table_id), K_(schema_version), K_(task_cnt), K_(need_online_opt_stat_gather), K_(trans_id), K_(seq_no)); + TO_STRING_KV(KP_(exec_ctx), K_(task_id), K_(table_id), K_(schema_version), K_(task_cnt), K_(need_online_opt_stat_gather), K_(trans_id), K_(seq_no), K_(parallel)); public: sql::ObExecContext *exec_ctx_; int64_t task_id_; @@ -237,6 +237,7 @@ public: // sequence number for the incremental direct load, // fixed 0 for the full direct load. int64_t seq_no_; // + int64_t parallel_; // used to decide wehter need to use compress temp data in rescan task. }; // full parameters used by runtime execution @@ -405,14 +406,15 @@ public: } virtual ~ObChunkSliceStore() { reset(); } int init(const int64_t rowkey_column_count, ObTabletHandle &tablet_handle, ObArenaAllocator &allocator, - const ObIArray &col_schema, const int64_t dir_id); + const ObIArray &col_schema, const int64_t dir_id, const int64_t parallelism); virtual int append_row(const blocksstable::ObDatumRow &datum_row) override; virtual int close() override; void reset(); virtual int64_t get_row_count() const { return row_cnt_; } TO_STRING_KV(K(is_inited_), K(target_store_idx_), K(row_cnt_), KP(arena_allocator_), K(datum_stores_), K(endkey_), K(rowkey_column_count_), K(cg_schemas_)); private: - int prepare_datum_stores(const uint64_t tenant_id, ObTabletHandle &tablet_handle, ObIAllocator &allocator, const ObIArray &col_array, const int64_t dir_id); + int prepare_datum_stores(const uint64_t tenant_id, ObTabletHandle &tablet_handle, ObIAllocator &allocator, + const ObIArray &col_array, const int64_t dir_id, const int64_t parallelism); int64_t calc_chunk_limit(const ObStorageColumnGroupSchema &cg_schema); public: bool is_inited_; @@ -477,6 +479,7 @@ public: const ObDirectLoadType &direct_load_type, const ObArray &column_items, const int64_t dir_id, + const int64_t parallelism, int64_t &affected_rows, ObInsertMonitor *insert_monitor = NULL); int fill_lob_sstable_slice( @@ -535,6 +538,7 @@ private: const int64_t schema_rowkey_column_num, const bool is_slice_store, const int64_t dir_id, + const int64_t parallelism, ObTabletHandle &tablet_handle, const share::SCN &start_scn); int report_unique_key_dumplicated( diff --git a/src/storage/direct_load/ob_direct_load_insert_table_ctx.cpp b/src/storage/direct_load/ob_direct_load_insert_table_ctx.cpp index c12eb72eed..245ba3c390 100644 --- a/src/storage/direct_load/ob_direct_load_insert_table_ctx.cpp +++ b/src/storage/direct_load/ob_direct_load_insert_table_ctx.cpp @@ -157,6 +157,7 @@ int ObDirectLoadInsertTabletContext::open() direct_load_param.runtime_only_param_.table_id_ = param_.table_id_; direct_load_param.runtime_only_param_.schema_version_ = param_.schema_version_; direct_load_param.runtime_only_param_.task_cnt_ = 1; // default value. + direct_load_param.runtime_only_param_.parallel_ = param_.reserved_parallel_; if (OB_FAIL(sstable_insert_mgr->create_tablet_direct_load( param_.context_id_, param_.execution_id_, direct_load_param))) { LOG_WARN("create tablet manager failed", K(ret)); diff --git a/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/all_virtual_sys_parameter_stat.result b/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/all_virtual_sys_parameter_stat.result index 81af566a5d..25d4b45b9b 100644 --- a/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/all_virtual_sys_parameter_stat.result +++ b/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/all_virtual_sys_parameter_stat.result @@ -98,7 +98,6 @@ enable_rpc_authentication_bypass enable_sql_audit enable_sql_extension enable_sql_operator_dump -enable_store_compression enable_syslog_recycle enable_syslog_wf enable_sys_table_ddl @@ -356,6 +355,7 @@ _min_malloc_sample_interval _mvcc_gc_using_min_txn_snapshot _nested_loop_join_enabled _obkv_feature_mode +_ob_ddl_temp_file_compress_func _ob_ddl_timeout _ob_elr_fast_freeze_threshold _ob_enable_direct_load diff --git a/unittest/sql/parser/test_parser.result b/unittest/sql/parser/test_parser.result index 8e2e8da02b..766d2b9dfe 100644 --- a/unittest/sql/parser/test_parser.result +++ b/unittest/sql/parser/test_parser.result @@ -5696,6 +5696,7 @@ question_mask_size: 0 } ] }, + { }, { } ] } @@ -5793,6 +5794,7 @@ question_mask_size: 0 } ] }, + { }, { } ] } @@ -5895,6 +5897,7 @@ question_mask_size: 0 } ] }, + { }, { } ] } diff --git a/unittest/storage/ddl/test_chunk_compact_store.cpp b/unittest/storage/ddl/test_chunk_compact_store.cpp index 3a6161a1f1..c809c92893 100644 --- a/unittest/storage/ddl/test_chunk_compact_store.cpp +++ b/unittest/storage/ddl/test_chunk_compact_store.cpp @@ -206,88 +206,13 @@ void TestCompactChunk::TearDown() TestDataFilePrepare::TearDown(); } -TEST_F(TestCompactChunk, test_read_writer) -{ - int ret = OB_SUCCESS; - ObCompactStore cs_chunk; - cs_chunk.init(1, 1, - ObCtxIds::DEFAULT_CTX_ID, "SORT_CACHE_CTX", true, 0, true, share::SORT_DEFAULT_LEVEL); - - StoredRow **sr; - ret = row_generate_.get_stored_row(sr); - ASSERT_EQ(ret, OB_SUCCESS); - - char *buf = reinterpret_cast(sr); - int64_t pos = 0; - for (int64_t i = 0; OB_SUCC(ret) && i < BATCH_SIZE; i++) { - StoredRow *tmp_sr = (StoredRow *)(buf + pos); - ret = cs_chunk.add_row(*tmp_sr); - ASSERT_EQ(ret, OB_SUCCESS); - pos += tmp_sr->row_size_; - } - - ret = cs_chunk.finish_add_row(); - ASSERT_EQ(ret, OB_SUCCESS); - for (int64_t i = 0; OB_SUCC(ret) && i < BATCH_SIZE; i++) { - int64_t result = 0; - const StoredRow *cur_sr = nullptr; - ret = cs_chunk.get_next_row(cur_sr); - if (ret == OB_ITER_END) { - ret = OB_SUCCESS; - } - ASSERT_EQ(ret, OB_SUCCESS); - for (int64_t k = 0; k < cur_sr->cnt_; k++) { - ObDatum cur_cell = cur_sr->cells()[k]; - result += *(int64_t *)(cur_cell.ptr_); - } - OB_ASSERT(result == 64); - } -} - -TEST_F(TestCompactChunk, test_batch) -{ - int ret = OB_SUCCESS; - ObCompactStore cs_chunk; - cs_chunk.init(1, 1, - ObCtxIds::DEFAULT_CTX_ID, "SORT_CACHE_CTX", true, 0, true, share::SORT_DEFAULT_LEVEL); - - StoredRow **sr; - ret = row_generate_.get_stored_row(sr); - ASSERT_EQ(ret, OB_SUCCESS); - - char *buf = reinterpret_cast(sr); - int64_t pos = 0; - for (int64_t i = 0; OB_SUCC(ret) && i < BATCH_SIZE; i++) { - StoredRow *tmp_sr = (StoredRow *)(buf + pos); - ret = cs_chunk.add_row(*tmp_sr); - ASSERT_EQ(ret, OB_SUCCESS); - pos += tmp_sr->row_size_; - } - ret = cs_chunk.finish_add_row(); - ASSERT_EQ(ret, OB_SUCCESS); - for (int64_t i = 0; OB_SUCC(ret) && i < BATCH_SIZE; i++) { - int64_t result = 0; - const StoredRow *cur_sr = nullptr; - ret = cs_chunk.get_next_row(cur_sr); - if (ret == OB_ITER_END) { - ret = OB_SUCCESS; - } - ASSERT_EQ(ret, OB_SUCCESS); - for (int64_t k = 0; k < cur_sr->cnt_; k++) { - ObDatum cur_cell = cur_sr->cells()[k]; - result += *(int64_t *)(cur_cell.ptr_); - } - OB_ASSERT(result == 64); - } -} - TEST_F(TestCompactChunk, test_read_writer_compact) { int ret = OB_SUCCESS; ObCompactStore cs_chunk; cs_chunk.init(1, 1, - ObCtxIds::DEFAULT_CTX_ID, "SORT_CACHE_CTX", true, 0, true, share::SORT_COMPACT_LEVEL); + ObCtxIds::DEFAULT_CTX_ID, "SORT_CACHE_CTX", true, 0, true); ChunkRowMeta row_meta(allocator_); row_meta.col_cnt_ = COLUMN_CNT; row_meta.fixed_cnt_ = COLUMN_CNT; @@ -343,7 +268,7 @@ TEST_F(TestCompactChunk, test_read_writer_compact_vardata) ObCompactStore cs_chunk; cs_chunk.init(1, 1, - ObCtxIds::DEFAULT_CTX_ID, "SORT_CACHE_CTX", true, 0, true, share::SORT_COMPACT_LEVEL); + ObCtxIds::DEFAULT_CTX_ID, "SORT_CACHE_CTX", true, 0, true); ChunkRowMeta row_meta(allocator_); row_meta.col_cnt_ = COLUMN_CNT; row_meta.fixed_cnt_ = 0; @@ -391,272 +316,12 @@ TEST_F(TestCompactChunk, test_read_writer_compact_vardata) } } -TEST_F(TestCompactChunk, test_read_writer_compression) -{ - int ret = OB_SUCCESS; - ObCompactStore cs_chunk; - - cs_chunk.init(1, 1, - ObCtxIds::DEFAULT_CTX_ID, "SORT_CACHE_CTX", true, 0, true, share::SORT_COMPRESSION_LEVEL, ZSTD_COMPRESSOR); - StoredRow **sr; - ret = row_generate_.get_stored_row(sr); - ASSERT_EQ(ret, OB_SUCCESS); - - char *buf = reinterpret_cast(sr); - int64_t pos = 0; - for (int64_t i = 0; OB_SUCC(ret) && i < BATCH_SIZE; i++) { - StoredRow *tmp_sr = (StoredRow *)(buf + pos); - ret = cs_chunk.add_row(*tmp_sr); - ASSERT_EQ(ret, OB_SUCCESS); - pos += tmp_sr->row_size_; - } - ret = cs_chunk.finish_add_row(); - ASSERT_EQ(ret, OB_SUCCESS); - for (int64_t i = 0; OB_SUCC(ret) && i < BATCH_SIZE; i++) { - int64_t result = 0; - const StoredRow *cur_sr = nullptr; - ret = cs_chunk.get_next_row(cur_sr); - if (ret == OB_ITER_END) { - ret = OB_SUCCESS; - } - ASSERT_EQ(ret, OB_SUCCESS); - for (int64_t k = 0; k < cur_sr->cnt_; k++) { - ObDatum cur_cell = cur_sr->cells()[k]; - result += *(int64_t *)(cur_cell.ptr_); - } - OB_ASSERT(result == 64); - } -} - -TEST_F(TestCompactChunk, test_irregular) -{ - int ret = OB_SUCCESS; - ObCompactStore cs_chunk; - cs_chunk.init(1, 1, - ObCtxIds::DEFAULT_CTX_ID, "SORT_CACHE_CTX", true, 0, false/*disable trunc*/, share::SORT_DEFAULT_LEVEL); - StoredRow **sr; - ret = row_generate_.get_stored_row_irregular(sr); - ASSERT_EQ(ret, OB_SUCCESS); - - char *buf = reinterpret_cast(sr); - int64_t pos = 0; - for (int64_t i = 0; OB_SUCC(ret) && i < BATCH_SIZE; i++) { - StoredRow *tmp_sr = (StoredRow *)(buf + pos); - ret = cs_chunk.add_row(*tmp_sr); - ASSERT_EQ(ret, OB_SUCCESS); - pos += tmp_sr->row_size_; - } - - ret = cs_chunk.finish_add_row(); - ASSERT_EQ(ret, OB_SUCCESS); - for (int j = 0; OB_SUCC(ret) && j < 1; j++ ) { - int64_t total_res = 0; - //cs_chunk.rescan(); - for (int64_t i = 0; OB_SUCC(ret) && i < BATCH_SIZE; i++) { - int64_t result = 0; - const StoredRow *cur_sr = nullptr; - ret = cs_chunk.get_next_row(cur_sr); - if (ret == OB_ITER_END) { - ret = OB_SUCCESS; - } - ASSERT_EQ(ret, OB_SUCCESS); - for (int64_t k = 0; k < cur_sr->cnt_; k++) { - ObDatum cur_cell = cur_sr->cells()[k]; - result += *(int64_t *)(cur_cell.ptr_); - total_res += *(int64_t *)(cur_cell.ptr_); - } - OB_ASSERT(result == ((1024 * i * COLUMN_CNT) + ((COLUMN_CNT - 1) * COLUMN_CNT / 2))); - } - OB_ASSERT(total_res == ((1024 * (BATCH_SIZE-1) * BATCH_SIZE * COLUMN_CNT / 2) + BATCH_SIZE * ((COLUMN_CNT - 1) * COLUMN_CNT / 2))); - } -} - -TEST_F(TestCompactChunk, test_rescan_irregular_1) -{ - int ret = OB_SUCCESS; - ObCompactStore cs_chunk; - cs_chunk.init(1, 1, - ObCtxIds::DEFAULT_CTX_ID, "SORT_CACHE_CTX", true, 0, false/*disable trunc*/, share::SORT_DEFAULT_LEVEL); - StoredRow **sr; - ret = row_generate_.get_stored_row_irregular(sr); - ASSERT_EQ(ret, OB_SUCCESS); - - char *buf = reinterpret_cast(sr); - int64_t pos = 0; - for (int64_t i = 0; OB_SUCC(ret) && i < BATCH_SIZE; i++) { - StoredRow *tmp_sr = (StoredRow *)(buf + pos); - ret = cs_chunk.add_row(*tmp_sr); - ASSERT_EQ(ret, OB_SUCCESS); - pos += tmp_sr->row_size_; - } - - ret = cs_chunk.finish_add_row(); - ASSERT_EQ(ret, OB_SUCCESS); - for (int j = 0; OB_SUCC(ret) && j < 1; j++ ) { - int64_t total_res = 0; - cs_chunk.rescan(); - for (int64_t i = 0; OB_SUCC(ret) && i < BATCH_SIZE; i++) { - int64_t result = 0; - const StoredRow *cur_sr = nullptr; - ret = cs_chunk.get_next_row(cur_sr); - if (ret == OB_ITER_END) { - ret = OB_SUCCESS; - } - ASSERT_EQ(ret, OB_SUCCESS); - for (int64_t k = 0; k < cur_sr->cnt_; k++) { - ObDatum cur_cell = cur_sr->cells()[k]; - result += *(int64_t *)(cur_cell.ptr_); - total_res += *(int64_t *)(cur_cell.ptr_); - } - OB_ASSERT(result == ((1024 * i * COLUMN_CNT) + ((COLUMN_CNT - 1) * COLUMN_CNT / 2))); - } - OB_ASSERT(total_res == ((1024 * (BATCH_SIZE-1) * BATCH_SIZE * COLUMN_CNT / 2) + BATCH_SIZE * ((COLUMN_CNT - 1) * COLUMN_CNT / 2))); - } -} - - -TEST_F(TestCompactChunk, test_rescan) -{ - int ret = OB_SUCCESS; - ObCompactStore cs_chunk; - cs_chunk.init(1, 1, - ObCtxIds::DEFAULT_CTX_ID, "SORT_CACHE_CTX", true, 0, false/*disable trunc*/, share::SORT_DEFAULT_LEVEL); - StoredRow **sr; - ret = row_generate_.get_stored_row(sr); - ASSERT_EQ(ret, OB_SUCCESS); - - char *buf = reinterpret_cast(sr); - int64_t pos = 0; - for (int64_t i = 0; OB_SUCC(ret) && i < BATCH_SIZE; i++) { - StoredRow *tmp_sr = (StoredRow *)(buf + pos); - ret = cs_chunk.add_row(*tmp_sr); - ASSERT_EQ(ret, OB_SUCCESS); - pos += tmp_sr->row_size_; - } - - ret = cs_chunk.finish_add_row(); - ASSERT_EQ(ret, OB_SUCCESS); - for (int j = 0; OB_SUCC(ret) && j < 10; j++ ) { - cs_chunk.rescan(); - for (int64_t i = 0; OB_SUCC(ret) && i < BATCH_SIZE; i++) { - int64_t result = 0; - const StoredRow *cur_sr = nullptr; - ret = cs_chunk.get_next_row(cur_sr); - if (ret == OB_ITER_END) { - ret = OB_SUCCESS; - } - ASSERT_EQ(ret, OB_SUCCESS); - for (int64_t k = 0; k < cur_sr->cnt_; k++) { - ObDatum cur_cell = cur_sr->cells()[k]; - result += *(int64_t *)(cur_cell.ptr_); - } - OB_ASSERT(result == 64); - } - } -} - -TEST_F(TestCompactChunk, test_rescan_irregular) -{ - int ret = OB_SUCCESS; - ObCompactStore cs_chunk; - cs_chunk.init(1, 1, - ObCtxIds::DEFAULT_CTX_ID, "SORT_CACHE_CTX", true, 0, false/*disable trunc*/, share::SORT_DEFAULT_LEVEL); - StoredRow **sr; - ret = row_generate_.get_stored_row_irregular(sr); - ASSERT_EQ(ret, OB_SUCCESS); - - char *buf = reinterpret_cast(sr); - int64_t pos = 0; - for (int64_t i = 0; OB_SUCC(ret) && i < BATCH_SIZE; i++) { - StoredRow *tmp_sr = (StoredRow *)(buf + pos); - ret = cs_chunk.add_row(*tmp_sr); - ASSERT_EQ(ret, OB_SUCCESS); - pos += tmp_sr->row_size_; - } - - ret = cs_chunk.finish_add_row(); - ASSERT_EQ(ret, OB_SUCCESS); - for (int j = 0; OB_SUCC(ret) && j < 2; j++ ) { - int64_t total_res = 0; - cs_chunk.rescan(); - for (int64_t i = 0; OB_SUCC(ret) && i < BATCH_SIZE; i++) { - int64_t result = 0; - const StoredRow *cur_sr = nullptr; - ret = cs_chunk.get_next_row(cur_sr); - if (ret == OB_ITER_END) { - ret = OB_SUCCESS; - } - ASSERT_EQ(ret, OB_SUCCESS); - for (int64_t k = 0; k < cur_sr->cnt_; k++) { - ObDatum cur_cell = cur_sr->cells()[k]; - result += *(int64_t *)(cur_cell.ptr_); - total_res += *(int64_t *)(cur_cell.ptr_); - } - OB_ASSERT(result == ((1024 * i * COLUMN_CNT) + ((COLUMN_CNT - 1) * COLUMN_CNT / 2))); - } - OB_ASSERT(total_res == ((1024 * (BATCH_SIZE-1) * BATCH_SIZE * COLUMN_CNT / 2) + BATCH_SIZE * ((COLUMN_CNT - 1) * COLUMN_CNT / 2))); - } -} - -TEST_F(TestCompactChunk, test_rescan_get_last_row) -{ - int ret = OB_SUCCESS; - ObCompactStore cs_chunk; - cs_chunk.init(1, 1, - ObCtxIds::DEFAULT_CTX_ID, "SORT_CACHE_CTX", true, 0, false/*disable trunc*/, share::SORT_DEFAULT_LEVEL); - StoredRow **sr; - ret = row_generate_.get_stored_row_irregular(sr); - ASSERT_EQ(ret, OB_SUCCESS); - - char *buf = reinterpret_cast(sr); - int64_t pos = 0; - for (int64_t i = 0; OB_SUCC(ret) && i < BATCH_SIZE; i++) { - StoredRow *tmp_sr = (StoredRow *)(buf + pos); - ret = cs_chunk.add_row(*tmp_sr); - ASSERT_EQ(ret, OB_SUCCESS); - pos += tmp_sr->row_size_; - // get last row - const StoredRow *cur_sr = nullptr; - ret = cs_chunk.get_last_stored_row(cur_sr); - ASSERT_EQ(ret, OB_SUCCESS); - int64_t res = 0; - for (int64_t k = 0; k < cur_sr->cnt_; k++) { - ObDatum cur_cell = cur_sr->cells()[k]; - res += *(int64_t *)(cur_cell.ptr_); - } - OB_ASSERT(res == ((1024 * i * COLUMN_CNT) + ((COLUMN_CNT - 1) * COLUMN_CNT / 2))); - } - - ret = cs_chunk.finish_add_row(); - ASSERT_EQ(ret, OB_SUCCESS); - for (int j = 0; OB_SUCC(ret) && j < 2; j++ ) { - int64_t total_res = 0; - cs_chunk.rescan(); - for (int64_t i = 0; OB_SUCC(ret) && i < BATCH_SIZE; i++) { - int64_t result = 0; - const StoredRow *cur_sr = nullptr; - ret = cs_chunk.get_next_row(cur_sr); - if (ret == OB_ITER_END) { - ret = OB_SUCCESS; - } - ASSERT_EQ(ret, OB_SUCCESS); - for (int64_t k = 0; k < cur_sr->cnt_; k++) { - ObDatum cur_cell = cur_sr->cells()[k]; - result += *(int64_t *)(cur_cell.ptr_); - total_res += *(int64_t *)(cur_cell.ptr_); - } - OB_ASSERT(result == ((1024 * i * COLUMN_CNT) + ((COLUMN_CNT - 1) * COLUMN_CNT / 2))); - } - OB_ASSERT(total_res == ((1024 * (BATCH_SIZE-1) * BATCH_SIZE * COLUMN_CNT / 2) + BATCH_SIZE * ((COLUMN_CNT - 1) * COLUMN_CNT / 2))); - } -} - TEST_F(TestCompactChunk, test_rescan_get_last_row_compact) { int ret = OB_SUCCESS; ObCompactStore cs_chunk; cs_chunk.init(1, 1, - ObCtxIds::DEFAULT_CTX_ID, "SORT_CACHE_CTX", true, 0, false/*disable trunc*/, share::SORT_COMPACT_LEVEL); + ObCtxIds::DEFAULT_CTX_ID, "SORT_CACHE_CTX", true, 0, false/*disable trunc*/); ChunkRowMeta row_meta(allocator_); row_meta.col_cnt_ = COLUMN_CNT; row_meta.fixed_cnt_ = 0;