Index: hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestExportSnapshot.java =================================================================== --- hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestExportSnapshot.java (revision 1468297) +++ hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestExportSnapshot.java (working copy) @@ -39,6 +39,7 @@ import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HColumnDescriptor; +import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.HTableDescriptor; import org.apache.hadoop.hbase.KeyValue; @@ -205,12 +206,12 @@ for (FileStatus fileStatus: rootFiles) { String name = fileStatus.getPath().getName(); assertTrue(fileStatus.isDir()); - assertTrue(name.equals(".snapshot") || name.equals(".archive")); + assertTrue(name.equals(HConstants.SNAPSHOT_DIR_NAME) || name.equals(".archive")); } // compare the snapshot metadata and verify the hfiles final FileSystem hdfs = FileSystem.get(hdfsUri, TEST_UTIL.getConfiguration()); - final Path snapshotDir = new Path(".snapshot", Bytes.toString(snapshotName)); + final Path snapshotDir = new Path(HConstants.SNAPSHOT_DIR_NAME, Bytes.toString(snapshotName)); verifySnapshot(hdfs, new Path(TEST_UTIL.getDefaultRootDirPath(), snapshotDir), fs, new Path(copyDir, snapshotDir)); verifyArchive(fs, copyDir, Bytes.toString(snapshotName)); @@ -233,7 +234,8 @@ */ private void verifyArchive(final FileSystem fs, final Path rootDir, final String snapshotName) throws IOException { - final Path exportedSnapshot = new Path(rootDir, new Path(".snapshot", snapshotName)); + final Path exportedSnapshot = new Path(rootDir, + new Path(HConstants.SNAPSHOT_DIR_NAME, snapshotName)); final Path exportedArchive = new Path(rootDir, ".archive"); LOG.debug(listFiles(fs, exportedArchive, exportedArchive)); SnapshotReferenceUtil.visitReferencedFiles(fs, exportedSnapshot, Index: hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestSnapshotDescriptionUtils.java =================================================================== --- hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestSnapshotDescriptionUtils.java (revision 1468297) +++ hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestSnapshotDescriptionUtils.java (working copy) @@ -29,6 +29,7 @@ import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.HBaseTestingUtility; +import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.MediumTests; import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription; import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription.Type; @@ -88,7 +89,7 @@ */ @Test public void testCompleteSnapshotWithNoSnapshotDirectoryFailure() throws Exception { - Path snapshotDir = new Path(root, ".snapshot"); + Path snapshotDir = new Path(root, HConstants.SNAPSHOT_DIR_NAME); Path tmpDir = new Path(snapshotDir, ".tmp"); Path workingDir = new Path(tmpDir, "not_a_snapshot"); assertFalse("Already have working snapshot dir: " + workingDir Index: hbase-server/src/main/java/org/apache/hadoop/hbase/master/snapshot/SnapshotManager.java =================================================================== --- hbase-server/src/main/java/org/apache/hadoop/hbase/master/snapshot/SnapshotManager.java (revision 1468297) +++ hbase-server/src/main/java/org/apache/hadoop/hbase/master/snapshot/SnapshotManager.java (working copy) @@ -877,6 +877,14 @@ cleaners = conf.getStrings(HConstants.HBASE_MASTER_LOGCLEANER_PLUGINS); if (cleaners != null) Collections.addAll(logCleaners, cleaners); + // check if an older version of snapshot directory was present + Path oldSnapshotDir = new Path(mfs.getRootDir(), ".snapshot"); + FileSystem fs = mfs.getFileSystem(); + if (fs.exists(oldSnapshotDir)) { + LOG.error("Snapshots from an earlier release were found under: " + oldSnapshotDir); + LOG.error("Please rename the directory as " + HConstants.SNAPSHOT_DIR_NAME); + } + // If the user has enabled the snapshot, we force the cleaners to be present // otherwise we still need to check if cleaners are enabled or not and verify // that there're no snapshot in the .snapshot folder. @@ -913,7 +921,6 @@ if (!snapshotEnabled) { LOG.info("Snapshot feature is not enabled, missing log and hfile cleaners."); Path snapshotDir = SnapshotDescriptionUtils.getSnapshotsDir(mfs.getRootDir()); - FileSystem fs = mfs.getFileSystem(); if (fs.exists(snapshotDir)) { FileStatus[] snapshots = FSUtils.listStatus(fs, snapshotDir, new SnapshotDescriptionUtils.CompletedSnaphotDirectoriesFilter(fs)); Index: hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestSnapshotFromAdmin.java =================================================================== --- hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestSnapshotFromAdmin.java (revision 1468297) +++ hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestSnapshotFromAdmin.java (working copy) @@ -123,7 +123,7 @@ HBaseAdmin admin = new HBaseAdmin(mockConnection); SnapshotDescription.Builder builder = SnapshotDescription.newBuilder(); // check that invalid snapshot names fail - failSnapshotStart(admin, builder.setName(".snapshot").build()); + failSnapshotStart(admin, builder.setName(HConstants.SNAPSHOT_DIR_NAME).build()); failSnapshotStart(admin, builder.setName("-snapshot").build()); failSnapshotStart(admin, builder.setName("snapshot fails").build()); failSnapshotStart(admin, builder.setName("snap$hot").build()); @@ -157,4 +157,4 @@ LOG.debug("Correctly failed to start snapshot:" + e.getMessage()); } } -} \ No newline at end of file +} Index: hbase-common/src/main/java/org/apache/hadoop/hbase/HConstants.java =================================================================== --- hbase-common/src/main/java/org/apache/hadoop/hbase/HConstants.java (revision 1468297) +++ hbase-common/src/main/java/org/apache/hadoop/hbase/HConstants.java (working copy) @@ -787,7 +787,7 @@ * remaining snapshot constants; this is here to keep HConstants dependencies at a minimum and * uni-directional. */ - public static final String SNAPSHOT_DIR_NAME = ".snapshot"; + public static final String SNAPSHOT_DIR_NAME = ".hbase-snapshot"; /** Temporary directory used for table creation and deletion */ public static final String HBASE_TEMP_DIRECTORY = ".tmp";