[ https://issues.apache.org/jira/browse/HBASE-7294?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13539614#comment-13539614 ]
Jonathan Hsieh edited comment on HBASE-7294 at 12/26/12 5:54 PM: ----------------------------------------------------------------- We really should push folks to use hbase.snapshot.enabled nit: Should we update this to describe hbase.snapshot.enabled? (seems simpler) also mention that you have data in the .snapshots dir (might be strange if it works with the same config, but later does not. at least if we mention the dir users will have a pointer and an option to remove snapshots. {code} + /** + * Throws an exception if snapshot operations (take a snapshot, restore, clone) are not supported. + * Called at the beginning of snapshot() and restoreSnapshot() methods. + * @throws UnsupportedOperationException if snapshot are not supported + */ + public void checkSnapshotSupport() throws UnsupportedOperationException { + if (!this.isSnapshotSupported) { + throw new UnsupportedOperationException( + "To use snapshots, the HBase Master must have the proper archive cleaners enabled. " + + "You must add to the hbase-site.xml: " + + "'" + HFileCleaner.MASTER_HFILE_CLEANER_PLUGINS + "' with '" + + HFileLinkCleaner.class.getName() + "', '" + SnapshotHFileCleaner.class.getName() + + "' support. And add '" + HConstants.HBASE_MASTER_LOGCLEANER_PLUGINS + "' with '" + + SnapshotLogCleaner.class.getName() + "' support."); + } + } {code} We should behave the same but emit a warning if folks are using the plugins and not the hbase.snapshot.enabled property. We should have a test the verifies snapshots work if configured one way or the other (and possibly a negative test exercing the case where it does not. was (Author: jmhsieh): We really push folks to use hbase.snapshot.enabled nit: Should we update this to describe hbase.snapshot.enabled? (seems simpler) also mention that you have data in the .snapshots dir (might be strange if it works with the same config, but later does not. at least if we mention the dir users will have a pointer and an option to remove snapshots. {code} + /** + * Throws an exception if snapshot operations (take a snapshot, restore, clone) are not supported. + * Called at the beginning of snapshot() and restoreSnapshot() methods. + * @throws UnsupportedOperationException if snapshot are not supported + */ + public void checkSnapshotSupport() throws UnsupportedOperationException { + if (!this.isSnapshotSupported) { + throw new UnsupportedOperationException( + "To use snapshots, the HBase Master must have the proper archive cleaners enabled. " + + "You must add to the hbase-site.xml: " + + "'" + HFileCleaner.MASTER_HFILE_CLEANER_PLUGINS + "' with '" + + HFileLinkCleaner.class.getName() + "', '" + SnapshotHFileCleaner.class.getName() + + "' support. And add '" + HConstants.HBASE_MASTER_LOGCLEANER_PLUGINS + "' with '" + + SnapshotLogCleaner.class.getName() + "' support."); + } + } {code} We should behave the same but emit a warning if folks are using the plugins and not the hbase.snapshot.enabled property. We should have a test the verifies snapshots work if configured one way or the other (and possibly a negative test exercing the case where it does not. > Check for snapshot file cleaners on start > ----------------------------------------- > > Key: HBASE-7294 > URL: https://issues.apache.org/jira/browse/HBASE-7294 > Project: HBase > Issue Type: Sub-task > Components: Client, master, regionserver, snapshots, Zookeeper > Affects Versions: hbase-6055 > Reporter: Jesse Yates > Assignee: Matteo Bertozzi > Fix For: hbase-6055, 0.96.0 > > Attachments: HBASE-7294-v1.patch, HBASE-7294-v2.patch, > HBASE-7294-v3.patch, HBASE-7294-v4.patch, HBASE-7294-v5.patch > > > Snapshots currently use the SnaphotHfileCleaner and SnapshotHLogCleaner to > ensure that any hfiles or hlogs (respectively) that are currently part of a > snapshot are not removed from their respective archive directories (.archive > and .oldlogs). > From Matteo Bertozzi: > {quote} > currently the snapshot cleaner is not in hbase-default.xml > and there's no warning/exception on snapshot/restore operation, if not > enabled. > even if we add the cleaner to the hbase-default.xml how do we ensure that the > user doesn't remove it? > Do we want to hardcode the cleaner at master startup? > Do we want to add a check in snapshot/restore that throws an exception if the > cleaner is not enabled? > {quote} -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira