-
Notifications
You must be signed in to change notification settings - Fork 589
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
Fix some concurrent memory access problems in partition balancer #18305
Fix some concurrent memory access problems in partition balancer #18305
Conversation
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.
This test is good, another bug uncovered. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where do we bump _topics_map_revision
after this emplace? https://github.com/redpanda-data/redpanda/pull/18305/files#diff-fe5b0d76af2702db674fdadb63ce097a8ea25f5b420f921374e0d1332464f549R1182
It is handy to have a base class for all instances of concurrent modifications.
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.
4fa0e47
to
1c63990
Compare
It's incremented here. Well, technically it is before, but what matters is that it is in the same continuation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm.
/backport v24.1.x |
/backport v23.3.x |
/backport v23.2.x |
Failed to create a backport PR to v23.3.x branch. I tried:
|
Failed to create a backport PR to v23.2.x branch. I tried:
|
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.Likely fixes:
RandomNodeOperationsTest.test_node_operations
#18130RandomNodeOperationsTest.test_node_operations
#17751RandomNodeOperationsTest.test_node_operations
#16533RandomNodeOperationsTest.test_node_operations
#16510RandomNodeOperationsTest.test_node_operations
#13301Backports Required
Release Notes