Fix the flakiness in ConvertToRawIndexMinionClusterIntegrationTest
While refreshing the segment, segment metadata file might not exist, which might cause test failure.
@@ -115,7 +115,6 @@ public class ConvertToRawIndexMinionClusterIntegrationTest extends HybridCluster
TestUtils.waitForCondition(new Function<Void, Boolean>() {
@Override
public Boolean apply(@Nullable Void aVoid) {
- try {
// Check task state
for (TaskState taskState : _helixTaskResourceManager.getTaskStates(
MinionConstants.ConvertToRawIndexTask.TASK_TYPE).values()) {
@@ -138,7 +137,14 @@ public class ConvertToRawIndexMinionClusterIntegrationTest extends HybridCluster
File[] indexDirs = tableDataDir.listFiles();
Assert.assertNotNull(indexDirs);
for (File indexDir : indexDirs) {
- SegmentMetadata segmentMetadata = new SegmentMetadataImpl(indexDir);
+ SegmentMetadata segmentMetadata;
+
+ // Segment metadata file might not exist if the segment is refreshing
+ try {
+ segmentMetadata = new SegmentMetadataImpl(indexDir);
+ } catch (Exception e) {
+ return false;
+ }
// The columns in COLUMNS_TO_CONVERT should have raw index
List<String> rawIndexColumns = Arrays.asList(StringUtils.split(COLUMNS_TO_CONVERT, ','));
@@ -156,9 +162,6 @@ public class ConvertToRawIndexMinionClusterIntegrationTest extends HybridCluster
}
return true;
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
}
}, 600_000L, "Failed to get all tasks COMPLETED and new segments refreshed");
}
