joshelser commented on a change in pull request #868: Make replication services
start when configured
URL: https://github.com/apache/accumulo/pull/868#discussion_r245753117
##########
File path: server/master/src/main/java/org/apache/accumulo/master/Master.java
##########
@@ -1391,27 +1377,20 @@ public void run() {
sleepUninterruptibly(100, TimeUnit.MILLISECONDS);
}
- // Start the daemon to scan the replication table and make units of work
- replicationWorkDriver = new ReplicationDriver(this);
- replicationWorkDriver.start();
-
- // Start the daemon to assign work to tservers to replicate to our peers
- replicationWorkAssigner = new WorkDriver(this);
- replicationWorkAssigner.start();
-
- // Advertise that port we used so peers don't have to be told what it is
- context.getZooReaderWriter().putPersistentData(
- getZooKeeperRoot() + Constants.ZMASTER_REPLICATION_COORDINATOR_ADDR,
- replAddress.address.toString().getBytes(UTF_8),
NodeExistsPolicy.OVERWRITE);
-
- // Register replication metrics
- MasterMetricsFactory factory = new
MasterMetricsFactory(getConfiguration(), this);
- Metrics replicationMetrics = factory.createReplicationMetrics();
- try {
- replicationMetrics.register();
- } catch (Exception e) {
- log.error("Failed to register replication metrics", e);
- }
+ // if the replication name is ever set, then start replication services
+ final AtomicReference<TServer> replServer = new AtomicReference<>();
+ SimpleTimer.getInstance(getConfiguration()).schedule(() -> {
+ try {
+ if (!getConfiguration().get(Property.REPLICATION_NAME).isEmpty()) {
Review comment:
Only concern with how this is written now is that it's subject to a race
condition if we ever had multiple invocations of this "block" being executed
concurrently (we could start two replication Thrift servers). I think
`SimpleTimer` does not allow this to happen though.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services