/** * Call commit on {@link IBufferStrategy} prior to creating the new * {@link IRootBlockView}. This will flush the {@link WriteCacheService} * . For HA, that ensures that the write set has been replicated to the * followers. * <p> * Note: required for {@link RWStore} since the metaBits allocations are * not made until commit, leading to invalid addresses for recent store * allocations. * <p> * Note: After this, we do not write anything on the backing store other * than the root block. The rest of this code is dedicated to creating a * properly formed root block. For a non-HA deployment, we just lay down * the root block. For an HA deployment, we do a 2-phase commit. * <p> * Note: In HA, the followers lay down the replicated writes * synchronously. Thus, they are guaranteed to be on local storage by * the time the leader finishes WriteCacheService.flush(). This does not * create much latency because the WriteCacheService drains the * dirtyList in a seperate thread. */ private void flushWriteSet() { final long beginNanos = System.nanoTime(); _bufferStrategy.commit(); store.commitCounters.elapsedFlushWriteSetNanos.add(System.nanoTime() - beginNanos); }
/** * Call commit on {@link IBufferStrategy} prior to creating the new * {@link IRootBlockView}. This will flush the {@link WriteCacheService} * . For HA, that ensures that the write set has been replicated to the * followers. * <p> * Note: required for {@link RWStore} since the metaBits allocations are * not made until commit, leading to invalid addresses for recent store * allocations. * <p> * Note: After this, we do not write anything on the backing store other * than the root block. The rest of this code is dedicated to creating a * properly formed root block. For a non-HA deployment, we just lay down * the root block. For an HA deployment, we do a 2-phase commit. * <p> * Note: In HA, the followers lay down the replicated writes * synchronously. Thus, they are guaranteed to be on local storage by * the time the leader finishes WriteCacheService.flush(). This does not * create much latency because the WriteCacheService drains the * dirtyList in a seperate thread. */ private void flushWriteSet() { final long beginNanos = System.nanoTime(); _bufferStrategy.commit(); store.commitCounters.elapsedFlushWriteSetNanos.add(System.nanoTime() - beginNanos); }