From 2d906552e25ad8be89d9a7f4eaf777ddbfddcd86 Mon Sep 17 00:00:00 2001 From: hiddenbomb Date: Mon, 19 Feb 2024 07:00:43 +0000 Subject: [PATCH] fix typo and enlarge major freeze timeout --- src/sql/engine/join/hash_join/hash_table.h | 14 ++++++++++-- .../engine/join/hash_join/join_hash_table.h | 8 +++++-- .../join/hash_join/ob_hash_join_vec_op.h | 4 ++-- .../plan_cache/ob_sql_parameterization.cpp | 7 ++++++ .../tablet/ob_i_tablet_mds_interface.ipp | 22 +++++++++---------- 5 files changed, 38 insertions(+), 17 deletions(-) diff --git a/src/sql/engine/join/hash_join/hash_table.h b/src/sql/engine/join/hash_join/hash_table.h index 8b2eeda008..b3143e67bd 100644 --- a/src/sql/engine/join/hash_join/hash_table.h +++ b/src/sql/engine/join/hash_join/hash_table.h @@ -286,7 +286,7 @@ struct IHashTable { virtual int64_t get_used_buckets() const = 0; virtual int64_t get_nbuckets() const = 0; virtual int64_t get_collisions() const = 0; - virtual int64_t get_bucket_mem_size() const = 0; + virtual int64_t get_mem_used() const = 0; virtual int64_t get_one_bucket_size() const = 0; virtual int64_t get_normalized_key_size() const = 0; virtual void set_diag_info(int64_t used_buckets, int64_t collisions) = 0; @@ -349,7 +349,17 @@ struct HashTable : public IHashTable int64_t get_used_buckets() const override { return used_buckets_; } int64_t get_nbuckets() const override { return nbuckets_; } int64_t get_collisions() const override { return collisions_; } - int64_t get_bucket_mem_size() const override { return NULL == buckets_ ? 0 : buckets_->mem_used(); } + int64_t get_mem_used() const override { + int64_t size = 0; + size = sizeof(*this); + if (NULL != buckets_) { + size += buckets_->mem_used(); + } + if (NULL != items_) { + size += items_->mem_used(); + } + return size; + } int64_t get_one_bucket_size() const { return sizeof(Bucket); }; int64_t get_normalized_key_size() const { return Prober::get_normalized_key_size(); diff --git a/src/sql/engine/join/hash_join/join_hash_table.h b/src/sql/engine/join/hash_join/join_hash_table.h index ab01965fb2..9640449844 100644 --- a/src/sql/engine/join/hash_join/join_hash_table.h +++ b/src/sql/engine/join/hash_join/join_hash_table.h @@ -35,9 +35,13 @@ public: }; int get_unmatched_rows(JoinTableCtx &ctx, OutputInfo &output_info); void reset() { - // TODO shengle + if (NULL != hash_table_) { + hash_table_->reset(); + } }; - int64_t get_bucket_mem_size() const { return hash_table_->get_bucket_mem_size(); } + int64_t get_mem_used() const { + return hash_table_->get_mem_used(); + } void free(ObIAllocator *allocator) { if (NULL != hash_table_) { hash_table_->free(allocator); diff --git a/src/sql/engine/join/hash_join/ob_hash_join_vec_op.h b/src/sql/engine/join/hash_join/ob_hash_join_vec_op.h index 7b36445427..7a739acb00 100644 --- a/src/sql/engine/join/hash_join/ob_hash_join_vec_op.h +++ b/src/sql/engine/join/hash_join/ob_hash_join_vec_op.h @@ -433,7 +433,7 @@ private: // memory used for dump that it's really used OB_INLINE int64_t get_cur_mem_used() { - return get_mem_used() - join_table_.get_bucket_mem_size() - dumped_fixed_mem_size_; + return get_mem_used() - join_table_.get_mem_used() - dumped_fixed_mem_size_; } OB_INLINE int64_t get_data_mem_used() { return sql_mem_processor_.get_data_size(); } OB_INLINE bool need_dump(int64_t mem_used) @@ -473,7 +473,7 @@ private: { int64_t bucket_cnt = profile_.get_bucket_size(); const int64_t DEFAULT_EXTRA_SIZE = 2 * 1024 * 1024; - int64_t res = join_table_.get_bucket_mem_size(); + int64_t res = join_table_.get_mem_used(); return res < 0 ? DEFAULT_EXTRA_SIZE : res; } diff --git a/src/sql/plan_cache/ob_sql_parameterization.cpp b/src/sql/plan_cache/ob_sql_parameterization.cpp index cb67e62a98..d4dde1b102 100644 --- a/src/sql/plan_cache/ob_sql_parameterization.cpp +++ b/src/sql/plan_cache/ob_sql_parameterization.cpp @@ -877,6 +877,13 @@ int ObSqlParameterization::transform_tree(TransformTreeCtx &ctx, } else { ctx.not_param_ = not_param; ctx.ignore_scale_check_ = ignore_scale_check; + // select a + 1 as 'a' from t where b = ?; 'a' in SQL will be recognized as a constant by fast parser + // In the ps parameterization scenario, 'a' will be added to the param store as a fixed parameter in + // the execute phase. The param store has two parameters, causing correctness problems. + // Therefore, the scene ps parameterization ability of specifying aliases needs to be disabled. + if (T_ALIAS == root->type_ && NULL != root->str_value_) { + ctx.sql_info_->ps_need_parameterized_ = false; + } if (T_ALIAS == root->type_ && 0 == i) { // alias node的param_num_处理必须等到其第一个子节点转换完之后 // select a + 1 as 'a','a'不能被参数化,但是它在raw_params数组内的下标必须是计算了1的下标之后才能得到 diff --git a/src/storage/tablet/ob_i_tablet_mds_interface.ipp b/src/storage/tablet/ob_i_tablet_mds_interface.ipp index 0999100163..904c48dbad 100644 --- a/src/storage/tablet/ob_i_tablet_mds_interface.ipp +++ b/src/storage/tablet/ob_i_tablet_mds_interface.ipp @@ -664,7 +664,7 @@ int ObITabletMdsInterface::obj_to_string_holder_(const T &obj, ObStringHolder &h int64_t pos = 0; if (FALSE_IT(databuff_printf(stack_buffer, buffer_size, pos, "%s", to_cstring(obj)))) {// try hard to fill buffer, it's ok if buffer not enough } else if (OB_FAIL(holder.assign(ObString(pos, stack_buffer)))) { - MDS_LOG(WARN, "fatil to assign to holder"); + MDS_LOG(WARN, "fail to assign to holder"); } return ret; } @@ -686,16 +686,16 @@ int ObITabletMdsInterface::fill_virtual_info_by_complex_addr_(const ObTabletComp } else if (FALSE_IT(cur_virtual_info = &mds_node_info_array.at(mds_node_info_array.count() - 1))) { } else { if (CLICK_FAIL(ObTabletMdsData::load_mds_dump_kv(allocator, addr, dump_kv))) { - MDS_LOG_GET(WARN, "fatil to read tablet_status_addr"); + MDS_LOG_GET(WARN, "fail to read tablet_status_addr"); } else if (nullptr == dump_kv || (nullptr != dump_kv && !dump_kv->is_valid())) { ret = OB_ENTRY_NOT_EXIST; MDS_LOG_GET(INFO, "dump kv not exist"); } else if (CLICK_FAIL(obj_to_string_holder_(dump_kv->k_, cur_virtual_info->user_key_))) { - MDS_LOG_GET(WARN, "fatil to fill string holder"); + MDS_LOG_GET(WARN, "fail to fill string holder"); } else if (CLICK_FAIL(dump_kv->v_.convert_to_user_mds_node(user_mds_node, get_tablet_meta_().ls_id_, get_tablet_meta_().tablet_id_))) { - MDS_LOG_GET(WARN, "fatil to convert tablet_status_node"); + MDS_LOG_GET(WARN, "fail to convert tablet_status_node"); } else if (CLICK_FAIL(user_mds_node.fill_virtual_info(*cur_virtual_info))) { - MDS_LOG_GET(WARN, "fatil to fill virtual info"); + MDS_LOG_GET(WARN, "fail to fill virtual info"); } else { cur_virtual_info->ls_id_ = get_tablet_meta_().ls_id_; cur_virtual_info->tablet_id_ = get_tablet_meta_().tablet_id_; @@ -727,11 +727,11 @@ int ObITabletMdsInterface::fill_virtual_info_by_obj_(const T &obj, if (!obj.is_valid()) { MDS_LOG_GET(INFO, "obj is not valid"); } else if (CLICK_FAIL(mds_node_info_array.push_back(mds::MdsNodeInfoForVirtualTable()))) { - MDS_LOG_GET(WARN, "fatil to push_back"); + MDS_LOG_GET(WARN, "fail to push_back"); } else if (FALSE_IT(cur_virtual_info = &mds_node_info_array.at(mds_node_info_array.count() - 1))) { } else { if (CLICK_FAIL(obj_to_string_holder_(obj, cur_virtual_info->user_data_))) { - MDS_LOG_GET(WARN, "fatil to fill string holder"); + MDS_LOG_GET(WARN, "fail to fill string holder"); } else { cur_virtual_info->ls_id_ = get_tablet_meta_().ls_id_; cur_virtual_info->tablet_id_ = get_tablet_meta_().tablet_id_; @@ -766,13 +766,13 @@ inline int ObITabletMdsInterface::fill_virtual_info(ObIArray(get_mds_data_().tablet_status_.committed_kv_, mds_node_info_array))) { - MDS_LOG_GET(WARN, "fatil to fill tablet_status_"); + MDS_LOG_GET(WARN, "fail to fill tablet_status_"); } else if (CLICK_FAIL(fill_virtual_info_by_complex_addr_(get_mds_data_().aux_tablet_info_.committed_kv_, mds_node_info_array))) { - MDS_LOG_GET(WARN, "fatil to fill aux_tablet_info_"); + MDS_LOG_GET(WARN, "fail to fill aux_tablet_info_"); } return ret;