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
34
35
36
37 public class ReplicationSourceDummy implements ReplicationSourceInterface {
38
39 ReplicationSourceManager manager;
40 String peerClusterId;
41 Path currentPath;
42 MetricsSource metrics;
43
44 @Override
45 public void init(Configuration conf, FileSystem fs, ReplicationSourceManager manager,
46 ReplicationQueues rq, ReplicationPeers rp, Stoppable stopper, String peerClusterId,
47 UUID clusterId, ReplicationEndpoint replicationEndpoint, MetricsSource metrics)
48 throws IOException {
49
50 this.manager = manager;
51 this.peerClusterId = peerClusterId;
52 this.metrics = metrics;
53 }
54
55 @Override
56 public void enqueueLog(Path log) {
57 this.currentPath = log;
58 metrics.incrSizeOfLogQueue();
59 }
60
61 @Override
62 public Path getCurrentPath() {
63 return this.currentPath;
64 }
65
66 @Override
67 public void startup() {
68
69 }
70
71 @Override
72 public void terminate(String reason) {
73
74 }
75
76 @Override
77 public void terminate(String reason, Exception e) {
78
79 }
80
81 @Override
82 public String getPeerClusterZnode() {
83 return peerClusterId;
84 }
85
86 @Override
87 public String getPeerClusterId() {
88 String[] parts = peerClusterId.split("-", 2);
89 return parts.length != 1 ?
90 parts[0] : peerClusterId;
91 }
92
93 @Override
94 public String getStats() {
95 return "";
96 }
97
98 @Override
99 public void addHFileRefs(TableName tableName, byte[] family, List<String> files)
100 throws ReplicationException {
101 return;
102 }
103
104 @Override
105 public MetricsSource getSourceMetrics() {
106 return metrics;
107 }
108 }