log = env.getRegionServerServices().getWAL();
// add a synchronizer so we don't archive a WAL that we need
log.registerWALActionsListener(new IndexLogRollSynchronizer(INDEX_READ_WRITE_LOCK.writeLock()));
// setup the actual index writer
this.writer = new IndexWriter(env, serverName + "-index-writer");
// setup the recovery writer that does retries on the failed edits
TrackingParallelWriterIndexCommitter recoveryCommmiter =
new TrackingParallelWriterIndexCommitter();
try {
// get the specified failure policy. We only ever override it in tests, but we need to do it
// here
Class<? extends IndexFailurePolicy> policyClass =
env.getConfiguration().getClass(INDEX_RECOVERY_FAILURE_POLICY_KEY,
StoreFailuresInCachePolicy.class, IndexFailurePolicy.class);
IndexFailurePolicy policy =
policyClass.getConstructor(PerRegionIndexWriteCache.class).newInstance(failedIndexEdits);
LOG.debug("Setting up recovery writter with committer: " + recoveryCommmiter.getClass()
+ " and failure policy: " + policy.getClass());
recoveryWriter =
new IndexWriter(recoveryCommmiter, policy, env, serverName + "-recovery-writer");
} catch (Exception ex) {
throw new IOException("Could not instantiate recovery failure policy!", ex);
}
} catch (NoSuchMethodError ex) {
disabled = true;