mirror of https://github.com/apache/cassandra
Fix infinite loop on exception while streaming
Patch by JoshuaMcKenzie; reviewed by marcuse for CASSANDRA-7330
This commit is contained in:
parent
62d9c43676
commit
58bb974a33
|
|
@ -11,6 +11,7 @@
|
|||
* Add authentication support to shuffle (CASSANDRA-6484)
|
||||
* Cqlsh counts non-empty lines for "Blank lines" warning (CASSANDRA-7325)
|
||||
* Make StreamSession#closeSession() idempotent (CASSANDRA-7262)
|
||||
* Fix infinite loop on exception while streaming (CASSANDRA-7330)
|
||||
Merged from 1.2:
|
||||
* Fix availability validation for LOCAL_ONE CL (CASSANDRA-7319)
|
||||
* Use LOCAL_ONE for non-superuser auth queries (CASSANDRA-7328)
|
||||
|
|
|
|||
|
|
@ -114,9 +114,20 @@ public class StreamReader
|
|||
protected void drain(InputStream dis, long bytesRead) throws IOException
|
||||
{
|
||||
long toSkip = totalSize() - bytesRead;
|
||||
toSkip = toSkip - dis.skip(toSkip);
|
||||
|
||||
// InputStream.skip can return -1 if dis is inaccessible.
|
||||
long skipped = dis.skip(toSkip);
|
||||
if (skipped == -1)
|
||||
return;
|
||||
|
||||
toSkip = toSkip - skipped;
|
||||
while (toSkip > 0)
|
||||
toSkip = toSkip - dis.skip(toSkip);
|
||||
{
|
||||
skipped = dis.skip(toSkip);
|
||||
if (skipped == -1)
|
||||
break;
|
||||
toSkip = toSkip - skipped;
|
||||
}
|
||||
}
|
||||
|
||||
protected long totalSize()
|
||||
|
|
|
|||
Loading…
Reference in New Issue