1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.hadoop.hbase.client;
19
20 import java.io.IOException;
21 import java.util.UUID;
22 import org.apache.hadoop.conf.Configuration;
23 import org.apache.hadoop.fs.Path;
24 import org.apache.hadoop.hbase.HConstants;
25 import org.apache.hadoop.hbase.master.snapshot.SnapshotManager;
26 import org.apache.hadoop.hbase.regionserver.ConstantSizeRegionSplitPolicy;
27 import org.apache.hadoop.hbase.snapshot.SnapshotDescriptionUtils;
28 import org.apache.hadoop.hbase.testclassification.LargeTests;
29 import org.junit.BeforeClass;
30 import org.junit.experimental.categories.Category;
31
32
33
34
35
36
37
38 @Category(LargeTests.class)
39 public class TestSnapshotDFSTemporaryDirectory
40 extends TestSnapshotTemporaryDirectory {
41
42
43
44
45
46
47 @BeforeClass public static void setupCluster() throws Exception {
48 setupConf(UTIL.getConfiguration());
49 UTIL.startMiniCluster(NUM_RS);
50 admin = UTIL.getHBaseAdmin();
51 }
52
53 private static void setupConf(Configuration conf) throws IOException {
54
55 conf.setInt("hbase.regionsever.info.port", -1);
56
57 conf.setInt("hbase.hregion.memstore.flush.size", 25000);
58
59
60 conf.setInt("hbase.hstore.compaction.min", 10);
61 conf.setInt("hbase.hstore.compactionThreshold", 10);
62
63 conf.setInt("hbase.hstore.blockingStoreFiles", 12);
64
65 conf.setBoolean(SnapshotManager.HBASE_SNAPSHOT_ENABLED, true);
66 conf.set(HConstants.HBASE_REGION_SPLIT_POLICY_KEY,
67 ConstantSizeRegionSplitPolicy.class.getName());
68
69 String snapshotPath = UTIL.getDefaultRootDirPath().toString() + Path.SEPARATOR +
70 UUID.randomUUID().toString() + Path.SEPARATOR + ".tmpdir" + Path.SEPARATOR;
71 conf.set(SnapshotDescriptionUtils.SNAPSHOT_WORKING_DIR, "file://" + new Path(snapshotPath).toUri());
72 }
73 }