accumulo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From keith-turner <...@git.apache.org>
Subject [GitHub] accumulo pull request #254: [ACCUMULO-4506] Add a timeout to the replication...
Date Mon, 01 May 2017 15:11:55 GMT
Github user keith-turner commented on a diff in the pull request:

    https://github.com/apache/accumulo/pull/254#discussion_r114136601
  
    --- Diff: server/tserver/src/main/java/org/apache/accumulo/tserver/replication/AccumuloReplicaSystem.java
---
    @@ -288,15 +295,36 @@ public String execute(ReplicationCoordinator.Client client) throws
Exception {
                 }
               } else {
                 span = Trace.start("WAL replication");
    +
    +            ExecutorService executor = Executors.newFixedThreadPool(1);
    +
                 try {
    -              finalStatus = replicateLogs(peerContext, peerTserver, target, p, status,
sizeLimit, remoteTableId, peerContext.rpcCreds(), helper, accumuloUgi);
    +              Future<Status> replStatus = executor.submit(new Callable<Status>()
{
    +                @Override
    +                public Status call() throws Exception {
    +                  return replicateLogs(peerContext, peerTserver, target, p, status, sizeLimit,
remoteTableId, peerContext.rpcCreds(), helper, accumuloUgi);
    +                }
    +              });
    +
    +              log.debug("Getting replication status with timeout {}", conf.get(Property.REPLICATION_TIMEOUT));
    +              finalStatus = replStatus.get(conf.getTimeInMillis(Property.REPLICATION_TIMEOUT),
MILLISECONDS);
    +              log.debug("New status for {} after replicating to {} is {}", p, peerContext.getInstance(),
ProtobufUtil.toString(finalStatus));
    +            } catch (InterruptedException e) {
    +              log.debug("Interrupted exception during replication", e);
    +              Thread.currentThread().interrupt();
    +              finalStatus = status;
    +            } catch (ExecutionException e) {
    +              log.warn("Caught execution exception", e);
    +              finalStatus = status;
    +            } catch (TimeoutException e) {
    +              log.debug("Replication timeout triggered, task will be retried by the framework");
    +              finalStatus = status;
                 } finally {
                   span.stop();
    +              executor.shutdownNow();
    --- End diff --
    
    Could add comment here that shutdownNow was called instead of shutdown because it will
interrupt threads.
    
    If you had an atomic boolean for interrupting, could set it here.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message