From 0a064f74886217f7d1b52a4757ca3dc5233bd0f8 Mon Sep 17 00:00:00 2001
From: Irene Y Zhang <iyzhang@cs.washington.edu>
Date: Mon, 22 Feb 2016 14:46:38 -0800
Subject: [PATCH] fixing one bug in TAPIR (not handling abstain) and one in IR,
 not correctly passing back decide result

---
 replication/ir/client.cc   |  6 +++---
 replication/ir/client.h    |  1 +
 store/tapirstore/client.cc | 31 +++++++++++++++++--------------
 3 files changed, 21 insertions(+), 17 deletions(-)

diff --git a/replication/ir/client.cc b/replication/ir/client.cc
index 80d3196..c5c39a5 100644
--- a/replication/ir/client.cc
+++ b/replication/ir/client.cc
@@ -232,7 +232,7 @@ IRClient::ConsensusSlowPath()
     string result = pendingConsensusRequest->decide(results);
 
     // Put the result in the request to store for later retries
-    pendingConsensusRequest->request = result;
+    pendingConsensusRequest->decideReq = result;
 
     // Send finalize message
     proto::FinalizeConsensusMessage response;
@@ -258,7 +258,7 @@ IRClient::ResendConfirmation()
         proto::FinalizeConsensusMessage response;
         response.mutable_opid()->set_clientid(clientid);
         response.mutable_opid()->set_clientreqid(pendingConsensusRequest->clientReqId);
-        response.set_result(pendingConsensusRequest->request);
+        response.set_result(pendingConsensusRequest->decideReq);
                  
         if(transport->SendMessageToAll(this, response)) {
             confirmationTimeout->Reset();
@@ -419,7 +419,7 @@ IRClient::HandleConfirm(const TransportAddress &remote,
         pendingConsensusRequest = NULL;
 
         // Return to client
-        req->continuation(req->request, pendingConsensusRequest->request);
+        req->continuation(req->request, req->decideReq);
         delete req;
     }
 }
diff --git a/replication/ir/client.h b/replication/ir/client.h
index 77d18fc..dfe863d 100644
--- a/replication/ir/client.h
+++ b/replication/ir/client.h
@@ -77,6 +77,7 @@ protected:
     struct PendingRequest
     {
         string request;
+        string decideReq;
         uint64_t clientReqId;
         decide_t decide;
         continuation_t continuation;
diff --git a/store/tapirstore/client.cc b/store/tapirstore/client.cc
index cab1d9c..8430d0a 100644
--- a/store/tapirstore/client.cc
+++ b/store/tapirstore/client.cc
@@ -166,24 +166,27 @@ Client::Prepare(Timestamp &timestamp)
         uint64_t proposed = p->GetTimestamp().getTimestamp();
 
         switch(p->GetReply()) {
-            case REPLY_OK:
-                Debug("Prepare ok vote");
-                continue;
-            case REPLY_FAIL:
-                // abort!
-                Debug("ABORT transaction");
-                return REPLY_FAIL;
-            case REPLY_RETRY:
-                status = REPLY_RETRY;
+        case REPLY_OK:
+            Debug("Prepare ok vote");
+            continue;
+        case REPLY_FAIL:
+            // abort!
+            Debug("ABORT transaction");
+            return REPLY_FAIL;
+        case REPLY_RETRY:
+            status = REPLY_RETRY;
                 if (proposed > ts) {
                     ts = proposed;
                 }
                 break;
-            case REPLY_TIMEOUT:
-                status = REPLY_RETRY;
-                break;
-            default:
-                NOT_IMPLEMENTED();
+        case REPLY_TIMEOUT:
+            status = REPLY_RETRY;
+            break;
+        case REPLY_ABSTAIN:
+            // just ignore abstains
+            break;
+        default:
+            break;
         }
         delete p;
     }
-- 
GitLab