diff --git a/cpp/velox/CMakeLists.txt b/cpp/velox/CMakeLists.txt index f20275c56b44..55f45881b108 100644 --- a/cpp/velox/CMakeLists.txt +++ b/cpp/velox/CMakeLists.txt @@ -382,6 +382,13 @@ target_link_libraries(velox PUBLIC Folly::folly) find_re2() target_link_libraries(velox PUBLIC ${RE2_LIBRARY}) +# since https://github.com/facebookincubator/velox/commit/47970417ac92135e862c0fde350d4d60fa2f1423 +if(Stemmer_FOUND) + target_link_libraries(velox PUBLIC stemmer::stemmer) +else() + add_velox_dependency(velox "${VELOX_BUILD_PATH}/_deps/libstemmer/src/libstemmer/libstemmer.a") +endif() + if(ENABLE_GLUTEN_VCPKG) find_package(Thrift CONFIG) else() diff --git a/cpp/velox/memory/VeloxMemoryManager.cc b/cpp/velox/memory/VeloxMemoryManager.cc index 0d22a9d0891f..c8d13b871062 100644 --- a/cpp/velox/memory/VeloxMemoryManager.cc +++ b/cpp/velox/memory/VeloxMemoryManager.cc @@ -92,8 +92,19 @@ class ListenableArbitrator : public velox::memory::MemoryArbitrator { private: uint64_t growPoolLocked(velox::memory::MemoryPool* pool, uint64_t bytes) { + // Since + // https://github.com/facebookincubator/velox/pull/9557/files#diff-436e44b7374032f8f5d7eb45869602add6f955162daa2798d01cc82f8725724dL812-L820, + // We should pass bytes as parameter "reservationBytes" when calling ::grow. + const uint64_t freeBytes = pool->freeBytes(); + if (freeBytes >= bytes) { + bool reserved = pool->grow(0, bytes); + GLUTEN_CHECK( + reserved, + "Unexpected: Failed to reserve " + std::to_string(bytes) + + " bytes although there is enough space, free bytes: " + std::to_string(freeBytes)); + } listener_->allocationChanged(bytes); - return pool->grow(bytes); + return pool->grow(bytes, bytes); } uint64_t releaseMemoryLocked(velox::memory::MemoryPool* pool, uint64_t bytes) { diff --git a/ep/build-velox/src/get_velox.sh b/ep/build-velox/src/get_velox.sh index 1a799200d9a9..dbc2aaa263fc 100755 --- a/ep/build-velox/src/get_velox.sh +++ b/ep/build-velox/src/get_velox.sh @@ -17,7 +17,7 @@ set -exu VELOX_REPO=https://github.com/oap-project/velox.git -VELOX_BRANCH=2024_04_26_2 +VELOX_BRANCH=2024_04_28 VELOX_HOME="" #Set on run gluten on HDFS