fix for hash groupby hung, exteng hashtable in process_popular_value_batch
This commit is contained in:
@ -254,7 +254,17 @@ int ObExtendHashTableVec<GroupRowBucket>::process_popular_value_batch(ObBatchRow
|
|||||||
ret = OB_ERR_UNEXPECTED;
|
ret = OB_ERR_UNEXPECTED;
|
||||||
LOG_WARN("unexpected check_valid_threshold value", K(check_valid_threshold));
|
LOG_WARN("unexpected check_valid_threshold value", K(check_valid_threshold));
|
||||||
}
|
}
|
||||||
|
// extend bucket to hold whole batch
|
||||||
|
while (OB_SUCC(ret) && auto_extend_ && OB_UNLIKELY((size_ + result_brs->size_)
|
||||||
|
* SIZE_BUCKET_SCALE >= get_bucket_num())) {
|
||||||
|
int64_t pre_bkt_num = get_bucket_num();
|
||||||
|
if (OB_FAIL(extend())) {
|
||||||
|
SQL_ENG_LOG(WARN, "extend failed", K(ret));
|
||||||
|
} else if (get_bucket_num() <= pre_bkt_num) {
|
||||||
|
ret = OB_ERR_UNEXPECTED;
|
||||||
|
LOG_WARN("failed to extend table", K(ret), K(pre_bkt_num), K(get_bucket_num()));
|
||||||
|
}
|
||||||
|
}
|
||||||
for (int64_t i = 0; i < exprs.count(); ++i) {
|
for (int64_t i = 0; i < exprs.count(); ++i) {
|
||||||
if (nullptr == exprs.at(i)) {
|
if (nullptr == exprs.at(i)) {
|
||||||
vector_ptrs_.at(i) = nullptr;
|
vector_ptrs_.at(i) = nullptr;
|
||||||
@ -264,6 +274,9 @@ int ObExtendHashTableVec<GroupRowBucket>::process_popular_value_batch(ObBatchRow
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (int64_t i=0; OB_SUCC(ret) && i < result_brs->size_; i++) {
|
for (int64_t i=0; OB_SUCC(ret) && i < result_brs->size_; i++) {
|
||||||
|
if (result_brs->skip_->at(i)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
by_pass_rows++;
|
by_pass_rows++;
|
||||||
mask_hash = (hash_vals[i] & ObGroupRowBucketBase::HASH_VAL_MASK);
|
mask_hash = (hash_vals[i] & ObGroupRowBucketBase::HASH_VAL_MASK);
|
||||||
if (popular_map->size() == 0) {
|
if (popular_map->size() == 0) {
|
||||||
|
@ -2330,7 +2330,7 @@ int ObHashGroupByVecOp::by_pass_prepare_one_batch(const int64_t batch_size)
|
|||||||
LOG_WARN("prepare add one row failed", K(ret));
|
LOG_WARN("prepare add one row failed", K(ret));
|
||||||
}
|
}
|
||||||
for (int64_t i = 0; OB_SUCC(ret) && i < brs_.size_; i++) {
|
for (int64_t i = 0; OB_SUCC(ret) && i < brs_.size_; i++) {
|
||||||
if (!batch_old_rows_[i]) {
|
if (!batch_old_rows_[i] || brs_.skip_->at(i)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
by_pass_agg_rows_++;
|
by_pass_agg_rows_++;
|
||||||
@ -2509,7 +2509,7 @@ int ObHashGroupByVecOp::by_pass_restart_round()
|
|||||||
if (skew_detection_enabled_ && bypass_ctrl_.by_passing()) {
|
if (skew_detection_enabled_ && bypass_ctrl_.by_passing()) {
|
||||||
// for popular values, so do not need to be big
|
// for popular values, so do not need to be big
|
||||||
OZ(local_group_rows_.resize(&mem_context_->get_malloc_allocator(),
|
OZ(local_group_rows_.resize(&mem_context_->get_malloc_allocator(),
|
||||||
INIT_BUCKET_COUNT_FOR_POPULAR));
|
INIT_BKT_SIZE_FOR_ADAPTIVE_GBY));
|
||||||
} else {
|
} else {
|
||||||
// if last round is in L2 cache, reuse the bucket
|
// if last round is in L2 cache, reuse the bucket
|
||||||
// otherwise resize to init size to avoid L2 cache overflow
|
// otherwise resize to init size to avoid L2 cache overflow
|
||||||
|
@ -126,7 +126,6 @@ public:
|
|||||||
static const uint64_t MIN_CHECK_POPULAR_VALID_ROWS = 10000;
|
static const uint64_t MIN_CHECK_POPULAR_VALID_ROWS = 10000;
|
||||||
constexpr static const float SKEW_POPULAR_MAX_RATIO = 0.5;
|
constexpr static const float SKEW_POPULAR_MAX_RATIO = 0.5;
|
||||||
const static int64_t SKEW_HEAP_SIZE = 15;
|
const static int64_t SKEW_HEAP_SIZE = 15;
|
||||||
const static int64_t INIT_BUCKET_COUNT_FOR_POPULAR = 32;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ObHashGroupByVecOp(ObExecContext &exec_ctx, const ObOpSpec &spec, ObOpInput *input)
|
ObHashGroupByVecOp(ObExecContext &exec_ctx, const ObOpSpec &spec, ObOpInput *input)
|
||||||
|
Reference in New Issue
Block a user