Skip to content

Conversation

@SleepyBear96
Copy link
Contributor

Proposed changes

Issue Number: close #xxx

Problem Summary:

The _agg_object_pool in row_batch is used to hold the pointer of bitmap or hll data, which will be released later.
When a tuple check direct conjuncts or check pushdown conjuncts fail, the memory holding by _agg_object_pool which belong to the tuple also should be released. Otherwise, it will lead up to OOM。
Describe the overview of changes.

Checklist(Required)

  1. Does it affect the original behavior: (Yes/No/I Don't know)
  2. Has unit tests been added: (Yes/No/No Need)
  3. Has document been added or modified: (Yes/No/No Need)
  4. Does it need to update dependencies: (Yes/No)
  5. Are there any changes that cannot be rolled back: (Yes/No)

Further comments

If this is a relatively large or complex change, kick off the discussion at dev@doris.apache.org by explaining why you chose the solution you did and what alternatives you considered, etc...

@SleepyBear96 SleepyBear96 changed the title [fix][OlapScanner]fix bitmap or hll's OOM [fix](OlapScanner)fix bitmap or hll's OOM Mar 31, 2022
// make sure to reset null indicators since we're overwriting
// the tuple assembled for the previous row
tuple->init(_tuple_desc->byte_size());
batch->agg_object_pool()->remove_last_one();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you give some more detail about the OOM?

If one thread(T2) add an new object into agg_object_pool, just before remove_last_one called by this thread(T1).
I think it may remove object added by T2, not the one added by T1?

Copy link
Contributor Author

@SleepyBear96 SleepyBear96 Mar 31, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

batch in Status OlapScanner::get_batch(RuntimeState*, RowBatch*, bool*) was allocated by void OlapScanNode::scanner_thread(OlapScanner*), every scanner_thread has its own batch, it isn't a multi-thread case.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your reply.

  1. Could you give me some detail steps? I want to try to reproduce the problem.
  2. If one tuple has bitmap and hll column at the same time, remove_last_one should be called twice?

@morningman morningman added the kind/fix Categorizes issue or PR as related to a bug. label Mar 31, 2022
int64_t raw_bytes_threshold = config::doris_scanner_row_bytes;
{
SCOPED_TIMER(_parent->_scan_timer);
ObjectPool tmp_object_pool;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add more comments to explain why we need this tmp object pool.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

kaijioh.niu and others added 2 commits April 5, 2022 23:36
// so we set a soft limit, default is 1MB
CONF_mInt32(string_type_length_soft_limit_bytes, "1048576");

CONF_Int32(object_pool_buffer_size, "100");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add comment for this new config

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

_objects.clear();
}

uint64_t size() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need a std::lock_guard<SpinLock> l(_lock);?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@morningman
Copy link
Contributor

See #9205

@morningman morningman closed this Apr 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/fix Categorizes issue or PR as related to a bug.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants