karafka 2.0.9 → 2.0.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ee9c609249fea5e996d9506bd3e04435dbcc189addcd6383a092b080e776f525
4
- data.tar.gz: 6ed354b21361966f1988bb90b29cea14d842fb02299f12bd30ab4ec57eaf8cc1
3
+ metadata.gz: f78f7cb985880d9172961be96386a0ebd37735831915f0cb9b9b46c832d2e9a9
4
+ data.tar.gz: a7f5a27cb3a6f0fa5185f32e5df7615f8a6013ef0018c85fb16c87de346f9362
5
5
  SHA512:
6
- metadata.gz: a20a1bf2d2b86fcd63bf2e036d535c1d7aa4d06943cc00a414851e8f0a0054054eff621b67bfd355456ac93f1561931aec598b43c0ca535ceaa57c9d94957378
7
- data.tar.gz: '05996101b929a143926508a0afb69e6e6b09de04fd088dd06c83cba122efc9cfecdd7586892c80ab5409964737dd4a74b0ecea0f8a30ff1dfbf032f6bb289288'
6
+ metadata.gz: 5b6fed517f69a2bd84b16e82d266251dd4b7564d52f466745f3a93be9106f866ec658581c38b1a0913dd9e126a17cf4b1f5e85c888447c6e1e4b790453e7c87e
7
+ data.tar.gz: 25cfa154028dd12519d7d4b72606242a4058c9fabd1655ba727a9d73a905a942cd80374e2f7357f410a098b74b623966fa840b1c6725f71d630bf3ce92db187e
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Karafka framework changelog
2
2
 
3
+ ## 2.0.10 (2022-09-23)
4
+ - Improve error recovery by delegating the recovery to the existing `librdkafka` instance.
5
+
3
6
  ## 2.0.9 (2022-09-22)
4
7
  - Fix Singleton not visible when used in PORO (#1034)
5
8
  - Divide pristine specs into pristine and poro. Pristine will still have helpers loaded, poro will have nothing.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- karafka (2.0.9)
4
+ karafka (2.0.10)
5
5
  karafka-core (>= 2.0.2, < 3.0.0)
6
6
  rdkafka (>= 0.12)
7
7
  thor (>= 0.20)
data/bin/integrations CHANGED
@@ -81,7 +81,7 @@ class Scenario
81
81
 
82
82
  # @return [Boolean] any spec that is not a regular one should not run in parallel with others
83
83
  def linear?
84
- !type == :regular
84
+ type != :regular
85
85
  end
86
86
 
87
87
  # @return [Boolean] did this scenario finished or is it still running
@@ -15,7 +15,7 @@ module Karafka
15
15
  attr_reader :name
16
16
 
17
17
  # How many times should we retry polling in case of a failure
18
- MAX_POLL_RETRIES = 10
18
+ MAX_POLL_RETRIES = 20
19
19
 
20
20
  private_constant :MAX_POLL_RETRIES
21
21
 
@@ -330,44 +330,26 @@ module Karafka
330
330
 
331
331
  @kafka.poll(timeout)
332
332
  rescue ::Rdkafka::RdkafkaError => e
333
- # We return nil, so we do not restart until running the whole loop
334
- # This allows us to run revocation jobs and other things and we will pick up new work
335
- # next time after dispatching all the things that are needed
336
- #
337
- # If we would retry here, the client reset would become transparent and we would not have
338
- # a chance to take any actions
339
- early_return = false
333
+ # Most of the errors can be safely ignored as librdkafka will recover from them
334
+ # @see https://github.com/edenhill/librdkafka/issues/1987#issuecomment-422008750
335
+ # @see https://github.com/edenhill/librdkafka/wiki/Error-handling
336
+ if time_poll.attempts > MAX_POLL_RETRIES || !time_poll.retryable?
337
+ Karafka.monitor.instrument(
338
+ 'error.occurred',
339
+ caller: self,
340
+ error: e,
341
+ type: 'connection.client.poll.error'
342
+ )
340
343
 
341
- case e.code
342
- when :max_poll_exceeded # -147
343
- reset
344
- early_return = true
345
- when :transport # -195
346
- reset
347
- early_return = true
348
- when :not_coordinator # 16
349
- reset
350
- early_return = true
351
- when :network_exception # 13
352
- early_return = true
353
- when :rebalance_in_progress # -27
354
- early_return = true
355
- when :coordinator_load_in_progress # 14
356
- early_return = true
357
- when :unknown_topic_or_part
358
- # This is expected and temporary until rdkafka catches up with metadata
359
- early_return = true
344
+ raise
360
345
  end
361
346
 
362
- raise if time_poll.attempts > MAX_POLL_RETRIES
363
- raise unless time_poll.retryable?
364
-
365
347
  time_poll.checkpoint
366
348
  time_poll.backoff
367
349
 
368
- # On unknown errors we do our best to retry and handle them before raising unless we
369
- # decide to early return
370
- early_return ? nil : retry
350
+ # poll may not only return message but also can run callbacks and if they changed,
351
+ # despite the errors we need to delegate to the other app parts
352
+ @rebalance_manager.changed? ? nil : retry
371
353
  end
372
354
 
373
355
  # Builds a new rdkafka consumer instance based on the subscription group configuration
@@ -153,6 +153,11 @@ module Karafka
153
153
  when 'librdkafka.error'
154
154
  error "librdkafka internal error occurred: #{error}"
155
155
  error details
156
+ # Those will only occur when retries in the client fail and when they did not stop after
157
+ # backoffs
158
+ when 'connection.client.poll.error'
159
+ error "Data polling error occurred: #{error}"
160
+ error details
156
161
  else
157
162
  # This should never happen. Please contact the maintainers
158
163
  raise Errors::UnsupportedCaseError, event
@@ -92,7 +92,7 @@ module Karafka
92
92
  # If this is not a long-running job there is nothing for us to do here
93
93
  return unless topic.long_running_job?
94
94
 
95
- seek(coordinator.seek_offset)
95
+ seek(coordinator.seek_offset) unless revoked?
96
96
 
97
97
  resume
98
98
  else
@@ -3,5 +3,5 @@
3
3
  # Main module namespace
4
4
  module Karafka
5
5
  # Current Karafka version
6
- VERSION = '2.0.9'
6
+ VERSION = '2.0.10'
7
7
  end
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.0.9
4
+ version: 2.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maciej Mensfeld
@@ -35,7 +35,7 @@ cert_chain:
35
35
  Qf04B9ceLUaC4fPVEz10FyobjaFoY4i32xRto3XnrzeAgfEe4swLq8bQsR3w/EF3
36
36
  MGU0FeSV2Yj7Xc2x/7BzLK8xQn5l7Yy75iPF+KP3vVmDHnNl
37
37
  -----END CERTIFICATE-----
38
- date: 2022-09-22 00:00:00.000000000 Z
38
+ date: 2022-09-23 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: karafka-core
metadata.gz.sig CHANGED
Binary file