private DBHandle init(int initialRecCnt) throws Exception {

		DBHandle dbh = new DBHandle(BUFFER_SIZE);
		BufferFile bf =
			fileSystem.createDatabase("/", "testDb", null, "Test", dbh.getBufferSize(), null, null);
		dbh.saveAs(bf, true, TaskMonitor.DUMMY);
		dbh.close();
		bf.dispose();

		DatabaseItem dbItem = (DatabaseItem) fileSystem.getItem("/", "testDb");
		assertTrue(!dbItem.canRecover());
		bf = dbItem.openForUpdate(FolderItem.DEFAULT_CHECKOUT_ID);
		dbh = new DBHandle(bf, true, TaskMonitor.DUMMY);

		long txId = dbh.startTransaction();
		Table table1 = dbh.createTable("table1", SCHEMA);
		tableFill(table1, initialRecCnt, "initTable1_");
		dbh.endTransaction(txId, true);

		txId = dbh.startTransaction();
		tableDelete(table1, initialRecCnt, 0, 2);
		dbh.endTransaction(txId, true);

		assertTrue(dbh.takeRecoverySnapshot(null, TaskMonitor.DUMMY));

		txId = dbh.startTransaction();
		Table table2 = dbh.createTable("table2", SCHEMA);
		tableFill(table2, initialRecCnt, "initTable2_");
		dbh.endTransaction(txId, true);

		txId = dbh.startTransaction();
		tableDelete(table2, initialRecCnt, 0, 2);
		dbh.endTransaction(txId, true);

		assertTrue(dbh.takeRecoverySnapshot(null, TaskMonitor.DUMMY));

		return dbh;
	}
File created:


Recovery snapshot taken after each transaction.
Transaction 1:

Transaction 2:

Transaction 3:

Transaction 4:


@throws Exception
Ghidra/Framework/FileSystem/src/test/java/db/RecoveryDBTest.java