HDFS-15201 SnapshotCounter hits MaxSnapshotID limit (#1870)

This commit is contained in:
Karthik Palanisamy 2020-03-24 02:45:46 -07:00 committed by GitHub
parent 5eddc82fb8
commit 5250cd6db3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 2 deletions

View File

@ -96,7 +96,7 @@ public class SnapshotManager implements SnapshotStatsMXBean {
private final boolean snapshotDiffAllowSnapRootDescendant;
private final AtomicInteger numSnapshots = new AtomicInteger();
private static final int SNAPSHOT_ID_BIT_WIDTH = 24;
private static final int SNAPSHOT_ID_BIT_WIDTH = 28;
private boolean allowNestedSnapshots = false;
private int snapshotCounter = 0;

View File

@ -92,4 +92,18 @@ public void testSnapshotLimits() throws Exception {
StringUtils.toLowerCase(se.getMessage()).contains("rollover"));
}
}
/**
* Snapshot is identified by INODE CURRENT_STATE_ID.
* So maximum allowable snapshotID should be less than CURRENT_STATE_ID
*/
@Test
public void testValidateSnapshotIDWidth() {
FSDirectory fsdir = mock(FSDirectory.class);
SnapshotManager snapshotManager = new SnapshotManager(new Configuration(),
fsdir);
Assert.assertTrue(snapshotManager.
getMaxSnapshotID() < Snapshot.CURRENT_STATE_ID);
}
}