zookeeper 1.4.7 → 1.4.8
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.
- data/CHANGELOG +31 -27
- data/ext/c_zookeeper.rb +26 -14
- data/lib/zookeeper/version.rb +1 -1
- metadata +2 -3
data/CHANGELOG
CHANGED
@@ -1,4 +1,8 @@
|
|
1
|
-
v1.4.
|
1
|
+
v1.4.8
|
2
|
+
|
3
|
+
* Fix deadlock related to state checks that can happen during reconnecting
|
4
|
+
|
5
|
+
v1.4.7
|
2
6
|
|
3
7
|
* Fixing dependent library compilation on FreeBSD 10 #53 (h/t: gogreen53)
|
4
8
|
|
@@ -26,7 +30,7 @@ v1.4.5
|
|
26
30
|
|
27
31
|
v1.4.4 fix build under FreeBSD (h/t: stass)
|
28
32
|
|
29
|
-
* https://github.com/slyphon/zookeeper/pull/40
|
33
|
+
* https://github.com/slyphon/zookeeper/pull/40
|
30
34
|
|
31
35
|
v1.4.3 fix build for ruby 2.0.0-rc2
|
32
36
|
|
@@ -59,8 +63,8 @@ v1.2.14 merge add_auth pull request, reduce chances for ContinuationTimeoutError
|
|
59
63
|
* added support for the add_auth call (h/t: @bradhe) see pull req #25
|
60
64
|
|
61
65
|
* fix a corner case where some pending Continuations may get stuck without
|
62
|
-
being shutdown when the event thread exits. This would lead to a
|
63
|
-
ContinuationTimeoutError being raised after 30s as a failsafe.
|
66
|
+
being shutdown when the event thread exits. This would lead to a
|
67
|
+
ContinuationTimeoutError being raised after 30s as a failsafe.
|
64
68
|
|
65
69
|
v1.2.13 fix build under rbenv
|
66
70
|
|
@@ -80,7 +84,7 @@ v1.2.11 remove dependency on backports gem
|
|
80
84
|
We apologise for the inconvenience.
|
81
85
|
|
82
86
|
v1.2.10 minor bug fix in java code
|
83
|
-
|
87
|
+
|
84
88
|
* Don't obscure a legitimate exception because of an unexpected nil
|
85
89
|
|
86
90
|
v1.2.7 further lock adjustments, deadlock risk reduction
|
@@ -94,7 +98,7 @@ v1.2.7 further lock adjustments, deadlock risk reduction
|
|
94
98
|
the case of an unforseen condition.
|
95
99
|
|
96
100
|
* Improve the CZookeeper#wait_until_connected to use a deadline approach
|
97
|
-
to waiting for both running and connected states. Also, handle the
|
101
|
+
to waiting for both running and connected states. Also, handle the
|
98
102
|
'nil' (wait forever) timeout properly.
|
99
103
|
|
100
104
|
* Wake all waiting threads on all ConditionVariables when CZookeeper#shut_down!
|
@@ -109,26 +113,26 @@ v1.2.5 cleanup locking in ZookeeperBase
|
|
109
113
|
exposed us to deadlocks in situations where an async event would be
|
110
114
|
delivered (probably a SESSION_EXPIRED event), but the callback block could
|
111
115
|
not be called because the dispatch thread would block on the mutex being
|
112
|
-
held by the caller of create.
|
116
|
+
held by the caller of create.
|
113
117
|
|
114
118
|
This version cleans up that usage, and ensures that the only time we hold
|
115
119
|
the mutex is during startup/shutdown (when the value of @czk may be changing),
|
116
120
|
and in all other cases we grab the mutex, dereference, and unlock then perform
|
117
|
-
whatever action on the reference.
|
121
|
+
whatever action on the reference.
|
118
122
|
|
119
123
|
* Add a safety net to Continuation (which will soon be called 'Promise' or
|
120
124
|
'Future' at the request of @eric). If any operation takes more than 30s
|
121
125
|
an exception will be raised in the calling thread. The session timeout
|
122
126
|
setting makes it so that no operation should take more than 20s, so we know
|
123
127
|
if we haven't received a reply in *longer* than that, something has gone
|
124
|
-
awry.
|
128
|
+
awry.
|
125
129
|
|
126
130
|
v1.2.4 fix buffer overflow in CZookeeper client_id code
|
127
|
-
|
131
|
+
|
128
132
|
* the 'passwd' part of the struct is a char[16], but isn't null terminated.
|
129
133
|
use rb_str_new with an explicit length, rather than rb_str_new2 which
|
130
134
|
uses strlen().
|
131
|
-
|
135
|
+
|
132
136
|
v1.2.3 ensure that all threads are woken up on shutdown
|
133
137
|
|
134
138
|
* There was an edge case where a call would be queued up and its thread
|
@@ -154,7 +158,7 @@ v1.2.1 simplify assert_open
|
|
154
158
|
action. This was meant as a fail-early lightweight check of the connection
|
155
159
|
state and it worked well when we were running against the mt code. Now this
|
156
160
|
requires us to use a Continuation and make our way through the event loop.
|
157
|
-
There is a possible deadlock this release should solve that was caused by
|
161
|
+
There is a possible deadlock this release should solve that was caused by
|
158
162
|
the assert_open code holding a lock while making an async call through
|
159
163
|
the event loop. This is no longer the case. The assert_open call only checks
|
160
164
|
that the current handle hasn't been closed, the connection-state checking
|
@@ -168,7 +172,7 @@ v1.2.0 Stop the World, I Wanna fork()
|
|
168
172
|
and resume_after_fork_in_parent to match their ZK counterparts
|
169
173
|
|
170
174
|
* replaced the Queue in QueueWithPipe (really have to change that name)
|
171
|
-
with an Array and Mutex/ConditionVariable pair. This allows us to
|
175
|
+
with an Array and Mutex/ConditionVariable pair. This allows us to
|
172
176
|
have better control over the shutdown signaling, and lets us resume
|
173
177
|
operations after a pause.
|
174
178
|
|
@@ -194,7 +198,7 @@ v1.1.0 Rewrite C backend to use zookeeper_st, the async library
|
|
194
198
|
be held by a thread when fork() was called, which opened up the possibility
|
195
199
|
for corruption and other badness.
|
196
200
|
|
197
|
-
This version contains a Continuation class, which allows us to present a
|
201
|
+
This version contains a Continuation class, which allows us to present a
|
198
202
|
synchronous front-end to the asynchronous backend. All features are still
|
199
203
|
supported, no special action is necessary to prepare for a fork, and the
|
200
204
|
post-fork procedure is the same as before: call reopen() in the child,
|
@@ -240,14 +244,14 @@ v1.0.0 Single Zookeeper namespace
|
|
240
244
|
|
241
245
|
* Java and C now use different names for the base class, to avoid the
|
242
246
|
possibility of error. Java is now JavaBase, C remains ZookeeperBase.
|
243
|
-
|
247
|
+
|
244
248
|
* All client methods are defined in the ClientMethods module and mixed
|
245
249
|
into the constructed Client class.
|
246
250
|
|
247
251
|
* Fix all requires, no longer monkey with $LOAD_PATH, use require_relative
|
248
252
|
|
249
|
-
* Bugfix for C client.
|
250
|
-
|
253
|
+
* Bugfix for C client.
|
254
|
+
|
251
255
|
Because we release the GIL, there's the possibilty that in the middle of a
|
252
256
|
synchronous C call, ruby will have switched thread contexts and one of
|
253
257
|
those threads will call close. It seems that during normal operation, this
|
@@ -277,20 +281,20 @@ v0.9.0 RELEASE THE KRAK..er, GIL!!
|
|
277
281
|
|
278
282
|
* In >= 1.9.2 the ruby interpreter allows you to release the GIL when
|
279
283
|
calling into native code, sounds like a good idea.
|
280
|
-
|
284
|
+
|
281
285
|
This release makes use of that code by parsing the zookeeper.h header file
|
282
286
|
and extracting the method signatures of all relevant zoo_* functions, then
|
283
287
|
generating boilerplate that allows us to call those functions via the
|
284
288
|
rb_thread_blocking_region function.
|
285
289
|
|
286
290
|
1.8.7 compatibility is maintained by stubbing out that functionality if built
|
287
|
-
under 1.8.7.
|
291
|
+
under 1.8.7.
|
288
292
|
|
289
293
|
* 1.8.7 is deprecated! I will continue to support 1.8.7 for the near future
|
290
294
|
but sometime soon, you're gonna have to upgrade.
|
291
295
|
|
292
296
|
v0.8.4 fix NameError, require 'forwardable'
|
293
|
-
|
297
|
+
|
294
298
|
* Really not sure why this didn't come up in tests
|
295
299
|
|
296
300
|
* issue here https://github.com/slyphon/zk/issues/22
|
@@ -310,7 +314,7 @@ v0.8.3 fix NonLocalJump exception in event delivery thread shutdown code
|
|
310
314
|
|
311
315
|
v0.8.2 fix close after a fork()
|
312
316
|
|
313
|
-
* The dispatch thread will be dead in this situation, so we need to
|
317
|
+
* The dispatch thread will be dead in this situation, so we need to
|
314
318
|
check to see if it's already dead before waiting on it to exit.
|
315
319
|
|
316
320
|
v0.8.1 Java client fix, silence warnings
|
@@ -318,20 +322,20 @@ v0.8.1 Java client fix, silence warnings
|
|
318
322
|
v0.8.0 Refactor C implementaion, EventMachine client
|
319
323
|
|
320
324
|
* separated CZookeeper and ZookeeperBase implementation
|
321
|
-
|
325
|
+
|
322
326
|
This solves issues with reopen not working properly, makes for a much
|
323
327
|
cleaner event delivery implementation. ZookeeperBase controls the lifecycle
|
324
328
|
of the event dispatch thread now, rather than it being tied to CZookeeper.
|
325
|
-
|
329
|
+
|
326
330
|
* added support for the 'sync' API call
|
327
|
-
|
331
|
+
|
328
332
|
* Refactored zookeeper_c.c and zookeeper_lib.c
|
329
|
-
|
333
|
+
|
330
334
|
More error checking in zookeeper_lib.c and restructure some things to make
|
331
335
|
logic easier to follow
|
332
|
-
|
336
|
+
|
333
337
|
Fix bug in method_get_next_event that made the shutdown case so complicated
|
334
|
-
|
338
|
+
|
335
339
|
* Massively simplified EMClient implementation
|
336
340
|
|
337
341
|
Rather than trying to hook the IO used by zookeeper_lib to notify zookeeper_c
|
data/ext/c_zookeeper.rb
CHANGED
@@ -73,7 +73,8 @@ class CZookeeper
|
|
73
73
|
@running_cond = @mutex.new_cond
|
74
74
|
|
75
75
|
# used to signal we've received the connected event
|
76
|
-
@
|
76
|
+
@state_mutex = Monitor.new
|
77
|
+
@state_cond = @state_mutex.new_cond
|
77
78
|
|
78
79
|
# the current state of the connection
|
79
80
|
@state = ZOO_CLOSED_STATE
|
@@ -120,14 +121,6 @@ class CZookeeper
|
|
120
121
|
state == ZOO_ASSOCIATING_STATE
|
121
122
|
end
|
122
123
|
|
123
|
-
def unhealthy?
|
124
|
-
@_closed || @_shutting_down || is_unrecoverable
|
125
|
-
end
|
126
|
-
|
127
|
-
def healthy?
|
128
|
-
!unhealthy?
|
129
|
-
end
|
130
|
-
|
131
124
|
def close
|
132
125
|
return if closed?
|
133
126
|
|
@@ -172,7 +165,7 @@ class CZookeeper
|
|
172
165
|
|
173
166
|
def state
|
174
167
|
return ZOO_CLOSED_STATE if closed?
|
175
|
-
@
|
168
|
+
@state_mutex.synchronize { @state }
|
176
169
|
end
|
177
170
|
|
178
171
|
# this implementation is gross, but i don't really see another way of doing it
|
@@ -187,7 +180,7 @@ class CZookeeper
|
|
187
180
|
|
188
181
|
return false unless wait_until_running(timeout)
|
189
182
|
|
190
|
-
@
|
183
|
+
@state_mutex.synchronize do
|
191
184
|
while true
|
192
185
|
if timeout
|
193
186
|
now = Time.now
|
@@ -205,6 +198,20 @@ class CZookeeper
|
|
205
198
|
end
|
206
199
|
|
207
200
|
private
|
201
|
+
# This method is NOT SYNCHRONIZED!
|
202
|
+
#
|
203
|
+
# you must hold the @mutex lock while calling this method
|
204
|
+
def unhealthy?
|
205
|
+
@_closed || @_shutting_down || is_unrecoverable
|
206
|
+
end
|
207
|
+
|
208
|
+
# This method is NOT SYNCHRONIZED!
|
209
|
+
#
|
210
|
+
# you must hold the @mutex lock while calling this method
|
211
|
+
def healthy?
|
212
|
+
!unhealthy?
|
213
|
+
end
|
214
|
+
|
208
215
|
# submits a job for processing
|
209
216
|
# blocks the caller until result has returned
|
210
217
|
def submit_and_block(meth, *args)
|
@@ -227,6 +234,8 @@ class CZookeeper
|
|
227
234
|
# this method is part of the reopen/close code, and is responsible for
|
228
235
|
# shutting down the dispatch thread.
|
229
236
|
#
|
237
|
+
# this method must be EXTERNALLY SYNCHRONIZED!
|
238
|
+
#
|
230
239
|
# @event_thread will be nil when this method exits
|
231
240
|
#
|
232
241
|
def stop_event_thread
|
@@ -329,8 +338,8 @@ class CZookeeper
|
|
329
338
|
if (hash[:req_id] == ZKRB_GLOBAL_CB_REQ) && (hash[:type] == -1)
|
330
339
|
ev_state = hash[:state]
|
331
340
|
|
332
|
-
|
333
|
-
@
|
341
|
+
@state_mutex.synchronize do
|
342
|
+
if @state != ev_state
|
334
343
|
@state = ev_state
|
335
344
|
@state_cond.broadcast
|
336
345
|
end
|
@@ -368,9 +377,12 @@ class CZookeeper
|
|
368
377
|
@mutex.synchronize do
|
369
378
|
@_shutting_down = true
|
370
379
|
# ollie ollie oxen all home free!
|
371
|
-
@state_cond.broadcast
|
372
380
|
@running_cond.broadcast
|
373
381
|
end
|
382
|
+
|
383
|
+
@state_mutex.synchronize do
|
384
|
+
@state_cond.broadcast
|
385
|
+
end
|
374
386
|
end
|
375
387
|
|
376
388
|
# called by underlying C code to signal we're running
|
data/lib/zookeeper/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zookeeper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -14,7 +14,7 @@ authors:
|
|
14
14
|
autorequire:
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
|
-
date:
|
17
|
+
date: 2014-01-16 00:00:00.000000000 Z
|
18
18
|
dependencies: []
|
19
19
|
description: ! 'A low-level multi-Ruby wrapper around the ZooKeeper API bindings.
|
20
20
|
For a
|
@@ -157,4 +157,3 @@ test_files:
|
|
157
157
|
- spec/support/progress_formatter.rb
|
158
158
|
- spec/support/zookeeper_spec_helpers.rb
|
159
159
|
- spec/zookeeper_spec.rb
|
160
|
-
has_rdoc:
|