Skip to content

Commit

Permalink
save work
Browse files Browse the repository at this point in the history
Signed-off-by: xufei <xufeixw@mail.ustc.edu.cn>
  • Loading branch information
windtalker committed Jul 18, 2023
1 parent 4ba4079 commit 5fe7e36
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
3 changes: 1 addition & 2 deletions dbms/src/Interpreters/Aggregator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -899,8 +899,7 @@ void Aggregator::spill(AggregatedDataVariants & data_variants, size_t thread_num
data_variants.aggregates_pools = Arenas(1, std::make_shared<Arena>());
data_variants.aggregates_pool = data_variants.aggregates_pools.back().get();
data_variants.without_key = nullptr;
auto size_bytes = data_variants.bytesCount();
agg_spill_context->updatePerThreadRevocableMemory(data_variants.revokableBytes(), thread_num);
agg_spill_context->updatePerThreadRevocableMemory(data_variants.revocableBytes(), thread_num);
}

template <typename Method>
Expand Down
2 changes: 1 addition & 1 deletion dbms/src/Interpreters/Aggregator.h
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ struct AggregatedDataVariants : private boost::noncopyable
}
}

size_t revokableBytes() const
size_t revocableBytes() const
{
if (empty())
return 0;
Expand Down
6 changes: 3 additions & 3 deletions dbms/src/Interpreters/Join.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ void Join::insertFromBlock(const Block & block, size_t stream_index)
const auto & join_partition = partitions[i];
auto partition_lock = join_partition->lockPartition();
partitions[i]->insertBlockForBuild(std::move(dispatch_blocks[i]));
if (hash_join_spill_context->updatePartitionRevocableMemory(force_spill_partition_blocks, i, join_partition->revokableBytes()))
if (hash_join_spill_context->updatePartitionRevocableMemory(force_spill_partition_blocks, i, join_partition->revocableBytes()))
blocks_to_spill = join_partition->trySpillBuildPartition(partition_lock);
else
stored_block = join_partition->getLastBuildBlock();
Expand All @@ -457,7 +457,7 @@ void Join::insertFromBlock(const Block & block, size_t stream_index)
{
join_partition->addMemoryUsage(byte_after_insert - byte_before_insert);
}
auto ret = hash_join_spill_context->updatePartitionRevocableMemory(force_spill_partition_blocks, i, join_partition->revokableBytes());
auto ret = hash_join_spill_context->updatePartitionRevocableMemory(force_spill_partition_blocks, i, join_partition->revocableBytes());
/// todo remove this after query level memory control
RUNTIME_CHECK_MSG(ret != true, "Join spill should not triggered here");
continue;
Expand Down Expand Up @@ -1903,7 +1903,7 @@ void Join::dispatchProbeBlock(Block & block, PartitionBlocks & partition_blocks_
if (getPartitionSpilled(i))
{
partitions[i]->insertBlockForProbe(std::move(partition_blocks[i]));
if (hash_join_spill_context->updatePartitionRevocableMemory(false, i, partitions[i]->revokableBytes()))
if (hash_join_spill_context->updatePartitionRevocableMemory(false, i, partitions[i]->revocableBytes()))
blocks_to_spill = partitions[i]->trySpillProbePartition(partition_lock);
need_spill = true;
}
Expand Down
2 changes: 1 addition & 1 deletion dbms/src/Interpreters/JoinPartition.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ class JoinPartition
return pool;
}
size_t getMemoryUsage() const { return memory_usage; }
size_t revokableBytes() const
size_t revocableBytes() const
{
if (build_partition.rows > 0 || probe_partition.rows > 0)
return memory_usage;
Expand Down

0 comments on commit 5fe7e36

Please sign in to comment.