karafka 2.4.4 → 2.4.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +4 -1
- data/.ruby-version +1 -1
- data/CHANGELOG.md +12 -1
- data/Gemfile.lock +9 -9
- data/docker-compose.yml +1 -1
- data/lib/karafka/connection/client.rb +31 -6
- data/lib/karafka/routing/subscription_group.rb +21 -1
- data/lib/karafka/setup/attributes_map.rb +4 -0
- data/lib/karafka/setup/config.rb +0 -3
- data/lib/karafka/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: e550fa0b7395eab3b961181319d195809baeca82c02935d2735cf98353f6ef8b
|
4
|
+
data.tar.gz: f734562bfb86db59a64f4fbeb596bfe126eacd428a4ade00da90d238d959ab64
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f80b521d063653c93caee987358573c992af2488ffec9c6465dbb04f9e51e8334548cf669b2b5f8f5783540be01fa8b52e067042cf72afda35f14181148ec87d
|
7
|
+
data.tar.gz: 32fd0f08102a2687f4b646d15cd07599f9aaefac957f828396af1f2d91bc91d5c922119bfec04d94cba63af86724d43cb50852de140d78e289fdbb612892dc78
|
checksums.yaml.gz.sig
CHANGED
@@ -1 +1,4 @@
|
|
1
|
-
|
1
|
+
S ���#s�`&"�!p<�73�T�)��NU����3Ocv�1+.|�ò��9�n���g���S�u�{n )��G�"���>�<_�h�[o1�ECp<�|��\u&���O�{��BP��2�N>R*]��i�?k���.��Ua�V��P,P�X��,F�M�)+ᣦO1Lo�jI ���gr�
|
2
|
+
�&"E�)*��+̰�FE�H��͗:�mk��1p� $R��Jz����������(�D��Dt�8�W�����
|
3
|
+
�֝b���DV�(�C�*��s�����J��@k��fL���x���
|
4
|
+
ה\��-���M����z���|EO��L�.-f���1�b��m~�X�-��&��X8�
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.3.
|
1
|
+
3.3.4
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,15 @@
|
|
1
|
-
# Karafka
|
1
|
+
# Karafka Framework Changelog
|
2
|
+
|
3
|
+
## 2.4.6 (2024-07-22)
|
4
|
+
- [Fix] Mitigate `rd_kafka_cgrp_terminated` and other `librdkafka` shutdown issues by unsubscribing fully prior to shutdown.
|
5
|
+
|
6
|
+
## 2.4.5 (2024-07-18)
|
7
|
+
- [Change] Inject `client.id` when building subscription group and not during the initial setup.
|
8
|
+
- [Fix] Mitigate `confluentinc/librdkafka/issues/4783` by injecting dynamic client id when using `cooperative-sticky` strategy.
|
9
|
+
|
10
|
+
### Change Note
|
11
|
+
|
12
|
+
`client.id` is technically a low-importance value that should not (aside from this error) impact operations. This is why it is not considered a breaking change. This change may be reverted when the original issue is fixed in librdkafka.
|
2
13
|
|
3
14
|
## 2.4.4 (2024-07-04)
|
4
15
|
- [Enhancement] Allow for offset storing from the Filtering API.
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
karafka (2.4.
|
4
|
+
karafka (2.4.6)
|
5
5
|
base64 (~> 0.2)
|
6
6
|
karafka-core (>= 2.4.3, < 2.5.0)
|
7
7
|
waterdrop (>= 2.7.3, < 3.0.0)
|
@@ -39,13 +39,13 @@ GEM
|
|
39
39
|
activesupport (>= 6.1)
|
40
40
|
i18n (1.14.5)
|
41
41
|
concurrent-ruby (~> 1.0)
|
42
|
-
karafka-core (2.4.
|
43
|
-
karafka-rdkafka (>= 0.15.0, < 0.
|
44
|
-
karafka-rdkafka (0.
|
42
|
+
karafka-core (2.4.4)
|
43
|
+
karafka-rdkafka (>= 0.15.0, < 0.18.0)
|
44
|
+
karafka-rdkafka (0.17.0)
|
45
45
|
ffi (~> 1.15)
|
46
46
|
mini_portile2 (~> 2.6)
|
47
47
|
rake (> 12)
|
48
|
-
karafka-testing (2.4.
|
48
|
+
karafka-testing (2.4.5)
|
49
49
|
karafka (>= 2.4.0, < 2.5.0)
|
50
50
|
waterdrop (>= 2.7.0)
|
51
51
|
karafka-web (0.9.1)
|
@@ -58,7 +58,7 @@ GEM
|
|
58
58
|
minitest (5.24.0)
|
59
59
|
mutex_m (0.2.0)
|
60
60
|
ostruct (0.6.0)
|
61
|
-
rack (3.1.
|
61
|
+
rack (3.1.5)
|
62
62
|
rake (13.2.1)
|
63
63
|
roda (3.81.0)
|
64
64
|
rack
|
@@ -84,8 +84,8 @@ GEM
|
|
84
84
|
tilt (2.4.0)
|
85
85
|
tzinfo (2.0.6)
|
86
86
|
concurrent-ruby (~> 1.0)
|
87
|
-
waterdrop (2.7.
|
88
|
-
karafka-core (>= 2.4.
|
87
|
+
waterdrop (2.7.4)
|
88
|
+
karafka-core (>= 2.4.3, < 3.0.0)
|
89
89
|
karafka-rdkafka (>= 0.15.1)
|
90
90
|
zeitwerk (~> 2.3)
|
91
91
|
zeitwerk (2.6.16)
|
@@ -106,4 +106,4 @@ DEPENDENCIES
|
|
106
106
|
simplecov
|
107
107
|
|
108
108
|
BUNDLED WITH
|
109
|
-
2.5.
|
109
|
+
2.5.11
|
data/docker-compose.yml
CHANGED
@@ -257,11 +257,15 @@ module Karafka
|
|
257
257
|
|
258
258
|
# Gracefully stops topic consumption.
|
259
259
|
def stop
|
260
|
-
#
|
261
|
-
#
|
262
|
-
#
|
260
|
+
# librdkafka has several constant issues when shutting down during rebalance. This is
|
261
|
+
# an issue that gets back every few versions of librdkafka in a limited scope, for example
|
262
|
+
# for cooperative-sticky or in a general scope. This is why we unsubscribe and wait until
|
263
|
+
# we no longer have any assignments. That way librdkafka consumer shutdown should never
|
264
|
+
# happen with rebalance associated with the given consumer instance
|
265
|
+
#
|
266
|
+
# @see https://github.com/confluentinc/librdkafka/issues/4792
|
263
267
|
# @see https://github.com/confluentinc/librdkafka/issues/4527
|
264
|
-
if
|
268
|
+
if unsubscribe?
|
265
269
|
unsubscribe
|
266
270
|
|
267
271
|
until assignment.empty?
|
@@ -658,8 +662,13 @@ module Karafka
|
|
658
662
|
subscriptions = @subscription_group.subscriptions
|
659
663
|
assignments = @subscription_group.assignments(consumer)
|
660
664
|
|
661
|
-
|
662
|
-
|
665
|
+
if subscriptions
|
666
|
+
consumer.subscribe(*subscriptions)
|
667
|
+
@mode = :subscribe
|
668
|
+
elsif assignments
|
669
|
+
consumer.assign(assignments)
|
670
|
+
@mode = :assign
|
671
|
+
end
|
663
672
|
|
664
673
|
consumer
|
665
674
|
end
|
@@ -690,6 +699,22 @@ module Karafka
|
|
690
699
|
@kafka.start
|
691
700
|
@kafka
|
692
701
|
end
|
702
|
+
|
703
|
+
# Decides whether or not we should unsubscribe prior to closing.
|
704
|
+
#
|
705
|
+
# We cannot do it when there is a static group membership assignment as it would be
|
706
|
+
# reassigned.
|
707
|
+
# We cannot do it also for assign mode because then there are no subscriptions
|
708
|
+
# We also do not do it if there are no assignments at all as it does not make sense
|
709
|
+
#
|
710
|
+
# @return [Boolean] should we unsubscribe prior to shutdown
|
711
|
+
def unsubscribe?
|
712
|
+
return false if @subscription_group.kafka.key?(:'group.instance.id')
|
713
|
+
return false if @mode != :subscribe
|
714
|
+
return false if assignment.empty?
|
715
|
+
|
716
|
+
true
|
717
|
+
end
|
693
718
|
end
|
694
719
|
end
|
695
720
|
end
|
@@ -121,8 +121,8 @@ module Karafka
|
|
121
121
|
kafka = Setup::AttributesMap.consumer(@topics.first.kafka.dup)
|
122
122
|
|
123
123
|
inject_group_instance_id(kafka)
|
124
|
+
inject_client_id(kafka)
|
124
125
|
|
125
|
-
kafka[:'client.id'] ||= client_id
|
126
126
|
kafka[:'group.id'] ||= @consumer_group.id
|
127
127
|
kafka[:'auto.offset.reset'] ||= @topics.first.initial_offset
|
128
128
|
# Karafka manages the offsets based on the processing state, thus we do not rely on the
|
@@ -132,6 +132,26 @@ module Karafka
|
|
132
132
|
kafka
|
133
133
|
end
|
134
134
|
|
135
|
+
# Sets (if needed) the client.id attribute
|
136
|
+
#
|
137
|
+
# @param kafka [Hash] kafka level config
|
138
|
+
def inject_client_id(kafka)
|
139
|
+
# If client id is set directly on librdkafka level, we do nothing and just go with what
|
140
|
+
# end user has configured
|
141
|
+
return if kafka.key?(:'client.id')
|
142
|
+
|
143
|
+
# This mitigates an issue for multiplexing and potentially other cases when running
|
144
|
+
# multiple karafka processes on one machine, where librdkafka goes into an infinite
|
145
|
+
# loop when using cooperative-sticky and upscaling.
|
146
|
+
#
|
147
|
+
# @see https://github.com/confluentinc/librdkafka/issues/4783
|
148
|
+
kafka[:'client.id'] = if kafka[:'partition.assignment.strategy'] == 'cooperative-sticky'
|
149
|
+
"#{client_id}/#{Time.now.to_f}/#{SecureRandom.hex[0..9]}"
|
150
|
+
else
|
151
|
+
client_id
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
135
155
|
# If we use static group memberships, there can be a case, where same instance id would
|
136
156
|
# be set on many subscription groups as the group instance id from Karafka perspective is
|
137
157
|
# set per config. Each instance even if they are subscribed to different topics needs to
|
@@ -38,6 +38,7 @@ module Karafka
|
|
38
38
|
default_topic_conf
|
39
39
|
enable.auto.commit
|
40
40
|
enable.auto.offset.store
|
41
|
+
enable.metrics.push
|
41
42
|
enable.partition.eof
|
42
43
|
enable.random.seed
|
43
44
|
enable.sasl.oauthbearer.unsecure.jwt
|
@@ -89,6 +90,8 @@ module Karafka
|
|
89
90
|
reconnect.backoff.max.ms
|
90
91
|
reconnect.backoff.ms
|
91
92
|
resolve_cb
|
93
|
+
retry.backoff.max.ms
|
94
|
+
retry.backoff.ms
|
92
95
|
sasl.kerberos.keytab
|
93
96
|
sasl.kerberos.kinit.cmd
|
94
97
|
sasl.kerberos.min.time.before.relogin
|
@@ -182,6 +185,7 @@ module Karafka
|
|
182
185
|
dr_msg_cb
|
183
186
|
enable.gapless.guarantee
|
184
187
|
enable.idempotence
|
188
|
+
enable.metrics.push
|
185
189
|
enable.random.seed
|
186
190
|
enable.sasl.oauthbearer.unsecure.jwt
|
187
191
|
enable.ssl.certificate.verification
|
data/lib/karafka/setup/config.rb
CHANGED
@@ -385,9 +385,6 @@ module Karafka
|
|
385
385
|
config.kafka[key] = value
|
386
386
|
end
|
387
387
|
|
388
|
-
# Use Karafka client_id as kafka client id if not set
|
389
|
-
config.kafka[:'client.id'] ||= config.client_id
|
390
|
-
|
391
388
|
return if Karafka::App.env.production?
|
392
389
|
|
393
390
|
KAFKA_DEV_DEFAULTS.each do |key, value|
|
data/lib/karafka/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
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.4.
|
4
|
+
version: 2.4.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maciej Mensfeld
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
AnG1dJU+yL2BK7vaVytLTstJME5mepSZ46qqIJXMuWob/YPDmVaBF39TDSG9e34s
|
36
36
|
msG3BiCqgOgHAnL23+CN3Rt8MsuRfEtoTKpJVcCfoEoNHOkc
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2024-07-
|
38
|
+
date: 2024-07-22 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: base64
|
metadata.gz.sig
CHANGED
Binary file
|