null check for writer if not initialized yet during syncrunner run

This commit is contained in:
Gaurav Kanade 2020-07-23 10:25:33 +05:30
parent 8191fbdd7d
commit 72932ad0df
1 changed files with 5 additions and 3 deletions

View File

@ -594,9 +594,11 @@ public class FSHLog extends AbstractFSWAL<Writer> {
long start = System.nanoTime();
Throwable lastException = null;
try {
TraceUtil.addTimelineAnnotation("syncing writer");
writer.sync(sf.isForceSync());
TraceUtil.addTimelineAnnotation("writer synced");
if(writer != null) {
TraceUtil.addTimelineAnnotation("syncing writer");
writer.sync(sf.isForceSync());
TraceUtil.addTimelineAnnotation("writer synced");
}
currentSequence = updateHighestSyncedSequence(currentSequence);
} catch (IOException e) {
LOG.error("Error syncing, request close of WAL", e);