You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@omid.apache.org by fp...@apache.org on 2016/05/12 00:22:46 UTC

[3/3] incubator-omid git commit: Clean commit check method

Clean commit check method

Clean unnecesary code and improve readability.
No changes in functionality done.

Change-Id: I02f6785056c646f7cb3454d383babbf54d1ae52a


Project: http://git-wip-us.apache.org/repos/asf/incubator-omid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-omid/commit/7d8a381b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-omid/tree/7d8a381b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-omid/diff/7d8a381b

Branch: refs/heads/master
Commit: 7d8a381b49b157e75a6c6d9da4e984e8d2c6f1ee
Parents: 05c8e46
Author: Francisco Perez-Sorrosal <fp...@yahoo-inc.com>
Authored: Wed May 11 17:20:31 2016 -0700
Committer: Francisco Perez-Sorrosal <fp...@yahoo-inc.com>
Committed: Wed May 11 17:20:31 2016 -0700

----------------------------------------------------------------------
 .../apache/omid/tso/RequestProcessorImpl.java    | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-omid/blob/7d8a381b/tso-server/src/main/java/org/apache/omid/tso/RequestProcessorImpl.java
----------------------------------------------------------------------
diff --git a/tso-server/src/main/java/org/apache/omid/tso/RequestProcessorImpl.java b/tso-server/src/main/java/org/apache/omid/tso/RequestProcessorImpl.java
index 4e17850..d101c72 100644
--- a/tso-server/src/main/java/org/apache/omid/tso/RequestProcessorImpl.java
+++ b/tso-server/src/main/java/org/apache/omid/tso/RequestProcessorImpl.java
@@ -167,37 +167,36 @@ class RequestProcessorImpl implements EventHandler<RequestProcessorImpl.RequestE
 
     }
 
-    private long handleCommit(RequestEvent event) throws Exception {
+    private void handleCommit(RequestEvent event) throws Exception {
 
         long startTimestamp = event.getStartTimestamp();
         Iterable<Long> writeSet = event.writeSet();
         boolean isRetry = event.isRetry();
         Channel c = event.getChannel();
 
-        boolean committed;
-        long commitTimestamp = 0L;
+        boolean txCanCommit;
 
         int numCellsInWriteset = 0;
         // 0. check if it should abort
         if (startTimestamp <= lowWatermark) {
-            committed = false;
+            txCanCommit = false;
         } else {
             // 1. check the write-write conflicts
-            committed = true;
+            txCanCommit = true;
             for (long cellId : writeSet) {
                 long value = hashmap.getLatestWriteForCell(cellId);
                 if (value != 0 && value >= startTimestamp) {
-                    committed = false;
+                    txCanCommit = false;
                     break;
                 }
                 numCellsInWriteset++;
             }
         }
 
-        if (committed) {
+        if (txCanCommit) {
             // 2. commit
             try {
-                commitTimestamp = timestampOracle.next();
+                long commitTimestamp = timestampOracle.next();
 
                 if (numCellsInWriteset > 0) {
                     long newLowWatermark = lowWatermark;
@@ -215,14 +214,12 @@ class RequestProcessorImpl implements EventHandler<RequestProcessorImpl.RequestE
                 }
                 persistProc.addCommitToBatch(startTimestamp, commitTimestamp, c, event.getMonCtx());
             } catch (IOException e) {
-                LOG.error("Error committing", e);
+                LOG.error("Error committing tx {}", startTimestamp, e);
             }
         } else { // add it to the aborted list
             persistProc.addAbortToBatch(startTimestamp, isRetry, c, event.getMonCtx());
         }
 
-        return commitTimestamp;
-
     }
 
     final static class RequestEvent implements Iterable<Long> {