cluster.waitClusterUp();
FileSystem fs = cluster.getFileSystem();
WaitingRoom wr = new WaitingRoom(conf);
WaitingRoomPurger purger = wr.getPurger();
SnapshotNode ssNode = new SnapshotNode(conf);
ssNode.shutdownWaitingRoomPurger();
String wrPath = conf.get("fs.snapshot.waitingroom", "/.WR");
String ssDir = conf.get("fs.snapshot.dir", "/.SNAPSHOT");
Path foo = new Path("/foo");
Path bar = new Path("/hadoop/bar");
Path mash = new Path("/hadoop/mash");
FSDataOutputStream stream;
// Create foo
stream = fs.create(foo);
stream.writeByte(0);
stream.close();
// Move foo to waiting room.
assertTrue(wr.moveToWaitingRoom(foo));
// Create snapshot
ssNode.createSnapshot("first", false); // contains nothing
// Create bar (V1)
stream = fs.create(bar);
stream.write(0);
stream.close();
// Create mash (empty)
stream = fs.create(mash);
stream.close();
// Create snapshot
ssNode.createSnapshot("second", false); // contains bar (V1), mash
// Move mash, bar to waiting room
assertTrue(wr.moveToWaitingRoom(mash));
assertTrue(wr.moveToWaitingRoom(bar));
// Create bar (V2)
stream = fs.create(bar);
stream.write(0);
stream.close();
ssNode.createSnapshot("third", false); // contains bar (V2)
// Verify fs state right now
assertTrue(fs.exists(bar));
assertFalse(fs.exists(foo));
assertFalse(fs.exists(mash));