Package org.apache.hadoop.hdfs.server.namenode

Examples of org.apache.hadoop.hdfs.server.namenode.SnapshotNode


  public void testSnapshotShell() throws IOException {
    Configuration conf = new Configuration();
    MiniDFSCluster cluster = new MiniDFSCluster(conf, 4, true, null);

    SnapshotNode ssNode = new SnapshotNode(conf);
    SnapshotShell ssShell = new SnapshotShell(conf);
    SnapshotProtocol ssProtocol = ssShell.getSnapshotNode();

    dfs = cluster.getFileSystem();
    ssDir = conf.get("fs.snapshot.dir", "/.SNAPSHOT");
View Full Code Here


    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));
View Full Code Here

  public void testSnapshotCreation() throws IOException {
    Configuration conf = new Configuration();
    MiniDFSCluster cluster = new MiniDFSCluster(conf, 4, true, null);

    SnapshotNode ssNode = new SnapshotNode(conf);
    dfs = cluster.getFileSystem();
    ssDir = conf.get("fs.snapshot.dir", "/.SNAPSHOT");
    FSDataOutputStream out;

    Path foo = new Path("/foo");
    Path bar = new Path("/hadoop/bar");

    out = dfs.create(foo);
    out.writeBytes("foo");
    out.close();

    // Keep bar as file under instruction
    out = dfs.create(bar);
    out.writeBytes("bar");
    out.sync(); // sync to flush stream buffer to NN

    ssNode.createSnapshot("leaseNotUpdated_V1", false);
    ssNode.createSnapshot("leaseUpdated_V1", true);

    out.writeBytes("bar");
    out.close();

    dfs.delete(foo);
    System.out.println("WOOT");
    ssNode.createSnapshot("leaseNotUpdated_V2", false);
    ssNode.createSnapshot("leaseUpdated_V2", true);

    // Shutdown ssNode
    ssNode.shutdown();

    INodeFile file;
    FSNamesystem fsNamesys;

    // Verify state of leaseNotUpdated_V1
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hdfs.server.namenode.SnapshotNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.