Skip to content

Conversation

@pkolaczk
Copy link

@pkolaczk pkolaczk commented Dec 4, 2025

This commit attempts to improve quality of RebufferingInputStream
and its implementations by the following changes:

  • reBuffer contract has been documented
  • reBuffer implementations no longer throw to indicate EOF
  • reBuffer implementations fill at least 1 byte when not on EOF
  • reBuffer implementations do not leave null buffer after exiting
    normally
  • state Preconditions have been added to reBuffer
  • readFully has been rewritten to rely on the Java contract of read
    which is allowed to read less than len bytes, instead of assuming
    non-standard behaviour present in the old read implementation
  • read has been significantly simplified, yet it still obeys
    the Java InputStream contract
  • some code has been made final / moved to private to disallow
    accidental breakage of contracts in subclasses

Those are not just code-style changes. In particular the following
contract violating behaviors should be impossible now:

  • read throwing EOFException
  • readFully throwing EOFException before reaching the real
    end of stream

@github-actions
Copy link

github-actions bot commented Dec 4, 2025

Checklist before you submit for review

  • This PR adheres to the Definition of Done
  • Make sure there is a PR in the CNDB project updating the Converged Cassandra version
  • Use NoSpamLogger for log lines that may appear frequently in the logs
  • Verify test results on Butler
  • Test coverage for new/modified code is > 80%
  • Proper code formatting
  • Proper title for each commit staring with the project-issue number, like CNDB-1234
  • Each commit has a meaningful description
  • Each commit is not very long and contains related changes
  • Renames, moves and reformatting are in distinct commits
  • All new files should contain the DataStax copyright header instead of the Apache License one

@pkolaczk pkolaczk self-assigned this Dec 4, 2025
@pkolaczk pkolaczk requested a review from jasonstack December 4, 2025 15:42
@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 4, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
74.6% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@cassci-bot
Copy link

❌ Build ds-cassandra-pr-gate/PR-2152 rejected by Butler


2 regressions found
See build details here


Found 2 new test failures

Test Explanation Runs Upstream
o.a.c.index.sai.cql.VectorCompaction100dTest.testCompactionWithEnoughRowsForPQAndDeleteARow[eb false] NEW 🔴 0 / 19
o.a.c.metrics.TrieMemtableMetricsTest.testContentionMetrics (compression) REGRESSION 🔴🔴 2 / 19

Found 3 known test failures

@pkolaczk pkolaczk force-pushed the c16212-read-fully branch 3 times, most recently from 02217e8 to c415ff4 Compare December 8, 2025 10:43
This commit attempts to improve quality of RebufferingInputStream
and its implementations by the following changes:

- `reBuffer` contract has been documented
- `reBuffer` implementations no longer throw to indicate EOF
- `reBuffer` implementations fill at least 1 byte when not on EOF
- `reBuffer` implementations do not leave null buffer after exiting
  normally
- state Preconditions have been added to `reBuffer`
- `readFully` has been rewritten to rely on the Java contract of `read`
  which is allowed to read less than `len` bytes, instead of assuming
  non-standard behaviour present in the old `read` implementation
- `read` has been significantly simplified, yet it still obeys
  the Java InputStream contract
- some code has been made final / moved to private to disallow
  accidental breakage of contracts in subclasses

Those are not just code-style changes. In particular the following
contract violating behaviors should be impossible now:
- `read` throwing EOFException
- `readFully` throwing EOFException before reaching the real
  end of stream

Additionally, a comprehensive test suite has been added for
`RebufferingInputStream`, which tests its logic in isolation from
its concrete implementations.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants