promiscuous-poseidon_cluster 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/poseidon/consumer_group.rb +6 -1
- data/spec/lib/poseidon/consumer_group_spec.rb +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf1cd4ee132f920c59ae5c234b0898b9bad8e24f
|
4
|
+
data.tar.gz: 2ad72d1618745591bf199208d43d9b985d00377d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2109520672c090b00f82218e9ea28b12aaecdc80763b5d8c2ca058660c58bbef00bd0f82314f9d71f789d7807f97dd89435519bd0486b1f08967faa18e5f78b9
|
7
|
+
data.tar.gz: d4522d89f6a13d4066704600101806a23935f436351e50c03c2dc8705398d5b10ec669acfe9c64e372d87f6710ea824d5f479c4982793e120c09fa3648d4ce09
|
@@ -125,9 +125,10 @@ class Poseidon::ConsumerGroup
|
|
125
125
|
# @return [Hash<Symbol,String>] registry paths
|
126
126
|
def registries
|
127
127
|
@registries ||= {
|
128
|
+
brokers: "/brokers/topics/#{name}",
|
128
129
|
consumer: "/consumers/#{name}/ids",
|
129
130
|
owner: "/consumers/#{name}/owners/#{topic}",
|
130
|
-
offset: "/consumers/#{name}/offsets/#{topic}"
|
131
|
+
offset: "/consumers/#{name}/offsets/#{topic}"
|
131
132
|
}
|
132
133
|
end
|
133
134
|
|
@@ -155,6 +156,7 @@ class Poseidon::ConsumerGroup
|
|
155
156
|
zk.mkdir_p(path)
|
156
157
|
end
|
157
158
|
zk.create(consumer_path, "{}", {:ephemeral => true})
|
159
|
+
zk.register(registries[:brokers]) { rebalance! }
|
158
160
|
zk.register(registries[:consumer]) { rebalance! }
|
159
161
|
|
160
162
|
rebalance!
|
@@ -387,6 +389,9 @@ class Poseidon::ConsumerGroup
|
|
387
389
|
release_all!
|
388
390
|
reload_metadata
|
389
391
|
|
392
|
+
# make sure we rebalance when partition ownership changes
|
393
|
+
zk.stat(registries[:brokers], {:watch => true})
|
394
|
+
|
390
395
|
consumer_ids = zk.children(registries[:consumer], {:watch => true}).sort
|
391
396
|
partition_list = partitions
|
392
397
|
responsible_for = self.class.pick(partition_list.size, consumer_ids, id)
|
@@ -38,6 +38,7 @@ describe Poseidon::ConsumerGroup do
|
|
38
38
|
before do
|
39
39
|
allow(ZK).to receive_messages(new: zk_client)
|
40
40
|
allow(zk_client).to receive(:children).and_return(nil, ["my-group-UNIQUEID"])
|
41
|
+
allow(zk_client).to receive(:stat)
|
41
42
|
allow(Poseidon::Cluster).to receive_messages(guid: "UNIQUEID")
|
42
43
|
allow_any_instance_of(Poseidon::ConsumerGroup).to receive(:sleep)
|
43
44
|
allow_any_instance_of(Poseidon::PartitionConsumer).to receive_messages(resolve_offset_if_necessary: 0)
|
@@ -58,6 +59,7 @@ describe Poseidon::ConsumerGroup do
|
|
58
59
|
its(:metadata) { should be_instance_of(Poseidon::ClusterMetadata) }
|
59
60
|
its(:topic_metadata) { should be_instance_of(Poseidon::TopicMetadata) }
|
60
61
|
its(:registries) { should == {
|
62
|
+
brokers: "/brokers/topics/my-group",
|
61
63
|
consumer: "/consumers/my-group/ids",
|
62
64
|
owner: "/consumers/my-group/owners/mytopic",
|
63
65
|
offset: "/consumers/my-group/offsets/mytopic",
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: promiscuous-poseidon_cluster
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Black Square Media
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-06-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: poseidon
|