You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by GitBox <gi...@apache.org> on 2022/04/01 15:07:00 UTC

[GitHub] [cassandra] jonmeredith commented on a change in pull request #1541: CASSANDRA-17510 streaming three min timeout

jonmeredith commented on a change in pull request #1541:
URL: https://github.com/apache/cassandra/pull/1541#discussion_r840675480



##########
File path: test/unit/org/apache/cassandra/net/AsyncStreamingInputPlusTest.java
##########
@@ -161,6 +129,61 @@ public void available_ClosedButWithBytes()
         Assert.assertEquals(size, inputPlus.unsafeAvailable());
     }
 
+    @Test
+    public void rebufferAndCloseToleratesInterruption() throws InterruptedException
+    {
+        ByteBuf beforeInterrupt = channel.alloc().heapBuffer(1024);
+        beforeInterrupt.writeCharSequence("BEFORE", Charset.forName("us-ascii"));

Review comment:
       Much better.

##########
File path: test/unit/org/apache/cassandra/net/AsyncStreamingInputPlusTest.java
##########
@@ -161,6 +129,61 @@ public void available_ClosedButWithBytes()
         Assert.assertEquals(size, inputPlus.unsafeAvailable());
     }
 
+    @Test
+    public void rebufferAndCloseToleratesInterruption() throws InterruptedException
+    {
+        ByteBuf beforeInterrupt = channel.alloc().heapBuffer(1024);
+        beforeInterrupt.writeCharSequence("BEFORE", Charset.forName("us-ascii"));
+        final int beforeInterruptBytes = beforeInterrupt.readableBytes();
+        ByteBuf afterInterrupt = channel.alloc().heapBuffer(1024);
+        afterInterrupt.writeCharSequence("AFTER", Charset.forName("us-ascii"));
+        final int afterInterruptBytes = afterInterrupt.readableBytes();
+
+        inputPlus = new AsyncStreamingInputPlus(channel);
+        Thread consumer = new Thread(() -> {
+            try
+            {
+                byte[] buffer = new byte[beforeInterruptBytes + afterInterruptBytes];
+                inputPlus.read(buffer, 0, beforeInterruptBytes + afterInterruptBytes);

Review comment:
       Can't hurt.




-- 
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: pr-unsubscribe@cassandra.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org