Skip to content

Commit bb1d731

Browse files
committed
fixup: Use same strategy for updating cache partition metadata
as for the `rd_kafka_toppar_t` that is also the same strategy as in Java client, considering: - when topic id changes partitions metadata is taken entirely from the new one. - when leader epoch is greater or equal to the one in the cache, or null (-1), partition metadata is taken from the new one. - when leader epoch is less than the one in the cache, partition metadata remains the same. Also when full metadata is necessary, the cache is used for storing it and for matching topics in the regex, removing the need to store the full metadata result, that is about the same size, but the cache is updated more accurately.
1 parent 262af94 commit bb1d731

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ librdkafka v2.9.0 is a feature release:
3131
* Fix for the case where a metadata refresh enqueued on an unreachable broker
3232
prevents refreshing the controller or the coordinator until that broker
3333
becomes reachable again (#4970).
34+
* Prevent metadata cache corruption when topic id changes
35+
(@kwdubuc, @marcin-krystianc, @GerKr, #4970).
36+
3437

3538
## Fixes
3639

@@ -75,6 +78,11 @@ librdkafka v2.9.0 is a feature release:
7578
the broker the request is enqueued on is up again.
7679
Solved by not retrying these kinds of metadata requests.
7780
Happens since 1.x (#4970).
81+
* Issues: #4964, #4778
82+
Prevent metadata cache corruption when topic id for the same topic name
83+
changes. Solved by correctly removing the entry with the old topic id from metadata cache
84+
to prevent subsequent use-after-free.
85+
Happens since 2.4.0 (@kwdubuc, @marcin-krystianc, @GerKr, #4970).
7886

7987
### Consumer fixes
8088

0 commit comments

Comments
 (0)