|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectvoldemort.server.gossip.Gossiper
public class Gossiper
Implementation of a Gossip protocol for metadata. Periodically, choose a
random peer and Gossip for all metadata keys specified in
MetadataStore.GOSSIP_KEYS with that peer.
Gossip between nodes A and B for a metadata key K starts with node A retrieving the key K and its vector clock from node B. The retrieved vector clock is then compared with the local vector clock for K. If the value at node B is determined to have come after the value at node A, node A will accept the value at node B. If the value at node B is determined to have come before the value at node A, node A will do nothing and allow node B to initiate Gossip. If the two vector clocks are found to be concurrent i.e., causally unrelated, an error is logged.
| Constructor Summary | |
|---|---|
Gossiper(MetadataStore metadataStore,
AdminClient adminClient,
int gossipInterval)
Create a Gossiper object, which implements Runnable
allowing it to be run as a thread or be submitted to an Executor. |
|
| Method Summary | |
|---|---|
protected void |
gossipKey(Node node,
java.lang.String key)
Perform Gossip on a specified metadata key with a remote node. |
void |
run()
Perform Gossip: until receiving a shutdown signal, pick a peer at random, Gossip all keys listed in MetadataStore.GOSSIP_KEYS with that peer
and then sleep for a specified interval. |
protected Node |
selectPeer()
Randomly select a distinct peer. |
void |
start()
Allow Gossip to start if run() is invoked. |
void |
stop()
After the current operation finishes, stop Gossip. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Gossiper(MetadataStore metadataStore,
AdminClient adminClient,
int gossipInterval)
Gossiper object, which implements Runnable
allowing it to be run as a thread or be submitted to an Executor.
metadataStore - The instance of
MetadataStore for the local node.adminClient - Instance of
AdminClientgossipInterval - Interval in milliseconds at which we want
to gossip.| Method Detail |
|---|
public void start()
run() is invoked.
public void stop()
public void run()
MetadataStore.GOSSIP_KEYS with that peer
and then sleep for a specified interval.
run in interface java.lang.Runnableprotected Node selectPeer()
protected rather
than private, so that it may be overridden if peer selection
logic is to be changed e.g., to add datacenter/rack awareness.
protected void gossipKey(Node node,
java.lang.String key)
Method is protected rather than private, so
that it may be overridden if the behaviour for handling concurrent values
of the same key was to be changed e.g., if two differently named stores
were added during a network split, merge appropriate metadata to include
both stores.
node - Node to Gossip with.key - Metadata key to exchange by Gossip.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||