@@ -150,6 +150,58 @@ public void testBatchPushNetworkOffline() throws Exception {
150150 Assertions .assertTrue (hasWait );
151151 }
152152
153+ @ Test
154+ public void testBatchPushNetworkOfflineWithSmallFall () throws Exception {
155+ String group = UUID .randomUUID ().toString ();
156+ String peers = String .format ("n0-localhost:%d;n1-localhost:%d" , nextPort (), nextPort ());
157+
158+ DLedgerServer dLedgerServer0 = launchServerEnableBatchPush (group , peers , "n0" , "n0" , DLedgerConfig .FILE );
159+ dLedgerServer0 .getDLedgerConfig ().setMaxPendingCommitBytes (100 );
160+
161+ boolean hasWait = false ;
162+ for (int i = 0 ; i < 3 ; i ++) {
163+ AppendEntryRequest appendEntryRequest = new AppendEntryRequest ();
164+ appendEntryRequest .setGroup (group );
165+ appendEntryRequest .setRemoteId (dLedgerServer0 .getMemberState ().getSelfId ());
166+ appendEntryRequest .setBody (new byte [128 ]);
167+ CompletableFuture <AppendEntryResponse > future = dLedgerServer0 .handleAppend (appendEntryRequest );
168+ Assertions .assertTrue (future instanceof AppendFuture );
169+ if (future .isDone ()) {
170+ Assertions .assertEquals (DLedgerResponseCode .LEADER_PENDING_FULL .getCode (), future .get ().getCode ());
171+ hasWait = true ;
172+ break ;
173+ }
174+ }
175+ dLedgerServer0 .shutdown ();
176+ Assertions .assertTrue (hasWait );
177+ }
178+
179+ @ Test
180+ public void testBatchPushNetworkOfflineWithSmallPendingCommitIndex () throws Exception {
181+ String group = UUID .randomUUID ().toString ();
182+ String peers = String .format ("n0-localhost:%d;n1-localhost:%d" , nextPort (), nextPort ());
183+
184+ DLedgerServer dLedgerServer0 = launchServerEnableBatchPush (group , peers , "n0" , "n0" , DLedgerConfig .FILE );
185+ dLedgerServer0 .getDLedgerConfig ().setMaxPendingCommitIndexNum (10 );
186+
187+ boolean hasWait = false ;
188+ for (int i = 0 ; i < 12 ; i ++) {
189+ AppendEntryRequest appendEntryRequest = new AppendEntryRequest ();
190+ appendEntryRequest .setGroup (group );
191+ appendEntryRequest .setRemoteId (dLedgerServer0 .getMemberState ().getSelfId ());
192+ appendEntryRequest .setBody (new byte [128 ]);
193+ CompletableFuture <AppendEntryResponse > future = dLedgerServer0 .handleAppend (appendEntryRequest );
194+ Assertions .assertTrue (future instanceof AppendFuture );
195+ if (future .isDone ()) {
196+ Assertions .assertEquals (DLedgerResponseCode .LEADER_PENDING_FULL .getCode (), future .get ().getCode ());
197+ hasWait = true ;
198+ break ;
199+ }
200+ }
201+ dLedgerServer0 .shutdown ();
202+ Assertions .assertTrue (hasWait );
203+ }
204+
153205 @ Test
154206 public void testBatchPushNetworkNotStable () throws Exception {
155207 String group = UUID .randomUUID ().toString ();
0 commit comments