dcapwell commented on code in PR #56:
URL: https://github.com/apache/cassandra-accord/pull/56#discussion_r1297746652


##########
accord-core/src/main/java/accord/messages/ReadData.java:
##########
@@ -149,14 +149,16 @@ void read(SafeCommandStore safeStore, Timestamp 
executeAt, PartialTxn txn)
         Ranges unavailable = safeStore.ranges().unsafeToReadAt(executeAt);
 
         txn.read(safeStore, executeAt).begin((next, throwable) -> {
-            if (throwable != null)
+            // TODO (expected, exceptions): should send exception to client, 
and consistency handle/propagate locally
+            logger.trace("{}: read failed for {}: {}", txnId, unsafeStore, 
throwable);

Review Comment:
   we don't actually know there is a read failure, we are a callback, so we see 
both success and failure!  we have to first check which one we are



##########
accord-core/src/main/java/accord/messages/ReadData.java:
##########
@@ -149,14 +149,16 @@ void read(SafeCommandStore safeStore, Timestamp 
executeAt, PartialTxn txn)
         Ranges unavailable = safeStore.ranges().unsafeToReadAt(executeAt);
 
         txn.read(safeStore, executeAt).begin((next, throwable) -> {
-            if (throwable != null)
+            // TODO (expected, exceptions): should send exception to client, 
and consistency handle/propagate locally
+            logger.trace("{}: read failed for {}: {}", txnId, unsafeStore, 
throwable);
+            synchronized (ReadData.this)

Review Comment:
   you are not checking that `throwable` is non-null, so this could lead to an 
exception at `fail.addSuppressed(throwable);`



##########
accord-core/src/main/java/accord/messages/ReadData.java:
##########
@@ -149,14 +149,16 @@ void read(SafeCommandStore safeStore, Timestamp 
executeAt, PartialTxn txn)
         Ranges unavailable = safeStore.ranges().unsafeToReadAt(executeAt);
 
         txn.read(safeStore, executeAt).begin((next, throwable) -> {
-            if (throwable != null)
+            // TODO (expected, exceptions): should send exception to client, 
and consistency handle/propagate locally
+            logger.trace("{}: read failed for {}: {}", txnId, unsafeStore, 
throwable);
+            synchronized (ReadData.this)
             {
-                // TODO (expected, exceptions): should send exception to 
client, and consistency handle/propagate locally
-                logger.trace("{}: read failed for {}: {}", txnId, unsafeStore, 
throwable);
-                node.reply(replyTo, replyContext, ReadNack.Error);
+                if (fail == null)
+                    fail = throwable;
+                else
+                    fail.addSuppressed(throwable);
             }
-            else
-                readComplete(unsafeStore, next, unavailable);
+            readComplete(unsafeStore, next, unavailable);

Review Comment:
   if there is a failure do we really want to call `readComplete`?  Feel like 
we should try to halt right away as the coordinator has already seen our failure



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to