ZooKeeper 3.0.0 Release Notes

These release notes include new developer and user facing incompatibilities, features, and major improvements.

Migration Instructions when Upgrading to 3.0.0

You should only have to read this section if you are upgrading from a previous version of ZooKeeper to version 3.0.0, otw skip down to changes

A small number of changes in this release have resulted in non-backward compatible Zookeeper client user code and server instance data. The following instructions provide details on how to migrate code and date from version 2.2.1 to version 3.0.0.

Note: ZooKeeper increments the major version number (major.minor.fix) when backward incompatible changes are made to the source base. As part of the migration from SourceForge we changed the package structure (com.yahoo.zookeeper.* to org.apache.zookeeper.*) and felt it was a good time to incorporate some changes that we had been withholding. As a result the following will be required when migrating from 2.2.1 to 3.0.0 version of ZooKeeper.

Migrating Client Code

The underlying client-server protocol has changed in version 3.0.0 of ZooKeeper. As a result clients must be upgraded along with serving clusters to ensure proper operation of the system (old pre-3.0.0 clients are not guaranteed to operate against upgraded 3.0.0 servers and vice-versa).

Watch Management

In previous releases of ZooKeeper any watches registered by clients were lost if the client lost a connection to a ZooKeeper server. This meant that developers had to track watches they were interested in and reregister them if a session disconnect event was received. In this release the client library tracks watches that a client has registered and reregisters the watches when a connection is made to a new server. Applications that still manually reregister interest should continue working properly as long as they are able to handle unsolicited watches. For example, an old application may register a watch for /foo and /goo, lose the connection, and reregister only /goo. As long as the application is able to receive a notification for /foo, (probably ignoring it) it does not need to be changed. One caveat to the watch management: it is possible to miss an event for the creation and deletion of a znode if watching for creation and both the create and delete happens while the client is disconnected from ZooKeeper.

This release also allows clients to specify call specific watch functions. This gives the developer the ability to modularize logic in different watch functions rather than cramming everything in the watch function attached to the ZooKeeper handle. Call specific watch functions receive all session events for as long as they are active, but will only receive the watch callbacks for which they are registered.

Java API

  1. The java package structure has changed from com.yahoo.zookeeper* to org.apache.zookeeper*. This will probably affect all of your java code which makes use of ZooKeeper APIs (typically import statements)
  2. A number of constants used in the client ZooKeeper API were re-specified using enums (rather than ints). See ZOOKEEPER-7, ZOOKEEPER-132 and ZOOKEEPER-139 for full details
  3. ZOOKEEPER-18 removed KeeperStateChanged, use KeeperStateDisconnected instead

Also see the current Java API

C API

  1. A number of constants used in the client ZooKeeper API were renamed in order to reduce namespace collision, see ZOOKEEPER-6 for full details

Migrating Server Data

The following issues resulted in changes to the on-disk data format (the snapshot and transaction log files contained within the ZK data directory) and require a migration utility to be run.

The following must be run once, and only once, when upgrading the ZooKeeper server instances to version 3.0.0.

Note

The and directories referenced below are specified by the dataLogDir and dataDir specification in your ZooKeeper config file respectively. dataLogDir defaults to the value of dataDir if not specified explicitly in the ZooKeeper server config file (in which case provide the same directory for both parameters to the upgrade utility).

  1. Shutdown the ZooKeeper server cluster.

  2. Backup your and directories

  3. Run upgrade using

    • bin/zkServer.sh upgrade <dataLogDir> <dataDir>

    or

    • java -classpath pathtolog4j:pathtozookeeper.jar UpgradeMain <dataLogDir> <dataDir>

    where is the directory where all transaction logs (log.) are stored. is the directory where all the snapshots (snapshot.) are stored.

  4. Restart the cluster.

If you have any failure during the upgrade procedure keep reading to sanitize your database.

This is how upgrade works in ZooKeeper. This will help you troubleshoot in case you have problems while upgrading

  1. Upgrade moves files from <dataLogDir> and <dataDir> to <dataLogDir>/version-1/ and <dataDir>/version-1 respectively (version-1 sub-directory is created by the upgrade utility).
  2. Upgrade creates a new version sub-directory <dataDir>/version-2 and <dataLogDir>/version-2
  3. Upgrade reads the old database from <dataDir>/version-1 and <dataLogDir>/version-1 into the memory and creates a new upgraded snapshot.
  4. Upgrade writes the new database in <dataDir>/version-2.

