public void testAlignmentOverReload() throws Exception
{
SequentialFileFactory factory = new FakeSequentialFileFactory(512, false);
JournalImpl impl = new JournalImpl(512 + 512 * 3, 20, 0, 0, factory, "hq", "hq", 1000);
impl.start();
impl.load(AlignedJournalImplTest.dummyLoader);
impl.appendAddRecord(1l, (byte)0, new SimpleEncoding(100, (byte)'a'), false);
impl.appendAddRecord(2l, (byte)0, new SimpleEncoding(100, (byte)'b'), false);
impl.appendAddRecord(3l, (byte)0, new SimpleEncoding(100, (byte)'b'), false);
impl.appendAddRecord(4l, (byte)0, new SimpleEncoding(100, (byte)'b'), false);
impl.stop();
impl = new JournalImpl(512 + 1024 + 512, 20, 0, 0, factory, "hq", "hq", 1000);
impl.start();
impl.load(AlignedJournalImplTest.dummyLoader);
// It looks silly, but this forceMoveNextFile is in place to replicate one
// specific bug caught during development
impl.forceMoveNextFile();
impl.appendDeleteRecord(1l, false);
impl.appendDeleteRecord(2l, false);
impl.appendDeleteRecord(3l, false);
impl.appendDeleteRecord(4l, false);
impl.stop();
impl = new JournalImpl(512 + 1024 + 512, 20, 0, 0, factory, "hq", "hq", 1000);
impl.start();
ArrayList<RecordInfo> info = new ArrayList<RecordInfo>();
ArrayList<PreparedTransactionInfo> trans = new ArrayList<PreparedTransactionInfo>();
impl.load(info, trans, null);
Assert.assertEquals(0, info.size());
Assert.assertEquals(0, trans.size());
}