This is an automated email from the ASF dual-hosted git repository.

asf-gitbox-commits pushed a commit to branch cassandra-5.0
in repository https://gitbox.apache.org/repos/asf/cassandra.git


The following commit(s) were added to refs/heads/cassandra-5.0 by this push:
     new 57857fa91b ninja: avoid spinning on a zero-byte read() in 
PartitionIndex#warmIndex()
57857fa91b is described below

commit 57857fa91b3bec99abf7047139c66d12df8ac2f8
Author: Caleb Rackliffe <[email protected]>
AuthorDate: Wed Oct 28 11:32:34 2026 -0500

    ninja: avoid spinning on a zero-byte read() in PartitionIndex#warmIndex()
---
 .../org/apache/cassandra/io/sstable/format/bti/PartitionIndex.java | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git 
a/src/java/org/apache/cassandra/io/sstable/format/bti/PartitionIndex.java 
b/src/java/org/apache/cassandra/io/sstable/format/bti/PartitionIndex.java
index a082547607..aeb2903a0e 100644
--- a/src/java/org/apache/cassandra/io/sstable/format/bti/PartitionIndex.java
+++ b/src/java/org/apache/cassandra/io/sstable/format/bti/PartitionIndex.java
@@ -255,6 +255,13 @@ public class PartitionIndex implements SharedCloseable
                 int read = fh.channel.read(buffer, pos);
                 if (read < 0)
                     throw new EOFException("Failed to read " + fh.path() + " 
at position " + pos);
+                else if (read == 0)
+                {
+                    // Shouldn't happen on a blocking file channel with space 
remaining, but stop rather than spin.
+                    logger.warn("Read 0 bytes from {} at position {}, 
partition index partially warmed ({} of {} bytes)",
+                                fh.path(), pos, pos - start, firstPos - start);
+                    break;
+                }
 
                 pos += read;
             }


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

Reply via email to