Skip to content

Commit

Permalink
Fix MockSharedArbitrationTest.ensureMemoryPoolMaxCapacity
Browse files Browse the repository at this point in the history
  • Loading branch information
tanjialiang committed Nov 7, 2024
1 parent 8c69b8b commit dca6292
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 0 additions & 1 deletion velox/common/memory/SharedArbitrator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1384,7 +1384,6 @@ SharedArbitrator::GlobalArbitrationSection::GlobalArbitrationSection(
SharedArbitrator::GlobalArbitrationSection::~GlobalArbitrationSection() {
VELOX_CHECK(arbitrator_->globalArbitrationRunning_);
arbitrator_->globalArbitrationRunning_ = false;
;
}

std::string SharedArbitrator::kind() const {
Expand Down
4 changes: 4 additions & 0 deletions velox/common/memory/SharedArbitrator.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,10 @@ class SharedArbitrator : public memory::MemoryArbitrator {

std::string toString() const final;

bool testingGlobalArbitrationRunning() const {
return globalArbitrationRunning_;
}

/// Operator level runtime stats reported for an arbitration operation
/// execution.
static inline const std::string kMemoryArbitrationWallNanos{
Expand Down
3 changes: 3 additions & 0 deletions velox/common/memory/tests/MockSharedArbitratorTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2341,6 +2341,9 @@ TEST_F(MockSharedArbitrationTest, ensureMemoryPoolMaxCapacity) {
} else if (testData.hasOtherTask) {
ASSERT_EQ(otherOp->reclaimer()->stats().numReclaims, 0);
}
while (arbitrator_->testingGlobalArbitrationRunning()) {
std::this_thread::sleep_for(std::chrono::milliseconds(200));
}
if (testData.expectedSuccess &&
(((testData.allocatedBytes + testData.requestBytes) >
testData.poolMaxCapacity) ||
Expand Down

0 comments on commit dca6292

Please sign in to comment.