Skip to content

fix: avoid snapshot-read close metadata NPE - #3654

Merged
Gezi-lzq merged 1 commit into
1.8from
fix/snapshot-read-close
Oct 13, 2026
Merged

Gezi-lzq merged 1 commit into
1.8from
fix/snapshot-read-close

Conversation

@Gezi-lzq

@Gezi-lzq Gezi-lzq commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Why

Snapshot-read ElasticLog instances intentionally have no MetaStream or ElasticLogSegmentManager. During partition removal or replacement, ElasticLog.close() still executed the normal metadata lifecycle and dereferenced those null components, producing SNAPSHOT_SUBSCRIBE_ERROR.

What

  • Do not install the lazy stream metadata listener for snapshot-read logs.
  • Skip MetaStream.beforeClose, log metadata persistence, and partition metadata persistence when closing snapshot-read logs.
  • Keep closing snapshot-read segments and data streams.
  • Leave the normal ElasticLog close path unchanged.

This PR intentionally does not change SnapshotReadPartitionsManager, request retry policy, or subscriber state convergence.

Test

The regression test builds a snapshot-read log with real segment metadata, closes it, and verifies that its data streams are closed. This avoids the former empty-log false positive where an activeSegment failure was swallowed internally.

Verification

  • ./gradlew core:S3UnitTest --tests kafka.log.streamaspect.ElasticLogTest.testSnapshotReadCloseSkipsMetadataLifecycle
  • git diff --check

Both pass.

@Gezi-lzq
Gezi-lzq force-pushed the fix/snapshot-read-close branch from 92a878b to 35047dc Compare October 13, 2026 02:16
@Gezi-lzq
Gezi-lzq changed the base branch from 1.7 to 1.8 October 13, 2026 02:16
@Gezi-lzq
Gezi-lzq force-pushed the fix/snapshot-read-close branch from 35047dc to 5aa3af4 Compare October 13, 2026 03:10
@Gezi-lzq Gezi-lzq changed the title fix: avoid snapshot-read close metadata NPE fix: make snapshot-read cleanup converge Oct 13, 2026
@Gezi-lzq
Gezi-lzq force-pushed the fix/snapshot-read-close branch from 5aa3af4 to ce4b840 Compare October 13, 2026 03:16
@Gezi-lzq Gezi-lzq changed the title fix: make snapshot-read cleanup converge fix: avoid snapshot-read close metadata NPE Oct 13, 2026
Comment thread core/src/main/scala/kafka/log/streamaspect/ElasticLog.scala
@Gezi-lzq
Gezi-lzq force-pushed the fix/snapshot-read-close branch from ce4b840 to a9588ee Compare October 13, 2026 03:39
@Gezi-lzq
Gezi-lzq enabled auto-merge (squash) October 13, 2026 05:38
@Gezi-lzq
Gezi-lzq merged commit c6f62b7 into 1.8 Oct 13, 2026
7 checks passed
@Gezi-lzq
Gezi-lzq deleted the fix/snapshot-read-close branch October 13, 2026 06:07
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.

2 participants