Skip to content
Open
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
6 changes: 5 additions & 1 deletion cpp/velox/memory/GlutenDirectBufferedInput.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ class GlutenDirectBufferedInput : public facebook::velox::dwio::common::DirectBu

~GlutenDirectBufferedInput() override {
requests_.clear();
for (auto& load : coalescedLoads_) {
Copy link
Member

Choose a reason for hiding this comment

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

Can we unify the two loops into one?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I intentionally moved this forward to cancel the load as early as possible, trying to reduce wait time. Thanks.

if (load->state() == facebook::velox::cache::CoalescedLoad::State::kPlanned) {
load->cancel();
}
}
for (auto& load : coalescedLoads_) {
if (load->state() == facebook::velox::cache::CoalescedLoad::State::kLoading) {
folly::SemiFuture<bool> waitFuture(false);
Expand All @@ -56,7 +61,6 @@ class GlutenDirectBufferedInput : public facebook::velox::dwio::common::DirectBu
std::move(waitFuture).via(&exec).wait();
}
}
load->cancel();
}
coalescedLoads_.clear();
}
Expand Down