1515 * See the License for the specific language governing permissions and
1616 * limitations under the License.
1717 */
18- package org .apache .hadoop .hbase .backup . example ;
18+ package org .apache .hadoop .hbase .backup ;
1919
2020import java .io .IOException ;
2121
22- import org .apache .yetus .audience .InterfaceAudience ;
2322import org .apache .hadoop .conf .Configuration ;
2423import org .apache .hadoop .fs .FileStatus ;
2524import org .apache .hadoop .fs .FileSystem ;
2625import org .apache .hadoop .fs .Path ;
2726import org .apache .hadoop .hbase .HBaseInterfaceAudience ;
2827import org .apache .hadoop .hbase .master .cleaner .BaseHFileCleanerDelegate ;
2928import org .apache .hadoop .hbase .util .FSUtils ;
29+ import org .apache .yetus .audience .InterfaceAudience ;
3030import org .apache .zookeeper .KeeperException ;
3131import org .slf4j .Logger ;
3232import org .slf4j .LoggerFactory ;
3535 * {@link BaseHFileCleanerDelegate} that only cleans HFiles that don't belong to a table that is
3636 * currently being archived.
3737 * <p>
38- * This only works properly if the
38+ * This only works properly if the
3939 * {@link org.apache.hadoop.hbase.master.cleaner.TimeToLiveHFileCleaner}
4040 * is also enabled (it always should be), since it may take a little time
4141 * for the ZK notification to propagate, in which case we may accidentally
@@ -53,14 +53,18 @@ public class LongTermArchivingHFileCleaner extends BaseHFileCleanerDelegate {
5353 public boolean isFileDeletable (FileStatus fStat ) {
5454 try {
5555 // if its a directory, then it can be deleted
56- if (fStat .isDirectory ()) return true ;
57-
56+ if (fStat .isDirectory ()) {
57+ return true ;
58+ }
59+
5860 Path file = fStat .getPath ();
5961 // check to see if
6062 FileStatus [] deleteStatus = FSUtils .listStatus (this .fs , file , null );
6163 // if the file doesn't exist, then it can be deleted (but should never
6264 // happen since deleted files shouldn't get passed in)
63- if (deleteStatus == null ) return true ;
65+ if (deleteStatus == null ) {
66+ return true ;
67+ }
6468
6569 // otherwise, we need to check the file's table and see its being archived
6670 Path family = file .getParent ();
@@ -69,7 +73,8 @@ public boolean isFileDeletable(FileStatus fStat) {
6973
7074 String tableName = table .getName ();
7175 boolean ret = !archiveTracker .keepHFiles (tableName );
72- LOG .debug ("Archiver says to [" + (ret ? "delete" : "keep" ) + "] files for table:" + tableName );
76+ LOG .debug ("Archiver says to [" + (ret ? "delete" : "keep" ) + "] files for table:" +
77+ tableName );
7378 return ret ;
7479 } catch (IOException e ) {
7580 LOG .error ("Failed to lookup status of:" + fStat .getPath () + ", keeping it just incase." , e );
@@ -97,13 +102,14 @@ public void setConf(Configuration config) {
97102
98103 @ Override
99104 public void stop (String reason ) {
100- if (this .isStopped ()) return ;
105+ if (this .isStopped ()) {
106+ return ;
107+ }
108+
101109 super .stop (reason );
102110 if (this .archiveTracker != null ) {
103111 LOG .info ("Stopping " + this .archiveTracker );
104112 this .archiveTracker .stop ();
105113 }
106-
107114 }
108-
109115}
0 commit comments