luoluoyuyu commented on code in PR #19114:
URL: https://github.com/apache/iotdb/pull/19114#discussion_r4464821712


##########
integration-test/src/test/java/org/apache/iotdb/db/it/utils/TestUtils.java:
##########
@@ -1747,6 +1749,39 @@ public static void restartCluster(BaseEnv env) {
     env.startAllConfigNodes();
     env.startAllDataNodes();
     ((AbstractEnv) env).checkClusterStatusWithoutUnknown();
+    awaitAllRegionsRunning(env);
+  }
+
+  /**
+   * Waits until every Region listed by SHOW REGIONS is Running. A running 
node does not imply a
+   * serving Region: right after a restart the RegionGroups of a Database stay 
Disabled in the
+   * ConfigNode LoadCache until all their Regions report Running, and any 
write issued in that
+   * window, including an active LOAD, is rejected with 
NO_AVAILABLE_REGION_GROUP.
+   */
+  public static void awaitAllRegionsRunning(final BaseEnv env) {
+    await()
+        .pollInSameThread()
+        .pollDelay(0L, TimeUnit.SECONDS)
+        .pollInterval(1L, TimeUnit.SECONDS)
+        .atMost(2, TimeUnit.MINUTES)
+        .ignoreExceptions()
+        .untilAsserted(
+            () -> {
+              try (final Connection connection = env.getConnection();

Review Comment:
   Good catch, fixed in ebe7ce9. `awaitAllRegionsRunning()` now runs the check 
on both dialects inside the same Awaitility condition: `env.getConnection()` 
(tree) and `env.getTableConnection()` (table), each asserting that every Region 
it lists is `Running`. A table-only cluster therefore waits for its table 
Regions, and a mixed cluster waits for both.
   
   Also added `IoTDBRegionReadyAfterRestartTableIT` (`TableClusterIT`): it 
creates a table-model Database, calls `TestUtils.restartCluster()`, then 
asserts that `SHOW REGIONS` over the table connection lists Running Regions and 
that the first write after the restart succeeds. With a tree-only readiness 
check the `regionCount > 0` assertion fails on a table-only cluster, so the 
regression is covered.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to