Troubleshooting.

  1. In case you start ZooKeeper 3.0 without upgrading from 2.0 on a 2.0 database - the servers will start up with an empty database. This is because the servers assume that <dataDir>/version-2 and <dataLogDir>/version-2 will have the database to start with. Since this will be empty in case of no upgrade, the servers will start with an empty database. In such a case, shutdown the ZooKeeper servers, remove the version-2 directory (remember this will lead to loss of updates after you started 3.0.) and then start the upgrade procedure.
  2. If the upgrade fails while trying to rename files into the version-1 directory, you should try and move all the files under <dataDir>/version-1 and <dataLogDir>/version-1 to <dataDir> and <dataLogDir> respectively. Then try upgrade again.
  3. If you do not wish to run with ZooKeeper 3.0 and prefer to run with ZooKeeper 2.0 and have already upgraded - you can run ZooKeeper 2 with the <dataDir> and <dataLogDir> directories changed to <dataDir>/version-1 and <dataLogDir>/version-1. Remember that you will lose all the updates that you made after the upgrade.

Migrating Server Configuration

There is a significant change to the ZooKeeper server configuration file.

The default election algorithm, specified by the electionAlg configuration attribute, has changed from a default of 0 to a default of 3. See Cluster Options section of the administrators guide, specifically the electionAlg and server.X properties.

You will either need to explicitly set electionAlg to its previous default value of 0 or change your server.X options to include the leader election port.

Changes Since ZooKeeper 2.2.1

Version 2.2.1 code, documentation, binaries, etc... are still accessible on SourceForge

