Skip to content

storage: adjust log lines in disk_log_impl::close/remove()#28536

Merged
WillemKauf merged 1 commit into
redpanda-data:devfrom
WillemKauf:followup_storage_pr
Nov 14, 2025
Merged

storage: adjust log lines in disk_log_impl::close/remove()#28536
WillemKauf merged 1 commit into
redpanda-data:devfrom
WillemKauf:followup_storage_pr

Conversation

@WillemKauf
Copy link
Copy Markdown
Contributor

Based on #28472.

Backports Required

  • none - not a bug fix
  • none - this is a backport
  • none - issue does not exist in previous branches
  • none - papercut/not impactful enough to backport
  • v25.3.x
  • v25.2.x
  • v25.1.x
  • v24.3.x

Release Notes

  • none

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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_lock acquisition in close() and remove() 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.error instead of stlog.info for 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()) {
Copy link

Copilot AI Nov 13, 2025

Choose a reason for hiding this comment

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

[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()) {

Copilot uses AI. Check for mistakes.
@vbotbuildovich
Copy link
Copy Markdown
Collaborator

vbotbuildovich commented Nov 14, 2025

CI test results

test results on build#76272
test_class test_method test_arguments test_kind job_url test_status passed reason test_history
MountUnmountIcebergTest test_simple_remount {"cloud_storage_type": 1} integration https://buildkite.com/redpanda/redpanda/builds/76272#019a7f70-3ace-4d49-858f-69621319ac5a FLAKY 16/21 upstream reliability is '83.95624430264357'. current run reliability is '76.19047619047619'. drift is 7.76577 and the allowed drift is set to 50. The test should PASS https://redpanda.metabaseapp.com/dashboard/87-tests?tab=142-dt-individual-test-history&test_class=MountUnmountIcebergTest&test_method=test_simple_remount
test results on build#76289
test_class test_method test_arguments test_kind job_url test_status passed reason test_history
ScalingUpTest test_moves_with_local_retention {"use_topic_property": false} integration https://buildkite.com/redpanda/redpanda/builds/76289#019a80a3-baf1-4bca-863b-e443e74d0e90 FLAKY 20/21 upstream reliability is '98.14814814814815'. current run reliability is '95.23809523809523'. drift is 2.91005 and the allowed drift is set to 50. The test should PASS https://redpanda.metabaseapp.com/dashboard/87-tests?tab=142-dt-individual-test-history&test_class=ScalingUpTest&test_method=test_moves_with_local_retention
TxUpgradeCompactionTest upgrade_with_compaction_test null integration https://buildkite.com/redpanda/redpanda/builds/76289#019a80a3-baf3-45b0-b84c-5aa56e3000c1 FLAKY 20/21 upstream reliability is '99.09909909909909'. current run reliability is '95.23809523809523'. drift is 3.861 and the allowed drift is set to 50. The test should PASS https://redpanda.metabaseapp.com/dashboard/87-tests?tab=142-dt-individual-test-history&test_class=TxUpgradeCompactionTest&test_method=upgrade_with_compaction_test
src/v/storage/mvlog/tests/file_test src/v/storage/mvlog/tests/file_test unit https://buildkite.com/redpanda/redpanda/builds/76289#019a8082-c875-429d-85c9-0efc476f8f20 FAIL 0/1

@WillemKauf
Copy link
Copy Markdown
Contributor Author

Force push to rebase to upstream/dev

@WillemKauf WillemKauf merged commit a577d21 into redpanda-data:dev Nov 14, 2025
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants