Permalink
Browse files

report failedElder at the connection time, add elders Tc to commit ha…

…shmap
  • Loading branch information...
1 parent 19f0a87 commit 763806f8dfef91a9fd589b863f4787d1c30f14c7 Maysam Yabandeh committed May 15, 2012
@@ -299,9 +299,9 @@ boolean isMoreRecentThan(KeyValueTc other) {
//Added by Maysam Yabandeh
/*
- * This filter assumes that only one column is feteched
- * TODO: generalize it
- * Assume: the writes of all elders are either feteched and rejected in a previous get or are presents in this result variable
+ * TODO: check for deletes
+ * This filter assumes that only one row is feteched
+ * Assume?: the writes of all elders are either feteched and rejected in a previous get or are presents in this result variable
* There are three kinds of committed values:
* 1: Normal values for which I have the commit timestamp Tc
* 2: Normal values for which the Tc is lost (Tc < Tmax)
@@ -21,6 +21,7 @@
import java.util.HashSet;
import java.util.TreeSet;
import java.util.PriorityQueue;
+import java.util.Iterator;
public class Elders {
//set is efficient for membership checking
@@ -52,6 +53,10 @@ public boolean isEldestChangedSinceLastProbe() {
return res;
}
+ public Iterator<Elder> failedEldersIterator() {
+ return failedElders.iterator();
+ }
+
//check if the eldest is still eldest
protected void updateEldest(Elder newElder) {
assert(newElder != null);
@@ -23,6 +23,7 @@
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
+import java.util.Iterator;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
@@ -57,6 +58,7 @@
import com.yahoo.omid.tso.messages.FullAbortReport;
import com.yahoo.omid.tso.messages.EldestUpdate;
import com.yahoo.omid.tso.messages.ReincarnationReport;
+import com.yahoo.omid.tso.messages.FailedElderReport;
import com.yahoo.omid.tso.messages.LargestDeletedTimestampReport;
import com.yahoo.omid.tso.messages.TimestampRequest;
import com.yahoo.omid.IsolationLevel;
@@ -215,6 +217,10 @@ public void handle(TimestampRequest msg, ChannelHandlerContext ctx) {
for (Long halfAborted : sharedState.hashmap.halfAborted) {
channel.write(new AbortedTransactionReport(halfAborted));
}
+ for (Iterator<Elder> failedElders = sharedState.elders.failedEldersIterator(); failedElders.hasNext(); ) {
+ Elder fe = failedElders.next();
+ channel.write(new FailedElderReport(fe.getId(), fe.getCommitTimestamp()));
+ }
}
channel.write(new AbortedTransactionReport(sharedState.latestHalfAbortTimestamp));
channel.write(new FullAbortReport(sharedState.latestFullAbortTimestamp));
@@ -313,6 +319,9 @@ public void handle(CommitRequest msg, ChannelHandlerContext ctx) {
sharedState.uncommited.commit(msg.startTimestamp);
//c) commit the transaction
newmax = sharedState.hashmap.setCommitted(msg.startTimestamp, reply.commitTimestamp, newmax);
+ if (reply.wwRowsLength > 0) {//if it is supposed to be reincarnated, also map Tc to Tc just in case of a future query.
+ newmax = sharedState.hashmap.setCommitted(reply.commitTimestamp, reply.commitTimestamp, newmax);
+ }
//d) report the commit to the immdediate next txn
synchronized (sharedMsgBufLock) {
queueCommit(msg.startTimestamp, reply.commitTimestamp);
@@ -334,6 +343,7 @@ public void handle(CommitRequest msg, ChannelHandlerContext ctx) {
}
//now do the rest out of sync block to allow more concurrency
toWAL.writeLong(reply.commitTimestamp);
+ //TODO: should we be able to recover the writeset of a failed elders?
if (newmax > oldmax) {//I caused a raise in Tmax
toWAL.writeByte((byte)-2);
toWAL.writeLong(newmax);

0 comments on commit 763806f

Please sign in to comment.