Switch branches/tags
Find file
Fetching contributors…
Cannot retrieve contributors at this time
393 lines (256 sloc) 15.2 KB
* backported fix for ZOOKEEPER-2253 by @chchen - #76
* fix for ruby 2.2.0 build - #74 (h/t: fbernier)
* Fix for build on OS-X 10.10 by @e0en
* Fix deadlock related to state checks that can happen during reconnecting
* Fixing dependent library compilation on FreeBSD 10 #53 (h/t: gogreen53)
* Fix two issues with dealing with unresponsive zookeeper servers
that would prevent the client from properly recovering the session
(including one in the Apache ZooKeeper C library — see ZOOKEEPER-1756
for more details)
* Reduce the chances of seeing Zookeeper::Exceptions::NotConnected
exceptions by only submitting new commands if we are connected
* Prevent commands from being queued to be sent to the server if the
session has expired which will solve most cases involving the
Zookeeper::Exceptions::ContinuationTimeoutError exception
* Upgrade the Apache ZooKeeper C library to 3.4.5 (client is backward
compatible with 3.3 servers). The Java library has not been updated.
* Cleanup complaints from compiler for uninitialized variable access
* Allow passing :session_id and :session_password options #42 (thanks to avalanche123)
* Fix permissions constants #46, #47, #48 (thanks to jaeho-kim)
* Allow JRuby to read nil values #44 (thanks to reidmorrison)
v1.4.4 fix build under FreeBSD (h/t: stass)
v1.4.3 fix build for ruby 2.0.0-rc2
v1.4.2 fix a bug in the forwarding logger format string
v1.4.1 merge pull request 29 - fix exception handling in jruby 1.7.x
* h/t to @dynamix for the patch
v1.4.0 Removed the 'logging' gem
* At the request of a user, use of the logging gem has been discontinued as
it appears to cause a fair amount of RSS memory bloating (8MB was
reported). It's been replaced by a fairly simple ad-hoc implementation
using the stdlib 'logger' class. No user impact is expected unless you were
adjusting the Loggers on components of zookeeper.
v1.3.0 much needed refactor of event and async result delivery
* event and async blocks were previously mixed in with a bunch of other
common code, and shared a Monitor with other unrelated functionality. This
code has been gently refactored into its own self-contained class (with its
own task-specific lock), which should help with maintenance.
v1.2.14 merge add_auth pull request, reduce chances for ContinuationTimeoutError
* added support for the add_auth call (h/t: @bradhe) see pull req #25
* fix a corner case where some pending Continuations may get stuck without
being shutdown when the event thread exits. This would lead to a
ContinuationTimeoutError being raised after 30s as a failsafe.
v1.2.13 fix build under rbenv
* h/t to Eric Lindvall for fixing #22 in
build reportedly works in rbenv now.
v1.2.12 improve locking in dispatch_next_callback
* Possible fix for an edgy NoMethodError on nil
v1.2.11 remove dependency on backports gem
* Somewhat naively we were requiring the backports gem to provide
Kernel#require_relative. This release implements similar functionlity
inside the Zookeeper module and doesn't affect the global namespace.
We apologise for the inconvenience.
v1.2.10 minor bug fix in java code
* Don't obscure a legitimate exception because of an unexpected nil
v1.2.7 further lock adjustments, deadlock risk reduction
* Refactor ZookeeperBase to not hold onto the mutex while waiting
for the dispatch thread to exit and the CZookeeper instance to close.
Instead, lock, nil out @czk, and unlock (which will cause all calls to
raise NotConnected), and then carry on with the shutdown procedure, greatly
reducing the chances of a deadlock. Also add a hardcoded 30 second timeout
to the join of the shutdown thread, that way we won't hang indefinitely in
the case of an unforseen condition.
* Improve the CZookeeper#wait_until_connected to use a deadline approach
to waiting for both running and connected states. Also, handle the
'nil' (wait forever) timeout properly.
* Wake all waiting threads on all ConditionVariables when CZookeeper#shut_down!
is called
v1.2.6 fix build on fedora
v1.2.5 cleanup locking in ZookeeperBase
* There were several situations where we would hold the lock before calling
a method on CZookeeper (inquisitors and #create in particular). This
exposed us to deadlocks in situations where an async event would be
delivered (probably a SESSION_EXPIRED event), but the callback block could
not be called because the dispatch thread would block on the mutex being
held by the caller of create.
This version cleans up that usage, and ensures that the only time we hold
the mutex is during startup/shutdown (when the value of @czk may be changing),
and in all other cases we grab the mutex, dereference, and unlock then perform
whatever action on the reference.
* Add a safety net to Continuation (which will soon be called 'Promise' or
'Future' at the request of @eric). If any operation takes more than 30s
an exception will be raised in the calling thread. The session timeout
setting makes it so that no operation should take more than 20s, so we know
if we haven't received a reply in *longer* than that, something has gone
v1.2.4 fix buffer overflow in CZookeeper client_id code
* the 'passwd' part of the struct is a char[16], but isn't null terminated.
use rb_str_new with an explicit length, rather than rb_str_new2 which
uses strlen().
v1.2.3 ensure that all threads are woken up on shutdown
* There was an edge case where a call would be queued up and its thread
sleeping waiting for a response, but that response would never come because
the connection was shut down. This version includes a patch for that case
to ensure that if a call is in 'pending' state, and shutdown time arrives
that all pending threads will receive a Zookeeper::Exceptions::NotConnected
v1.2.2 avoid race while waiting for connection
* There was a possible race in CZookeeper#wait_until_connected where if we
couldn't connect to the port specified (localhost:28271) then we wound up
burning 100% CPU and spinning. This solution fixes that by hooking into the
event delivery and keeping track of what the current state is. When there's
a change, we use a ConditionVariable to wake up threads that were waiting
until the connection was connected. Additionally, we now respect the
timeout parameter again.
v1.2.1 simplify assert_open
* The client methods were all calling assert_open before performing an
action. This was meant as a fail-early lightweight check of the connection
state and it worked well when we were running against the mt code. Now this
requires us to use a Continuation and make our way through the event loop.
There is a possible deadlock this release should solve that was caused by
the assert_open code holding a lock while making an async call through
the event loop. This is no longer the case. The assert_open call only checks
that the current handle hasn't been closed, the connection-state checking
now occurs before submitting a request on the event iteration thread, and
the behavior should be the same as it was before. If the underlying
connection is not in the 'connected' state, an exception will be raised.
v1.2.0 Stop the World, I Wanna fork()
* changed pause/resume methods to pause_before_fork_in_parent
and resume_after_fork_in_parent to match their ZK counterparts
* replaced the Queue in QueueWithPipe (really have to change that name)
with an Array and Mutex/ConditionVariable pair. This allows us to
have better control over the shutdown signaling, and lets us resume
operations after a pause.
v1.1.1 Cleanup after code review (h/t @eric)
* While hunting down this bug:
Eric Lindvall made a number of helpful catches.
* Reduce syscall overhead by not using an unnecessary pipe in the event_lib.c
* More careful use of rb_raise, don't longjmp past necessary free() calls.
* More careful malloc in the get() implementation (we need to allocate 1MB
to hold the data in a znode, but only in the SYNC cases).
v1.1.0 Rewrite C backend to use zookeeper_st, the async library
* In order to ensure fork safety, a rewrite of the backend was necessary.
It was impossible to guarantee with the mt lib that a lock would not
be held by a thread when fork() was called, which opened up the possibility
for corruption and other badness.
This version contains a Continuation class, which allows us to present a
synchronous front-end to the asynchronous backend. All features are still
supported, no special action is necessary to prepare for a fork, and the
post-fork procedure is the same as before: call reopen() in the child,
continue on in the parent like nothing happened.
v1.0.6 Only include backports if RUBY_VERSION is 1.8.x
* 'backports' pollutes too much, use sparingly
v1.0.5 Minor cleanup
* Fix the InheritedConnectionError message
* Clean up the module includes
v1.0.3 Linux: Fix hang on reopen after fork
* Linux users relying on fork() should upgrade to 1.0.3, as it
fixes a bug in the reopen code that would cause a hang in the child.
If you're running on linux, you *really* should upgrade
v1.0.0 Single Zookeeper namespace
* The top level Zookeeper class is now a module, the former Zookeeper
class is now Zookeeper::Client
* Consolidate the 6 top-level namespaces into one, Zookeeper module
ZookeeperCommon -> Zookeeper::Common
ZookeeperCallbacks -> Zookeeper::Callbacks
ZookeeperConstants -> Zookeeper::Constants
ZookeeperExceptions -> Zookeeper::Exceptions
ZookeeperACLs -> Zookeeper::ACLs
CZookeeper -> Zookeeper::CZookeeper
* Added a 'zookeeper/compatibility' file that will define the old names
and look up the new constants for users, and print a warning telling them
the change has occurred and that they should update their code
* Added scripts/upgrade-1.0-sed-alike.rb which will basically do a
find-and-replace, changing the old names to the new names (worked on
both the Zookeeper and ZK codebases).
* Java and C now use different names for the base class, to avoid the
possibility of error. Java is now JavaBase, C remains ZookeeperBase.
* All client methods are defined in the ClientMethods module and mixed
into the constructed Client class.
* Fix all requires, no longer monkey with $LOAD_PATH, use require_relative
* Bugfix for C client.
Because we release the GIL, there's the possibilty that in the middle of a
synchronous C call, ruby will have switched thread contexts and one of
those threads will call close. It seems that during normal operation, this
is not a problem, but during shutdown, this causes CPU to spike to 100% and
a deadlock. This fix essentially wraps every call to the C layer in a
mutex. There may be a slightly less heavyweight optimization in the future,
but this is the safest option at the moment.
v0.9.3 Event thread shutdown fix, Windows compatibility fix
* Use a 'shutdown thread' to coordinate cleanup if close is called from the
event thread (prevents deadlock)
* Default Logger now uses $stderr instead of opening /dev/null [#16]
* Gemfile/gemspec/Rakefile refactoring.
v0.9.2 More efficient and simpler wrappers for GIL release
* After a code review by Andrew Wason (rectalogic), use a much simpler
technique for creating the arg structs and passing them to the
zkrb_gvl_* functions. No malloc(), no free(), no problem.
v0.9.1 see v0.8.4 notes, same patch
* In >= 1.9.2 the ruby interpreter allows you to release the GIL when
calling into native code, sounds like a good idea.
This release makes use of that code by parsing the zookeeper.h header file
and extracting the method signatures of all relevant zoo_* functions, then
generating boilerplate that allows us to call those functions via the
rb_thread_blocking_region function.
1.8.7 compatibility is maintained by stubbing out that functionality if built
under 1.8.7.
* 1.8.7 is deprecated! I will continue to support 1.8.7 for the near future
but sometime soon, you're gonna have to upgrade.
v0.8.4 fix NameError, require 'forwardable'
* Really not sure why this didn't come up in tests
* issue here
v0.8.3 fix NonLocalJump exception in event delivery thread shutdown code
* hit a corner case where we're waiting for the zkc handle setup
and the user decides to shutdown, but before we've had a chance
to enter the delivery loop.
* Cleaned up some nasty code in ZookeeperConstants
* removed ZookeeperConstants#print_events and ZookeeperConstants#print_states
* changed EVENT_TYPE_NAMES and EVENT_STATE_NAMES in ZookeeperConstants
to use string values instead of symbols
v0.8.2 fix close after a fork()
* The dispatch thread will be dead in this situation, so we need to
check to see if it's already dead before waiting on it to exit.
v0.8.1 Java client fix, silence warnings
v0.8.0 Refactor C implementaion, EventMachine client
* separated CZookeeper and ZookeeperBase implementation
This solves issues with reopen not working properly, makes for a much
cleaner event delivery implementation. ZookeeperBase controls the lifecycle
of the event dispatch thread now, rather than it being tied to CZookeeper.
* added support for the 'sync' API call
* Refactored zookeeper_c.c and zookeeper_lib.c
More error checking in zookeeper_lib.c and restructure some things to make
logic easier to follow
Fix bug in method_get_next_event that made the shutdown case so complicated
* Massively simplified EMClient implementation
Rather than trying to hook the IO used by zookeeper_lib to notify zookeeper_c
about event availabiltiy directly into EventMachine, use the same event delivery
thread, but wrap the dispatch call in EM.schedule.
* Improve implementation of spin-lock-esque code that waits for the connection to be
established before returning.
This cut the test runtime down from 1m 20s to 2s.
* Java client refactoring, similar correctness changes
* Change ZookeeperException base class to StandardError instead of Exception
v0.4.5 Upgrade to ZooKeeper 3.3.3
v0.4.4 Fix race condition on close, possible data corruption on async get.
v0.4.3 Fix a handful of memory-related bugs, fix SIGSEGV on master change, reduce latency of event handling, fix compilation on OSX.
v0.4.2 Add options to Zookeeper#initialize, silence most Zookeeper logs.
v0.4.1 Upgrade to ZooKeeper 3.3.2
v0.4.0. More attr-readers (StarvingMarvin) and 1.9 compatibility (tsuraan)
v0.3.2. Handle close, closed connections and expired sessions a little more gracefully.
v0.3.1. ACL bugfix.
v0.3.0. Wickman's rewrite, breaks dependencies from myelin/emaland port.
v0.2.2. Fix compatibility with stock Leopard fat-binary Ruby.
v0.2.1. No more camelcase classname.
v0.2. Bundle C dependencies, like memcached.gem.
v0.1. First release.
# vim:ft=text:ts=2:sw=2:et