improve malloc efficiency for cluster slots_info_pairs #10488
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Recently the cluster tests are consistently failing when executed with ASAN in the CI.
The failure is usually in
04-resharding.tcl:when it happens with
test-sanitizer-address (gcc)we can later see this:
when it happens with
test-sanitizer-address (clang)we see:these traces indicate that the test suite infra is attempting to terminate the redis instance, and when it refuses to terminate, the test suite sends a SIGSEGV in order to see where it is hung.
we see it is hung inside
exitI tried to track down the commit that started it, and it appears to be #10293.
Looking at the commit, i realize it didn't affect this test / flow, other than the replacement of the slots_info_pairs from sds to list.
i concluded that what could be happening is that the slot range is very fragmented, and that results in many allocations.
with sds, it results in one allocation and also, we have a greedy growth mechanism, but with adlist, we just have many many small allocations.
this probably causes stress on ASAN, and causes it to be slow at termination.
This commit improve malloc efficiency of this mechanism by changing adlist into an array being realloced with greedy growth mechanism
.
tests: https://github.com/redis/redis/actions/runs/2052717847