joshelser commented on a change in pull request #868: Make replication services
start when configured
URL: https://github.com/apache/accumulo/pull/868#discussion_r245375195
##########
File path: server/master/src/main/java/org/apache/accumulo/master/Master.java
##########
@@ -1391,27 +1376,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 ReplTServer replServer = new ReplTServer();
+ SimpleTimer.getInstance(getConfiguration()).schedule(() -> {
+ try {
+ if (!getConfiguration().get(Property.REPLICATION_NAME).isEmpty()) {
+ if (replServer.server == null) {
+ log.info(Property.REPLICATION_NAME.getKey() + " was set, starting
repl services.");
+ replServer.setServer(setupReplication());
+ }
+ }
+ } catch (UnknownHostException | KeeperException | InterruptedException
e) {
+ log.error("Error occurred starting replication services. ", e);
+ }
+ }, 1000, 5000);
Review comment:
Change we make this initial delay `0` to mimic the current semantics (we
start the service right away)?
----------------------------------------------------------------
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