Пример #1
0
 /// <exception cref="System.IO.IOException"/>
 private void LoadSnapshots(InputStream @in, int size)
 {
     for (int i = 0; i < size; i++)
     {
         FsImageProto.SnapshotSection.Snapshot pbs = FsImageProto.SnapshotSection.Snapshot
                                                     .ParseDelimitedFrom(@in);
         INodeDirectory root = FSImageFormatPBINode.Loader.LoadINodeDirectory(pbs.GetRoot(
                                                                                  ), parent.GetLoaderContext());
         int            sid    = pbs.GetSnapshotId();
         INodeDirectory parent = fsDir.GetInode(root.GetId()).AsDirectory();
         Org.Apache.Hadoop.Hdfs.Server.Namenode.Snapshot.Snapshot snapshot = new Org.Apache.Hadoop.Hdfs.Server.Namenode.Snapshot.Snapshot
                                                                                 (sid, root, parent);
         // add the snapshot to parent, since we follow the sequence of
         // snapshotsByNames when saving, we do not need to sort when loading
         parent.GetDirectorySnapshottableFeature().AddSnapshot(snapshot);
         snapshotMap[sid] = snapshot;
     }
 }
Пример #2
0
 /// <exception cref="System.IO.IOException"/>
 private void DumpSnapshotSection(InputStream @in)
 {
     @out.Write("<SnapshotSection>");
     FsImageProto.SnapshotSection s = FsImageProto.SnapshotSection.ParseDelimitedFrom(
         @in);
     O("snapshotCounter", s.GetSnapshotCounter());
     if (s.GetSnapshottableDirCount() > 0)
     {
         @out.Write("<snapshottableDir>");
         foreach (long id in s.GetSnapshottableDirList())
         {
             O("dir", id);
         }
         @out.Write("</snapshottableDir>\n");
     }
     for (int i = 0; i < s.GetNumSnapshots(); ++i)
     {
         FsImageProto.SnapshotSection.Snapshot pbs = FsImageProto.SnapshotSection.Snapshot
                                                     .ParseDelimitedFrom(@in);
         O("snapshot", pbs.GetSnapshotId());
     }
     @out.Write("</SnapshotSection>\n");
 }