hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Hadoop Wiki] Update of "ZabProtocol" by BenjaminReed
Date Thu, 30 Oct 2008 15:54:37 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Hadoop Wiki" for change notification.

The following page has been changed by BenjaminReed:
http://wiki.apache.org/hadoop/ZabProtocol

New page:
= Zab: Atomic Broadcast for ZooKeeper =

We would like to modularize the Atomic Broadcast layer of ZooKeeper so that it can be used
independently. It also help to be able to test more effectively.

Zab is a standard atomic broadcast layer, but there are somethings that ZooKeeper uses from
Zab that is specific to its implementation:

 1. ZooKeeper forwards change requests to a leader. It uses the same leader that Zab uses
for simplicity and efficiency, so we need a method to get the leader.
 1. ZooKeeper uses Zab's write-ahead logging for atomic broadcast to also do the write-ahead
logging for database changes.
 1. Most applications of atomic broadcast involves a state transfer if a process gets too
far behind, so we have merged state transfer into Zab.

Zab is currently buried into Zab. Here is a proposed interface for the extracted Zab:

{{{
class Zab {
    // This constructor takes a ZabCallback that will receive events from Zab.
    // After Zab is constructed cb, will get called with setState() and deliver() for
    // any state and transactions that have been logged locally
    Zab(ZabCallback cb);
    // This method propose the message and returns a zxid (Zab transaction identifier)
    long propose(byte message[]);
}

enum ZabStatus { LOOKING, FOLLOWING, LEADING };

interface ZabCallback {
    // This method is called when a message has been delivered by Zab
    void deliver(long zxid, byte message[]);
    // This method is called when Zab's status changes. If this instance
    // of Zab is FOLLOWING, leader will have the name of the leader.
    void status(ZabStatus status, String leader);
    // This method is called by Zab to get the current state of ZooKeeper.
    // It may be called to sync with leaders who are behind (a state transfer), or it
    // may be used to periodically get the state of ZooKeeper for recovery.
    void getState(OutputStream os);
    // This method is called by Zab to push a state transfer to ZooKeeper.
    void setState(InputStream is);
}
}}}

Mime
View raw message