Skip to content

[fix](OlapScanner)fix bitmap or hll's OOM - #8764

Closed
SleepyBear96 wants to merge 13 commits into
apache:masterfrom
SleepyBear96:master
Closed

[fix](OlapScanner)fix bitmap or hll's OOM#8764
SleepyBear96 wants to merge 13 commits into
apache:masterfrom
SleepyBear96:master

Conversation

@SleepyBear96

Copy link
Copy Markdown
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...

@SleepyBear96SleepyBear96 changed the title [fix][OlapScanner]fix bitmap or hll's OOM[fix](OlapScanner)fix bitmap or hll's OOMMar 31, 2022
Comment threadbe/src/exec/olap_scanner.cpp Outdated
// 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
Copy Markdown
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?

@SleepyBear96SleepyBear96Mar 31, 2022

Copy link
Copy Markdown
ContributorAuthor

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
Copy Markdown
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?

@morningmanmorningman added the kind/fix Categorizes issue or PR as related to a bug. label Mar 31, 2022
Comment threadbe/src/exec/olap_scanner.cpp Outdated
int64_t raw_bytes_threshold = config::doris_scanner_row_bytes;
{
SCOPED_TIMER(_parent->_scan_timer);
ObjectPool tmp_object_pool;

Copy link
Copy Markdown
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
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Done.

// 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
Copy Markdown
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
Copy Markdown
ContributorAuthor

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
Copy Markdown
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
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Done.

@morningman

Copy link
Copy Markdown
Contributor

See #9205

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/fixCategorizes issue or PR as related to a bug.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@SleepyBear96@morningman@cambyzju