You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ratis.apache.org by GitBox <gi...@apache.org> on 2020/11/23 13:59:31 UTC

[GitHub] [incubator-ratis] szetszwo commented on a change in pull request #294: RATIS-1171. Allow null for the stream parameter in StateMachine.DataApi.link

szetszwo commented on a change in pull request #294:
URL: https://github.com/apache/incubator-ratis/pull/294#discussion_r528721708



##########
File path: ratis-test/src/test/java/org/apache/ratis/datastream/DataStreamTestUtils.java
##########
@@ -76,18 +80,34 @@ static ByteString bytesWritten2ByteString(long bytesWritten) {
 
     @Override
     public CompletableFuture<?> link(DataStream stream, LogEntryProto entry) {
-      final SingleDataStream s = getSingleDataStream(ClientInvocationId.valueOf(entry.getStateMachineLogEntry()));
-      s.setLogEntry(entry);
+      LOG.info("link {}", stream);
+      if (stream == null) {
+        return JavaUtils.completeExceptionally(new IllegalStateException("Null stream: entry=" + entry));
+      }
+      ((SingleDataStream)stream).setLogEntry(entry);
       return CompletableFuture.completedFuture(null);
     }
 
+    @Override
+    public CompletableFuture<Message> applyTransaction(TransactionContext trx) {

Review comment:
       Yes.  Otherwise, the reply won't have a message.
   
   I just found that there are bugs in both the code and the tests.  The double negative makes the tests passed.  Will fix them.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org