[
https://issues.apache.org/jira/browse/HBASE-10296?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13868792#comment-13868792
]
Feng Honghua commented on HBASE-10296:
--------------------------------------
bq.One aspect of ZK that is worth remembering is that it lets other apps keep
an eye on what is going on
Yes, this is a good question. ZK's watch/notification pattern can be viewed as
a communication mechanism: each ZK node represents a piece of data, app A
updates this ZK node when it updates the data, then app B which has a watch on
it will receives a notification when the data is updated.
If we use paxos to replace ZK, the data represented by each ZK node now is
hosted within each master process' memory as an data structure, updated via the
paxos replicated state machine triggered by client/regionserver requests. Now
the watch/notification center is moved from ZK to master, and we can still use
the node->watch-list mechanism for implementation which's used by ZK.
The above 'keep an eye on what is going on'(or watch/notify) now is changed in
two ways:
1. master <-> zk <-> regionserver communication now is replaced by
master<->regionserver direct communication
2. client<->zk<->regionserver communication now is replaced by
client<->master<->regionserver communication (master plays the role of original
ZK)
a note: we can now provide more flexible options by exposing sync/async
notification and one-time/permanent watch. by ZK only one-time async watch is
provided.
> Replace ZK with a paxos running within master processes to provide better
> master failover performance and state consistency
> ---------------------------------------------------------------------------------------------------------------------------
>
> Key: HBASE-10296
> URL: https://issues.apache.org/jira/browse/HBASE-10296
> Project: HBase
> Issue Type: Brainstorming
> Components: master, Region Assignment, regionserver
> Reporter: Feng Honghua
>
> Currently master relies on ZK to elect active master, monitor liveness and
> store almost all of its states, such as region states, table info,
> replication info and so on. And zk also plays as a channel for
> master-regionserver communication(such as in region assigning) and
> client-regionserver communication(such as replication state/behavior change).
> But zk as a communication channel is fragile due to its one-time watch and
> asynchronous notification mechanism which together can leads to missed
> events(hence missed messages), for example the master must rely on the state
> transition logic's idempotence to maintain the region assigning state
> machine's correctness, actually almost all of the most tricky inconsistency
> issues can trace back their root cause to the fragility of zk as a
> communication channel.
> Replace zk with paxos running within master processes have following benefits:
> 1. better master failover performance: all master, either the active or the
> standby ones, have the same latest states in memory(except lag ones but which
> can eventually catch up later on). whenever the active master dies, the newly
> elected active master can immediately play its role without such failover
> work as building its in-memory states by consulting meta-table and zk.
> 2. better state consistency: master's in-memory states are the only truth
> about the system,which can eliminate inconsistency from the very beginning.
> and though the states are contained by all masters, paxos guarantees they are
> identical at any time.
> 3. more direct and simple communication pattern: client changes state by
> sending requests to master, master and regionserver talk directly to each
> other by sending request and response...all don't bother to using a
> third-party storage like zk which can introduce more uncertainty, worse
> latency and more complexity.
> 4. zk can only be used as liveness monitoring for determining if a
> regionserver is dead, and later on we can eliminate zk totally when we build
> heartbeat between master and regionserver.
> I know this might looks like a very crazy re-architect, but it deserves deep
> thinking and serious discussion for it, right?
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)