-
Notifications
You must be signed in to change notification settings - Fork 3.4k
HBASE-23683 Make HBaseInterClusterReplicationEndpoint more extensible… #1047
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -114,6 +114,25 @@ public class HBaseInterClusterReplicationEndpoint extends HBaseReplicationEndpoi | |
| private boolean dropOnDeletedTables; | ||
| private boolean isSerial = false; | ||
|
|
||
| /* | ||
| * Some implementations of HBaseInterClusterReplicationEndpoint may require instantiate different | ||
| * Connection implementations, or initialize it in a different way, so defining createConnection | ||
| * as protected for possible overridings. | ||
| */ | ||
| protected Connection createConnection(Configuration conf) throws IOException { | ||
| return ConnectionFactory.createConnection(conf); | ||
| } | ||
|
|
||
| /* | ||
| * Some implementations of HBaseInterClusterReplicationEndpoint may require instantiate different | ||
| * ReplicationSinkManager implementations, or initialize it in a different way, | ||
| * so defining createReplicationSinkManager as protected for possible overridings. | ||
| */ | ||
| protected ReplicationSinkManager createReplicationSinkManager(Connection conn) { | ||
| return new ReplicationSinkManager((ClusterConnection) conn, this.ctx.getPeerId(), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: redundant cast to conn.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Compilation fails without this cast, as ReplicationSinkManager expects ClusterConnection.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sorry, I meant pass ClusterConnection directly, but I guess that brings us back to your other comment as to why you want to use generic "Connection" object. |
||
| this, this.conf); | ||
| } | ||
|
|
||
| @Override | ||
| public void init(Context context) throws IOException { | ||
| super.init(context); | ||
|
|
@@ -133,12 +152,12 @@ public void init(Context context) throws IOException { | |
| // TODO: This connection is replication specific or we should make it particular to | ||
| // replication and make replication specific settings such as compression or codec to use | ||
| // passing Cells. | ||
| this.conn = (ClusterConnection) ConnectionFactory.createConnection(this.conf); | ||
| this.conn = (ClusterConnection) createConnection(this.conf); | ||
|
||
| this.sleepForRetries = | ||
| this.conf.getLong("replication.source.sleepforretries", 1000); | ||
| this.metrics = context.getMetrics(); | ||
| // ReplicationQueueInfo parses the peerId out of the znode for us | ||
| this.replicationSinkMgr = new ReplicationSinkManager(conn, ctx.getPeerId(), this, this.conf); | ||
| this.replicationSinkMgr = createReplicationSinkManager(conn); | ||
| // per sink thread pool | ||
| this.maxThreads = this.conf.getInt(HConstants.REPLICATION_SOURCE_MAXTHREADS_KEY, | ||
| HConstants.REPLICATION_SOURCE_MAXTHREADS_DEFAULT); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: instantiating..