joshelser commented on a change in pull request #868: Make replication services
start when configured
URL: https://github.com/apache/accumulo/pull/868#discussion_r245376493
##########
File path:
server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
##########
@@ -2841,35 +2839,14 @@ public void run() {
log.error("Error setting watches for recoveries");
throw new RuntimeException(ex);
}
-
- // Start the thrift service listening for incoming replication requests
- try {
- startReplicationService();
- } catch (UnknownHostException e) {
- throw new RuntimeException("Failed to start replication service", e);
- }
-
- // Start the pool to handle outgoing replications
- final ThreadPoolExecutor replicationThreadPool = new SimpleThreadPool(
- getConfiguration().getCount(Property.REPLICATION_WORKER_THREADS),
"replication task");
- replWorker.setExecutor(replicationThreadPool);
- replWorker.run();
-
- // Check the configuration value for the size of the pool and, if changed,
resize the pool,
- // every 5 seconds);
final AccumuloConfiguration aconf = getConfiguration();
- Runnable replicationWorkThreadPoolResizer = new Runnable() {
- @Override
- public void run() {
- int maxPoolSize = aconf.getCount(Property.REPLICATION_WORKER_THREADS);
- if (replicationThreadPool.getMaximumPoolSize() != maxPoolSize) {
- log.info("Resizing thread pool for sending replication work from {}
to {}",
- replicationThreadPool.getMaximumPoolSize(), maxPoolSize);
- replicationThreadPool.setMaximumPoolSize(maxPoolSize);
- }
+ // if the replication name is ever set, then start replication services
+ SimpleTimer.getInstance(aconf).schedule(() -> {
+ if (!getConfiguration().get(Property.REPLICATION_NAME).isEmpty()) {
+ log.info(Property.REPLICATION_NAME.getKey() + " was set, starting repl
services.");
+ setupReplication(aconf);
}
- };
- SimpleTimer.getInstance(aconf).schedule(replicationWorkThreadPoolResizer,
10000, 30000);
+ }, 1000, 5000);
Review comment:
`0` initial delay here too, please.
----------------------------------------------------------------
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