private void applyLN(final ReplayTxn repTxn,
final InputWireRecord wireRecord)
throws DatabaseException {
final LNLogEntry lnEntry = (LNLogEntry) wireRecord.getLogEntry();
final DatabaseId dbId = lnEntry.getDbId();
/*
* If this is a change to the rep group db, remember at commit time,
* and refresh this node's group metadata.
*/
if (dbId.getId() == RepGroupDB.DB_ID) {
repTxn.noteRepGroupDbChange();
}
/*
* Note that we don't have to worry about serializable isolation when
* applying a replicated txn; serializable isolation in only an issue
* for txns that take read locks, and a replicated txn consists only of
* write operations.
*/
final DatabaseImpl dbImpl = repImpl.getDbTree().getDb
(dbId, -1, repImpl.getRepNode().getReplica().getDbCache());
final ReplicationContext repContext =
new ReplicationContext(wireRecord.getVLSN());
final Cursor cursor = DbInternal.makeCursor(dbImpl, repTxn,
null /*cursorConfig*/);
try {
OperationStatus status;
final LN ln = lnEntry.getLN();
if (ln.isDeleted()) {
/* Perform an exact search by key or key/data. */
final DatabaseEntry key = new DatabaseEntry(lnEntry.getKey());
final byte[] dupKey = lnEntry.getDupKey();
final DatabaseEntry data = new DatabaseEntry();
final SearchMode searchMode;
if (dupKey == null) {
searchMode = SearchMode.SET;
} else {
searchMode = SearchMode.BOTH;
data.setData(dupKey);
}
status = DbInternal.search(cursor, key, data, LockMode.RMW,
searchMode);
if (status == OperationStatus.SUCCESS) {
status = DbInternal.deleteInternal(cursor, repContext);
}
} else {
status = DbInternal.putLN(cursor, lnEntry.getKey(), ln,
PutMode.OVERWRITE_KNOWN, repContext);
}
if (status != OperationStatus.SUCCESS) {
throw new EnvironmentFailureException