public void onSuccess(StreamState result) { String message = String.format("Sync complete using session %s between %s and %s on %s", desc.sessionId, r1.endpoint, r2.endpoint, desc.columnFamily); logger.info("[repair #{}] {}", desc.sessionId, message); Tracing.traceRepair(message); set(stat); }
public void onSuccess(StreamState result) { String message = String.format("Sync complete using session %s between %s and %s on %s", desc.sessionId, r1.endpoint, r2.endpoint, desc.columnFamily); logger.info("[repair #{}] {}", desc.sessionId, message); Tracing.traceRepair(message); set(stat); }
public void onSuccess(StreamState result) { String message = String.format("Sync complete using session %s between %s and %s on %s", desc.sessionId, r1.endpoint, r2.endpoint, desc.columnFamily); logger.info("[repair #{}] {}", desc.sessionId, message); Tracing.traceRepair(message); set(stat); }
public void onFailure(Throwable t) { logger.error(String.format("[repair #%s] Session completed with the following error", getId()), t); Tracing.traceRepair("Session completed with the following error: {}", t); forceShutdown(t); } });
public void onFailure(Throwable t) { logger.error(String.format("[repair #%s] Session completed with the following error", getId()), t); Tracing.traceRepair("Session completed with the following error: {}", t); forceShutdown(t); } });
public void onFailure(Throwable t) { logger.error(String.format("[repair #%s] Session completed with the following error", getId()), t); Tracing.traceRepair("Session completed with the following error: {}", t); forceShutdown(t); } });
/** * Compares trees, and triggers repairs for any ranges that mismatch. */ public void run() { // compare trees, and collect differences List<Range<Token>> differences = MerkleTrees.difference(r1.trees, r2.trees); stat = new SyncStat(new NodePair(r1.endpoint, r2.endpoint), differences.size()); // choose a repair method based on the significance of the difference String format = String.format("[repair #%s] Endpoints %s and %s %%s for %s", desc.sessionId, r1.endpoint, r2.endpoint, desc.columnFamily); if (differences.isEmpty()) { logger.info(String.format(format, "are consistent")); Tracing.traceRepair("Endpoint {} is consistent with {} for {}", r1.endpoint, r2.endpoint, desc.columnFamily); set(stat); return; } // non-0 difference: perform streaming repair logger.info(String.format(format, "have " + differences.size() + " range(s) out of sync")); Tracing.traceRepair("Endpoint {} has {} range(s) out of sync with {} for {}", r1.endpoint, differences.size(), r2.endpoint, desc.columnFamily); startSync(differences); }
/** * Receive merkle tree response or failed response from {@code endpoint} for current repair job. * * @param desc repair job description * @param endpoint endpoint that sent merkle tree * @param trees calculated merkle trees, or null if validation failed */ public void validationComplete(RepairJobDesc desc, InetAddress endpoint, MerkleTrees trees) { ValidationTask task = validating.remove(Pair.create(desc, endpoint)); if (task == null) { assert terminated; return; } String message = String.format("Received merkle tree for %s from %s", desc.columnFamily, endpoint); logger.info("[repair #{}] {}", getId(), message); Tracing.traceRepair(message); task.treesReceived(trees); }
protected void startSync(List<Range<Token>> differences) { InetAddress local = FBUtilities.getBroadcastAddress(); SyncRequest request = new SyncRequest(desc, local, r1.endpoint, r2.endpoint, differences); String message = String.format("Forwarding streaming repair of %d ranges to %s (to be streamed with %s)", request.ranges.size(), request.src, request.dst); logger.info("[repair #{}] {}", desc.sessionId, message); Tracing.traceRepair(message); MessagingService.instance().sendOneWay(request.createMessage(), request.src); }
protected void startSync(List<Range<Token>> differences) { InetAddress local = FBUtilities.getBroadcastAddress(); SyncRequest request = new SyncRequest(desc, local, r1.endpoint, r2.endpoint, differences); String message = String.format("Forwarding streaming repair of %d ranges to %s (to be streamed with %s)", request.ranges.size(), request.src, request.dst); logger.info("[repair #{}] {}", desc.sessionId, message); Tracing.traceRepair(message); MessagingService.instance().sendOneWay(request.createMessage(), request.src); }
/** * Receive merkle tree response or failed response from {@code endpoint} for current repair job. * * @param desc repair job description * @param endpoint endpoint that sent merkle tree * @param trees calculated merkle trees, or null if validation failed */ public void validationComplete(RepairJobDesc desc, InetAddress endpoint, MerkleTrees trees) { ValidationTask task = validating.remove(Pair.create(desc, endpoint)); if (task == null) { assert terminated; return; } String message = String.format("Received merkle tree for %s from %s", desc.columnFamily, endpoint); logger.info("[repair #{}] {}", getId(), message); Tracing.traceRepair(message); task.treesReceived(trees); }
protected void startSync(List<Range<Token>> differences) { InetAddress local = FBUtilities.getBroadcastAddress(); SyncRequest request = new SyncRequest(desc, local, r1.endpoint, r2.endpoint, differences); String message = String.format("Forwarding streaming repair of %d ranges to %s (to be streamed with %s)", request.ranges.size(), request.src, request.dst); logger.info("[repair #{}] {}", desc.sessionId, message); Tracing.traceRepair(message); MessagingService.instance().sendOneWay(request.createMessage(), request.src); }
public void onSuccess(List<RepairResult> results) { // this repair session is completed logger.info("[repair #{}] {}", getId(), "Session completed successfully"); Tracing.traceRepair("Completed sync of range {}", ranges); set(new RepairSessionResult(id, keyspace, ranges, results)); taskExecutor.shutdown(); // mark this session as terminated terminate(); }
public void onSuccess(List<RepairResult> results) { // this repair session is completed logger.info("[repair #{}] {}", getId(), "Session completed successfully"); Tracing.traceRepair("Completed sync of range {}", ranges); set(new RepairSessionResult(id, keyspace, ranges, results)); taskExecutor.shutdown(); // mark this session as terminated terminate(); }
public void onSuccess(List<RepairResult> results) { // this repair session is completed logger.info("[repair #{}] {}", getId(), "Session completed successfully"); Tracing.traceRepair("Completed sync of range {}", ranges); set(new RepairSessionResult(id, keyspace, ranges, results)); taskExecutor.shutdown(); // mark this session as terminated terminate(); }
/** * Called after the validation lifecycle to respond with the now valid tree. Runs in Stage.ANTIENTROPY. */ public void run() { // respond to the request that triggered this validation if (!initiator.equals(FBUtilities.getBroadcastAddress())) { logger.info("[repair #{}] Sending completed merkle tree to {} for {}.{}", desc.sessionId, initiator, desc.keyspace, desc.columnFamily); Tracing.traceRepair("Sending completed merkle tree to {} for {}.{}", initiator, desc.keyspace, desc.columnFamily); } MessagingService.instance().sendOneWay(new ValidationComplete(desc, trees).createMessage(), initiator); } }
/** * Called after the validation lifecycle to respond with the now valid tree. Runs in Stage.ANTIENTROPY. */ public void run() { // respond to the request that triggered this validation if (!initiator.equals(FBUtilities.getBroadcastAddress())) { logger.info("[repair #{}] Sending completed merkle tree to {} for {}.{}", desc.sessionId, initiator, desc.keyspace, desc.columnFamily); Tracing.traceRepair("Sending completed merkle tree to {} for {}.{}", initiator, desc.keyspace, desc.columnFamily); } MessagingService.instance().sendOneWay(new ValidationComplete(desc, trees).createMessage(), initiator); } }
/** * Called after the validation lifecycle to respond with the now valid tree. Runs in Stage.ANTIENTROPY. */ public void run() { // respond to the request that triggered this validation if (!initiator.equals(FBUtilities.getBroadcastAddress())) { logger.info("[repair #{}] Sending completed merkle tree to {} for {}.{}", desc.sessionId, initiator, desc.keyspace, desc.columnFamily); Tracing.traceRepair("Sending completed merkle tree to {} for {}.{}", initiator, desc.keyspace, desc.columnFamily); } MessagingService.instance().sendOneWay(new ValidationComplete(desc, trees).createMessage(), initiator); } }
/** * Creates {@link ValidationTask} and submit them to task executor in parallel. * * @param endpoints Endpoint addresses to send validation request * @return Future that can get all {@link TreeResponse} from replica, if all validation succeed. */ private ListenableFuture<List<TreeResponse>> sendValidationRequest(Collection<InetAddress> endpoints) { String message = String.format("Requesting merkle trees for %s (to %s)", desc.columnFamily, endpoints); logger.info("[repair #{}] {}", desc.sessionId, message); Tracing.traceRepair(message); int gcBefore = Keyspace.open(desc.keyspace).getColumnFamilyStore(desc.columnFamily).gcBefore(FBUtilities.nowInSeconds()); List<ListenableFuture<TreeResponse>> tasks = new ArrayList<>(endpoints.size()); for (InetAddress endpoint : endpoints) { ValidationTask task = new ValidationTask(desc, endpoint, gcBefore); tasks.add(task); session.waitForValidation(Pair.create(desc, endpoint), task); taskExecutor.execute(task); } return Futures.allAsList(tasks); }
/** * Creates {@link ValidationTask} and submit them to task executor in parallel. * * @param endpoints Endpoint addresses to send validation request * @return Future that can get all {@link TreeResponse} from replica, if all validation succeed. */ private ListenableFuture<List<TreeResponse>> sendValidationRequest(Collection<InetAddress> endpoints) { String message = String.format("Requesting merkle trees for %s (to %s)", desc.columnFamily, endpoints); logger.info("[repair #{}] {}", desc.sessionId, message); Tracing.traceRepair(message); int gcBefore = Keyspace.open(desc.keyspace).getColumnFamilyStore(desc.columnFamily).gcBefore(FBUtilities.nowInSeconds()); List<ListenableFuture<TreeResponse>> tasks = new ArrayList<>(endpoints.size()); for (InetAddress endpoint : endpoints) { ValidationTask task = new ValidationTask(desc, endpoint, gcBefore); tasks.add(task); session.waitForValidation(Pair.create(desc, endpoint), task); taskExecutor.execute(task); } return Futures.allAsList(tasks); }