Skip to content
Browse files

Code fixes for the fixing of orphans.

src/java/voldemort/utils/ConsistencyFix.java
- added .trace output for parsing of ugly input
- pass the correct key-type into constructor

src/java/voldemort/utils/ConsistencyFixWorker.java
- substantially more .debug output to trace operation
  • Loading branch information...
1 parent c29bdf5 commit eceaf0159c7f02342158c75d6e1cec3cb49a31bb @jayjwylie jayjwylie committed Feb 11, 2013
Showing with 42 additions and 9 deletions.
  1. +14 −6 src/java/voldemort/utils/ConsistencyFix.java
  2. +28 −3 src/java/voldemort/utils/ConsistencyFixWorker.java
View
20 src/java/voldemort/utils/ConsistencyFix.java
@@ -334,24 +334,32 @@ private VectorClock parseVersion(String versionString) throws IOException {
List<ClockEntry> versions = new ArrayList<ClockEntry>();
long timestamp = 0;
- // TODO: confirm regex works...
- String parsed[] = versionString.split(") ts:");
+ String parsed[] = versionString.split(" ts:");
+ // TODO: remove .trace outputs after we have a unit test for this
+ // method.
+ // TODO: move this method to be a method of VectorClock?
+ logger.trace("parsed[0]: " + parsed[0]);
if(parsed.length != 2) {
throw new IOException("Could not parse vector clock: " + versionString);
}
timestamp = Long.parseLong(parsed[1]);
// "version("
- // 01234567
+ // _01234567_
// => 8 is the magic offset to elide "version("
- String clockEntryList = parsed[0].substring(8);
+ // '-1' gets rid of the last ")"
+ String clockEntryList = parsed[0].substring(8, parsed[0].length() - 1);
+ logger.trace("clockEntryList: <" + clockEntryList + ">");
String parsedClockEntryList[] = clockEntryList.split(", ");
for(int i = 0; i < parsedClockEntryList.length; ++i) {
+ logger.trace("parsedClockEntry... : <" + parsedClockEntryList[i] + ">");
String parsedClockEntry[] = parsedClockEntryList[i].split(":");
if(parsedClockEntry.length != 2) {
- throw new IOException("Could not parse ClockEntry: " + parsedClockEntryList[i]);
+ throw new IOException("Could not parse ClockEntry: <" + parsedClockEntryList[i]
+ + ">");
}
short nodeId = Short.parseShort(parsedClockEntry[0]);
long version = Long.parseLong(parsedClockEntry[1]);
+ logger.trace("clock entry parsed: <" + nodeId + "> : <" + version + ">");
versions.add(new ClockEntry(nodeId, version));
}
@@ -393,7 +401,7 @@ public void run() {
values.add(new Versioned<byte[]>(value, vectorClock));
}
QueryKeyResult queryKeyResult = new QueryKeyResult(keyByteArray, values);
- consistencyFixWorkers.submit(new ConsistencyFixWorker(keyNumVals,
+ consistencyFixWorkers.submit(new ConsistencyFixWorker(key,
consistencyFix,
badKeyQOut,
queryKeyResult));
View
31 src/java/voldemort/utils/ConsistencyFixWorker.java
@@ -248,6 +248,13 @@ private ProcessReadRepliesResult processReadReplies(final List<Integer> nodeIdLi
logger.info("Aborting fixKey because exceptions were encountered when fetching key-values.");
return new ProcessReadRepliesResult(Status.FETCH_EXCEPTION);
}
+ if(logger.isDebugEnabled()) {
+ for(NodeValue<ByteArray, byte[]> nkv: nodeValues) {
+ logger.debug("\tRead NodeKeyValue : " + ByteUtils.toHexString(nkv.getKey().get())
+ + " on node with id " + nkv.getNodeId() + " for version "
+ + nkv.getVersion());
+ }
+ }
return new ProcessReadRepliesResult(nodeValues);
}
@@ -276,6 +283,15 @@ private ProcessReadRepliesResult processReadReplies(final List<Integer> nodeIdLi
// store/routed/action/AbstractReadRepair.java and
// store/routed/ThreadPoolRoutedStore.java
ReadRepairer<ByteArray, byte[]> readRepairer = new ReadRepairer<ByteArray, byte[]>();
+ if(logger.isDebugEnabled()) {
+ for(NodeValue<ByteArray, byte[]> nodeKeyValue: readRepairer.getRepairs(nodeValues)) {
+ logger.debug("\tNodeKeyValue result from readRepairer.getRepairs : "
+ + ByteUtils.toHexString(nodeKeyValue.getKey().get())
+ + " on node with id " + nodeKeyValue.getNodeId() + " for version "
+ + nodeKeyValue.getVersion());
+ }
+ }
+
List<NodeValue<ByteArray, byte[]>> toReadRepair = Lists.newArrayList();
for(NodeValue<ByteArray, byte[]> v: readRepairer.getRepairs(nodeValues)) {
if(v.getNodeId() > currentFakeNodeId) {
@@ -285,14 +301,22 @@ private ProcessReadRepliesResult processReadReplies(final List<Integer> nodeIdLi
toReadRepair.add(new NodeValue<ByteArray, byte[]>(v.getNodeId(),
v.getKey(),
versioned));
+ } else {
+ if(logger.isDebugEnabled()) {
+ logger.debug("\tIgnoring repair to fake node: "
+ + ByteUtils.toHexString(v.getKey().get()) + " on node with id "
+ + v.getNodeId() + " for version " + v.getVersion());
+ }
}
+
}
if(logger.isDebugEnabled()) {
for(NodeValue<ByteArray, byte[]> nodeKeyValue: toReadRepair) {
- logger.debug("\tRepair key " + nodeKeyValue.getKey() + "on node with id "
- + nodeKeyValue.getNodeId() + " for version "
+ logger.debug("\tRepair key " + ByteUtils.toHexString(nodeKeyValue.getKey().get())
+ + " on node with id " + nodeKeyValue.getNodeId() + " for version "
+ nodeKeyValue.getVersion());
+
}
}
return toReadRepair;
@@ -313,6 +337,7 @@ public Status doRepairPut(final List<NodeValue<ByteArray, byte[]>> toReadRepair)
consistencyFix.getAdminClient().storeOps.putNodeKeyValue(consistencyFix.getStoreName(),
nodeKeyValue);
} catch(ObsoleteVersionException ove) {
+ // TODO: Add OVE catches to some statistics?
// NOOP. Treat OVE as success.
} catch(VoldemortException ve) {
allRepairsSuccessful = false;
@@ -323,7 +348,7 @@ public Status doRepairPut(final List<NodeValue<ByteArray, byte[]>> toReadRepair)
}
}
if(!allRepairsSuccessful) {
- logger.info("Aborting fixKey because exceptions were encountered when reparing key-values.");
+ logger.info("Aborting fixKey because exceptions were encountered when repairing key-values.");
return Status.REPAIR_EXCEPTION;
}
return Status.SUCCESS;

0 comments on commit eceaf01

Please sign in to comment.
Something went wrong with that request. Please try again.