|
18 | 18 |
|
19 | 19 | import com.alibaba.fluss.config.ConfigOptions;
|
20 | 20 | import com.alibaba.fluss.config.Configuration;
|
21 |
| -import com.alibaba.fluss.metadata.PhysicalTablePath; |
22 | 21 | import com.alibaba.fluss.metadata.TableBucket;
|
23 | 22 | import com.alibaba.fluss.metadata.TableDescriptor;
|
24 |
| -import com.alibaba.fluss.metadata.TablePath; |
25 | 23 | import com.alibaba.fluss.rpc.gateway.TabletServerGateway;
|
26 |
| -import com.alibaba.fluss.rpc.messages.NotifyLeaderAndIsrRequest; |
27 |
| -import com.alibaba.fluss.rpc.messages.PbNotifyLeaderAndIsrReqForBucket; |
28 | 24 | import com.alibaba.fluss.rpc.messages.PbProduceLogRespForBucket;
|
29 | 25 | import com.alibaba.fluss.rpc.messages.ProduceLogResponse;
|
30 |
| -import com.alibaba.fluss.rpc.messages.StopReplicaRequest; |
31 | 26 | import com.alibaba.fluss.rpc.protocol.Errors;
|
32 |
| -import com.alibaba.fluss.server.entity.NotifyLeaderAndIsrData; |
33 | 27 | import com.alibaba.fluss.server.testutils.FlussClusterExtension;
|
34 | 28 | import com.alibaba.fluss.server.testutils.RpcMessageTestUtils;
|
35 |
| -import com.alibaba.fluss.server.utils.RpcMessageUtils; |
36 | 29 | import com.alibaba.fluss.server.zk.ZooKeeperClient;
|
37 | 30 | import com.alibaba.fluss.server.zk.data.LeaderAndIsr;
|
38 | 31 |
|
|
41 | 34 | import org.junit.jupiter.api.extension.RegisterExtension;
|
42 | 35 |
|
43 | 36 | import java.time.Duration;
|
44 |
| -import java.util.Collections; |
45 | 37 | import java.util.List;
|
46 | 38 | import java.util.stream.Collectors;
|
47 | 39 |
|
48 | 40 | import static com.alibaba.fluss.record.TestData.DATA1;
|
49 | 41 | import static com.alibaba.fluss.record.TestData.DATA1_SCHEMA;
|
50 | 42 | import static com.alibaba.fluss.record.TestData.DATA1_TABLE_PATH;
|
51 |
| -import static com.alibaba.fluss.server.utils.RpcMessageUtils.makeNotifyBucketLeaderAndIsr; |
52 |
| -import static com.alibaba.fluss.server.utils.RpcMessageUtils.makeStopBucketReplica; |
53 | 43 | import static com.alibaba.fluss.testutils.DataTestUtils.genMemoryLogRecordsByObject;
|
54 | 44 | import static com.alibaba.fluss.testutils.common.CommonTestUtils.retry;
|
55 | 45 | import static com.alibaba.fluss.testutils.common.CommonTestUtils.waitValue;
|
@@ -95,18 +85,8 @@ void testIsrShrinkAndExpand() throws Exception {
|
95 | 85 | FLUSS_CLUSTER_EXTENSION.waitAndGetFollowerReplica(tb, stopFollower);
|
96 | 86 | TabletServerGateway followerGateway =
|
97 | 87 | FLUSS_CLUSTER_EXTENSION.newTabletServerClientForNode(stopFollower);
|
98 |
| - // send stop replica request to the follower |
99 |
| - followerGateway |
100 |
| - .stopReplica( |
101 |
| - new StopReplicaRequest() |
102 |
| - .setCoordinatorEpoch(currentLeaderAndIsr.coordinatorEpoch()) |
103 |
| - .addAllStopReplicasReqs( |
104 |
| - Collections.singleton( |
105 |
| - makeStopBucketReplica( |
106 |
| - tb, |
107 |
| - false, |
108 |
| - currentLeaderAndIsr.leaderEpoch())))) |
109 |
| - .get(); |
| 88 | + // stop follower replica for the bucket |
| 89 | + FLUSS_CLUSTER_EXTENSION.stopReplica(stopFollower, tb, leader); |
110 | 90 |
|
111 | 91 | isr.remove(stopFollower);
|
112 | 92 |
|
@@ -159,8 +139,8 @@ void testIsrShrinkAndExpand() throws Exception {
|
159 | 139 | currentLeaderAndIsr.coordinatorEpoch(),
|
160 | 140 | currentLeaderAndIsr.bucketEpoch());
|
161 | 141 | isr.add(stopFollower);
|
162 |
| - followerGateway.notifyLeaderAndIsr( |
163 |
| - makeNotifyLeaderAndIsrRequest(DATA1_TABLE_PATH, tb, newLeaderAndIsr, isr)); |
| 142 | + FLUSS_CLUSTER_EXTENSION.notifyLeaderAndIsr( |
| 143 | + stopFollower, DATA1_TABLE_PATH, tb, newLeaderAndIsr, isr); |
164 | 144 | // retry until the stop follower add back to ISR.
|
165 | 145 | retry(
|
166 | 146 | Duration.ofMinutes(1),
|
@@ -276,20 +256,4 @@ private static Configuration initConfig() {
|
276 | 256 | conf.setInt(ConfigOptions.LOG_REPLICA_MIN_IN_SYNC_REPLICAS_NUMBER, 2);
|
277 | 257 | return conf;
|
278 | 258 | }
|
279 |
| - |
280 |
| - private NotifyLeaderAndIsrRequest makeNotifyLeaderAndIsrRequest( |
281 |
| - TablePath tablePath, |
282 |
| - TableBucket tableBucket, |
283 |
| - LeaderAndIsr leaderAndIsr, |
284 |
| - List<Integer> replicas) { |
285 |
| - PbNotifyLeaderAndIsrReqForBucket reqForBucket = |
286 |
| - makeNotifyBucketLeaderAndIsr( |
287 |
| - new NotifyLeaderAndIsrData( |
288 |
| - PhysicalTablePath.of(tablePath), |
289 |
| - tableBucket, |
290 |
| - replicas, |
291 |
| - leaderAndIsr)); |
292 |
| - return RpcMessageUtils.makeNotifyLeaderAndIsrRequest( |
293 |
| - 0, Collections.singletonList(reqForBucket)); |
294 |
| - } |
295 | 259 | }
|
0 commit comments