/** * Return a read-only view of the last committed state of the * {@link CommitRecordIndex}. * * @return The read-only view of the {@link CommitRecordIndex}. */ public CommitRecordIndex getReadOnlyCommitRecordIndex() { final ReadLock lock = _fieldReadWriteLock.readLock(); lock.lock(); try { assertOpen(); final CommitRecordIndex commitRecordIndex = getCommitRecordIndex( _rootBlock.getCommitRecordIndexAddr(), true/* readOnly */); // return new ReadOnlyIndex(commitRecordIndex); return commitRecordIndex; } finally { lock.unlock(); } }
/** * Return a read-only view of the last committed state of the * {@link CommitRecordIndex}. * * @return The read-only view of the {@link CommitRecordIndex}. */ public CommitRecordIndex getReadOnlyCommitRecordIndex() { final ReadLock lock = _fieldReadWriteLock.readLock(); lock.lock(); try { assertOpen(); final CommitRecordIndex commitRecordIndex = getCommitRecordIndex( _rootBlock.getCommitRecordIndexAddr(), true/* readOnly */); // return new ReadOnlyIndex(commitRecordIndex); return commitRecordIndex; } finally { lock.unlock(); } }
IIndex getMutableCommitIndexManager() { return getCommitRecordIndex( getRootBlockView().getCommitRecordIndexAddr(), false/* readOnly */); } }
IIndex getMutableCommitIndexManager() { return getCommitRecordIndex( getRootBlockView().getCommitRecordIndexAddr(), false/* readOnly */); } }
/** * Read and return the {@link CommitRecordIndex} from the current root * block. * * @return The {@link CommitRecordIndex} and never <code>null</code>. */ private CommitRecordIndex _getCommitRecordIndex() { assert _fieldReadWriteLock.writeLock().isHeldByCurrentThread(); assert _rootBlock != null; final long addr = _rootBlock.getCommitRecordIndexAddr(); try { if (log.isDebugEnabled()) log.debug("Loading from addr=" + addr); // Load the live index from the disk. return getCommitRecordIndex(addr, false/* readOnly */); } catch (RuntimeException ex) { /* * Log the root block for post-mortem. */ log.fatal("Could not read the commit record index:\n" + _rootBlock, ex); throw ex; } }
/** * Read and return the {@link CommitRecordIndex} from the current root * block. * * @return The {@link CommitRecordIndex} and never <code>null</code>. */ private CommitRecordIndex _getCommitRecordIndex() { assert _fieldReadWriteLock.writeLock().isHeldByCurrentThread(); assert _rootBlock != null; final long addr = _rootBlock.getCommitRecordIndexAddr(); try { if (log.isDebugEnabled()) log.debug("Loading from addr=" + addr); // Load the live index from the disk. return getCommitRecordIndex(addr, false/* readOnly */); } catch (RuntimeException ex) { /* * Log the root block for post-mortem. */ log.fatal("Could not read the commit record index:\n" + _rootBlock, ex); throw ex; } }
+ rootBlock.getCommitRecordAddr() + ", commitRecordIndexAddr: " + rootBlock.getCommitRecordIndexAddr());
+ rootBlock.getCommitRecordAddr() + ", commitRecordIndexAddr: " + rootBlock.getCommitRecordIndexAddr());
.getCommitRecordIndexAddr(),true/*readOnly*/);
.getCommitRecordIndexAddr(),true/*readOnly*/);
assertTrue(commitTime[i] > commitTime[i - 1]); commitRecordIndexAddrs[i] = journal.getRootBlockView().getCommitRecordIndexAddr();
assertTrue(commitTime[i] > commitTime[i - 1]); commitRecordIndexAddrs[i] = journal.getRootBlockView().getCommitRecordIndexAddr();