Search in sources :

Example 1 with SnapshotSection

use of org.apache.hadoop.hdfs.server.namenode.FsImageProto.SnapshotSection in project hadoop by apache.

the class PBImageXmlWriter method dumpSnapshotSection.

private void dumpSnapshotSection(InputStream in) throws IOException {
    out.print("<" + SNAPSHOT_SECTION_NAME + ">");
    SnapshotSection s = SnapshotSection.parseDelimitedFrom(in);
    o(SNAPSHOT_SECTION_SNAPSHOT_COUNTER, s.getSnapshotCounter());
    o(SNAPSHOT_SECTION_NUM_SNAPSHOTS, s.getNumSnapshots());
    if (s.getSnapshottableDirCount() > 0) {
        out.print("<" + SNAPSHOT_SECTION_SNAPSHOT_TABLE_DIR + ">");
        for (long id : s.getSnapshottableDirList()) {
            o(SNAPSHOT_SECTION_DIR, id);
        }
        out.print("</" + SNAPSHOT_SECTION_SNAPSHOT_TABLE_DIR + ">\n");
    }
    for (int i = 0; i < s.getNumSnapshots(); ++i) {
        SnapshotSection.Snapshot pbs = SnapshotSection.Snapshot.parseDelimitedFrom(in);
        out.print("<" + SNAPSHOT_SECTION_SNAPSHOT + ">");
        o(SECTION_ID, pbs.getSnapshotId());
        out.print("<" + SNAPSHOT_SECTION_ROOT + ">");
        dumpINodeFields(pbs.getRoot());
        out.print("</" + SNAPSHOT_SECTION_ROOT + ">");
        out.print("</" + SNAPSHOT_SECTION_SNAPSHOT + ">");
    }
    out.print("</" + SNAPSHOT_SECTION_NAME + ">\n");
}
Also used : SnapshotSection(org.apache.hadoop.hdfs.server.namenode.FsImageProto.SnapshotSection)

Aggregations

SnapshotSection (org.apache.hadoop.hdfs.server.namenode.FsImageProto.SnapshotSection)1