Skip to content

Conversation

@rescrv
Copy link
Contributor

@rescrv rescrv commented Jun 26, 2025

Description of changes

In a commit back in March I took out the cancellation safety from append batch.

This re-adds that so that the batch only waits for itself, not until all work is done.

Test plan

CI

Documentation Changes

N/A

In a commit back in March I took out the cancellation safety from append batch.

This re-adds that so that the batch only waits for itself, not until all work is done.
@propel-code-bot
Copy link
Contributor

Restore Cancellation Safety to append_batch Processing

This PR reintroduces cancellation safety for batch appends in the WAL writer. Now, the batch processing only waits for its own completion instead of until all work is done, by spawning each append_batch using tokio tasks. Minimal wording updates were made to clarify a comment in batch_manager.rs.

Key Changes:
• Revised OnceLogWriter to spawn append_batch via tokio::task::spawn, ensuring cancellation safety.
• Modified code to ensure each batch append waits only on its own completion, not global completion.
• Minor comment update in batch_manager.rs for clarity on notification.

Affected Areas:
• rust/wal3/src/writer.rs
• rust/wal3/src/batch_manager.rs

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

@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)

@rescrv rescrv requested a review from Sicheng-Pan June 26, 2025 22:33
Copy link
Contributor

@Sicheng-Pan Sicheng-Pan left a comment

Choose a reason for hiding this comment

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

Note: previously append_batch may continue to do more work, but after the fix it will only wait for its own work to be done.

@rescrv rescrv merged commit 8314b97 into main Jun 26, 2025
58 checks passed
rescrv added a commit that referenced this pull request Jun 26, 2025
## Description of changes

In a commit back in March I took out the cancellation safety from append
batch.

This re-adds that so that the batch only waits for itself, not until all
work is done.

## Test plan

CI

## Documentation Changes

N/A
rescrv added a commit that referenced this pull request Jun 27, 2025
## Description of changes

Included changes

- **[ENH] Purge dirty log in background at the end of scheduled
compaction (#4915)**
- **[ENH] Move Log GC to operator (#4919)**
- **[BUG]  Do not leak tokio tasks in the log service. (#4936)**
- **[BUG] Log GC offset should be one above minimum compaction offset
(#4938)**
- **[ENH] Make roll dirty log always converge to coalesce everything.
(#4927)**
- **[BUG] Coalesce when multiple collections return the same info to
compact (#4946)**
- **[BUG]  Enrich from the manifest if a cursor doesn't exist. (#4947)**
- **[ENH] If the dirty log fails with LogContentionDurable, do not fail
the operation. (#4953)**
- **[ENH]  Warn, not error, if dirty log has no cursor. (#4952)**
- **[ENH]  Cancellation safety for append_batch. (#4959)**

## Test plan

CI

## Documentation Changes

N/A

---------

Co-authored-by: Macronova <[email protected]>
@rescrv rescrv deleted the rescrv/bg-tasks branch August 1, 2025 18:18
Inventrohyder pushed a commit to Inventrohyder/chroma that referenced this pull request Aug 5, 2025
## Description of changes

In a commit back in March I took out the cancellation safety from append
batch.

This re-adds that so that the batch only waits for itself, not until all
work is done.

## Test plan

CI

## Documentation Changes

N/A
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