karafka-rdkafka 0.17.1.beta1 → 0.17.2.rc1

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: 192d225abdb3819438f2da32dde41f7940666ee105f51f315ab55cf670e8c3b9
4
- data.tar.gz: bc393b0baa8f62980b9acf4d8d993f63cc1f07f9e3c8da54bceb8a76b387849b
3
+ metadata.gz: f9321c1841f24770f9e375013312c710058066384cdeef25a8e25d5b29d2b869
4
+ data.tar.gz: 944cd7539a70a2ed8400340e10a3705b34a0aec51d25a666def0f575069027de
5
5
  SHA512:
6
- metadata.gz: 82476a66a8ae78150ee80122df8d31925afb31ba06bc9cd0467ebf2fa09fcacaaa69f0262e9ff75447461871c29c3db9026cc3adda505cd9b0fe9dd8741f3336
7
- data.tar.gz: 86fca73dcffd68a5197276a01cf6366ef4f0ba702656e78209e8666534f76a1bb3f05f5e624f812ed6576255545093b810603be267f2a7653e7005ea42c1ddc0
6
+ metadata.gz: 04ae1810964a9ae6d96b402c1c52b8a6e506c8d4f7ff97299f5a35f79ce66a5f415aab2156ec037da1fce2e71b4302e72f1c7509acd6358fb52c2c360a0417c1
7
+ data.tar.gz: aef4f2144adfe02b54c449cfbdf84eabf8f50aab5df180a7afadb7aa7daa22b243ba00f8ce0686daa7da53441b5b0f81d450204f86cf941011014a0d76146edd
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -1,6 +1,9 @@
1
1
  # Rdkafka Changelog
2
2
 
3
- ## 0.17.1 (Unreleased)
3
+ ## 0.17.2 (2024-08-07)
4
+ - [Enhancement] Support returning `#details` for errors that do have topic/partition related extra info.
5
+
6
+ ## 0.17.1 (2024-08-01)
4
7
  - [Enhancement] Support ability to release patches to librdkafka.
5
8
  - [Patch] Patch cooperative-sticky assignments in librdkafka.
6
9
 
@@ -9,6 +12,7 @@
9
12
 
10
13
  ## 0.16.1 (2024-07-10)
11
14
  - [Feature] Add `#seek_by` to be able to seek for a message by topic, partition and offset (zinahia)
15
+ - [Change] Remove old producer timeout API warnings.
12
16
  - [Fix] Switch to local release of librdkafka to mitigate its unavailability.
13
17
 
14
18
  ## 0.16.0 (2024-06-17)
data/README.md CHANGED
@@ -161,13 +161,14 @@ bundle exec rake produce_messages
161
161
 
162
162
  ## Versions
163
163
 
164
- | rdkafka-ruby | librdkafka |
165
- |-|-|
166
- | 0.17.0 (Unreleased) | 2.5.0 (2024-07-10) |
167
- | 0.16.0 (2024-06-13) | 2.4.0 (2024-05-07) |
168
- | 0.15.0 (2023-12-03) | 2.3.0 (2023-10-25) |
169
- | 0.14.0 (2023-11-21) | 2.2.0 (2023-07-12) |
170
- | 0.13.0 (2023-07-24) | 2.0.2 (2023-01-20) |
171
- | 0.12.0 (2022-06-17) | 1.9.0 (2022-06-16) |
172
- | 0.11.0 (2021-11-17) | 1.8.2 (2021-10-18) |
173
- | 0.10.0 (2021-09-07) | 1.5.0 (2020-07-20) |
164
+ | rdkafka-ruby | librdkafka | patches |
165
+ |-|-|-|
166
+ | 0.17.0 (2024-08-01) | 2.5.0 (2024-07-10) | yes |
167
+ | 0.17.0 (2024-07-21) | 2.5.0 (2024-07-10) | no |
168
+ | 0.16.0 (2024-06-13) | 2.4.0 (2024-05-07) | no |
169
+ | 0.15.0 (2023-12-03) | 2.3.0 (2023-10-25) | no |
170
+ | 0.14.0 (2023-11-21) | 2.2.0 (2023-07-12) | no |
171
+ | 0.13.0 (2023-07-24) | 2.0.2 (2023-01-20) | no |
172
+ | 0.12.0 (2022-06-17) | 1.9.0 (2022-06-16) | no |
173
+ | 0.11.0 (2021-11-17) | 1.8.2 (2021-10-18) | no |
174
+ | 0.10.0 (2021-09-07) | 1.5.0 (2020-07-20) | no |
@@ -16,9 +16,6 @@ module Rdkafka
16
16
  REGISTRY = {}
17
17
  # Default wait timeout is 31 years
18
18
  MAX_WAIT_TIMEOUT_FOREVER = 10_000_000_000
19
- # Deprecation message for wait_timeout argument in wait method
20
- WAIT_TIMEOUT_DEPRECATION_MESSAGE = "The 'wait_timeout' argument is deprecated and will be removed in future versions without replacement. " \
21
- "We don't rely on it's value anymore. Please refactor your code to remove references to it."
22
19
 
