Skip to content

feat(storage): adding disabling option for bidi reads#13506

Open
Dhriti07 wants to merge 16 commits into
mainfrom
disable-bidi-checksum-new
Open

feat(storage): adding disabling option for bidi reads#13506
Dhriti07 wants to merge 16 commits into
mainfrom
disable-bidi-checksum-new

Conversation

@Dhriti07

Copy link
Copy Markdown
Contributor

Add option to disable Bidi Checksum using checksum disable system property

@Dhriti07 Dhriti07 requested review from a team as code owners June 17, 2026 16:28
@Dhriti07 Dhriti07 changed the title adding disabling for bidi reads feat(storage): adding disabling for bidi reads Jun 17, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors CRC32C checksum validation by replacing Hasher.enabled() with Hasher.defaultHasher() and checking against Hasher.noop(). It also updates CumulativeHasher to use the delegate's initial value, handle null values safely, and adds a unit test for disabled validation. The review feedback correctly points out that removing the !(hasher instanceof Hasher.NoOpHasher) check in BaseObjectReadSessionStreamRead leads to unnecessary allocations of CumulativeHasher when checksumming is disabled, and recommends restoring this check.

this.readId = readId;
this.hasher =
(rangeSpec.begin() == 0 && !(hasher instanceof Hasher.NoOpHasher))
(rangeSpec.begin() == 0)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

By removing the !(hasher instanceof Hasher.NoOpHasher) check, a CumulativeHasher is now always allocated and wrapped around the delegate hasher when rangeSpec.begin() == 0, even if checksum validation is disabled (i.e., when hasher is a NoOpHasher). Keeping this check avoids unnecessary object allocation and overhead when checksumming is disabled.

Suggested change
(rangeSpec.begin() == 0)
(rangeSpec.begin() == 0 && !(hasher instanceof Hasher.NoOpHasher))
References
  1. Prefer lazy initialization over eager initialization for resource-intensive objects if they are not guaranteed to be used in all execution paths, to avoid unnecessary performance and memory overhead.

this.readId = new AtomicLong(readId);
this.hasher =
(rangeSpec.begin() == 0 && !(hasher instanceof Hasher.NoOpHasher))
(rangeSpec.begin() == 0)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

By removing the !(hasher instanceof Hasher.NoOpHasher) check, a CumulativeHasher is now always allocated and wrapped around the delegate hasher when rangeSpec.begin() == 0, even if checksum validation is disabled (i.e., when hasher is a NoOpHasher). Keeping this check avoids unnecessary object allocation and overhead when checksumming is disabled.

Suggested change
(rangeSpec.begin() == 0)
(rangeSpec.begin() == 0 && !(hasher instanceof Hasher.NoOpHasher))
References
  1. Prefer lazy initialization over eager initialization for resource-intensive objects if they are not guaranteed to be used in all execution paths, to avoid unnecessary performance and memory overhead.

@Dhriti07 Dhriti07 changed the title feat(storage): adding disabling for bidi reads feat(storage): adding disabling option for bidi reads Jun 17, 2026
Base automatically changed from add-cumulative-hasher-bidi-flow to main June 17, 2026 18:24
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.

2 participants