|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectvoldemort.client.protocol.admin.BaseStreamingClient
public class BaseStreamingClient
The streaming API allows for send events into voldemort stores in the async fashion. All the partition and replication logic will be taken care of internally. The users is expected to provide two callbacks, one for performing period checkpoints and one for recovering the streaming process from the last checkpoint. NOTE: The API is not thread safe, since if multiple threads use this API we cannot make any guarantees about correctness of the checkpointing mechanism. Right now we expect this to used by a single thread per data source
Field Summary | |
---|---|
protected AdminClient |
adminClient
|
protected java.util.List<java.lang.Integer> |
blackListedNodes
|
protected static int |
CHECKPOINT_COMMIT_SIZE
|
protected int |
entriesProcessed
|
protected java.util.List<java.lang.Integer> |
faultyNodes
|
protected static boolean |
MARKED_BAD
|
protected java.util.HashMap<Pair<java.lang.String,java.lang.Integer>,java.lang.Boolean> |
nodeIdStoreInitialized
|
protected java.util.HashMap<Pair<java.lang.String,java.lang.Integer>,java.io.DataOutputStream> |
nodeIdStoreToOutputStreamRequest
|
protected java.util.List<Node> |
nodesToStream
|
protected RoutingStrategy |
routingStrategy
|
protected java.util.HashMap<java.lang.String,RoutingStrategy> |
storeToRoutingStrategy
|
protected SocketPool |
streamingSocketPool
|
protected EventThrottler |
throttler
|
Constructor Summary | |
---|---|
BaseStreamingClient(StreamingClientConfig config)
|
Method Summary | |
---|---|
protected void |
addStoreToSession(java.lang.String store)
Add another store destination to an existing streaming session |
void |
blacklistNode(int nodeId)
mark a node as blacklisted |
protected void |
close(java.net.Socket socket)
|
void |
closeStreamingSession()
Close the streaming session Flush all n/w buffers and call the commit callback |
void |
closeStreamingSession(java.util.concurrent.Callable resetCheckpointCallback)
|
void |
closeStreamingSessions()
Close the streaming session Flush all n/w buffers and call the commit callback |
void |
closeStreamingSessions(java.util.concurrent.Callable resetCheckpointCallback)
|
void |
commitToVoldemort()
Flush the network buffer and write all entries to the server Wait for an ack from the server This is a blocking call. |
protected void |
finalize()
|
AdminClient |
getAdminClient()
|
java.util.List<java.lang.Integer> |
getFaultyNodes()
|
void |
initStreamingSession(java.lang.String store,
java.util.concurrent.Callable checkpointCallback,
java.util.concurrent.Callable recoveryCallback,
boolean allowMerge)
|
void |
initStreamingSessions(java.util.List<java.lang.String> stores,
java.util.concurrent.Callable checkpointCallback,
java.util.concurrent.Callable recoveryCallback,
boolean allowMerge)
|
void |
initStreamingSessions(java.util.List<java.lang.String> stores,
java.util.concurrent.Callable checkpointCallback,
java.util.concurrent.Callable recoveryCallback,
boolean allowMerge,
java.util.List<java.lang.Integer> blackListedNodes)
|
void |
removeStoreFromSession(java.util.List<java.lang.String> storeNameToRemove)
Remove a list of stores from the session First commit all entries for these stores and then cleanup resources |
void |
streamingPut(ByteArray key,
Versioned<byte[]> value)
A Streaming Put call |
void |
streamingPut(ByteArray key,
Versioned<byte[]> value,
java.lang.String storeName)
|
void |
unmarkBad()
Reset streaming session by unmarking it as bad |
void |
updateThrottleLimit(int throttleQPS)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected SocketPool streamingSocketPool
protected RoutingStrategy routingStrategy
protected static int CHECKPOINT_COMMIT_SIZE
protected int entriesProcessed
protected static boolean MARKED_BAD
protected EventThrottler throttler
protected AdminClient adminClient
protected java.util.HashMap<java.lang.String,RoutingStrategy> storeToRoutingStrategy
protected java.util.HashMap<Pair<java.lang.String,java.lang.Integer>,java.lang.Boolean> nodeIdStoreInitialized
protected java.util.HashMap<Pair<java.lang.String,java.lang.Integer>,java.io.DataOutputStream> nodeIdStoreToOutputStreamRequest
protected java.util.List<Node> nodesToStream
protected java.util.List<java.lang.Integer> blackListedNodes
protected java.util.List<java.lang.Integer> faultyNodes
Constructor Detail |
---|
public BaseStreamingClient(StreamingClientConfig config)
Method Detail |
---|
public AdminClient getAdminClient()
public java.util.List<java.lang.Integer> getFaultyNodes()
public void updateThrottleLimit(int throttleQPS)
public void initStreamingSession(java.lang.String store, java.util.concurrent.Callable checkpointCallback, java.util.concurrent.Callable recoveryCallback, boolean allowMerge)
store
- - the name of the store to be streamed tocheckpointCallback
- - the callback that allows for the user to
record the progress, up to the last event delivered. This callable
would be invoked every so often internally.recoveryCallback
- - the callback that allows the user to rewind the
upstream to the position recorded by the last complete call on
checkpointCallback whenever an exception occurs during the
streaming session.allowMerge
- - whether to allow for the streaming event to be merged
with online writes. If not, all online writes since the completion
of the last streaming session will be lost at the end of the
current streaming session.public void streamingPut(ByteArray key, Versioned<byte[]> value)
key
- - The keyvalue
- - The valuepublic void closeStreamingSession(java.util.concurrent.Callable resetCheckpointCallback)
resetCheckpointCallback
- - the callback that allows for the user to
clean up the checkpoint at the end of the streaming session so a
new session could, if necessary, start from 0 position.public void closeStreamingSession()
protected void close(java.net.Socket socket)
protected void finalize()
finalize
in class java.lang.Object
public void initStreamingSessions(java.util.List<java.lang.String> stores, java.util.concurrent.Callable checkpointCallback, java.util.concurrent.Callable recoveryCallback, boolean allowMerge)
stores
- - the list of name of the stores to be streamed tocheckpointCallback
- - the callback that allows for the user to
record the progress, up to the last event delivered. This callable
would be invoked every so often internally.recoveryCallback
- - the callback that allows the user to rewind the
upstream to the position recorded by the last complete call on
checkpointCallback whenever an exception occurs during the
streaming session.allowMerge
- - whether to allow for the streaming event to be merged
with online writes. If not, all online writes since the completion
of the last streaming session will be lost at the end of the
current streaming session.public void initStreamingSessions(java.util.List<java.lang.String> stores, java.util.concurrent.Callable checkpointCallback, java.util.concurrent.Callable recoveryCallback, boolean allowMerge, java.util.List<java.lang.Integer> blackListedNodes)
stores
- - the list of name of the stores to be streamed tocheckpointCallback
- - the callback that allows for the user to
record the progress, up to the last event delivered. This callable
would be invoked every so often internally.recoveryCallback
- - the callback that allows the user to rewind the
upstream to the position recorded by the last complete call on
checkpointCallback whenever an exception occurs during the
streaming session.allowMerge
- - whether to allow for the streaming event to be merged
with online writes. If not, all online writes since the completion
of the last streaming session will be lost at the end of the
current streaming session.blackListedNodes
- - the list of Nodes not to stream to; we can
probably recover them later from the replicasprotected void addStoreToSession(java.lang.String store)
store
- the name of the store to stream topublic void removeStoreFromSession(java.util.List<java.lang.String> storeNameToRemove)
storeNameToRemove
- List of stores to be removed from the current
streaming sessionpublic void streamingPut(ByteArray key, Versioned<byte[]> value, java.lang.String storeName)
key
- - The keyvalue
- - The valuestoreName
- takes an additional store name as a parameter
If a store is added mid way through a streaming session we do not
play catchup and entries that were processed earlier during the
session will not be applied for the store.public void commitToVoldemort()
public void unmarkBad()
public void blacklistNode(int nodeId)
nodeId
- Integer node id of the node to be balcklistedpublic void closeStreamingSessions(java.util.concurrent.Callable resetCheckpointCallback)
resetCheckpointCallback
- - the callback that allows for the user to
clean up the checkpoint at the end of the streaming session so a
new session could, if necessary, start from 0 position.public void closeStreamingSessions()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |