Skip to content

Commit

Permalink
Resolve comments
Browse files Browse the repository at this point in the history
  • Loading branch information
JkSelf committed Oct 23, 2024
1 parent ad55b61 commit 9c058b0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,7 @@ add_test(velox_hdfs_insert_test velox_hdfs_insert_test)

target_link_libraries(
velox_hdfs_insert_test
velox_file
velox_hdfs
velox_core
velox_exec_test_lib
velox_hive_connector
velox_dwio_common_exception
velox_exec
GTest::gtest
GTest::gtest_main
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,15 @@ void checkReadErrorMessages(
}
}

bool checkMiniClusterStop(ReadFile* readFile, const std::string& errorMessage) {
try {
readFile->pread(0, 1);
return false;
} catch (const VeloxException& error) {
return error.message().find(errorMessage) != std::string::npos;
}
}

void verifyFailures(LibHdfsShim* driver, hdfsFS hdfs) {
HdfsReadFile readFile(driver, hdfs, destinationPath);
HdfsReadFile readFile2(driver, hdfs, destinationPath);
Expand All @@ -156,16 +165,19 @@ void verifyFailures(LibHdfsShim* driver, hdfsFS hdfs) {
checkReadErrorMessages(&readFile, offsetErrorMessage, kOneMB);
HdfsFileSystemTest::miniCluster->stop();

const int max_retries = 10;
const int sleep_duration_ms = 1000;
constexpr auto kMaxRetries = 10;
int retries = 0;
while (true) {
if (retries >= max_retries) {
if (checkMiniClusterStop(&readFile2, readFailErrorMessage)) {
checkReadErrorMessages(&readFile2, readFailErrorMessage, 1);
break;
} else {
sleep(1);
retries++;
if (retries >= kMaxRetries) {
FAIL() << "MiniCluster doesn't stop after kMaxRetries try";
} else {
sleep(1);
retries++;
}
}
}
}
Expand Down

0 comments on commit 9c058b0

Please sign in to comment.