ruby-kafka 0.7.1.beta2 → 0.7.1.debugcorruption2

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: def137ba9f120b344452139b52dd8826740af0343fd17da25f96ee819e1f7c87
4
- data.tar.gz: 8ffb491a63f5a7fbea9771962e521169d11ea84c810effecbf0140ebf1a8f1fe
3
+ metadata.gz: 309f92b03ff0cd0687e06bb794ca1881d33abec51cd388145aa45bd8adfe1f89
4
+ data.tar.gz: 990eeb531683ceaba2ef825a97847a71b9cc23e59c25bfb817ca98098d4d2a6b
5
5
  SHA512:
6
- metadata.gz: 21e457a2830b7e3524654b4e04fd939a4532fc4f531eab0c0bb2572e71a5426fd8ec484721c8ae40b740c77f3be1762642ec698bb1e6177f502d20952509320a
7
- data.tar.gz: cda0dcf607d826c027eb4c91f923038353048b22296a79a4cfa2e9edc16adeb83e50ed66d992aba4335c9ee94dcba0bba06c5b0c7f7ece3b6595e90ebbbba6d5
6
+ metadata.gz: 35336add7284db579083c04e67fed4a4ecc0274bad6ef015f55c77f84e5feb0846f3dfb3729aeb9a1345cad22ee152b8c6d6e8f77474c497c4300e0441ab3712
7
+ data.tar.gz: b4b6ccfdaa9decaabb5225b8b0118a3b9e1c7a2e670748479426e47757413f0f59f2fcbddd2db89f7e7f7189421592536f8b7e2b850154a74aa68c8ef8f572db
data/CHANGELOG.md CHANGED
@@ -4,11 +4,11 @@ Changes and additions to the library will be listed here.
4
4
 
5
5
  ## Unreleased
6
6
 
7
- - Fix consuming duplication due to redundant messages returned from Kafka (#636).
8
- - Fresh cluster info on fetch error (#641).
9
-
10
7
  ## 0.7.1
11
8
 
9
+ - Compatibility with dogstatsd-ruby v4.0.0.
10
+ - Fix consuming duplication due to redundant messages returned from Kafka (#636).
11
+ - Fresh cluster info on fetch error (#641).
12
12
  - Exactly Once Delivery and Transactional Messaging Support (#608).
13
13
  - Support extra client certificates in the SSL Context when authenticating with Kafka (#633).
14
14
 
data/lib/kafka/broker.rb CHANGED
@@ -71,7 +71,31 @@ module Kafka
71
71
  def produce(**options)
72
72
  request = Protocol::ProduceRequest.new(**options)
73
73
 
74
- send_request(request)
74
+ resp = send_request(request)
75
+
76
+ return if resp.nil?
77
+
78
+ errored_partitions = []
79
+ resp.topics.each do |topic_info|
80
+ errored = topic_info.partitions.find {|part_info| part_info.error_code == 2 }
81
+ errored_partitions << errored unless errored.nil?
82
+ end
83
+
84
+ errored_partitions.each do |partition_info|
85
+
86
+ @logger.error "Corrupt message code received for #{request} to partition #{partition_info.partition}"
87
+
88
+ #{"topic" => {"partition" => [message, message] }}
89
+ request.messages_for_topics.each do |topic, messages_for_partition|
90
+ messages_for_partition.fetch(partition_info.partition, []).each do |message|
91
+ @logger.error "Message key: #{message.key}"
92
+ @logger.error "Message value: #{message.value}"
93
+ end
94
+ end
95
+
96
+ end
97
+
98
+ resp
75
99
  end
76
100
 
77
101
  def fetch_offsets(**options)
data/lib/kafka/client.rb CHANGED
@@ -618,7 +618,15 @@ module Kafka
618
618
  #
619
619
  # @return [Array<String>] the list of topic names.
620
620
  def topics
621
- @cluster.list_topics
621
+ attempts = 0
622
+ begin
623
+ attempts += 1
624
+ @cluster.list_topics
625
+ rescue Kafka::ConnectionError
626
+ @cluster.mark_as_stale!
627
+ retry unless attempts > 1
628
+ raise
629
+ end
622
630
  end
623
631
 
624
632
  # Lists all consumer groups in the cluster
data/lib/kafka/cluster.rb CHANGED
@@ -397,6 +397,7 @@ module Kafka
397
397
  end
398
398
 
399
399
  def random_broker
400
+ refresh_metadata_if_necessary!
400
401
  node_id = cluster_info.brokers.sample.node_id
401
402
  connect_to_broker(node_id)
402
403
  end
data/lib/kafka/datadog.rb CHANGED
@@ -40,7 +40,7 @@ module Kafka
40
40
  end
41
41
 
42
42
  def host
43
- @host ||= ::Datadog::Statsd::DEFAULT_HOST
43
+ @host ||= default_host
44
44
  end
45
45
 
46
46
  def host=(host)
@@ -49,7 +49,7 @@ module Kafka
49
49
  end
50
50
 
51
51
  def port
52
- @port ||= ::Datadog::Statsd::DEFAULT_PORT
52
+ @port ||= default_port
53
53
  end
54
54
 
55
55
  def port=(port)
@@ -77,6 +77,14 @@ module Kafka
77
77
 
78
78
  private
79
79
 
80
+ def default_host
81
+ ::Datadog::Statsd.const_defined?(:Connection) ? ::Datadog::Statsd::Connection::DEFAULT_HOST : ::Datadog::Statsd::DEFAULT_HOST
82
+ end
83
+
84
+ def default_port
85
+ ::Datadog::Statsd.const_defined?(:Connection) ? ::Datadog::Statsd::Connection::DEFAULT_PORT : ::Datadog::Statsd::DEFAULT_PORT
86
+ end
87
+
80
88
  def clear
81
89
  @statsd && @statsd.close
82
90
  @statsd = nil
data/lib/kafka/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Kafka
4
- VERSION = "0.7.1.beta2"
4
+ VERSION = "0.7.1.debugcorruption2"
5
5
  end
data/ruby-kafka.gemspec CHANGED
@@ -41,7 +41,7 @@ Gem::Specification.new do |spec|
41
41
  spec.add_development_dependency "extlz4"
42
42
  spec.add_development_dependency "colored"
43
43
  spec.add_development_dependency "rspec_junit_formatter", "0.2.2"
44
- spec.add_development_dependency "dogstatsd-ruby", ">= 3.0.0", "<4.0.0"
44
+ spec.add_development_dependency "dogstatsd-ruby", ">= 3.0.0", "< 5.0.0"
45
45
  spec.add_development_dependency "statsd-ruby"
46
46
  spec.add_development_dependency "ruby-prof"
47
47
  spec.add_development_dependency "timecop"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-kafka
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1.beta2
4
+ version: 0.7.1.debugcorruption2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Schierbeck
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-09-11 00:00:00.000000000 Z
11
+ date: 2018-09-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: digest-crc
@@ -201,7 +201,7 @@ dependencies:
201
201
  version: 3.0.0
202
202
  - - "<"
203
203
  - !ruby/object:Gem::Version
204
- version: 4.0.0
204
+ version: 5.0.0
205
205
  type: :development
206
206
  prerelease: false
207
207
  version_requirements: !ruby/object:Gem::Requirement
@@ -211,7 +211,7 @@ dependencies:
211
211
  version: 3.0.0
212
212
  - - "<"
213
213
  - !ruby/object:Gem::Version
214
- version: 4.0.0
214
+ version: 5.0.0
215
215
  - !ruby/object:Gem::Dependency
216
216
  name: statsd-ruby
217
217
  requirement: !ruby/object:Gem::Requirement