1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.hadoop.hbase.master.cleaner;
19
20 import java.util.List;
21 import java.util.Map;
22
23 import org.apache.hadoop.hbase.classification.InterfaceAudience;
24 import org.apache.hadoop.conf.Configuration;
25 import org.apache.hadoop.fs.FileSystem;
26 import org.apache.hadoop.fs.Path;
27 import org.apache.hadoop.hbase.Stoppable;
28 import org.apache.hadoop.hbase.io.HFileLink;
29 import org.apache.hadoop.hbase.regionserver.StoreFileInfo;
30
31
32
33
34 @InterfaceAudience.Private
35 public class HFileCleaner extends CleanerChore<BaseHFileCleanerDelegate> {
36
37 public static final String MASTER_HFILE_CLEANER_PLUGINS = "hbase.master.hfilecleaner.plugins";
38
39 public HFileCleaner(final int period, final Stoppable stopper, Configuration conf, FileSystem fs,
40 Path directory) {
41 this(period, stopper, conf, fs, directory, null);
42 }
43
44
45
46
47
48
49
50
51
52 public HFileCleaner(final int period, final Stoppable stopper, Configuration conf, FileSystem fs,
53 Path directory, Map<String, Object> params) {
54 super("HFileCleaner", period, stopper, conf, fs,
55 directory, MASTER_HFILE_CLEANER_PLUGINS, params);
56 }
57
58 @Override
59 protected boolean validate(Path file) {
60 if (HFileLink.isBackReferencesDir(file) || HFileLink.isBackReferencesDir(file.getParent())) {
61 return true;
62 }
63 return StoreFileInfo.validateStoreFileName(file.getName());
64 }
65
66
67
68
69 public List<BaseHFileCleanerDelegate> getDelegatesForTesting() {
70 return this.cleanersChain;
71 }
72 }