Class FSHLog.SyncRunner

java.lang.Object
java.lang.Thread
org.apache.hadoop.hbase.regionserver.wal.FSHLog.SyncRunner
All Implemented Interfaces:
Runnable
Enclosing class:
FSHLog

private class FSHLog.SyncRunner extends Thread
Thread to runs the hdfs sync call. This call takes a while to complete. This is the longest pole adding edits to the WAL and this must complete to be sure all edits persisted. We run multiple threads sync'ng rather than one that just syncs in series so we have better latencies; otherwise, an edit that arrived just after a sync started, might have to wait almost the length of two sync invocations before it is marked done.

When the sync completes, it marks all the passed in futures done. On the other end of the sync future is a blocked thread, usually a regionserver Handler. There may be more than one future passed in the case where a few threads arrive at about the same time and all invoke 'sync'. In this case we'll batch up the invocations and run one filesystem sync only for a batch of Handler sync invocations. Do not confuse these Handler SyncFutures with the futures an ExecutorService returns when you call submit. We have no use for these in this model. These SyncFutures are 'artificial', something to hold the Handler until the filesystem sync completes.