Closed adofsauron closed 1 year ago
What are the static and dynamic flows of the aggregate's overall architecture
From the analysis of module layer, it can be divided into several modules
What is the focus of the responsibilities of different modules, and what are the boundaries of interaction between modules
How do classes interact within a single module, and what are the relationships between classes? Pan China? A combination? Aggregation? CRTP(Singular Template Programming)?
temporary_data_merge_threads_=16) at ../src/Processors/Transforms/AggregatingTransform.cpp:397
__args=@0x7f332b193228: 16, __args=@0x7f332b193228: 16, __args=@0x7f332b193228: 16, __args=@0x7f332b193228: 16) at ../contrib/llvm-project/libcxx/include/__memory/construct_at.h:35
__args=@0x7f332b193228: 16) at ../contrib/llvm-project/libcxx/include/__memory/allocator_traits.h:298
__args=@0x7f332b193228: 16, __args=@0x7f332b193228: 16, __args=@0x7f332b193228: 16, __args=@0x7f332b193228: 16, __args=@0x7f332b193228: 16)
at ../contrib/llvm-project/libcxx/include/__memory/shared_ptr.h:292
__args=@0x7f332b193228: 16, __args=@0x7f332b193228: 16, __args=@0x7f332b193228: 16, __args=@0x7f332b193228: 16, __args=@0x7f332b193228: 16, __args=@0x7f332b193228: 16)
at ../contrib/llvm-project/libcxx/include/__memory/shared_ptr.h:953
__args=@0x7f332b193228: 16, __args=@0x7f332b193228: 16) at ../contrib/llvm-project/libcxx/include/__memory/shared_ptr.h:962
this=0x7f332b226be0, header=...) at ../src/Processors/QueryPlan/AggregatingStep.cpp:421
(__f=..., __args=...) at ../contrib/llvm-project/libcxx/include/__functional/invoke.h:394
at ../contrib/llvm-project/libcxx/include/__functional/function.h:235
this=0x7f33a43e9108, __args=...) at ../contrib/llvm-project/libcxx/include/__functional/function.h:848
at ../contrib/llvm-project/libcxx/include/__functional/function.h:1187
--Type
at ../contrib/llvm-project/libcxx/include/__functional/invoke.h:394
__args=@0x7f33a43e8b1c: DB::Pipe::StreamType::Main) at ../contrib/llvm-project/libcxx/include/__functional/invoke.h:470
__arg=@0x7f33a43e8b1c: DB::Pipe::StreamType::Main, __arg=@0x7f33a43e8b1c: DB::Pipe::StreamType::Main) at ../contrib/llvm-project/libcxx/include/__functional/function.h:235
__args=DB::Pipe::StreamType::Main) at ../contrib/llvm-project/libcxx/include/__functional/function.h:716
at ../contrib/llvm-project/libcxx/include/__functional/function.h:848
this=0x7f33a43e8e80, __arg=DB::Pipe::StreamType::Main, __arg=DB::Pipe::StreamType::Main) at ../contrib/llvm-project/libcxx/include/__functional/function.h:1187
getter=...) at ../src/QueryPipeline/Pipe.cpp:658
at ../src/QueryPipeline/Pipe.cpp:668
getter=...) at ../src/QueryPipeline/QueryPipelineBuilder.cpp:128
begin=0x7f332b178000 "select\nc_name,\nc_custkey,\no_orderkey,\no_orderdate,\no_totalprice,\nsum(l_quantity)\nfrom\ncustomer,\norders,\nlineitem\nwhere\nc_custkey = o_custkey\nand o_orderkey = l_orderkey\ngroup by\nc_name,\nc_custkey,\no_o"..., end=0x7f332b17811c "", context=..., internal=false, stage=DB::QueryProcessingStage::Complete, istr=0x0)
at ../src/Interpreters/executeQuery.cpp:715
--Type
Why write aggregate data to disk files and what is the purpose of aggregating it into separate pipelines
An aggregation is done with store of temporary data on the disk, and they need to be merged in a memory efficient way.
The new size fits into the last MemoryChunk, so just alloc the additional size. We can alloc without alignment here, because it only applies to the start of the range, and we don't change it.
Begin or expand a contiguous range of memory. 'range_start' is the start of range. If nullptr, a new range is allocated. If there is no space in the current MemoryChunk to expand the range, the entire range is copied to a new, bigger memory MemoryChunk, and the va of 'range_start' is updated. If the optional 'start_alignment' is specified, the start of range is kept aligned to this value.
NOTE This method is usable only for the last allocation made on this Arena. For earlier allocations, see 'realloc' method.
Memory pool to append something. For example, short strings. Usage scenario:
/// If it is claimed that the zero key can not be inserted into the table.
if constexpr (!Cell::need_zero_value_storage)
return false;
if (unlikely(Cell::isZero(x, *this)))
{
it = this->zeroValue();
if (!this->hasZero())
{
++m_size;
this->setHasZero();
this->zeroValue()->setHash(hash_value);
inserted = true;
}
else
inserted = false;
return true;
}
return false;
During processing of row #i we will prefetch HashTable cell for row #(i + prefetch_look_ahead).
for (size_t i = row_begin; i < row_end; ++i)
if (places[i])
static_cast<const Derived *>(this)->add(places[i] + place_offset, columns, i, arena);
#0 0x0000000002dcc26e in Tianmu::mm::TCMHeap::alloc (this=0x8b3ace0, size=1408) at /root/work/stonedb-dev-20230213/storage/tianmu/mm/tcm_heap_policy.cpp:76
#1 0x0000000002db8ccc in Tianmu::mm::MemoryHandling::alloc (this=0x825bf00, size=1408, type=Tianmu::mm::BLOCK_TYPE::BLOCK_HUGE, owner=0x7f4a7ca5b030,
nothrow=false) at /root/work/stonedb-dev-20230213/storage/tianmu/mm/memory_handling_policy.cpp:206
#2 0x0000000002dcd992 in Tianmu::mm::TraceableObject::alloc (this=0x7f4a7ca5b030, size=1408, type=Tianmu::mm::BLOCK_TYPE::BLOCK_HUGE, nothrow=false)
at /root/work/stonedb-dev-20230213/storage/tianmu/mm/traceable_object.cpp:55
#3 0x000000000312db54 in Tianmu::core::MemBlockManager::GetBlock (this=0x7f4a7ca5b030)
at /root/work/stonedb-dev-20230213/storage/tianmu/core/blocked_mem_table.cpp:45
#4 0x000000000312e3e1 in Tianmu::core::BlockedRowMemStorage::AddEmptyRow (this=0x7f4a7ca6ce98)
at /root/work/stonedb-dev-20230213/storage/tianmu/core/blocked_mem_table.cpp:160
#5 0x00000000031162aa in Tianmu::core::ValueMatching_HashTable::FindCurrentRow (this=0x7f4a7ca6cdf0, input_buffer=0x7f4a7cb73a60 "", row=@0x7f52037ecbf8: 0,
add_if_new=true) at /root/work/stonedb-dev-20230213/storage/tianmu/core/value_matching_hashtable.cpp:202
#6 0x0000000002fd947a in Tianmu::core::GroupTable::FindCurrentRow (this=0x7f52497be2a8, row=@0x7f52037ecbf8: 0)
at /root/work/stonedb-dev-20230213/storage/tianmu/core/group_table.cpp:412
#7 0x0000000002f84b34 in Tianmu::core::GroupByWrapper::FindCurrentRow (this=0x7f52497be1e0, row=@0x7f52037ecbf8: 0)
at /root/work/stonedb-dev-20230213/storage/tianmu/core/groupby_wrapper.h:109
#8 0x0000000002f811f9 in Tianmu::core::AggregationAlgorithm::AggregatePackrow (this=0x7f52497be570, gbw=..., mit=0x7f52037ecd20, cur_tuple=0,
mem_used=0x7f52497bdc70) at /root/work/stonedb-dev-20230213/storage/tianmu/core/aggregation_algorithm.cpp:618
#9 0x0000000002f8238e in Tianmu::core::AggregationWorkerEnt::TaskAggrePacks (this=0x7f52497bdc80, taskIterator=0x7f4a7ca96b80, dims=0x7f52497bd800,
mit=0x7f52497bdcd0, task=0x7f4a7ca968f0, gbw=0x7f52497be1e0, ci=0x7f4a7ca39720, mem_used=0x7f52497bdc70)
at /root/work/stonedb-dev-20230213/storage/tianmu/core/aggregation_algorithm.cpp:934
#10 0x0000000002f92efa in _ZSt13__invoke_implIvRMN6Tianmu4core20AggregationWorkerEntEFvPNS1_10MIIteratorEPNS1_15DimensionVectorES4_PNS1_5CTaskEPNS1_14GroupByWrapperEPNS1_11TransactionEPmERPS2_IRS4_RS6_SJ_RS8_RSA_RSC_RSD_EET_St21__invoke_memfun_derefOT0_OT1_DpOT2_ (__f=
@0x7f4a7ca68e48: (void (Tianmu::core::AggregationWorkerEnt::*)(Tianmu::core::AggregationWorkerEnt * const, Tianmu::core::MIIterator *, Tianmu::core::DimensionVector *, Tianmu::core::MIIterator *, Tianmu::core::CTask *, Tianmu::core::GroupByWrapper *, Tianmu::core::Transaction *, unsigned long *)) 0x2f8220e <Tianmu::core::AggregationWorkerEnt::TaskAggrePacks(Tianmu::core::MIIterator*, Tianmu::core::DimensionVector*, Tianmu::core::MIIterator*, Tianmu::core::CTask*, Tianmu::core::GroupByWrapper*, Tianmu::core::Transaction*, unsigned long*)>, __t=@0x7f4a7ca68e90: 0x7f52497bdc80) at /usr/include/c++/8/bits/invoke.h:73
#11 0x0000000002f92a55 in std::__invoke<void (Tianmu::core::AggregationWorkerEnt::*&)(Tianmu::core::MIIterator*, Tianmu::core::DimensionVector*, Tianmu::core::MIIterator*, Tianmu::core::CTask*, Tianmu::core::GroupByWrapper*, Tianmu::core::Transaction*, unsigned long*), Tianmu::core::AggregationWorkerEnt*&, Tianmu::core::MIIterator*&, Tianmu::core::DimensionVector*&, Tianmu::core::MIIterator*&, Tianmu::core::CTask*&, Tianmu::core::GroupByWrapper*&, Tianmu::core::Transaction*&, unsigned long*&> (__fn=
@0x7f4a7ca68e48: (void (Tianmu::core::AggregationWorkerEnt::*)(Tianmu::core::AggregationWorkerEnt * const, Tianmu::core::MIIterator *, Tianmu::core::DimensionVector *, Tianmu::core::MIIterator *, Tianmu::core::CTask *, Tianmu::core::GroupByWrapper *, Tianmu::core::Transaction *, unsigned long *)) 0x2f8220e <Tianmu::core::AggregationWorkerEnt::TaskAggrePacks(Tianmu::core::MIIterator*, Tianmu::core::DimensionVector*, Tianmu::core::MIIterator*, Tianmu::core::CTask*, Tianmu::core::GroupByWrapper*, Tianmu::core::Transaction*, unsigned long*)>) at /usr/include/c++/8/bits/invoke.h:95
#12 0x0000000002f9244e in std::_Bind<void (Tianmu::core::AggregationWorkerEnt::*(Tianmu::core::AggregationWorkerEnt*, Tianmu::core::MIIterator*, Tianmu::core::DimensionVector*, Tianmu::core::MIIterator*, Tianmu::core::CTask*, Tianmu::core::GroupByWrapper*, Tianmu::core::Transaction*, unsigned long*))(Tianmu::core::MIIterator*, Tianmu::core::DimensionVector*, Tianmu::core::MIIterator*, Tianmu::core::CTask*, Tianmu::core::GroupByWrapper*, Tianmu::core::Transaction*, unsigned long*)>::__call<void, , 0ul, 1ul, 2ul, 3ul, 4ul, 5ul, 6ul, 7ul>(std::tuple<>&&, std::_Index_tuple<0ul, 1ul, 2ul, 3ul, 4ul, 5ul, 6ul, 7ul>) (this=0x7f4a7ca68e48,
__args=empty std::tuple) at /usr/include/c++/8/functional:400
#13 0x0000000002f9179a in std::_Bind<void (Tianmu::core::AggregationWorkerEnt::*(Tianmu::core::AggregationWorkerEnt*, Tianmu::core::MIIterator*, Tianmu::core::DimensionVector*, Tianmu::core::MIIterator*, Tianmu::core::CTask*, Tianmu::core::GroupByWrapper*, Tianmu::core::Transaction*, unsigned long*))(Tianmu::core::MIIterator*, Tianmu::core::DimensionVector*, Tianmu::core::MIIterator*, Tianmu::core::CTask*, Tianmu::core::GroupByWrapper*, Tianmu::core::Transaction*, unsigned long*)>::operator()<, void>() (this=0x7f4a7ca68e48) at /usr/include/c++/8/functional:484
#14 0x0000000002f90f4d in std::__invoke_impl<void, std::_Bind<void (Tianmu::core::AggregationWorkerEnt::*(Tianmu::core::AggregationWorkerEnt*, Tianmu::core::MIItera--Type <RET> for more, q to quit, c to continue without paging--
tor*, Tianmu::core::DimensionVector*, Tianmu::core::MIIterator*, Tianmu::core::CTask*, Tianmu::core::GroupByWrapper*, Tianmu::core::Transaction*, unsigned long*))(Tianmu::core::MIIterator*, Tianmu::core::DimensionVector*, Tianmu::core::MIIterator*, Tianmu::core::CTask*, Tianmu::core::GroupByWrapper*, Tianmu::core::Transaction*, unsigned long*)>&>(std::__invoke_other, std::_Bind<void (Tianmu::core::AggregationWorkerEnt::*(Tianmu::core::AggregationWorkerEnt*, Tianmu::core::MIIterator*, Tianmu::core::DimensionVector*, Tianmu::core::MIIterator*, Tianmu::core::CTask*, Tianmu::core::GroupByWrapper*, Tianmu::core::Transaction*, unsigned long*))(Tianmu::core::MIIterator*, Tianmu::core::DimensionVector*, Tianmu::core::MIIterator*, Tianmu::core::CTask*, Tianmu::core::GroupByWrapper*, Tianmu::core::Transaction*, unsigned long*)>&) (__f=...) at /usr/include/c++/8/bits/invoke.h:60
#15 0x0000000002f90848 in std::__invoke<std::_Bind<void (Tianmu::core::AggregationWorkerEnt::*(Tianmu::core::AggregationWorkerEnt*, Tianmu::core::MIIterator*, Tianmu::core::DimensionVector*, Tianmu::core::MIIterator*, Tianmu::core::CTask*, Tianmu::core::GroupByWrapper*, Tianmu::core::Transaction*, unsigned long*))(Tianmu::core::MIIterator*, Tianmu::core::DimensionVector*, Tianmu::core::MIIterator*, Tianmu::core::CTask*, Tianmu::core::GroupByWrapper*, Tianmu::core::Transaction*, unsigned long*)>&>(std::_Bind<void (Tianmu::core::AggregationWorkerEnt::*(Tianmu::core::AggregationWorkerEnt*, Tianmu::core::MIIterator*, Tianmu::core::DimensionVector*, Tianmu::core::MIIterator*, Tianmu::core::CTask*, Tianmu::core::GroupByWrapper*, Tianmu::core::Transaction*, unsigned long*))(Tianmu::core::MIIterator*, Tianmu::core::DimensionVector*, Tianmu::core::MIIterator*, Tianmu::core::CTask*, Tianmu::core::GroupByWrapper*, Tianmu::core::Transaction*, unsigned long*)>&) (__fn=...)
at /usr/include/c++/8/bits/invoke.h:95
#16 0x0000000002f901c7 in std::__future_base::_Task_state<std::_Bind<void (Tianmu::core::AggregationWorkerEnt::*(Tianmu::core::AggregationWorkerEnt*, Tianmu::core::MIIterator*, Tianmu::core::DimensionVector*, Tianmu::core::MIIterator*, Tianmu::core::CTask*, Tianmu::core::GroupByWrapper*, Tianmu::core::Transaction*, unsigned long*))(Tianmu::core::MIIterator*, Tianmu::core::DimensionVector*, Tianmu::core::MIIterator*, Tianmu::core::CTask*, Tianmu::core::GroupByWrapper*, Tianmu::core::Transaction*, unsigned long*)>, std::allocator<int>, void ()>::_M_run()::{lambda()#1}::operator()() const (this=0x7f4a7ca68e20) at /usr/include/c++/8/future:1421
#17 0x0000000002f91841 in std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<void (Tianmu::core::AggregationWorkerEnt::*(Tianmu::core::AggregationWorkerEnt*, Tianmu::core::MIIterator*, Tianmu::core::DimensionVector*, Tianmu::core::MIIterator*, Tianmu::core::CTask*, Tianmu::core::GroupByWrapper*, Tianmu::core::Transaction*, unsigned long*))(Tianmu::core::MIIterator*, Tianmu::core::DimensionVector*, Tianmu::core::MIIterator*, Tianmu::core::CTask*, Tianmu::core::GroupByWrapper*, Tianmu::core::Transaction*, unsigned long*)>, std::allocator<int>, void ()>::_M_run()::{lambda()#1}, void>::operator()() const (this=0x7f52037ed590) at /usr/include/c++/8/future:1362
#18 0x0000000002f90fcc in std::_Function_handler<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> (), std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<void (Tianmu::core::AggregationWorkerEnt::*(Tianmu::core::AggregationWorkerEnt*, Tianmu::core::MIIterator*, Tianmu::core::DimensionVector*, Tianmu::core::MIIterator*, Tianmu::core::CTask*, Tianmu::core::GroupByWrapper*, Tianmu::core::Transaction*, unsigned long*))(Tianmu::core::MIIterator*, Tianmu::core::DimensionVector*, Tianmu::core::MIIterator*, Tianmu::core::CTask*, Tianmu::core::GroupByWrapper*, Tianmu::core::Transaction*, unsigned long*)>, std::allocator<int>, void ()>::_M_run()::{lambda()#1}, void> >::_M_invoke(std::_Any_data const&) (__functor=...) at /usr/include/c++/8/bits/std_function.h:283
#19 0x0000000002c4f6bf in std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>::operator()() const (
this=0x7f52037ed590) at /usr/include/c++/8/bits/std_function.h:687
#20 0x0000000002c4888b in std::__future_base::_State_baseV2::_M_do_set(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*) (this=0x7f4a7ca68e20, __f=0x7f52037ed590, __did_set=0x7f52037ed4f7) at /usr/include/c++/8/future:561
#21 0x0000000002c5eed1 in std::__invoke_impl<void, void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2<std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>*> (__f=
@0x7f52037ed510: (void (std::__future_base::_State_baseV2::*)(std::__future_base::_State_baseV2 * const, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>()> *, bool *)) 0x2c48864 <std::__future_base::_State_baseV2::_M_do_set(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*)>, __t=@0x7f52037ed508: 0x7f4a7ca68e20) at /usr/include/c++/8/bits/invoke.h:73
#22 0x0000000002c5710f in std::__invoke<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(void (std::__future_base::_State_baseV2::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&) (__fn=
@0x7f52037ed510: (void (std::__future_base::_State_baseV2::*)(std::__future_base::_State_baseV2 * const, std::function<std::unique_ptr<std::__future_base::_Resu--Type <RET> for more, q to quit, c to continue without paging--
lt_base, std::__future_base::_Result_base::_Deleter>()> *, bool *)) 0x2c48864 <std::__future_base::_State_baseV2::_M_do_set(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*)>) at /usr/include/c++/8/bits/invoke.h:95
#23 0x0000000002c4f2bc in std::call_once<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(std::once_flag&, void (std::__future_base::_State_baseV2::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&)::{lambda()#1}::operator()() const (this=0x7f52037ed480) at /usr/include/c++/8/mutex:672
#24 0x0000000002c4f327 in std::call_once<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(std::once_flag&, void (std::__future_base::_State_baseV2::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&)::{lambda()#2}::operator()() const (this=0x0) at /usr/include/c++/8/mutex:677
#25 0x0000000002c4f338 in std::call_once<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(std::once_flag&, void (std::__future_base::_State_baseV2::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&)::{lambda()#2}::_FUN() () at /usr/include/c++/8/mutex:677
#26 0x00007f5299101e67 in __pthread_once_slow () from /lib64/libpthread.so.0
#27 0x0000000002c42faf in __gthread_once (__once=0x7f4a7ca68e38, __func=0x7f52993d3b90 <__once_proxy>)
at /usr/include/c++/8/x86_64-redhat-linux/bits/gthr-default.h:699
#28 0x0000000002c4f3e2 in std::call_once<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(std::once_flag&, void (std::__future_base::_State_baseV2::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&) (__once=..., __f=
@0x7f52037ed510: (void (std::__future_base::_State_baseV2::*)(std::__future_base::_State_baseV2 * const, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>()> *, bool *)) 0x2c48864 <std::__future_base::_State_baseV2::_M_do_set(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*)>) at /usr/include/c++/8/mutex:684
#29 0x0000000002c484d3 in std::__future_base::_State_baseV2::_M_set_result(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>, bool) (this=0x7f4a7ca68e20, __res=..., __ignore_failure=false) at /usr/include/c++/8/future:401
#30 0x0000000002f90226 in std::__future_base::_Task_state<std::_Bind<void (Tianmu::core::AggregationWorkerEnt::*(Tianmu::core::AggregationWorkerEnt*, Tianmu::core::MIIterator*, Tianmu::core::DimensionVector*, Tianmu::core::MIIterator*, Tianmu::core::CTask*, Tianmu::core::GroupByWrapper*, Tianmu::core::Transaction*, unsigned long*))(Tianmu::core::MIIterator*, Tianmu::core::DimensionVector*, Tianmu::core::MIIterator*, Tianmu::core::CTask*, Tianmu::core::GroupByWrapper*, Tianmu::core::Transaction*, unsigned long*)>, std::allocator<int>, void ()>::_M_run() (this=0x7f4a7ca68e20) at /usr/include/c++/8/future:1423
#31 0x0000000002c5c48d in std::packaged_task<void ()>::operator()() (this=0x7f4a7ca98220) at /usr/include/c++/8/future:1556
#32 0x0000000002f8630a in Tianmu::utils::thread_pool::add_task<void (Tianmu::core::AggregationWorkerEnt::*)(Tianmu::core::MIIterator*, Tianmu::core::DimensionVector*, Tianmu::core::MIIterator*, Tianmu::core::CTask*, Tianmu::core::GroupByWrapper*, Tianmu::core::Transaction*, unsigned long*), Tianmu::core::AggregationWorkerEnt*, Tianmu::core::MIIterator*, Tianmu::core::DimensionVector*, Tianmu::core::MIIterator*, Tianmu::core::CTask*, Tianmu::core::GroupByWrapper*&, Tianmu::core::Transaction*&, unsigned long*&>(void (Tianmu::core::AggregationWorkerEnt::*&&)(Tianmu::core::MIIterator*, Tianmu::core::DimensionVector*, Tianmu::core::MIIterator*, Tianmu::core::CTask*, Tianmu::core::GroupByWrapper*, Tianmu::core::Transaction*, unsigned long*), Tianmu::core::AggregationWorkerEnt*&&, Tianmu::core::MIIterator*&&, Tianmu::core::DimensionVector*&&, Tianmu::core::MIIterator*&&, Tianmu::core::CTask*&&, Tianmu::core::GroupByWrapper*&, Tianmu::core::Transaction*&, unsigned long*&)::{lambda()#1}::operator()() const (this=0x7f4a7ca98260) at /root/work/stonedb-dev-20230213/storage/tianmu/util/thread_pool.h:94
#33 0x0000000002f8bf69 in std::_Function_handler<void (), Tianmu::utils::thread_pool::add_task<void (Tianmu::core::AggregationWorkerEnt::*)(Tianmu::core::MIIterator*, Tianmu::core::DimensionVector*, Tianmu::core::MIIterator*, Tianmu::core::CTask*, Tianmu::core::GroupByWrapper*, Tianmu::core::Transaction*, unsigned long*), Tian--Type <RET> for more, q to quit, c to continue without paging--
mu::core::AggregationWorkerEnt*, Tianmu::core::MIIterator*, Tianmu::core::DimensionVector*, Tianmu::core::MIIterator*, Tianmu::core::CTask*, Tianmu::core::GroupByWrapper*&, Tianmu::core::Transaction*&, unsigned long*&>(void (Tianmu::core::AggregationWorkerEnt::*&&)(Tianmu::core::MIIterator*, Tianmu::core::DimensionVector*, Tianmu::core::MIIterator*, Tianmu::core::CTask*, Tianmu::core::GroupByWrapper*, Tianmu::core::Transaction*, unsigned long*), Tianmu::core::AggregationWorkerEnt*&&, Tianmu::core::MIIterator*&&, Tianmu::core::DimensionVector*&&, Tianmu::core::MIIterator*&&, Tianmu::core::CTask*&&, Tianmu::core::GroupByWrapper*&, Tianmu::core::Transaction*&, unsigned long*&)::{lambda()#1}>::_M_invoke(std::_Any_data const&) (__functor=...) at /usr/include/c++/8/bits/std_function.h:297
#34 0x0000000002c4e1a4 in std::function<void ()>::operator()() const (this=0x7f52037ed6a0) at /usr/include/c++/8/bits/std_function.h:687
#35 0x0000000002c48d35 in Tianmu::utils::thread_pool::thread_pool(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long)::{lambda()#1}::operator()() const (__closure=0x827e7b8) at /root/work/stonedb-dev-20230213/storage/tianmu/util/thread_pool.h:61
#36 0x0000000002c6db9c in std::__invoke_impl<void, Tianmu::utils::thread_pool::thread_pool(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long)::{lambda()#1}>(std::__invoke_other, Tianmu::utils::thread_pool::thread_pool(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long)::{lambda()#1}&&) (__f=...) at /usr/include/c++/8/bits/invoke.h:60
#37 0x0000000002c66f47 in std::__invoke<Tianmu::utils::thread_pool::thread_pool(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long)::{lambda()#1}>(std::__invoke_result&&, (Tianmu::utils::thread_pool::thread_pool(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long)::{lambda()#1}&&)...) (__fn=...) at /usr/include/c++/8/bits/invoke.h:95
#38 0x0000000002c7c4a0 in std::thread::_Invoker<std::tuple<Tianmu::utils::thread_pool::thread_pool(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long)::{lambda()#1}> >::_M_invoke<0ul>(std::_Index_tuple<0ul>) (this=0x827e7b8) at /usr/include/c++/8/thread:244
#39 0x0000000002c7bdf5 in std::thread::_Invoker<std::tuple<Tianmu::utils::thread_pool::thread_pool(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long)::{lambda()#1}> >::operator()() (this=0x827e7b8) at /usr/include/c++/8/thread:253
#40 0x0000000002c7af2c in std::thread::_State_impl<std::thread::_Invoker<std::tuple<Tianmu::utils::thread_pool::thread_pool(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long)::{lambda()#1}> > >::_M_run() (this=0x827e7b0) at /usr/include/c++/8/thread:196
#41 0x00007f52993d4b13 in execute_native_thread_routine () from /lib64/libstdc++.so.6
#42 0x00007f52990fa1ca in start_thread () from /lib64/libpthread.so.0
#43 0x00007f5296052e73 in clone () from /lib64/libc.so.6
Feb 27 10:42:44 kevin kernel: Out of memory: Killed process 4167 (mysqld) total-vm:57281236kB, anon-rss:15482648kB, file-rss:0kB, shmem-rss:0kB, UID:1001 pgtables:100820kB oom_score_adj:0
When the disk space is sufficient, the system runs properly. Note that the physical memory is only 4GB. When the available memory is less than 1GB, memory mapping to disk files occurs
7fc71f1ce000-7fce9f1ce000 rw-s 00000000 08:02 3670018 /tmp/tianmuhuge.12039
Abstract:
TIANMU Engine - Aggregate operation intermediate results cache disk files to avoid OOM- requirements analysis
Related ISSUE: https://github.com/stoneatom/stonedb/issues/21
Note of context:
The results of the current aggregate operation are cached in the in-memory HASH. Once the amount of data exceeds the RAM, the OOM occurs.
If the data volume exceeds RAM, convert it to disk file storage to avoid OOM
Functional Requirements:
1. The HASH result of the aggregation operation is cached in the disk file and properly participates in the operation
When the intermediate result exceeds RAM
Performance requirements:
1. The compression ratio of the cache file size to the original data content, and the ratio of disk space to memory
Influence compression algorithm
2. Disk cache file write speed and read speed
Standard disk hardware
It affects the speed of aggregation operations and the rules for writing and reading disk cache files
3. The impact on the performance of aggregation operations
Development cycle:
TODO: