|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectvoldemort.store.AbstractStore<K,V,T>
voldemort.store.DelegatingStore<ByteArray,byte[],byte[]>
voldemort.store.rebalancing.RedirectingStore
public class RedirectingStore
The RedirectingStore extends DelegatingStore
If current server_state is MetadataStore.VoldemortState.REBALANCING_MASTER_SERVER
then handle incoming requests in the following way, if the key belongs to a
partition that this server is currently stealing. Such a server has what we
call a 'proxy node', which is the server which owned that partition as the
exact same type of replica in the same zone, as per the old cluster topology.
1. getVersions/get
If the server contains the key locally, then serve it directly. Else, fetch
from proxy node, update local storage and then serve it off that.
2. getAll
Similarly, for keys that exist locally, serve it off directly. Else,
fetch-update the missing keys from proxyNode and then serve them off local
storage.
3. put
First write it to local storage, then submit a async put() to the proxy node,
so we can safely abort the rebalancing if we have to.
4. delete
:) :) :)
Constructor Summary | |
---|---|
RedirectingStore(Store<ByteArray,byte[],byte[]> innerStore,
MetadataStore metadata,
StoreRepository storeRepository,
FailureDetector detector,
SocketStoreFactory storeFactory,
java.util.concurrent.ExecutorService proxyPutWorkerPool,
ProxyPutStats proxyPutStats)
|
Method Summary | |
---|---|
protected void |
checkNodeAvailable(Node proxyNode)
|
boolean |
delete(ByteArray key,
Version version)
TODO : Handle delete correctly. |
java.util.List<Versioned<byte[]>> |
get(ByteArray key,
byte[] transforms)
Get the value associated with the given key |
java.util.Map<ByteArray,java.util.List<Versioned<byte[]>>> |
getAll(java.lang.Iterable<ByteArray> keys,
java.util.Map<ByteArray,byte[]> transforms)
Get the values associated with the given keys and returns them in a Map of keys to a list of versioned values. |
boolean |
getIsRedirectingStoreEnabled()
|
protected MetadataStore |
getMetadataStore()
|
ProxyPutStats |
getProxyPutStats()
|
protected Store<ByteArray,byte[],byte[]> |
getRedirectingSocketStore(java.lang.String storeName,
int proxyNodeId)
Get the SocketStore to redirect to for the
proxy node, creating one if needed. |
java.util.List<Version> |
getVersions(ByteArray key)
Get the versions associated with the given key. |
boolean |
isServerRebalancing()
|
void |
put(ByteArray key,
Versioned<byte[]> value,
byte[] transforms)
Associate the value with the key and version in this store |
protected void |
recordException(Node node,
long startNs,
UnreachableStoreException e)
|
protected void |
recordSuccess(Node node,
long startNs)
|
protected void |
reportProxyPutFailure()
|
protected void |
reportProxyPutSuccess()
|
void |
setIsRedirectingStoreEnabled(boolean isRedirectingStoreEnabled)
|
Methods inherited from class voldemort.store.DelegatingStore |
---|
close, delete, get, getAll, getCapability, getInnerStore, put, toString |
Methods inherited from class voldemort.store.AbstractStore |
---|
getName |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public RedirectingStore(Store<ByteArray,byte[],byte[]> innerStore, MetadataStore metadata, StoreRepository storeRepository, FailureDetector detector, SocketStoreFactory storeFactory, java.util.concurrent.ExecutorService proxyPutWorkerPool, ProxyPutStats proxyPutStats)
Method Detail |
---|
public void setIsRedirectingStoreEnabled(boolean isRedirectingStoreEnabled)
public boolean getIsRedirectingStoreEnabled()
public java.util.List<Versioned<byte[]>> get(ByteArray key, byte[] transforms) throws VoldemortException
Store
get
in interface Store<ByteArray,byte[],byte[]>
get
in class DelegatingStore<ByteArray,byte[],byte[]>
key
- The key to check for
VoldemortException
public java.util.List<Version> getVersions(ByteArray key)
Store
getVersions
in interface Store<ByteArray,byte[],byte[]>
getVersions
in class DelegatingStore<ByteArray,byte[],byte[]>
key
- The key to retrieve the versions for
public java.util.Map<ByteArray,java.util.List<Versioned<byte[]>>> getAll(java.lang.Iterable<ByteArray> keys, java.util.Map<ByteArray,byte[]> transforms) throws VoldemortException
Store
getAll
in interface Store<ByteArray,byte[],byte[]>
getAll
in class DelegatingStore<ByteArray,byte[],byte[]>
keys
- The keys to check for.
VoldemortException
public void put(ByteArray key, Versioned<byte[]> value, byte[] transforms) throws VoldemortException
Store
put
in interface Store<ByteArray,byte[],byte[]>
put
in class DelegatingStore<ByteArray,byte[],byte[]>
key
- The key to usevalue
- The value to store and its version.
VoldemortException
public boolean delete(ByteArray key, Version version) throws VoldemortException
The options are:
delete
in interface Store<ByteArray,byte[],byte[]>
delete
in class DelegatingStore<ByteArray,byte[],byte[]>
key
- The key to deleteversion
- The current value of the key
VoldemortException
public boolean isServerRebalancing()
protected void checkNodeAvailable(Node proxyNode)
protected Store<ByteArray,byte[],byte[]> getRedirectingSocketStore(java.lang.String storeName, int proxyNodeId)
SocketStore
to redirect to for the
proxy node, creating one if needed.
storeName
- Name of the storeproxyNodeId
- proxy node id
SocketStore
object for storeName
and
proxyNodeId
protected void recordException(Node node, long startNs, UnreachableStoreException e)
protected void recordSuccess(Node node, long startNs)
protected MetadataStore getMetadataStore()
protected void reportProxyPutFailure()
protected void reportProxyPutSuccess()
public ProxyPutStats getProxyPutStats()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |