File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,14 @@ class GlutenDirectBufferedInput : public facebook::velox::dwio::common::DirectBu
4848
4949 ~GlutenDirectBufferedInput () override {
5050 requests_.clear ();
51+ // Cancel all the planned loads as soon as possible to avoid unnecessary IO.
52+ for (auto & load : coalescedLoads_) {
53+ if (load->state () == facebook::velox::cache::CoalescedLoad::State::kPlanned ) {
54+ load->cancel ();
55+ }
56+ }
57+ // Ensure all the loadings can finish in the TableScan destructor to avoid the issue that the load is still running
58+ // when the VeloxMemoryManager used by the whole task is trying to destruct.
5159 for (auto & load : coalescedLoads_) {
5260 if (load->state () == facebook::velox::cache::CoalescedLoad::State::kLoading ) {
5361 folly::SemiFuture<bool > waitFuture (false );
@@ -56,7 +64,6 @@ class GlutenDirectBufferedInput : public facebook::velox::dwio::common::DirectBu
5664 std::move (waitFuture).via (&exec).wait ();
5765 }
5866 }
59- load->cancel ();
6067 }
6168 coalescedLoads_.clear ();
6269 }
You can’t perform that action at this time.
0 commit comments