rdkafka 0.29.1 → 0.30.0
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
- data/CHANGELOG.md +33 -11
- data/README.md +1 -0
- data/dist/{librdkafka-2.14.2.tar.gz → librdkafka-2.15.0.tar.gz} +0 -0
- data/lib/rdkafka/admin/alter_consumer_group_offsets_handle.rb +31 -0
- data/lib/rdkafka/admin/alter_consumer_group_offsets_report.rb +50 -0
- data/lib/rdkafka/admin/delete_consumer_group_offsets_handle.rb +31 -0
- data/lib/rdkafka/admin/delete_consumer_group_offsets_report.rb +50 -0
- data/lib/rdkafka/admin.rb +263 -85
- data/lib/rdkafka/bindings.rb +46 -2
- data/lib/rdkafka/callbacks/alter_consumer_group_offsets_handler.rb +65 -0
- data/lib/rdkafka/callbacks/delete_consumer_group_offsets_handler.rb +65 -0
- data/lib/rdkafka/callbacks.rb +14 -16
- data/lib/rdkafka/clients.rb +114 -0
- data/lib/rdkafka/config.rb +118 -39
- data/lib/rdkafka/consumer/allocator.rb +38 -0
- data/lib/rdkafka/consumer/topic_partition_list.rb +1 -2
- data/lib/rdkafka/consumer.rb +44 -40
- data/lib/rdkafka/version.rb +3 -3
- data/lib/rdkafka.rb +10 -0
- data/package-lock.json +6 -6
- data/renovate.json +1 -1
- metadata +11 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9a5ff1b8b0535c2a9781c7a629907b034e372fd69707895be94867aacdf70c69
|
|
4
|
+
data.tar.gz: 8594c653516b17b414ff6c1e02709d1f00e776caa497980c699cb2ac8ea131d0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 88d5515df49496899ecbb474ed379b2405b4aacbf8a7cd2c10b9356276bdeb862091a450b87713dca495d4101e585717b459a96b2a1bdffb55ef80caf948165e
|
|
7
|
+
data.tar.gz: 17743522771d227ad2f729a87a6c6976322908221cbebb74b5af7a46d7218cf7e2775bda7b031ace347ceccad1f20d7035c486b23cc6158c1d5ed29e2ecee56e
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# Rdkafka Changelog
|
|
2
2
|
|
|
3
|
+
## 0.30.0 (2026-09-25)
|
|
4
|
+
- [Feature] Add `Admin#alter_consumer_group_offsets` and `Admin#delete_consumer_group_offsets` to set or clear a consumer group's committed offsets from the admin client.
|
|
5
|
+
- [Enhancement] Bump the bundled zlib to `1.3.2`.
|
|
6
|
+
- [Enhancement] Bump librdkafka to `2.15.0`.
|
|
7
|
+
- [Enhancement] Bump the bundled MIT Kerberos (krb5) to `1.22.2`.
|
|
8
|
+
- [Enhancement] Add `Rdkafka::Config.partitioner_key_uses_bytesize` to hash partition keys by byte length, matching other Kafka clients for multibyte keys. Defaults to `false`.
|
|
9
|
+
- [Maintenance] Derive the zlib `CHECKSUMS` entry from `ZLIB_VERSION`.
|
|
10
|
+
- [Maintenance] Drop the unused `dist/openssl-3.0.16.tar.gz` build cache.
|
|
11
|
+
- [Fix] Honor the `isolation_level:` argument to `Admin#list_offsets`, which was silently ignored.
|
|
12
|
+
- [Fix] Return correct results for every item of a multi-item topic, partition, group or ACL admin request, not just the first.
|
|
13
|
+
- [Maintenance] Fix a use-after-free in the multi-item admin integration test that read result-name pointers after librdkafka had destroyed the background event, which made it flaky on newer glibc (e.g. Debian trixie).
|
|
14
|
+
- [Maintenance] Stabilize consumer specs on slow CI runners: wait longer for a partition assignment, raise the `TestTopics.create` admin timeout (a timeout there also tripped the leaked-handle guard), and let the long-running consumption spec drain its backlog instead of stopping at a fixed 60s.
|
|
15
|
+
- [Maintenance] Raise the `TestTopics.create` admin timeout to 30s so a loaded CI runner no longer hits `create topic timed out` (which also tripped the leaked-handle guard).
|
|
16
|
+
|
|
17
|
+
## 0.29.2 (2026-09-11)
|
|
18
|
+
- [Fix] Close live clients from an `at_exit` hook before Ruby's shutdown finalization, so librdkafka is no longer `dlclose`d while its native threads are still running (which could segfault on exit).
|
|
19
|
+
- [Fix] Make client construction exception-safe and destroy the native handle when setup fails after `rd_kafka_new`, so a later error no longer orphans the native client.
|
|
20
|
+
- [Fix] Fix a double-free in `Consumer#poll_batch`/`#poll_batch_nb` that could abort the process when building a message raised a non-`RdkafkaError`.
|
|
21
|
+
- [Fix] Free native resources when `Admin#describe_configs`/`#incremental_alter_configs` raise while building their request (e.g. a non-String resource name).
|
|
22
|
+
- [Fix] Raise `ConfigError` instead of segfaulting when `Admin#describe_configs`/`#incremental_alter_configs` get an empty resource name or a negative resource type.
|
|
23
|
+
|
|
3
24
|
## 0.29.1 (2026-09-04)
|
|
4
25
|
- [Enhancement] Add `Admin#delete_records` to delete all messages in a partition up to a given offset.
|
|
5
26
|
- [Enhancement] Add `Admin#list_consumer_groups` to list the cluster's consumer groups.
|
|
@@ -8,11 +29,12 @@
|
|
|
8
29
|
- [Fix] Make `NativeKafka#close` fork-aware so a forked child no longer segfaults on exit.
|
|
9
30
|
- [Fix] Stabilize the `to_native_tpl` leak integration spec.
|
|
10
31
|
- [Fix] Stabilize the flaky partitions count cache statistics spec.
|
|
32
|
+
- [Fix] Use global allocator in topic_partition_list for pointer freed by librdkafka.
|
|
11
33
|
|
|
12
34
|
## 0.29.0 (2026-07-10)
|
|
13
35
|
- [Enhancement] Bump librdkafka to `2.14.2`
|
|
14
|
-
- [Enhancement] Add `Consumer#metadata` and `Producer#metadata`, mirroring `Admin#metadata`,
|
|
15
|
-
- [Enhancement] Support offset-commit metadata
|
|
36
|
+
- [Enhancement] Add `Consumer#metadata` and `Producer#metadata`, mirroring `Admin#metadata`, to fetch cluster metadata without a separate admin connection.
|
|
37
|
+
- [Enhancement] Support offset-commit metadata via `Consumer#store_offset(message, metadata)`, readable through `Consumer::Partition#metadata` and `Consumer#committed`.
|
|
16
38
|
- [Enhancement] Expose `replicas` and `isrs` (in-sync replica broker ids) on each partition in topic metadata; both were previously dropped from the `Metadata#topics` partition hashes.
|
|
17
39
|
- [Enhancement] Extract the admin background-event result handlers into one class per operation under `lib/rdkafka/callbacks/`. Internal reorganization with no API or behavior change.
|
|
18
40
|
- [Enhancement] Reuse per-thread scratch pointers in `Consumer::Headers.from_native`, removing the per-message native allocations from the consumer hot path.
|
|
@@ -20,32 +42,32 @@
|
|
|
20
42
|
- [Fix] Cache the partition count for a missing topic, so `produce` with a `partition_key` to a missing topic no longer re-runs a blocking metadata query on every message.
|
|
21
43
|
- [Fix] Let `PartitionsCountCache` adopt a lower partition count once the cached entry has expired, so a topic recreated with fewer partitions no longer fails `produce` until process restart.
|
|
22
44
|
- [Fix] Surface per-message build errors inline in `Consumer#poll_batch`/`#poll_batch_nb` instead of discarding the batch, preserving the messages that built successfully.
|
|
23
|
-
- [Fix] Bound the `Metadata` retry loop
|
|
45
|
+
- [Fix] Bound the `Metadata` retry loop to about 5 seconds, so a synchronous metadata fetch can no longer block for minutes.
|
|
24
46
|
- [Fix] Synchronize `AbstractHandle::REGISTRY` mutations with a mutex, which could otherwise lose a write on JRuby and leave a handle unregistered or leaked.
|
|
25
|
-
- [Fix]
|
|
47
|
+
- [Fix] Raise `ConfigError` instead of `NameError` in `Admin#delete_group`, `#delete_acl` and `#describe_acl` when the background queue is unavailable.
|
|
26
48
|
- [Fix] Actually populate `ConfigBindingResult#synonyms`. The synonym loop built the synonym binding objects and discarded them, so `#synonyms` was always an empty array; they are now appended.
|
|
27
49
|
- [Fix] Stop leaking the native `rd_kafka_topic_conf_t` in `Producer#set_topic_config` when a per-topic config value is rejected.
|
|
28
|
-
- [Fix]
|
|
50
|
+
- [Fix] Raise `ClosedConsumerError` from `Consumer#position` on a closed consumer, like the other consumer methods.
|
|
29
51
|
- [Fix] Guard the OAuthBearer token refresh callback against a NULL client pointer before calling `rd_kafka_name` on it.
|
|
30
|
-
- [Fix]
|
|
52
|
+
- [Fix] Fully close a consumer collected without an explicit `close`, preventing a hang or leak.
|
|
31
53
|
- [Fix] Free the librdkafka-allocated string in `Consumer#cluster_id` and `Consumer#member_id`, and fix the `rd_kafka_clusterid` arity. `Consumer#cluster_id` now accepts a `timeout_ms`.
|
|
32
54
|
- [Fix] Attach `rd_kafka_query_watermark_offsets` with `blocking: true` so it releases the GVL; it previously froze every other Ruby thread for up to `timeout_ms`.
|
|
33
55
|
- [Fix] Stop leaking the native `rd_kafka_conf_t` when client creation fails, a multi-KB leak per failed attempt for supervisors retrying on transient SASL/SSL misconfiguration.
|
|
34
56
|
- [Fix] Stop `Metadata` from leaking the native metadata struct on every retried fetch; each attempt now frees its own native resources.
|
|
35
57
|
- [Fix] Stop `Producer#produce` from orphaning the delivery handle in the process-global registry when it fails after registering it.
|
|
36
58
|
- [Fix] Guard the message delivery callback so a raising user `delivery_callback` can no longer leave the handle locked or crash the producer; exceptions are now logged and swallowed.
|
|
37
|
-
- [Fix] Stop `describe_configs`, `incremental_alter_configs` and `list_offsets` from leaking
|
|
38
|
-
- [Fix]
|
|
59
|
+
- [Fix] Stop `describe_configs`, `incremental_alter_configs` and `list_offsets` from leaking native resources when their arguments are rejected.
|
|
60
|
+
- [Fix] Stop `TopicPartitionList#to_native_tpl` from leaking the native list when building it fails partway.
|
|
39
61
|
- [Fix] Raise instead of silently dropping a rejected `incremental_alter_configs` entry, which previously left the alter request reporting success.
|
|
40
62
|
- [Fix] Allocate the admin result-count out-parameter as `:size_t` instead of `:int32`, fixing a 4-byte overflow on every admin result parse.
|
|
41
63
|
- [Fix] Stabilize the flaky `Consumer#lag` "calculates the consumer lag" spec on overloaded CI.
|
|
42
|
-
- [Fix]
|
|
43
|
-
- [Fix]
|
|
64
|
+
- [Fix] Return the real error from an admin operation that fails at the operation level (e.g. brokers unreachable) instead of blocking until `wait` times out.
|
|
65
|
+
- [Fix] Stop every admin operation from leaking its result event. The internal FFI struct fields on admin handles are removed; use `handle.wait` and the returned report objects, which are unchanged.
|
|
44
66
|
|
|
45
67
|
## 0.28.0 (2026-06-03)
|
|
46
68
|
- [Enhancement] Bump librdkafka to `2.14.1`
|
|
47
69
|
- [Enhancement] Replace version-gated `Warning[:performance]` with dynamic `Warning.categories` opt-in in spec helper so new Ruby warning categories are automatically enabled without manual updates.
|
|
48
|
-
- [Enhancement] `poll_batch` and `poll_batch_nb` now return
|
|
70
|
+
- [Enhancement] `poll_batch` and `poll_batch_nb` now return errors inline as `RdkafkaError` objects instead of raising on the first one. The return type is `Array<Message, RdkafkaError>`, so callers must handle errors in the result.
|
|
49
71
|
|
|
50
72
|
## 0.27.0 (2026-05-07)
|
|
51
73
|
- [Feature] Add `Consumer#poll_batch(timeout_ms, max_items:)` and `Consumer#poll_batch_nb(timeout_ms, max_items:)` for batch message polling via `rd_kafka_consume_batch_queue`.
|
data/README.md
CHANGED
|
@@ -163,6 +163,7 @@ bundle exec rake produce_messages
|
|
|
163
163
|
|
|
164
164
|
| rdkafka-ruby | librdkafka | patches |
|
|
165
165
|
|-|-|-|
|
|
166
|
+
| 0.30.x (2026-09-25) | 2.15.0 (2026-06-30) | yes |
|
|
166
167
|
| 0.29.x (2026-07-10) | 2.14.2 (2026-06-03) | yes |
|
|
167
168
|
| 0.28.x (2026-06-03) | 2.14.1 (2026-04-15) | yes |
|
|
168
169
|
| 0.27.x (2026-05-07) | 2.14.0 (2026-04-01) | yes |
|
|
Binary file
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Rdkafka
|
|
4
|
+
class Admin
|
|
5
|
+
# Handle for alter consumer group offsets operation
|
|
6
|
+
class AlterConsumerGroupOffsetsHandle < AbstractHandle
|
|
7
|
+
layout :pending, :bool,
|
|
8
|
+
:response, :int
|
|
9
|
+
|
|
10
|
+
# @return [String] the name of the operation
|
|
11
|
+
def operation_name
|
|
12
|
+
"alter consumer group offsets"
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# Creates the result report
|
|
16
|
+
# @return [AlterConsumerGroupOffsetsReport]
|
|
17
|
+
def create_result
|
|
18
|
+
prepared_result
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# Raises an error if the operation failed
|
|
22
|
+
# @raise [RdkafkaError]
|
|
23
|
+
def raise_error
|
|
24
|
+
raise RdkafkaError.new(
|
|
25
|
+
self[:response],
|
|
26
|
+
broker_message: broker_message
|
|
27
|
+
)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Rdkafka
|
|
4
|
+
class Admin
|
|
5
|
+
# Report for alter consumer group offsets operation result
|
|
6
|
+
class AlterConsumerGroupOffsetsReport
|
|
7
|
+
# @return [String, nil] the group the operation ran against
|
|
8
|
+
attr_reader :group_name
|
|
9
|
+
|
|
10
|
+
# @return [String, nil] group level error message, if any
|
|
11
|
+
attr_reader :error_string
|
|
12
|
+
|
|
13
|
+
# Per partition outcomes, each with `:topic`, `:partition`, `:offset` and `:error`
|
|
14
|
+
# (an `RdkafkaError` or nil). Partitions are reported individually because Kafka can
|
|
15
|
+
# fail some and accept others within a single request.
|
|
16
|
+
# @return [Array<Hash>]
|
|
17
|
+
attr_reader :partitions
|
|
18
|
+
|
|
19
|
+
# @param error_string [FFI::Pointer] pointer to the group level error string
|
|
20
|
+
# @param result_name [FFI::Pointer] pointer to the group name
|
|
21
|
+
# @param partitions_ptr [FFI::Pointer] pointer to the per partition result list
|
|
22
|
+
def initialize(error_string, result_name, partitions_ptr = FFI::Pointer::NULL)
|
|
23
|
+
@error_string = error_string.read_string if error_string != FFI::Pointer::NULL
|
|
24
|
+
@group_name = result_name.read_string if result_name != FFI::Pointer::NULL
|
|
25
|
+
@partitions = extract_partitions(partitions_ptr)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
private
|
|
29
|
+
|
|
30
|
+
# @param partitions_ptr [FFI::Pointer] pointer to a native topic partition list
|
|
31
|
+
# @return [Array<Hash>]
|
|
32
|
+
def extract_partitions(partitions_ptr)
|
|
33
|
+
return [] if partitions_ptr.nil? || partitions_ptr.null?
|
|
34
|
+
|
|
35
|
+
native = Bindings::TopicPartitionList.new(partitions_ptr)
|
|
36
|
+
|
|
37
|
+
Array.new(native[:cnt]) do |i|
|
|
38
|
+
tp = Bindings::TopicPartition.new(native[:elems] + (i * Bindings::TopicPartition.size))
|
|
39
|
+
|
|
40
|
+
{
|
|
41
|
+
topic: tp[:topic],
|
|
42
|
+
partition: tp[:partition],
|
|
43
|
+
offset: tp[:offset],
|
|
44
|
+
error: tp[:err].zero? ? nil : RdkafkaError.new(tp[:err])
|
|
45
|
+
}
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Rdkafka
|
|
4
|
+
class Admin
|
|
5
|
+
# Handle for delete consumer group offsets operation
|
|
6
|
+
class DeleteConsumerGroupOffsetsHandle < AbstractHandle
|
|
7
|
+
layout :pending, :bool,
|
|
8
|
+
:response, :int
|
|
9
|
+
|
|
10
|
+
# @return [String] the name of the operation
|
|
11
|
+
def operation_name
|
|
12
|
+
"delete consumer group offsets"
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# Creates the result report
|
|
16
|
+
# @return [DeleteConsumerGroupOffsetsReport]
|
|
17
|
+
def create_result
|
|
18
|
+
prepared_result
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# Raises an error if the operation failed
|
|
22
|
+
# @raise [RdkafkaError]
|
|
23
|
+
def raise_error
|
|
24
|
+
raise RdkafkaError.new(
|
|
25
|
+
self[:response],
|
|
26
|
+
broker_message: broker_message
|
|
27
|
+
)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Rdkafka
|
|
4
|
+
class Admin
|
|
5
|
+
# Report for delete consumer group offsets operation result
|
|
6
|
+
class DeleteConsumerGroupOffsetsReport
|
|
7
|
+
# @return [String, nil] the group the operation ran against
|
|
8
|
+
attr_reader :group_name
|
|
9
|
+
|
|
10
|
+
# @return [String, nil] group level error message, if any
|
|
11
|
+
attr_reader :error_string
|
|
12
|
+
|
|
13
|
+
# Per partition outcomes, each with `:topic`, `:partition`, `:offset` and `:error`
|
|
14
|
+
# (an `RdkafkaError` or nil). Partitions are reported individually because Kafka can
|
|
15
|
+
# fail some and accept others within a single request.
|
|
16
|
+
# @return [Array<Hash>]
|
|
17
|
+
attr_reader :partitions
|
|
18
|
+
|
|
19
|
+
# @param error_string [FFI::Pointer] pointer to the group level error string
|
|
20
|
+
# @param result_name [FFI::Pointer] pointer to the group name
|
|
21
|
+
# @param partitions_ptr [FFI::Pointer] pointer to the per partition result list
|
|
22
|
+
def initialize(error_string, result_name, partitions_ptr = FFI::Pointer::NULL)
|
|
23
|
+
@error_string = error_string.read_string if error_string != FFI::Pointer::NULL
|
|
24
|
+
@group_name = result_name.read_string if result_name != FFI::Pointer::NULL
|
|
25
|
+
@partitions = extract_partitions(partitions_ptr)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
private
|
|
29
|
+
|
|
30
|
+
# @param partitions_ptr [FFI::Pointer] pointer to a native topic partition list
|
|
31
|
+
# @return [Array<Hash>]
|
|
32
|
+
def extract_partitions(partitions_ptr)
|
|
33
|
+
return [] if partitions_ptr.nil? || partitions_ptr.null?
|
|
34
|
+
|
|
35
|
+
native = Bindings::TopicPartitionList.new(partitions_ptr)
|
|
36
|
+
|
|
37
|
+
Array.new(native[:cnt]) do |i|
|
|
38
|
+
tp = Bindings::TopicPartition.new(native[:elems] + (i * Bindings::TopicPartition.size))
|
|
39
|
+
|
|
40
|
+
{
|
|
41
|
+
topic: tp[:topic],
|
|
42
|
+
partition: tp[:partition],
|
|
43
|
+
offset: tp[:offset],
|
|
44
|
+
error: tp[:err].zero? ? nil : RdkafkaError.new(tp[:err])
|
|
45
|
+
}
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|