1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.hadoop.hbase.replication;
20
21 import java.io.IOException;
22 import java.util.List;
23 import java.util.UUID;
24
25 import org.apache.hadoop.conf.Configuration;
26 import org.apache.hadoop.fs.FileSystem;
27 import org.apache.hadoop.fs.Path;
28 import org.apache.hadoop.hbase.Stoppable;
29 import org.apache.hadoop.hbase.TableName;
30 import org.apache.hadoop.hbase.replication.regionserver.MetricsSource;
31 import org.apache.hadoop.hbase.replication.regionserver.ReplicationSourceInterface;
32 import org.apache.hadoop.hbase.replication.regionserver.ReplicationSourceManager;
33 import org.apache.hadoop.hbase.util.Pair;
34
35
36
37
38 public class ReplicationSourceDummy implements ReplicationSourceInterface {
39
40 ReplicationSourceManager manager;
41 String peerClusterId;
42 Path currentPath;
43 MetricsSource metrics;
44
45 @Override
46 public void init(Configuration conf, FileSystem fs, ReplicationSourceManager manager,
47 ReplicationQueues rq, ReplicationPeers rp, Stoppable stopper, String peerClusterId,
48 UUID clusterId, ReplicationEndpoint replicationEndpoint, MetricsSource metrics)
49 throws IOException {
50
51 this.manager = manager;
52 this.peerClusterId = peerClusterId;
53 this.metrics = metrics;
54 }
55
56 @Override
57 public void enqueueLog(Path log) {
58 this.currentPath = log;
59 metrics.incrSizeOfLogQueue();
60 }
61
62 @Override
63 public Path getCurrentPath() {
64 return this.currentPath;
65 }
66
67 @Override
68 public void startup() {
69
70 }
71
72 @Override
73 public void terminate(String reason) {
74
75 }
76
77 @Override
78 public void terminate(String reason, Exception e) {
79
80 }
81
82 @Override
83 public String getPeerClusterZnode() {
84 return peerClusterId;
85 }
86
87 @Override
88 public String getPeerClusterId() {
89 String[] parts = peerClusterId.split("-", 2);
90 return parts.length != 1 ?
91 parts[0] : peerClusterId;
92 }
93
94 @Override
95 public String getStats() {
96 return "";
97 }
98
99 @Override
100 public void addHFileRefs(TableName tableName, byte[] family, List<Pair<Path, Path>> files)
101 throws ReplicationException {
102 return;
103 }
104
105 @Override
106 public MetricsSource getSourceMetrics() {
107 return metrics;
108 }
109 }