fix hash part infra hang because negative bound size
This commit is contained in:
@ -1062,9 +1062,9 @@ int64_t ObBasicHashPartInfrastructure<HashCol, HashRowStore>::est_bucket_count(
|
||||
}
|
||||
int64_t est_bucket_mem_size = next_pow2(rows) * sizeof(void*);
|
||||
int64_t est_data_mem_size = rows * width;
|
||||
int64_t max_remain_mem_size = sql_mem_processor_->get_mem_bound() - est_part_cnt_ * BLOCK_SIZE;
|
||||
int64_t max_remain_mem_size = std::max(0l, sql_mem_processor_->get_mem_bound() - est_part_cnt_ * BLOCK_SIZE);
|
||||
int64_t est_bucket_num = rows;
|
||||
while (est_bucket_mem_size + est_data_mem_size > max_remain_mem_size) {
|
||||
while (est_bucket_mem_size + est_data_mem_size > max_remain_mem_size && est_bucket_num > 0) {
|
||||
est_bucket_num >>= 1;
|
||||
est_bucket_mem_size = next_pow2(est_bucket_num) * sizeof(void*);
|
||||
est_data_mem_size = est_bucket_num * width;
|
||||
@ -1706,10 +1706,10 @@ int ObPartitionExtendHashTable<Item>::init(
|
||||
template <typename Item>
|
||||
int64_t ObPartitionExtendHashTable<Item>::estimate_bucket_num(const int64_t bucket_num, const int64_t max_hash_mem)
|
||||
{
|
||||
int64_t max_bound_size = max_hash_mem * MAX_MEM_PERCENT / 100;
|
||||
int64_t max_bound_size = std::max(0l, max_hash_mem * MAX_MEM_PERCENT / 100);
|
||||
int64_t est_bucket_num = common::next_pow2(bucket_num);
|
||||
int64_t est_size = est_bucket_num * sizeof(void*);
|
||||
while (est_size > max_bound_size) {
|
||||
int64_t est_size = est_bucket_num * sizeof(void *);
|
||||
while (est_size > max_bound_size && est_bucket_num > 0) {
|
||||
est_bucket_num >>= 1;
|
||||
est_size = est_bucket_num * sizeof(void*);
|
||||
}
|
||||
|
||||
@ -1051,9 +1051,9 @@ int64_t ObHashPartInfrastructure<HashCol, HashRowStore>::est_bucket_count(
|
||||
}
|
||||
int64_t est_bucket_mem_size = next_pow2(rows) * sizeof(void*);
|
||||
int64_t est_data_mem_size = rows * width;
|
||||
int64_t max_remain_mem_size = sql_mem_processor_->get_mem_bound() - est_part_cnt_ * BLOCK_SIZE;
|
||||
int64_t max_remain_mem_size = std::max(0l, sql_mem_processor_->get_mem_bound() - est_part_cnt_ * BLOCK_SIZE);
|
||||
int64_t est_bucket_num = rows;
|
||||
while (est_bucket_mem_size + est_data_mem_size > max_remain_mem_size) {
|
||||
while (est_bucket_mem_size + est_data_mem_size > max_remain_mem_size && est_bucket_num > 0) {
|
||||
est_bucket_num >>= 1;
|
||||
est_bucket_mem_size = next_pow2(est_bucket_num) * sizeof(void*);
|
||||
est_data_mem_size = est_bucket_num * width;
|
||||
@ -1719,10 +1719,10 @@ template <typename Item>
|
||||
int64_t ObHashPartitionExtendHashTable<Item>::estimate_bucket_num(
|
||||
const int64_t bucket_num, const int64_t max_hash_mem, const int64_t min_bucket, const int64_t max_bucket)
|
||||
{
|
||||
int64_t max_bound_size = max_hash_mem * MAX_MEM_PERCENT / 100;
|
||||
int64_t max_bound_size = std::max(0l, max_hash_mem * MAX_MEM_PERCENT / 100);
|
||||
int64_t est_bucket_num = common::next_pow2(bucket_num);
|
||||
int64_t est_size = est_bucket_num * sizeof(void*);
|
||||
while (est_size > max_bound_size) {
|
||||
int64_t est_size = est_bucket_num * sizeof(void *);
|
||||
while (est_size > max_bound_size && est_bucket_num > 0) {
|
||||
est_bucket_num >>= 1;
|
||||
est_size = est_bucket_num * sizeof(void*);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user