23
20
  private_constant :MAX_WAIT_TIMEOUT_FOREVER
24
21
 
@@ -59,16 +56,13 @@ module Rdkafka
59
56
  #
60
57
  # @param max_wait_timeout [Numeric, nil] Amount of time to wait before timing out.
61
58
  # If this is nil we will wait forever
62
- # @param wait_timeout [nil] deprecated
63
59
  # @param raise_response_error [Boolean] should we raise error when waiting finishes
64
60
  #
65
61
  # @return [Object] Operation-specific result
66
62
  #
67
63
  # @raise [RdkafkaError] When the operation failed
68
64
  # @raise [WaitTimeoutError] When the timeout has been reached and the handle is still pending
69
- def wait(max_wait_timeout: 60, wait_timeout: nil, raise_response_error: true)
70
- Kernel.warn(WAIT_TIMEOUT_DEPRECATION_MESSAGE) unless wait_timeout.nil?
71
-
65
+ def wait(max_wait_timeout: 60, raise_response_error: true)
72
66
  timeout = max_wait_timeout ? monotonic_now + max_wait_timeout : MAX_WAIT_TIMEOUT_FOREVER
73
67
 
74
68
  @mutex.synchronize do
data/lib/rdkafka/error.rb CHANGED
@@ -6,6 +6,9 @@ module Rdkafka
6
6
 
7
7
  # Error returned by the underlying rdkafka library.
8
8
  class RdkafkaError < BaseError
9
+ # Empty hash for details default allocation
10
+ EMPTY_HASH = {}.freeze
11
+
9
12
  # The underlying raw error response
10
13
  # @return [Integer]
11
14
  attr_reader :rdkafka_response
@@ -18,6 +21,10 @@ module Rdkafka
18
21
  # @return [String]
19
22
  attr_reader :broker_message
20
23
 
24
+ # Optional details hash specific to a given error or empty hash if none or not supported
25
+ # @return [Hash]
26
+ attr_reader :details
27
+
21
28
  class << self
22
29
  def build_from_c(response_ptr, message_prefix = nil, broker_message: nil)
23
30
  code = Rdkafka::Bindings.rd_kafka_error_code(response_ptr)
@@ -54,7 +61,21 @@ module Rdkafka
54
61
  message_prefix ||= response_ptr_or_code[:payload].read_string(response_ptr_or_code[:len])
55
62
  end
56
63
 
57
- new(response_ptr_or_code[:err], message_prefix, broker_message: broker_message)
64
+ details = if response_ptr_or_code[:rkt].null?
65
+ EMPTY_HASH
66
+ else
67
+ {
68
+ partition: response_ptr_or_code[:partition],
69
+ offset: response_ptr_or_code[:offset],
70
+ topic: Bindings.rd_kafka_topic_name(response_ptr_or_code[:rkt])
71
+ }.freeze
72
+ end
73
+ new(
74
+ response_ptr_or_code[:err],
75
+ message_prefix,
76
+ broker_message: broker_message,
77
+ details: details
78
+ )
58
79
  else
59
80
  build_from_c(response_ptr_or_code, message_prefix)
60
81
  end
@@ -73,7 +94,8 @@ module Rdkafka
73
94
  broker_message: nil,
74
95
  fatal: false,
75
96
  retryable: false,
76
- abortable: false
97
+ abortable: false,
98
+ details: EMPTY_HASH
77
99
  )
78
100
  raise TypeError.new("Response has to be an integer") unless response.is_a? Integer
79
101
  @rdkafka_response = response
@@ -82,6 +104,7 @@ module Rdkafka
82
104
  @fatal = fatal
83
105
  @retryable = retryable
84
106
  @abortable = abortable
107
+ @details = details
85
108
  end
86
109
 
87
110
  # This error's code, for example `:partition_eof`, `:msg_size_too_large`.
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Rdkafka
4
- VERSION = "0.17.1.beta1"
4
+ VERSION = "0.17.2.rc1"
5
5
  LIBRDKAFKA_VERSION = "2.5.0"
6
6
  LIBRDKAFKA_SOURCE_SHA256 = "3dc62de731fd516dfb1032861d9a580d4d0b5b0856beb0f185d06df8e6c26259"
7
7
  end
@@ -80,7 +80,6 @@ describe Rdkafka::AbstractHandle do
80
80
  let(:pending_handle) { true }
81
81
 
82
82
  it "should wait until the timeout and then raise an error" do
83
- expect(Kernel).not_to receive(:warn)
84
83
  expect {
85
84
  subject.wait(max_wait_timeout: 0.1)
86
85
  }.to raise_error Rdkafka::AbstractHandle::WaitTimeoutError, /test_operation/
@@ -90,22 +89,15 @@ describe Rdkafka::AbstractHandle do
90
89
  context 'when pending_handle false' do
91
90
  let(:pending_handle) { false }
92
91
 
