System.out.println("LSN " + i + " = " + lsn);
System.out.println("IN " + i + " = " + in.getNodeId());
}
/* Add other types of INs. */
BIN bin = new BIN(DbInternal.dbGetDatabaseImpl(db), key, 2, 1);
lsn = bin.log(logManager);
checkList.add(new CheckInfo(lsn, bin));
/* Add provisional entries, which should get ignored. */
lsn = bin.logProvisional(logManager, in);
/* Add a LN, to stress the node tracking. */
LN ln = new LN(data);
lsn = ln.log(envImpl,
DbInternal.dbGetDatabaseImpl(db).getId(),
key, DbLsn.NULL_LSN, null);
/*
* Add an IN delete entry, it should get picked up by the reader.
*/
INDeleteInfo info =
new INDeleteInfo(i, key, DbInternal.
dbGetDatabaseImpl(db).getId());
lsn = logManager.log(info);
checkList.add(new CheckInfo(lsn, info));
/*
* Add an BINDelta. Generate it by making the first, full version
* provisional so the test doesn't pick it up, and then log a
* delta.
*/
BIN binDeltaBin =
new BIN(DbInternal.dbGetDatabaseImpl(db), key, 10, 1);
maxNodeId = binDeltaBin.getNodeId();
binDeltaBin.latch();
ChildReference newEntry =
new ChildReference(null, key, DbLsn.makeLsn(0, 0));
assertTrue(binDeltaBin.insertEntry(newEntry));
lsn = binDeltaBin.logProvisional(logManager, in); // full
/* Modify the bin with one entry so there can be a delta. */
byte[] keyBuf2 = new byte[2];
Arrays.fill(keyBuf2, (byte) (i + 2));
ChildReference newEntry2 =
new ChildReference(null, keyBuf2,
DbLsn.makeLsn(100, 101));
assertTrue(binDeltaBin.insertEntry(newEntry2));
assertTrue(binDeltaBin.log(logManager, true, false) ==
DbLsn.NULL_LSN);
lsn = binDeltaBin.getLastDeltaVersion();
if (DEBUG) {
System.out.println("delta =" + binDeltaBin.getNodeId() +
" at LSN " + lsn);
}
checkList.add(new CheckInfo(lsn, binDeltaBin));
/*
* Reset the generation to 0 so this version of the BIN, which gets
* saved for unit test comparison, will compare to the version read
* from the log, which is initialized to 0.
*/
binDeltaBin.setGeneration(0);
binDeltaBin.releaseLatch();
}
/* Flush the log, files. */
logManager.flush();
envImpl.getFileManager().clear();