storage: adjust log lines in disk_log_impl::close/remove()#28536
Merged
Conversation
8 tasks
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR enhances the disk_log_impl::close() and disk_log_impl::remove() methods by adding synchronization to prevent race conditions with prefix truncation operations. The changes include acquiring rewrite locks before closing/removing logs, refactoring the prefix truncation logic, and improving error handling in the appender.
Key Changes:
- Added
_segment_rewrite_lockacquisition inclose()andremove()methods to prevent races with prefix truncation - Refactored segment removal logic into a dedicated
do_remove_prefix_full_segment()coroutine - Updated error logging to use
stlog.errorinstead ofstlog.infofor batch write failures
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/v/storage/disk_log_impl.cc | Added lock acquisition in close()/remove() and refactored prefix segment removal into separate coroutine with improved locking |
| src/v/storage/disk_log_impl.h | Added declaration for new do_remove_prefix_full_segment() helper method |
| src/v/storage/disk_log_appender.cc | Added closed segment check and improved error logging for batch write failures |
| src/v/storage/probe.h | Simplified batch_write_error() signature by removing exception parameter |
| src/v/storage/probe.cc | Removed logging from batch_write_error() as it's now handled at call site |
| src/v/storage/tests/storage_e2e_test.cc | Added test for concurrent truncate/append/close operations and converted helper to coroutine |
Comment on lines
+54
to
+55
| !_seg || !_seg->has_appender() || _seg->is_tombstone() | ||
| || _seg->is_closed()) { |
There was a problem hiding this comment.
[nitpick] The multi-line condition formatting is inconsistent. The || _seg->is_closed() should be on the same line as the previous conditions or all conditions should be on separate lines for readability.
Suggested change
| !_seg || !_seg->has_appender() || _seg->is_tombstone() | |
| || _seg->is_closed()) { | |
| !_seg | |
| || !_seg->has_appender() | |
| || _seg->is_tombstone() | |
| || _seg->is_closed()) { |
Collaborator
CI test resultstest results on build#76272
test results on build#76289
|
For debugability.
09bee48 to
e1685a1
Compare
Contributor
Author
|
Force push to rebase to |
andrwng
approved these changes
Nov 14, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Based on #28472.
Backports Required
Release Notes