93
- it 'should show a deprecation warning when wait_timeout is set' do
94
- expect(Kernel).to receive(:warn).with(Rdkafka::AbstractHandle::WAIT_TIMEOUT_DEPRECATION_MESSAGE)
95
- subject.wait(wait_timeout: 0.1)
96
- end
97
-
98
92
  context "without error" do
99
93
  let(:result) { 1 }
100
94
 
101
95
  it "should return a result" do
102
- expect(Kernel).not_to receive(:warn)
103
96
  wait_result = subject.wait
104
97
  expect(wait_result).to eq(result)
105
98
  end
106
99
 
107
100
  it "should wait without a timeout" do
108
- expect(Kernel).not_to receive(:warn)
109
101
  wait_result = subject.wait(max_wait_timeout: nil)
110
102
  expect(wait_result).to eq(result)
111
103
  end
@@ -115,7 +107,6 @@ describe Rdkafka::AbstractHandle do
115
107
  let(:response) { 20 }
116
108
 
117
109
  it "should raise an rdkafka error" do
118
- expect(Kernel).not_to receive(:warn)
119
110
  expect {
120
111
  subject.wait
121
112
  }.to raise_error Rdkafka::RdkafkaError
@@ -1467,4 +1467,39 @@ describe Rdkafka::Consumer do
1467
1467
  end
1468
1468
  end
1469
1469
  end
1470
+
1471
+ describe "when reaching eof on a topic and eof reporting enabled" do
1472
+ let(:consumer) { rdkafka_consumer_config(:"enable.partition.eof" => true).consumer }
1473
+
1474
+ it "should return proper details" do
1475
+ (0..2).each do |i|
1476
+ producer.produce(
1477
+ topic: "consume_test_topic",
1478
+ key: "key lag #{i}",
1479
+ partition: i
1480
+ ).wait
1481
+ end
1482
+
1483
+ # Consume to the end
1484
+ consumer.subscribe("consume_test_topic")
1485
+ eof_count = 0
1486
+ eof_error = nil
1487
+
1488
+ loop do
1489
+ begin
1490
+ consumer.poll(100)
1491
+ rescue Rdkafka::RdkafkaError => error
1492
+ if error.is_partition_eof?
1493
+ eof_error = error
1494
+ end
1495
+ break if eof_error
1496
+ end
1497
+ end
1498
+
1499
+ expect(eof_error.code).to eq(:partition_eof)
1500
+ expect(eof_error.details[:topic]).to eq('consume_test_topic')
1501
+ expect(eof_error.details[:partition]).to be_a(Integer)
1502
+ expect(eof_error.details[:offset]).to be_a(Integer)
1503
+ end
1504
+ end
1470
1505
  end
@@ -11,6 +11,12 @@ describe Rdkafka::RdkafkaError do
11
11
  expect(Rdkafka::RdkafkaError.new(10, "message prefix").message_prefix).to eq "message prefix"
12
12
  end
13
13
 
14
+ it "should have empty frozen details by default" do
15
+ error = Rdkafka::RdkafkaError.new(10, "message prefix")
16
+ expect(error.details).to eq({})
17
+ expect(error.details).to be_frozen
18
+ end
19
+
14
20
  it "should create an error with a broker message" do
15
21
  expect(Rdkafka::RdkafkaError.new(10, broker_message: "broker message").broker_message).to eq "broker message"
16
22
  end
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.17.1.beta1
4
+ version: 0.17.2.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thijs Cadier
@@ -36,7 +36,7 @@ cert_chain:
36
36
  AnG1dJU+yL2BK7vaVytLTstJME5mepSZ46qqIJXMuWob/YPDmVaBF39TDSG9e34s
37
37
  msG3BiCqgOgHAnL23+CN3Rt8MsuRfEtoTKpJVcCfoEoNHOkc
38
38
  -----END CERTIFICATE-----
39
- date: 2024-07-30 00:00:00.000000000 Z
39
+ date: 2024-08-07 00:00:00.000000000 Z
40
40
  dependencies:
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: ffi
metadata.gz.sig CHANGED
@@ -1,2 +1,4 @@
1
- Y3�&���ikAVt���2�ON׿���� �������H[U�ǡ���R�홥̈;�0�@7x�}Վٚ��\Xi�?J")��1��vxI}�궕��5��ڬ��D�Mh�]����*³�}��k
2
- C�+���DO��9���sO��K��{nk��ڤ
1
+ 68�EY��|�).cxd��ͱL�E>�3���°et9cU
2
+ @�zn2tw��H�����T#�����p��9
3
+ j�
4
+ eצ�Zv�B�L���7f���.�d&��=��1��3�f�P���y� 4[$��7��34pW�������l������n��It���Rg���8�K�5N�İ��f����8é���0���B��������e��e��R����ic9�Le͉w��A�x��c�ˆ�J�)��^���F�PB�#F[�iI[�zrp1�2�CaW-am �BW���d6��s^X�'侠�~�TZ5R1OP�26���_Ki��p����}�j��T( ��C-)8j�g8