File tree Expand file tree Collapse file tree 2 files changed +19
-7
lines changed
jraft-core/src/main/java/com/alipay/sofa/jraft/core
jraft-extension/java-log-storage-impl/src/test/java/com/alipay/sofa/jraft/core Expand file tree Collapse file tree 2 files changed +19
-7
lines changed Original file line number Diff line number Diff line change @@ -1385,6 +1385,18 @@ public void run(final Status status) {
1385
1385
}
1386
1386
1387
1387
private void executeApplyingTasks (final List <LogEntryAndClosure > tasks ) {
1388
+ if (!this .logManager .hasAvailableCapacityToAppendEntries (1 )) {
1389
+ // It's overload, fail-fast
1390
+ final List <Closure > dones = tasks .stream ().map (ele -> ele .done ).filter (Objects ::nonNull )
1391
+ .collect (Collectors .toList ());
1392
+ ThreadPoolsFactory .runInThread (this .groupId , () -> {
1393
+ for (final Closure done : dones ) {
1394
+ done .run (new Status (RaftError .EBUSY , "Node %s log manager is busy." , this .getNodeId ()));
1395
+ }
1396
+ });
1397
+ return ;
1398
+ }
1399
+
1388
1400
this .writeLock .lock ();
1389
1401
try {
1390
1402
final int size = tasks .size ();
Original file line number Diff line number Diff line change @@ -3407,13 +3407,13 @@ public void testChangePeersChaosApplyTasks() throws Exception {
3407
3407
for (final ChangeArg arg : args ) {
3408
3408
arg .stop = true ;
3409
3409
}
3410
- for (final Future <?> future : futures ) {
3411
- try {
3412
- future .get (20 , TimeUnit .SECONDS );
3413
- } catch (TimeoutException e ) {
3414
- // ignore
3415
- }
3416
- }
3410
+ for (final Future <?> future : futures ) {
3411
+ try {
3412
+ future .get (20 , TimeUnit .SECONDS );
3413
+ } catch (TimeoutException e ) {
3414
+ // ignore
3415
+ }
3416
+ }
3417
3417
3418
3418
cluster .waitLeader ();
3419
3419
final SynchronizedClosure done = new SynchronizedClosure ();
You can’t perform that action at this time.
0 commit comments