Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[improvement](bitmap) Use shared_ptr in BitmapValue to avoid deep copying #21271

Merged
merged 1 commit into from
Jul 11, 2023

Conversation

mrhhsg
Copy link
Member

@mrhhsg mrhhsg commented Jun 28, 2023

Proposed changes

pick #19101

Currently bitmapvalue type is copied between columns, it cost a lot of memory. Use a shared ptr in bitmap value to avoid copy data.

Further comments

If this is a relatively large or complex change, kick off the discussion at [email protected] by explaining why you chose the solution you did and what alternatives you considered, etc...

…ying (apache#19101)

Currently bitmapvalue type is copied between columns, it cost a lot of memory. Use a shared ptr in bitmap value to avoid copy data.
@yiguolei
Copy link
Contributor

wait feedback from users, do not merge it please

@yiguolei yiguolei merged commit 4b9c87d into apache:branch-1.2-lts Jul 11, 2023
morningman pushed a commit that referenced this pull request Jul 19, 2023
…ying (#19101) (#21271)

Currently bitmapvalue type is copied between columns, it cost a lot of memory. Use a shared ptr in bitmap value to avoid copy data.
GoGoWen pushed a commit to GoGoWen/incubator-doris that referenced this pull request Jul 26, 2023
…ying (apache#19101) (apache#21271)

Currently bitmapvalue type is copied between columns, it cost a lot of memory. Use a shared ptr in bitmap value to avoid copy data.
@lide-reed
Copy link
Contributor

Core was generated by `/usr/local/service/doris/lib/be/doris_be'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x000055ce83a529ce in convert_run_to_efficient_container ()
[Current thread is 1 (Thread 0x7f4b27c39700 (LWP 497157))]
(gdb) bt
#0 0x000055ce83a529ce in convert_run_to_efficient_container ()
#1 0x000055ce83a52a9f in convert_run_to_efficient_container_and_free ()
#2 0x000055ce83a5609b in array_run_container_xor ()
#3 0x000055ce83a5617f in array_run_container_ixor ()
#4 0x000055ce83a3f210 in roaring_bitmap_xor_inplace ()
#5 0x000055ce80017cdd in roaring::Roaring::operator^= (r=..., this=) at /var/local/thirdparty/installed/include/roaring/roaring.hh:273
#6 doris::detail::Roaring64Map::operator^= (r=..., this=0x55cedbf8acd0) at /data/doris-1.x/be/src/util/bitmap_value.h:327
#7 doris::BitmapValue::operator^= (this=0x55cec5054280, rhs=...) at /data/doris-1.x/be/src/util/bitmap_value.h:1475
#8 0x000055ce8002067c in doris::vectorized::BitmapXor::vector_vector (res_nulls=, res=..., input_rows_count=, col_size=2, argument_columns=0x7f4b27c31a50)
at /var/local/ldb-toolchain/include/c++/11/bits/stl_vector.h:1043
#9 doris::vectorized::FunctionBitMapVariadicdoris::vectorized::BitmapXor::execute_impl_internal (this=0x55cf03fa0d50, context=, block=..., arguments=..., result=,
input_rows_count=) at /data/doris-1.x/be/src/vec/functions/function_bitmap_variadic.cpp:230
#10 0x000055ce80020d44 in doris::vectorized::FunctionBitMapVariadicdoris::vectorized::BitmapXor::execute_impl (this=, context=, block=..., arguments=...,
result=, input_rows_count=302) at /data/doris-1.x/be/src/vec/functions/function_bitmap_variadic.cpp:184
#11 0x000055ce8051b2dc in doris::vectorized::DefaultExecutable::execute_impl (input_rows_count=302, result=2, arguments=..., block=..., context=0x55cf0e19fda0, this=0x55ced8814f70)
at /var/local/ldb-toolchain/include/c++/11/bits/shared_ptr_base.h:1290
#12 doris::vectorized::PreparedFunctionImpl::execute_without_low_cardinality_columns (this=this@entry=0x55ced8814f70, context=context@entry=0x55cf0e19fda0, block=..., args=..., result=2,
input_rows_count=302, dry_run=false) at /data/doris-1.x/be/src/vec/functions/function.cpp:244
#13 0x000055ce8051ad10 in doris::vectorized::PreparedFunctionImpl::default_implementation_for_nulls (this=this@entry=0x55ced8814f70, context=context@entry=0x55cf0e19fda0, block=..., args=...,
result=result@entry=8, input_rows_count=302, dry_run=false, executed=0x7f4b27c31e6f) at /data/doris-1.x/be/src/vec/functions/function.cpp:214
#14 0x000055ce8051b1e7 in doris::vectorized::PreparedFunctionImpl::execute_without_low_cardinality_columns (this=0x55ced8814f70, context=0x55cf0e19fda0, block=..., args=..., result=8,
input_rows_count=302, dry_run=false) at /data/doris-1.x/be/src/vec/functions/function.cpp:235
#15 0x000055ce8051c199 in doris::vectorized::PreparedFunctionImpl::execute (this=, context=, block=..., args=..., result=, input_rows_count=302, dry_run=false)
at /data/doris-1.x/be/src/vec/functions/function.cpp:265
#16 0x000055ce7ec17044 in doris::vectorized::IFunctionBase::execute (this=this@entry=0x55ced28f99b0, context=0x55cf0e19fda0, block=..., arguments=..., result=result@entry=8, input_rows_count=302,
dry_run=false) at /var/local/ldb-toolchain/include/c++/11/bits/shared_ptr_base.h:1290
#17 0x000055ce7fc88e36 in doris::vectorized::VectorizedFnCall::execute (this=0x55cee229dc00, context=0x55ceee9d0040, block=0x7f4b27c322b0, result_column_id=0x7f4b27c32120)
at /var/local/ldb-toolchain/include/c++/11/bits/stl_vector.h:1043
#18 0x000055ce7fc8b3a7 in doris::vectorized::VExprContext::execute (this=0x55ceee9d0040, block=block@entry=0x7f4b27c322b0, result_column_id=result_column_id@entry=0x7f4b27c32120)
at /data/doris-1.x/be/src/vec/exprs/vexpr_context.cpp:46
#19 0x000055ce7eb2e3ad in doris::vectorized::VUnionNode::materialize_block (this=this@entry=0x55ced5b4a300, src_block=src_block@entry=0x7f4b27c322b0, dst_block=dst_block@entry=0x7f4b27c32340)
at /var/local/ldb-toolchain/include/c++/11/bits/stl_vector.h:1061
#20 0x000055ce7eb2ebfa in doris::vectorized::VUnionNode::get_next_materialized (this=this@entry=0x55ced5b4a300, state=state@entry=0x55cef02bae00, block=block@entry=0x55cee38395f0)
at /data/doris-1.x/be/src/vec/exec/vunion_node.cpp:157
#21 0x000055ce7eb30ec9 in doris::vectorized::VUnionNode::get_next (this=0x55ced5b4a300, state=0x55cef02bae00, block=0x55cee38395f0, eos=0x55ceef34f079)
at /data/doris-1.x/be/src/vec/exec/vunion_node.cpp:243
#22 0x000055ce7d56f8b6 in doris::ExecNode::get_next_after_projects (this=0x55ced5b4a300, state=0x55cef02bae00, block=0x55cee38395f0, eos=eos@entry=0x55ceef34f079)
at /data/doris-1.x/be/src/exec/exec_node.cpp:855
#23 0x000055ce7d89a2c8 in doris::PlanFragmentExecutor::get_vectorized_internal (this=this@entry=0x55ceef34ef80, block=block@entry=0x7f4b27c327d0)
at /var/local/ldb-toolchain/include/c++/11/bits/unique_ptr.h:421
#24 0x000055ce7d89ce9b in doris::PlanFragmentExecutor::open_vectorized_internal (this=this@entry=0x55ceef34ef80) at /data/doris-1.x/be/src/runtime/plan_fragment_executor.cpp:308
#25 0x000055ce7d89e3fe in doris::PlanFragmentExecutor::open (this=this@entry=0x55ceef34ef80) at /data/doris-1.x/be/src/runtime/plan_fragment_executor.cpp:261
#26 0x000055ce7d876ad9 in doris::FragmentExecState::execute (this=0x55ceef34ef00) at /data/doris-1.x/be/src/runtime/fragment_mgr.cpp:260
#27 0x000055ce7d87a12e in doris::FragmentMgr::_exec_actual(std::shared_ptrdoris::FragmentExecState, std::function<void (doris::PlanFragmentExecutor*)>) (this=this@entry=0x55ce8d3b9400, exec_state=...,
cb=...) at /var/local/ldb-toolchain/include/c++/11/bits/shared_ptr_base.h:1290
#28 0x000055ce7d87a662 in operator() (__closure=) at /var/local/ldb-toolchain/include/c++/11/ext/atomicity.h:109
#29 std::__invoke_impl<void, doris::FragmentMgr::exec_plan_fragment(const doris::TExecPlanFragmentParams&, doris::FragmentMgr::FinishCallback)::<lambda()>&> (__f=...)
at /var/local/ldb-toolchain/include/c++/11/bits/invoke.h:61
#30 std::__invoke_r<void, doris::FragmentMgr::exec_plan_fragment(const doris::TExecPlanFragmentParams&, doris::FragmentMgr::FinishCallback)::<lambda()>&> (__fn=...)
at /var/local/ldb-toolchain/include/c++/11/bits/invoke.h:111
#31 std::_Function_handler<void(), doris::FragmentMgr::exec_plan_fragment(const doris::TExecPlanFragmentParams&, doris::FragmentMgr::FinishCallback)::<lambda()> >::_M_invoke(const std::_Any_data &) (
__functor=...) at /var/local/ldb-toolchain/include/c++/11/bits/std_function.h:291
#32 0x000055ce7db29cf5 in std::function<void ()>::operator()() const (this=) at /var/local/ldb-toolchain/include/c++/11/bits/std_function.h:556
#33 doris::FunctionRunnable::run (this=) at /data/doris-1.x/be/src/util/threadpool.cpp:46
#34 doris::ThreadPool::dispatch_thread (this=0x55ce8dee81c0) at /data/doris-1.x/be/src/util/threadpool.cpp:535
#35 0x000055ce7db1f14f in std::function<void ()>::operator()() const (this=0x55cece49ae18) at /var/local/ldb-toolchain/include/c++/11/bits/std_function.h:556
#36 doris::Thread::supervise_thread (arg=0x55cece49ae00) at /data/doris-1.x/be/src/util/thread.cpp:454
#37 0x00007f4d586c1ea5 in start_thread () from /lib64/libpthread.so.0
--Type for more, q to quit, c to continue without paging--
#38 0x00007f4d589d49fd in clone () from /lib64/libc.so.6

@lide-reed
Copy link
Contributor

It seems this pr caused above core

@lide-reed
Copy link
Contributor

#27409
#27411

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants