/** Compares our trees, and triggers repairs for any ranges that mismatch. */ public void run() { InetAddress local = FBUtilities.getLocalAddress(); // restore partitioners (in case we were serialized) if (ltree.partitioner() == null) ltree.partitioner(StorageService.getPartitioner()); if (rtree.partitioner() == null) rtree.partitioner(StorageService.getPartitioner()); // compare trees, and collect differences differences.addAll(MerkleTree.difference(ltree, rtree)); // choose a repair method based on the significance of the difference String format = "Endpoints " + local + " and " + remote + " %s for " + cfname + " on " + range; if (differences.isEmpty()) { logger.info(String.format(format, "are consistent")); completed(remote, cfname); return; } // non-0 difference: perform streaming repair logger.info(String.format(format, "have " + differences.size() + " range(s) out of sync")); try { performStreamingRepair(); } catch (IOException e) { throw new RuntimeException(e); } }
public TreeRequest deserialize(DataInput dis, int version) throws IOException { String sessId = dis.readUTF(); InetAddress endpoint = CompactEndpointSerializationHelper.deserialize(dis); CFPair cfpair = new CFPair(dis.readUTF(), dis.readUTF()); Range<Token> range; if (version > MessagingService.VERSION_07) range = (Range<Token>) AbstractBounds.serializer().deserialize(dis, version); else range = new Range<Token>( StorageService.getPartitioner().getMinimumToken(), StorageService.getPartitioner().getMinimumToken()); return new TreeRequest(sessId, endpoint, range, cfpair); }
/** Compares our trees, and triggers repairs for any ranges that mismatch. */ public void run() { // restore partitioners (in case we were serialized) if (r1.tree.partitioner() == null) r1.tree.partitioner(StorageService.getPartitioner()); if (r2.tree.partitioner() == null) r2.tree.partitioner(StorageService.getPartitioner()); // compare trees, and collect differences differences.addAll(MerkleTree.difference(r1.tree, r2.tree)); // choose a repair method based on the significance of the difference String format = String.format( "[repair #%s] Endpoints %s and %s %%s for %s", getName(), r1.endpoint, r2.endpoint, cfname); if (differences.isEmpty()) { logger.info(String.format(format, "are consistent")); completed(this); return; } // non-0 difference: perform streaming repair logger.info(String.format(format, "have " + differences.size() + " range(s) out of sync")); performStreamingRepair(); }