Skip to content

Conversation

@dannyzaken
Copy link
Member

@dannyzaken dannyzaken commented Nov 18, 2025

Describe the Problem

  • In read_object_stream, we used the requested_size passed to the _read function as the value to acquire from the io semaphore. By default, this is 32 MB (the stream's highWaterMark).
  • For datasets with mostly small objects, this limits the number of concurrent reads more than necessary.

Explain the Changes

  • Changed io_sem_size to reflect the actual size requested by the current read.
  • Also, avoid entering the code under the semaphore if there is nothing more to read.
  • changed debug level of some read\upload messages to log1 instead of log0

Issues: Fixed #xxx / Gap #xxx

Testing Instructions:

  • Doc added/updated
  • Tests added

Summary by CodeRabbit

  • Bug Fixes

    • Fixed early termination handling for read streams and ensured original errors are rethrown after logging.
    • Improved completion signaling when reads finish.
  • Refactor

    • Reduced logging verbosity across upload and read paths to minimize noise.
    • Adjusted read resource sizing to better match requested ranges.
    • Added a log entry indicating streaming target during uploads.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Nov 18, 2025

Walkthrough

Replaces several verbose debug logs with lower-verbosity logs across upload/read paths, adds an early-termination guard in read_object_stream, adjusts IO semaphore sizing to use requested_end - reader.pos, adds an explicit re-throw in upload error handling, and inserts a few additional log lines and a minor comment formatting change.

Changes

Cohort / File(s) Summary
Debug logging standardization and IO logic refinements
src/sdk/object_io.js
Converts verbose debug logs (log0) to less verbose (log1) across upload and read flows; adds early-termination guard in read_object_stream when requested_end ≤ reader.pos (pushes null and returns); changes IO semaphore sizing to use requested_end - reader.pos; adds explicit throw of caught error in upload path; adds a log line for streaming target bucket/key; minor comment formatting tweak

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Verify semaphore sizing change (requested_end - reader.pos) for buffer and concurrency correctness.
  • Review early-termination guard in read_object_stream for correct stream-close semantics and edge cases.
  • Confirm the explicit re-throw in upload error handling preserves original stack/context and does not alter error handling elsewhere.

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly addresses the main change: adjusting IO semaphore acquisition to use the exact read size (requested_end - reader.pos) instead of the default stream size, which is the primary objective.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4abf62d and f4918af.

📒 Files selected for processing (1)
  • src/sdk/object_io.js
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/sdk/object_io.js
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: run-package-lock-validation
  • GitHub Check: Build Noobaa Image
  • GitHub Check: run-jest-unit-tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

// instead of getting multiple calls from the stream with small slices to return.

const requested_end = Math.min(params.end, reader.pos + requested_size);
if (requested_end <= reader.pos) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Just thinking here, maybe the logic will be clearer:
if (requested_size === 0 || reader.pos >= params.end) {
As this will give us more understanding that reading is finished

Copy link
Contributor

@alphaprinz alphaprinz left a comment

Choose a reason for hiding this comment

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

Nice. LGTM.

re Jacky's comment, can't say I have a preference. Options are equivalent and both make sense.

- In read_object_stream, we used the requested_size passed to the _read function as the value to acquire from the io semaphore. By default, this is 32 MB (the stream's highWaterMark).
- For datasets with mostly small objects, this limits the number of concurrent reads more than necessary.
- Changed io_sem_size to reflect the actual size requested by the current read.
- Also, avoid entering the code under the semaphore if there is nothing more to read.
- changed debug level of some read\upload messages to log1 instead of log0

Signed-off-by: Danny Zaken <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants