fix hash join do not clear last batch memory leads OOM

This commit is contained in:
18523270951@163.com
2023-08-08 09:54:52 +00:00
committed by ob-robot
parent 0ac8dd7d1b
commit b047318590
3 changed files with 6 additions and 4 deletions

View File

@ -673,6 +673,7 @@ public:
class IterationAge class IterationAge
{ {
public: public:
IterationAge() : age_(0) {}
int64_t get(void) const { return age_; } int64_t get(void) const { return age_; }
void inc(void) { age_ += 1; } void inc(void) { age_ += 1; }
private: private:

View File

@ -1250,8 +1250,8 @@ int ObHashJoinOp::build_hash_table_for_nest_loop(int64_t &num_left_rows)
int64_t memory_bound = std::max(remain_data_memory_size_, int64_t memory_bound = std::max(remain_data_memory_size_,
hj_batch->get_chunk_row_store().get_max_blk_size()); hj_batch->get_chunk_row_store().get_max_blk_size());
const int64_t row_bound = hash_table.nbuckets_ / 2; const int64_t row_bound = hash_table.nbuckets_ / 2;
ObChunkDatumStore::IterationAge iter_age; hj_batch->set_iteration_age(iter_age_);
hj_batch->set_iteration_age(iter_age); iter_age_.inc();
while (OB_SUCC(ret)) { while (OB_SUCC(ret)) {
int64_t read_size = 0; int64_t read_size = 0;
if (OB_FAIL(hj_batch->get_next_batch(left_stored_rows, if (OB_FAIL(hj_batch->get_next_batch(left_stored_rows,
@ -1740,8 +1740,8 @@ int ObHashJoinOp::build_hash_table_in_memory(int64_t &num_left_rows)
// do nothing // do nothing
} else { } else {
PartHashJoinTable &hash_table = *cur_hash_table_; PartHashJoinTable &hash_table = *cur_hash_table_;
ObChunkDatumStore::IterationAge iter_age; hj_batch->set_iteration_age(iter_age_);
hj_batch->set_iteration_age(iter_age); iter_age_.inc();
while (OB_SUCC(ret)) { while (OB_SUCC(ret)) {
int64_t read_size = 0; int64_t read_size = 0;
if (OB_FAIL(hj_batch->get_next_batch(left_stored_rows, if (OB_FAIL(hj_batch->get_next_batch(left_stored_rows,

View File

@ -1269,6 +1269,7 @@ private:
*/ */
bool skip_left_null_; bool skip_left_null_;
bool skip_right_null_; bool skip_right_null_;
ObChunkDatumStore::IterationAge iter_age_;
}; };
inline int ObHashJoinOp::init_mem_context(uint64_t tenant_id) inline int ObHashJoinOp::init_mem_context(uint64_t tenant_id)