Skip to content

fix: guard null partition location in weak read prep#440

Merged
WeiXinChan merged 1 commit into
masterfrom
bugfix/prepare-for-weak-read-npe-master
Jul 20, 2026
Merged

fix: guard null partition location in weak read prep#440
WeiXinChan merged 1 commit into
masterfrom
bugfix/prepare-for-weak-read-npe-master

Conversation

@maochongxin

Copy link
Copy Markdown
Contributor

Background

In origin/master, ObPartitionEntry.prepareForWeakRead() iterates over partitionInfos and directly calls entry.getValue().getPartitionLocation().prepareForWeakRead(ldcLocation).

However, getPartitionInfo() creates and publishes an ObPartitionLocationInfo via ConcurrentHashMap.computeIfAbsent(). At that moment, partitionLocation may still be null.

During concurrent tablet location refreshes, one thread may iterate over an entry that was just published by another thread but has not been populated by updateLocation() yet, causing an NPE.

Changes

  • Add null checks for ObPartitionLocationInfo and ObPartitionLocation in prepareForWeakRead().
  • Skip partition locations that have not been initialized yet.
  • Add a regression test covering the case where an empty ObPartitionLocationInfo has been published but its partitionLocation is still null.

@CLAassistant

CLAassistant commented Jul 20, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@WeiXinChan

Copy link
Copy Markdown
Contributor

LGTM

@WeiXinChan
WeiXinChan merged commit a599227 into master Jul 20, 2026
3 checks passed
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