Skip to content

Commit 2d6576a

Browse files
committed
add retry wait for aborting RS by preparing flush cache
1 parent cbbd8eb commit 2d6576a

1 file changed

Lines changed: 19 additions & 14 deletions

File tree

  • hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver

hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2847,12 +2847,7 @@ protected PrepareFlushResult internalPrepareFlushCache(WAL wal, long myseqid,
28472847
"flushsize=" + totalSizeOfFlushableStores;
28482848
status.setStatus(s);
28492849

2850-
try {
2851-
doSyncOfUnflushedWALChanges(wal, getRegionInfo());
2852-
} catch (Throwable t) {
2853-
status.abort("Sync unflushed WAL changes failed: " + StringUtils.stringifyException(t));
2854-
fatalForFlushCache(t);
2855-
}
2850+
doSyncOfUnflushedWALChanges(status, wal, getRegionInfo());
28562851
return new PrepareFlushResult(storeFlushCtxs, committedFiles, storeFlushableSize, startTime,
28572852
flushOpSeqId, flushedSeqId, totalSizeOfFlushableStores);
28582853
}
@@ -2909,17 +2904,27 @@ private void doAbortFlushToWAL(final WAL wal, final long flushOpSeqId,
29092904
/**
29102905
* Sync unflushed WAL changes. See HBASE-8208 for details
29112906
*/
2912-
private static void doSyncOfUnflushedWALChanges(final WAL wal, final RegionInfo hri)
2913-
throws IOException {
2907+
private void doSyncOfUnflushedWALChanges(MonitoredTask status, final WAL wal,
2908+
final RegionInfo hri) throws IOException {
29142909
if (wal == null) {
29152910
return;
29162911
}
2917-
try {
2918-
wal.sync(); // ensure that flush marker is sync'ed
2919-
} catch (IOException ioe) {
2920-
wal.abortCacheFlush(hri.getEncodedNameAsBytes());
2921-
throw ioe;
2922-
}
2912+
int retry = 0;
2913+
int maxRetry = 3;
2914+
IOException lastIOE = null;
2915+
do {
2916+
try {
2917+
wal.sync(); // ensure that flush marker is sync'ed
2918+
return;
2919+
} catch (IOException ioe) {
2920+
retry++;
2921+
LOG.warn("Sync region " + hri + " unflushed WAL changes failed, retry time " + retry, ioe);
2922+
lastIOE = ioe;
2923+
}
2924+
} while (retry < maxRetry);
2925+
status.abort("Sync region " + hri + " unflushed WAL changes failed: " + StringUtils
2926+
.stringifyException(lastIOE));
2927+
fatalForFlushCache(lastIOE);
29232928
}
29242929

29252930
/**

0 commit comments

Comments
 (0)