karafka-rdkafka 0.14.8 → 0.14.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/CHANGELOG.md +4 -0
- data/lib/rdkafka/producer.rb +14 -7
- data/lib/rdkafka/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8a3805cc154b0e1ca0d71fe06a852013c3e8d8dfd8148d4de8902aed66a2774d
|
4
|
+
data.tar.gz: 908236ad1ab0be52549f01ddf90ed37355a3b6e9e3373b867eeb83fa05fdf39c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6460881076e6c45ae5feb38a3cfd4da3160f13a092f6a7acdbbe268e297b10e27ad792dab32a8c193824a5ef44fc9c2f40c5685ee5c489370056f1c408297f83
|
7
|
+
data.tar.gz: c2f42212e4df244d36f2312506dd69e52e8064c3485dc1fd0692d223ac9f2512a8b8102b7f473766386eb997dc7bb490fc4fc3c4a2815c528d6c1a8cddee7fcd
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# Rdkafka Changelog
|
2
2
|
|
3
|
+
## 0.14.9 (2024-01-29)
|
4
|
+
- [Fix] Partition cache caches invalid `nil` result for `PARTITIONS_COUNT_TTL`.
|
5
|
+
- [Enhancement] Report `-1` instead of `nil` in case `partition_count` failure.
|
6
|
+
|
3
7
|
## 0.14.8 (2024-01-24)
|
4
8
|
- [Enhancement] Provide support for Nix OS (alexandriainfantino)
|
5
9
|
- [Enhancement] Skip intermediate array creation on delivery report callback execution (one per message) (mensfeld)
|
data/lib/rdkafka/producer.rb
CHANGED
@@ -40,10 +40,16 @@ module Rdkafka
|
|
40
40
|
topic_metadata = ::Rdkafka::Metadata.new(inner, topic).topics&.first
|
41
41
|
end
|
42
42
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
43
|
+
partition_count = topic_metadata ? topic_metadata[:partition_count] : -1
|
44
|
+
|
45
|
+
# This approach caches the failure to fetch only for 1 second. This will make sure, that
|
46
|
+
# we do not cache the failure for too long but also "buys" us a bit of time in case there
|
47
|
+
# would be issues in the cluster so we won't overaload it with consecutive requests
|
48
|
+
cache[topic] = if partition_count.positive?
|
49
|
+
[monotonic_now, partition_count]
|
50
|
+
else
|
51
|
+
[monotonic_now - PARTITIONS_COUNT_TTL + 5, partition_count]
|
52
|
+
end
|
47
53
|
end
|
48
54
|
end
|
49
55
|
|
@@ -199,14 +205,15 @@ module Rdkafka
|
|
199
205
|
# Partition count for a given topic.
|
200
206
|
#
|
201
207
|
# @param topic [String] The topic name.
|
202
|
-
# @return [Integer] partition count for a given topic
|
208
|
+
# @return [Integer] partition count for a given topic or `-1` if it could not be obtained.
|
203
209
|
#
|
204
210
|
# @note If 'allow.auto.create.topics' is set to true in the broker, the topic will be
|
205
211
|
# auto-created after returning nil.
|
206
212
|
#
|
207
213
|
# @note We cache the partition count for a given topic for given time.
|
208
214
|
# This prevents us in case someone uses `partition_key` from querying for the count with
|
209
|
-
# each message. Instead we query once every 30 seconds at most
|
215
|
+
# each message. Instead we query once every 30 seconds at most if we have a valid partition
|
216
|
+
# count or every 5 seconds in case we were not able to obtain number of partitions
|
210
217
|
def partition_count(topic)
|
211
218
|
closed_producer_check(__method__)
|
212
219
|
|
@@ -256,7 +263,7 @@ module Rdkafka
|
|
256
263
|
if partition_key
|
257
264
|
partition_count = partition_count(topic)
|
258
265
|
# If the topic is not present, set to -1
|
259
|
-
partition = Rdkafka::Bindings.partitioner(partition_key, partition_count, @partitioner_name) if partition_count
|
266
|
+
partition = Rdkafka::Bindings.partitioner(partition_key, partition_count, @partitioner_name) if partition_count.positive?
|
260
267
|
end
|
261
268
|
|
262
269
|
# If partition is nil, use -1 to let librdafka set the partition randomly or
|
data/lib/rdkafka/version.rb
CHANGED
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: karafka-rdkafka
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.14.
|
4
|
+
version: 0.14.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thijs Cadier
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
AnG1dJU+yL2BK7vaVytLTstJME5mepSZ46qqIJXMuWob/YPDmVaBF39TDSG9e34s
|
36
36
|
msG3BiCqgOgHAnL23+CN3Rt8MsuRfEtoTKpJVcCfoEoNHOkc
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2024-01-
|
38
|
+
date: 2024-01-29 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: ffi
|
metadata.gz.sig
CHANGED
Binary file
|