|
125 | 125 | import static org.apache.fluss.row.encode.KvValueLayout.PLAIN; |
126 | 126 | import static org.apache.fluss.testutils.DataTestUtils.row; |
127 | 127 | import static org.apache.fluss.testutils.InternalRowAssert.assertThatRow; |
| 128 | +import static org.apache.fluss.testutils.common.CommonTestUtils.retry; |
128 | 129 | import static org.apache.fluss.testutils.common.CommonTestUtils.waitUntil; |
129 | 130 | import static org.assertj.core.api.Assertions.assertThat; |
130 | 131 | import static org.assertj.core.api.Assertions.assertThatThrownBy; |
@@ -2644,6 +2645,22 @@ void testCreateTableWithAggregateEngineAndWalChangelog() throws Exception { |
2644 | 2645 | .build(); |
2645 | 2646 | admin.createTable(tablePath6, tableDescriptor6, false).get(); |
2646 | 2647 | assertThat(admin.tableExists(tablePath6).get()).isTrue(); |
| 2648 | + |
| 2649 | + // Finish leader initialization before teardown deletes the schemas needed by KV recovery. |
| 2650 | + for (TablePath tablePath : |
| 2651 | + Arrays.asList( |
| 2652 | + DEFAULT_TABLE_PATH, |
| 2653 | + tablePath2, |
| 2654 | + tablePath3, |
| 2655 | + tablePath4, |
| 2656 | + tablePath5, |
| 2657 | + tablePath6)) { |
| 2658 | + TableInfo tableInfo = admin.getTableInfo(tablePath).get(); |
| 2659 | + for (int bucket = 0; bucket < tableInfo.getNumBuckets(); bucket++) { |
| 2660 | + FLUSS_CLUSTER_EXTENSION.waitAndGetLeaderReplica( |
| 2661 | + new TableBucket(tableInfo.getTableId(), bucket)); |
| 2662 | + } |
| 2663 | + } |
2647 | 2664 | } |
2648 | 2665 |
|
2649 | 2666 | // ==================== Table Statistics Tests ==================== |
@@ -2905,10 +2922,16 @@ void testClusterHealthDuringRollingUpgrade() throws Exception { |
2905 | 2922 | waitAllReplicasReady(tableId, 3); |
2906 | 2923 |
|
2907 | 2924 | // Phase 1: Cluster is healthy — status should be GREEN. |
2908 | | - ClusterHealth health = admin.getClusterHealth().get(); |
2909 | | - assertThat(health.getStatus()).isEqualTo(ClusterHealthStatus.GREEN); |
2910 | | - assertThat(health.getNumReplicas()).isEqualTo(health.getInSyncReplicas()); |
2911 | | - assertThat(health.getNumLeaderReplicas()).isEqualTo(health.getActiveLeaderReplicas()); |
| 2925 | + // Wait for previous table deletions and coordinator-side leader activation to settle. |
| 2926 | + retry( |
| 2927 | + Duration.ofMinutes(1), |
| 2928 | + () -> { |
| 2929 | + ClusterHealth health = admin.getClusterHealth().get(); |
| 2930 | + assertThat(health.getStatus()).isEqualTo(ClusterHealthStatus.GREEN); |
| 2931 | + assertThat(health.getNumReplicas()).isEqualTo(health.getInSyncReplicas()); |
| 2932 | + assertThat(health.getNumLeaderReplicas()) |
| 2933 | + .isEqualTo(health.getActiveLeaderReplicas()); |
| 2934 | + }); |
2912 | 2935 |
|
2913 | 2936 | // Phase 2: Stop one tablet server (simulate server crash during rolling upgrade). |
2914 | 2937 | int stoppedServerId = 0; |
|
0 commit comments