Skip to content

Commit fdcc383

Browse files
duxiao1212facebook-github-bot
authored andcommitted
fix: Fix flaky test BroadcastTest.endToEndWithMultipleWriteNodes (#26461)
Summary: Fix flaky stress test buck2 test //github/presto-trunk/presto-native-execution/presto_cpp/main/operators/tests:presto_operators_test -- 'BroadcastTest.endToEndWithMultipleWriteNodes/zstd' --stress-runs 100 BroadcastTestParam::TearDown() inherited from OperatorTestBase https://www.internalfb.com/code/fbsource/[37f968940832]/fbcode/velox/exec/tests/utils/OperatorTestBase.cpp?lines=153 , We have an existing exchange source lifecycle protection for LocalExchangeSource https://fburl.com/code/aoz55crb. But our BroadcastTest..endToEndWithMultipleWriteNodes uses BroadcastExchangeSource which lacks this protection. Since it's just a flaky test, the most straightforward way is just inject a latency to handle a race condition in async cleanup. Differential Revision: D85685549
1 parent dc68abf commit fdcc383

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

presto-native-execution/presto_cpp/main/operators/tests/BroadcastTest.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,15 @@ class BroadcastTest : public exec::test::OperatorTestBase,
6666
BroadcastExchangeSource::createExchangeSource);
6767
}
6868

69+
void TearDown() override {
70+
velox::exec::test::waitForAllTasksToBeDeleted();
71+
// Fix flaky stress-test: Add a delay to allow async destructors to fully complete.
72+
std::this_thread::sleep_for(std::chrono::milliseconds(100));
73+
pool_.reset();
74+
rootPool_.reset();
75+
resetMemory();
76+
}
77+
6978
std::unique_ptr<VectorSerde::Options> getVectorSerdeOptions(
7079
common::CompressionKind compressionKind) {
7180
std::unique_ptr<VectorSerde::Options> options = std::make_unique<
@@ -303,9 +312,9 @@ TEST_P(BroadcastTest, endToEndWithMultipleWriteNodes) {
303312

304313
// Read back result.
305314
auto [taskCursorReadNode, broadcastReadResults] = executeBroadcastRead(
306-
asRowType(dataVector[0]->type()),
307-
tempDirectoryPath->getPath(),
308-
broadcastFilePaths);
315+
asRowType(dataVector[0]->type()),
316+
tempDirectoryPath->getPath(),
317+
broadcastFilePaths);
309318

310319
// Validate BroadcastExchange reads back output of both writes.
311320
velox::exec::test::assertEqualResults(dataVector, broadcastReadResults);

0 commit comments

Comments
 (0)