@Metric({ "Snapshots", "The number of snapshots" }) public int getNumSnapshots() { return this.snapshotManager.getNumSnapshots(); }
/** * @return number of non-fatal errors detected while saving the image. * @throws IOException on fatal error. */ private long saveSnapshots(FileSummary.Builder summary) throws IOException { FSImageFormatPBSnapshot.Saver snapshotSaver = new FSImageFormatPBSnapshot.Saver( this, summary, context, context.getSourceNamesystem()); snapshotSaver.serializeSnapshotSection(sectionOutputStream); // Skip snapshot-related sections when there is no snapshot. if (context.getSourceNamesystem().getSnapshotManager() .getNumSnapshots() > 0) { snapshotSaver.serializeSnapshotDiffSection(sectionOutputStream); } snapshotSaver.serializeINodeReferenceSection(sectionOutputStream); return snapshotSaver.getNumImageErrors(); }
SnapshotSection.Builder b = SnapshotSection.newBuilder() .setSnapshotCounter(sm.getSnapshotCounter()) .setNumSnapshots(sm.getNumSnapshots()); Preconditions.checkState(i == sm.getNumSnapshots()); parent.commitSection(headers, FSImageFormatProtobuf.SectionName.SNAPSHOT);
@Metric({ "Snapshots", "The number of snapshots" }) public int getNumSnapshots() { return this.snapshotManager.getNumSnapshots(); }
@Metric({ "Snapshots", "The number of snapshots" }) public int getNumSnapshots() { return this.snapshotManager.getNumSnapshots(); }
private void saveSnapshots(FileSummary.Builder summary) throws IOException { FSImageFormatPBSnapshot.Saver snapshotSaver = new FSImageFormatPBSnapshot.Saver( this, summary, context, context.getSourceNamesystem()); snapshotSaver.serializeSnapshotSection(sectionOutputStream); // Skip snapshot-related sections when there is no snapshot. if (context.getSourceNamesystem().getSnapshotManager() .getNumSnapshots() > 0) { snapshotSaver.serializeSnapshotDiffSection(sectionOutputStream); } snapshotSaver.serializeINodeReferenceSection(sectionOutputStream); }
private void saveSnapshots(FileSummary.Builder summary) throws IOException { FSImageFormatPBSnapshot.Saver snapshotSaver = new FSImageFormatPBSnapshot.Saver( this, summary, context, context.getSourceNamesystem()); snapshotSaver.serializeSnapshotSection(sectionOutputStream); // Skip snapshot-related sections when there is no snapshot. if (context.getSourceNamesystem().getSnapshotManager() .getNumSnapshots() > 0) { snapshotSaver.serializeSnapshotDiffSection(sectionOutputStream); } snapshotSaver.serializeINodeReferenceSection(sectionOutputStream); }
(CompositeData[]) mbs.getAttribute(mxbeanName, "Snapshots"); int numSnapshots = Array.getLength(snapshots); assertEquals(sm.getNumSnapshots(), numSnapshots);
SnapshotSection.Builder b = SnapshotSection.newBuilder() .setSnapshotCounter(sm.getSnapshotCounter()) .setNumSnapshots(sm.getNumSnapshots()); Preconditions.checkState(i == sm.getNumSnapshots()); parent.commitSection(headers, FSImageFormatProtobuf.SectionName.SNAPSHOT);
HdfsAdmin admin = new HdfsAdmin(FileSystem.getDefaultUri(conf), conf); assertEquals(0, nnSnapshotManager.getNumSnapshots()); assertEquals(0, nnSnapshotManager.getNumSnapshottableDirs()); assertEquals(0, secondarySnapshotManager.getNumSnapshots()); assertEquals(0, secondarySnapshotManager.getNumSnapshottableDirs()); assertEquals(0, nnSnapshotManager.getNumSnapshots()); assertEquals(1, nnSnapshotManager.getNumSnapshottableDirs()); assertEquals(1, nnSnapshotManager.getNumSnapshots()); assertEquals(1, nnSnapshotManager.getNumSnapshottableDirs()); assertEquals(1, secondarySnapshotManager.getNumSnapshots()); assertEquals(1, secondarySnapshotManager.getNumSnapshottableDirs()); assertEquals(0, nnSnapshotManager.getNumSnapshots()); assertEquals(0, nnSnapshotManager.getNumSnapshottableDirs()); assertEquals(0, secondarySnapshotManager.getNumSnapshots()); assertEquals(0, secondarySnapshotManager.getNumSnapshottableDirs()); } finally {
SnapshotSection.Builder b = SnapshotSection.newBuilder() .setSnapshotCounter(sm.getSnapshotCounter()) .setNumSnapshots(sm.getNumSnapshots()); Preconditions.checkState(i == sm.getNumSnapshots()); parent.commitSection(headers, FSImageFormatProtobuf.SectionName.SNAPSHOT);