voldemort.store.rebalancing
Class RedirectingStore

java.lang.Object
  extended by voldemort.store.DelegatingStore<ByteArray,byte[],byte[]>
      extended by voldemort.store.rebalancing.RedirectingStore
All Implemented Interfaces:
Store<ByteArray,byte[],byte[]>

public class RedirectingStore
extends DelegatingStore<ByteArray,byte[],byte[]>

The RedirectingStore extends DelegatingStore

If current server_state is MetadataStore.VoldemortState.REBALANCING_MASTER_SERVER
then before serving any client request do a remote get() call, put it locally ignoring any ObsoleteVersionException and then serve the client requests. This piece of code is run on the stealer nodes.


Constructor Summary
RedirectingStore(Store<ByteArray,byte[],byte[]> innerStore, MetadataStore metadata, StoreRepository storeRepository, FailureDetector detector, SocketStoreFactory storeFactory)
           
 
Method Summary
 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()
           
 java.util.List<Version> getVersions(ByteArray key)
           
 void put(ByteArray key, Versioned<byte[]> value, byte[] transforms)
          Associate the value with the key and version in this store
 void setIsRedirectingStoreEnabled(boolean isRedirectingStoreEnabled)
           
 
Methods inherited from class voldemort.store.DelegatingStore
close, getCapability, getInnerStore, getName, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RedirectingStore

public RedirectingStore(Store<ByteArray,byte[],byte[]> innerStore,
                        MetadataStore metadata,
                        StoreRepository storeRepository,
                        FailureDetector detector,
                        SocketStoreFactory storeFactory)
Method Detail

setIsRedirectingStoreEnabled

public void setIsRedirectingStoreEnabled(boolean isRedirectingStoreEnabled)

getIsRedirectingStoreEnabled

public boolean getIsRedirectingStoreEnabled()

put

public void put(ByteArray key,
                Versioned<byte[]> value,
                byte[] transforms)
         throws VoldemortException
Description copied from interface: Store
Associate the value with the key and version in this store

Specified by:
put in interface Store<ByteArray,byte[],byte[]>
Overrides:
put in class DelegatingStore<ByteArray,byte[],byte[]>
Parameters:
key - The key to use
value - The value to store and its version.
Throws:
VoldemortException

get

public java.util.List<Versioned<byte[]>> get(ByteArray key,
                                             byte[] transforms)
                                      throws VoldemortException
Description copied from interface: Store
Get the value associated with the given key

Specified by:
get in interface Store<ByteArray,byte[],byte[]>
Overrides:
get in class DelegatingStore<ByteArray,byte[],byte[]>
Parameters:
key - The key to check for
Returns:
The value associated with the key or an empty list if no values are found.
Throws:
VoldemortException

getVersions

public java.util.List<Version> getVersions(ByteArray key)
Specified by:
getVersions in interface Store<ByteArray,byte[],byte[]>
Overrides:
getVersions in class DelegatingStore<ByteArray,byte[],byte[]>

getAll

public java.util.Map<ByteArray,java.util.List<Versioned<byte[]>>> getAll(java.lang.Iterable<ByteArray> keys,
                                                                         java.util.Map<ByteArray,byte[]> transforms)
                                                                  throws VoldemortException
Description copied from interface: Store
Get the values associated with the given keys and returns them in a Map of keys to a list of versioned values. Note that the returned map will only contain entries for the keys which have a value associated with them.

Specified by:
getAll in interface Store<ByteArray,byte[],byte[]>
Overrides:
getAll in class DelegatingStore<ByteArray,byte[],byte[]>
Parameters:
keys - The keys to check for.
Returns:
A Map of keys to a list of versioned values.
Throws:
VoldemortException

delete

public boolean delete(ByteArray key,
                      Version version)
               throws VoldemortException
TODO : Handle delete correctly.

The options are:

  1. Delete locally and on remote node as well. The issue is cursor is open in READ_UNCOMMITED mode while rebalancing and can push the value back.
  2. Keep the operation in separate slop store and apply all deletes after rebalancing.
  3. Do not worry about deletes for now, Voldemort in general has an issue that if node goes down during a delete, we will still keep the old version.

Specified by:
delete in interface Store<ByteArray,byte[],byte[]>
Overrides:
delete in class DelegatingStore<ByteArray,byte[],byte[]>
Parameters:
key - The key to delete
version - The current value of the key
Returns:
True if anything was deleted
Throws:
VoldemortException


Jay Kreps, Roshan Sumbaly, Alex Feinberg, Bhupesh Bansal, Lei Gao, Chinmay Soman, Vinoth Chandar, Zhongjie Wu