IssueNotes
ZOOKEEPER-43Server side of auto reset watches.
ZOOKEEPER-132Create Enum to replace CreateFlag in ZooKepper.create method
ZOOKEEPER-139Create Enums for WatcherEvent's KeeperState and EventType
ZOOKEEPER-18keeper state inconsistency
ZOOKEEPER-38headers in log/snap files
ZOOKEEPER-8Stat enchaned to include num of children and size
ZOOKEEPER-6List of problem identifiers in zookeeper.h
ZOOKEEPER-7Use enums rather than ints for types and state
ZOOKEEPER-27Unique DB identifiers for servers and clients
ZOOKEEPER-32CRCs for ZooKeeper data
ZOOKEEPER-33Better ACL management
ZOOKEEPER-203fix datadir typo in releasenotes
ZOOKEEPER-145write detailed release notes for users migrating from 2.x to 3.0
ZOOKEEPER-23Auto reset of watches on reconnect
ZOOKEEPER-191forrest docs for upgrade.
ZOOKEEPER-201validate magic number when reading snapshot and transaction logs
ZOOKEEPER-200the magic number for snapshot and log must be different
ZOOKEEPER-199fix log messages in persistence code
ZOOKEEPER-197create checksums for snapshots
ZOOKEEPER-198apache license header missing from FollowerSyncRequest.java
ZOOKEEPER-5Upgrade Feature in Zookeeper server.
ZOOKEEPER-194Fix terminology in zookeeperAdmin.xml
ZOOKEEPER-151Document change to server configuration
ZOOKEEPER-193update java example doc to compile with latest zookeeper
ZOOKEEPER-187CreateMode api docs missing
ZOOKEEPER-186add new “releasenotes.xml” to forrest documentation
ZOOKEEPER-190Reorg links to docs and navs to docs into related sections
ZOOKEEPER-189forrest build not validated xml of input documents
ZOOKEEPER-188Check that election port is present for all servers
ZOOKEEPER-185Improved version of FLETest
ZOOKEEPER-184tests: An explicit include derective is needed for the usage of memcpy functions
ZOOKEEPER-183Array subscript is above array bounds in od_completion, src/cli.c.
ZOOKEEPER-182zookeeper_init accepts empty host-port string and returns valid pointer to zhandle_t.
ZOOKEEPER-17zookeeper_init doc needs clarification
ZOOKEEPER-181Some Source Forge Documents did not get moved over: javaExample, zookeeperTutorial, zookeeperInternals
ZOOKEEPER-180Placeholder sections needed in document for new topics that the umbrella jira discusses
ZOOKEEPER-179Programmer's Guide “Basic Operations” section is missing content
ZOOKEEPER-178FLE test.
ZOOKEEPER-159Cover two corner cases of leader election
ZOOKEEPER-156update programmer guide with acl details from old wiki page
ZOOKEEPER-154reliability graph diagram in overview doc needs context
ZOOKEEPER-157Peer can't find existing leader
ZOOKEEPER-155improve “the zookeeper project” section of overview doc
ZOOKEEPER-140Deadlock in QuorumCnxManager
ZOOKEEPER-147This is version of the documents with most of the [tbd...] scrubbed out
ZOOKEEPER-150zookeeper build broken
ZOOKEEPER-136sync causes hang in all followers of quorum.
ZOOKEEPER-134findbugs cleanup
ZOOKEEPER-133hudson tests failing intermittently
ZOOKEEPER-144add tostring support for watcher event, and enums for event type/state
ZOOKEEPER-21Improve zk ctor/watcher
ZOOKEEPER-142Provide Javadoc as to the maximum size of the data byte array that may be stored within a znode
ZOOKEEPER-93Create Documentation for Zookeeper
ZOOKEEPER-117threading issues in Leader election
ZOOKEEPER-137client watcher objects can lose events
ZOOKEEPER-131Old leader election can elect a dead leader over and over again
ZOOKEEPER-130update build.xml to support apache release process
ZOOKEEPER-118findbugs flagged switch statement in followerrequestprocessor.run
ZOOKEEPER-115Potential NPE in QuorumCnxManager
ZOOKEEPER-114cleanup ugly event messages in zookeeper client
ZOOKEEPER-112src/java/main ZooKeeper.java has test code embedded into it.
ZOOKEEPER-39Use Watcher objects rather than boolean on read operations.
ZOOKEEPER-97supports optional output directory in code generator.
ZOOKEEPER-101Integrate ZooKeeper with “violations” feature on hudson
ZOOKEEPER-105Catch Zookeeper exceptions and print on the stderr.
ZOOKEEPER-42Change Leader Election to fast tcp.
ZOOKEEPER-48auth_id now handled correctly when no auth ids present
ZOOKEEPER-44Create sequence flag children with prefixes of 0's so that they can be lexicographically sorted.
ZOOKEEPER-108Fix sync operation reordering on a Quorum.
ZOOKEEPER-25Fuse module for Zookeeper.
ZOOKEEPER-58Race condition on ClientCnxn.java
ZOOKEEPER-56Add clover support to build.xml.
ZOOKEEPER-75register the ZooKeeper mailing lists with nabble.com
ZOOKEEPER-54remove sleeps in the tests.
ZOOKEEPER-55build.xml failes to retrieve a release number from SVN and the ant target “dist” fails
ZOOKEEPER-89invoke WhenOwnerListener.whenNotOwner when the ZK connection fails
ZOOKEEPER-90invoke WhenOwnerListener.whenNotOwner when the ZK session expires and the znode is the leader
ZOOKEEPER-82Make the ZooKeeperServer more DI friendly.
ZOOKEEPER-110Build script relies on svnant, which is not compatible with subversion 1.5 working copies
ZOOKEEPER-111Significant cleanup of existing tests.
ZOOKEEPER-122Fix NPE in jute's Utils.toCSVString.
ZOOKEEPER-123Fix the wrong class is specified for the logger.
ZOOKEEPER-2Fix synchronization issues in QuorumPeer and FastLeader election.
ZOOKEEPER-125Remove unwanted class declaration in FastLeaderElection.
ZOOKEEPER-61Address in client/server test cases.
ZOOKEEPER-75cleanup the library directory
ZOOKEEPER-109cleanup of NPE and Resource issue nits found by static analysis
ZOOKEEPER-76Commit 677109 removed the cobertura library, but not the build targets.
ZOOKEEPER-63Race condition in client close
ZOOKEEPER-70Add skeleton forrest doc structure for ZooKeeper
ZOOKEEPER-79Document jacob's leader election on the wiki recipes page
ZOOKEEPER-73Move ZK wiki from SourceForge to Apache
ZOOKEEPER-72Initial creation/setup of ZooKeeper ASF site.
ZOOKEEPER-71Determine what to do re ZooKeeper Changelog
ZOOKEEPER-68parseACLs in ZooKeeper.java fails to parse elements of ACL, should be lastIndexOf rather than IndexOf
ZOOKEEPER-130update build.xml to support apache release process.
ZOOKEEPER-131Fix Old leader election can elect a dead leader over and over again.
ZOOKEEPER-137client watcher objects can lose events
ZOOKEEPER-117threading issues in Leader election
ZOOKEEPER-128test coverage on async client operations needs to be improved
ZOOKEEPER-127Use of non-standard election ports in config breaks services
ZOOKEEPER-53tests failing on solaris.
ZOOKEEPER-172FLE Test
ZOOKEEPER-41Sample startup script
ZOOKEEPER-33Better ACL management
ZOOKEEPER-49SetACL does not work
ZOOKEEPER-20Child watches are not triggered when the node is deleted
ZOOKEEPER-15handle failure better in build.xml:test
ZOOKEEPER-11ArrayList is used instead of List
ZOOKEEPER-45Restructure the SVN repository after initial import
ZOOKEEPER-1Initial ZooKeeper code contribution from Yahoo!