diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java index 92f1979ecaea..a1d082e97010 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java @@ -704,9 +704,11 @@ public void terminate(String reason, Exception cause, boolean clearMetrics, worker.entryReader.interrupt(); } } - //If worker is already stopped but there was still entries batched, - //we need to clear buffer used for non processed entries - worker.clearWALEntryBatch(); + if (!server.isAborted() && !server.isStopped()) { + //If server is running and worker is already stopped but there was still entries batched, + //we need to clear buffer used for non processed entries + worker.clearWALEntryBatch(); + } } if (join) {