Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v23.2.x] Fix some concurrent memory access problems in partition balancer #18498

Merged
merged 3 commits into from
May 22, 2024

Conversation

ztlpn
Copy link
Contributor

@ztlpn ztlpn commented May 15, 2024

Backport of PR #18305

ztlpn added 3 commits May 14, 2024 14:09
Partition balancer relies on _topics_map_revision checks to safely iterate
over topic table collections with partition granularity (i.e. references
to partition data and replica sets are stored and accessed across yield
points). To make this safe, increment _topics_map_revision every time
_topics, _updates_in_progress, _disabled_partitions or nested
collections are modified in a way that invalidates references or
iterators.

(cherry picked from commit 30bbfb1)

Conflicts:
	src/v/cluster/topic_table.cc
It is handy to have a base class for all instances of concurrent
modifications.

(cherry picked from commit 627db4d)

Conflicts:
	src/v/cluster/topic_table.h
	src/v/cluster/topics_frontend.cc
	src/v/utils/stable_iterator_adaptor.h
Shard-local allocation_state object is replaced when we are applying
a controller snapshot. After this happens, all live allocated_partition
objects become invalid. Detect this and throw
concurrent_modification_error in case these objects are still used and
make destructors no-op.

(cherry picked from commit a57a575)

Conflicts:
	src/v/cluster/scheduling/types.cc
@ztlpn ztlpn added this to the v23.2.x-next milestone May 15, 2024
@ztlpn ztlpn added the kind/backport PRs targeting a stable branch label May 15, 2024
@ztlpn ztlpn marked this pull request as ready for review May 15, 2024 15:58
@ztlpn
Copy link
Contributor Author

ztlpn commented May 15, 2024

Just as with the 23.3.x backport, skip commit 1c63990 containing the test so as not to block backporting the actual fixes. I will backport it later with another fix.

@ztlpn ztlpn merged commit 9e4bddc into redpanda-data:v23.2.x May 22, 2024
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/redpanda kind/backport PRs targeting a stable branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[v23.2.x] Fix some concurrent memory access problems in partition balancer
2 participants