Skip to content

Conversation

@Sicheng-Pan
Copy link
Contributor

@Sicheng-Pan Sicheng-Pan commented Oct 30, 2025

Description of changes

Summarize the changes made by this PR.

  • Improvements & Bug fixes
    • Throw error during fork_log if the first available offset in the copied manifest is ahead of the compaction cursor
  • New functionality
    • N/A

Test plan

How are these changes tested?

  • Tests pass locally with pytest for python, yarn test for js, cargo test for rust

Migration plan

Are there any migrations, or any forwards/backwards compatibility changes needed in order to make sure this change deploys reliably?

Observability plan

What is the plan to instrument and monitor this change?

Documentation Changes

Are all docstrings for user-facing APIs updated if required? Do we need to make documentation changes in the _docs section?_

Copy link
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions
Copy link

Reviewer Checklist

Please leverage this checklist to ensure your code review is thorough before approving

Testing, Bugs, Errors, Logs, Documentation

  • Can you think of any use case in which the code does not behave as intended? Have they been tested?
  • Can you think of any inputs or external events that could break the code? Is user input validated and safe? Have they been tested?
  • If appropriate, are there adequate property based tests?
  • If appropriate, are there adequate unit tests?
  • Should any logging, debugging, tracing information be added or removed?
  • Are error messages user-friendly?
  • Have all documentation changes needed been made?
  • Have all non-obvious changes been commented?

System Compatibility

  • Are there any potential impacts on other parts of the system or backward compatibility?
  • Does this change intersect with any items on our roadmap, and if so, is there a plan for fitting them together?

Quality

  • Is this code of a unexpectedly high quality (Readability, Modularity, Intuitiveness)

@Sicheng-Pan Sicheng-Pan marked this pull request as ready for review October 30, 2025 02:49
@propel-code-bot
Copy link
Contributor

propel-code-bot bot commented Oct 30, 2025

Add sanity checks in fork_logs to detect incomplete copied manifest

Small patch in the Rust log-service that hardens the fork_logs flow. After copying a source log to the target collection via wal3::copy, the code now loads the copied manifest directly and validates two invariants:

  1. The compaction cursor (offset) must not be behind the first timestamp recorded in the copied manifest (first_copied_offset).
  2. The compaction cursor must be ≤ the manifest’s next_write_timestamp (existing check, now performed against the in-memory manifest rather than an extra reader call).
    If either invariant fails, the RPC returns Status::internal instead of silently proceeding, preventing reads or writes on an inconsistent fork.
Key Changes

• Added new_manifest retrieval via log_reader.manifest().await inside fork_logs
• Introduced check if offset < first_copied_offset { return Err(Status::internal(...)) }
• Replaced previous log_reader.next_write_timestamp().await call with new_manifest.next_write_timestamp()
• Updated variable names (first_copied_offset, max_offset) and error text to clarify failure cases

Affected Areas

rust/log-service/src/lib.rs – function LogServer::fork_logs

This summary was automatically generated by @propel-code-bot

@Sicheng-Pan Sicheng-Pan merged commit 5ca19f7 into main Oct 30, 2025
62 checks passed
@Sicheng-Pan Sicheng-Pan deleted the 10-29-_bug_fork_log_should_error_on_incomplete_manifest branch October 30, 2025 17:58
chroma-droid pushed a commit that referenced this pull request Oct 30, 2025
## Description of changes

_Summarize the changes made by this PR._

- Improvements & Bug fixes
- Throw error during `fork_log` if the first available offset in the
copied manifest is ahead of the compaction cursor
- New functionality
    - N/A

## Test plan

_How are these changes tested?_

- [ ] Tests pass locally with `pytest` for python, `yarn test` for js,
`cargo test` for rust

## Migration plan

_Are there any migrations, or any forwards/backwards compatibility
changes needed in order to make sure this change deploys reliably?_

## Observability plan

_What is the plan to instrument and monitor this change?_

## Documentation Changes

_Are all docstrings for user-facing APIs updated if required? Do we need
to make documentation changes in the_ [_docs
section](https://github.com/chroma-core/chroma/tree/main/docs/docs.trychroma.com)?_
Sicheng-Pan added a commit that referenced this pull request Oct 30, 2025
This PR cherry-picks the commit 5ca19f7
onto release/2025-10-24. If there are unresolved conflicts, please
resolve them manually.

Co-authored-by: Macronova <[email protected]>
jasonvigil added a commit that referenced this pull request Nov 2, 2025
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