Skip to content

Commit 63c0259

Browse files
committed
fix
1 parent 7563ac8 commit 63c0259

1 file changed

Lines changed: 15 additions & 7 deletions

File tree

integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBLoadTsFileWithModIT.java

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import org.apache.iotdb.it.framework.IoTDBTestRunner;
3434
import org.apache.iotdb.itbase.category.ClusterIT;
3535
import org.apache.iotdb.itbase.category.LocalStandaloneIT;
36+
import org.apache.iotdb.itbase.exception.InconsistentDataException;
3637

3738
import org.apache.tsfile.enums.TSDataType;
3839
import org.apache.tsfile.exception.write.WriteProcessException;
@@ -222,22 +223,29 @@ public void testWithNewModFileAndLoadAttributes()
222223
tmpDir.getAbsolutePath(), databaseName));
223224

224225
boolean databaseFound = false;
225-
out:
226226
for (int i = 0; i < 10; i++) {
227227
try (final ResultSet resultSet = statement.executeQuery("show databases")) {
228228
while (resultSet.next()) {
229229
final String currentDatabase = resultSet.getString(1);
230230
if (databaseName.equalsIgnoreCase(currentDatabase)) {
231231
databaseFound = true;
232-
break out;
232+
break;
233233
}
234234
}
235+
} catch (InconsistentDataException ignored) {
236+
// Async load propagates the new database metadata to different DataNodes at
237+
// slightly different times, so "show databases" may be inconsistent transiently.
238+
}
235239

236-
try {
237-
Thread.sleep(1000);
238-
} catch (InterruptedException e) {
239-
break;
240-
}
240+
if (databaseFound) {
241+
break;
242+
}
243+
244+
try {
245+
Thread.sleep(1000);
246+
} catch (InterruptedException e) {
247+
Thread.currentThread().interrupt();
248+
break;
241249
}
242250
}
243251
Assert.assertTrue(

0 commit comments

Comments
 (0)