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

Revert "Refine cancel for read thread stream (#8511)" (#8541) #8544

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 5 additions & 15 deletions dbms/src/Storages/DeltaMerge/ReadThread/UnorderedInputStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,25 +56,17 @@ class UnorderedInputStream : public IProfilingBlockInputStream
LOG_DEBUG(log, "Created, pool_id={} ref_no={}", task_pool->poolId(), ref_no);
}

void cancel(bool /*kill*/) override { decreaseRefCount(true); }

~UnorderedInputStream() override { decreaseRefCount(false); }
~UnorderedInputStream() override
{
task_pool->decreaseUnorderedInputStreamRefCount();
LOG_DEBUG(log, "Destroy, pool_id={} ref_no={}", task_pool->poolId(), ref_no);
}

String getName() const override { return NAME; }

Block getHeader() const override { return header; }

protected:
void decreaseRefCount(bool is_cancel)
{
bool ori = false;
if (is_stopped.compare_exchange_strong(ori, true))
{
task_pool->decreaseUnorderedInputStreamRefCount();
LOG_DEBUG(log, "{}, pool_id={} ref_no={}", is_cancel ? "Cancel" : "Destroy", task_pool->poolId(), ref_no);
}
}

Block readImpl() override
{
FilterPtr filter_ignored;
Expand Down Expand Up @@ -137,7 +129,5 @@ class UnorderedInputStream : public IProfilingBlockInputStream
LoggerPtr log;
int64_t ref_no;
bool task_pool_added;

std::atomic_bool is_stopped = false;
};
} // namespace DB::DM