voldemort.store.bdb
Class PartitionPrefixedBdbStorageEngine

java.lang.Object
  extended by voldemort.store.AbstractStore<K,V,T>
      extended by voldemort.store.AbstractStorageEngine<ByteArray,byte[],byte[]>
          extended by voldemort.store.bdb.BdbStorageEngine
              extended by voldemort.store.bdb.PartitionPrefixedBdbStorageEngine
All Implemented Interfaces:
NativeBackupable, StorageEngine<ByteArray,byte[],byte[]>, Store<ByteArray,byte[],byte[]>

public class PartitionPrefixedBdbStorageEngine
extends BdbStorageEngine

Extends BDB Storage Engine with capabilities to perform partition range scans, to speed up scan jobs, that filter on partition id


Field Summary
 
Fields inherited from class voldemort.store.bdb.BdbStorageEngine
bdbEnvironmentStats, checkpointerOffForBatchWrites, minimizeScanImpact
 
Constructor Summary
PartitionPrefixedBdbStorageEngine(java.lang.String name, com.sleepycat.je.Environment environment, com.sleepycat.je.Database database, BdbRuntimeConfig config, RoutingStrategy strategy)
           
 
Method Summary
 boolean delete(ByteArray key, Version version)
          Delete all entries prior to the given version
 ClosableIterator<Pair<ByteArray,Versioned<byte[]>>> entries(int partition)
          Get an iterator over pairs of entries in a store's partition.
 java.util.List<Versioned<byte[]>> get(ByteArray key, byte[] transforms)
          Get the value associated with the given key
protected  org.apache.log4j.Logger getLogger()
           
 boolean isPartitionScanSupported()
          Does the storage engine support efficient scanning of a single partition?
 ClosableIterator<ByteArray> keys(int partition)
          Get an iterator over keys in the store's partition Note that the iterator need not be threadsafe, and that it must be manually closed after use.
 java.util.List<Versioned<byte[]>> multiVersionPut(ByteArray key, java.util.List<Versioned<byte[]>> values)
          Atomically update storage with the list of versioned values for the given key, to improve storage efficiency.
 void put(ByteArray key, Versioned<byte[]> value, byte[] transforms)
          Associate the value with the key and version in this store
 
Methods inherited from class voldemort.store.bdb.BdbStorageEngine
beginBatchModifications, close, endBatchModifications, entries, equals, getAll, getBdbDatabase, getBdbEnvironmentStats, getBdbStats, getBdbStats, getStats, getVersions, hashCode, keys, nativeBackup, truncate
 
Methods inherited from class voldemort.store.AbstractStorageEngine
isPartitionAware, resolveAndConstructVersionsToPersist
 
Methods inherited from class voldemort.store.AbstractStore
delete, get, getAll, getCapability, getName, put
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface voldemort.store.Store
delete, get, getAll, getCapability, getName, put
 

Constructor Detail

PartitionPrefixedBdbStorageEngine

public PartitionPrefixedBdbStorageEngine(java.lang.String name,
                                         com.sleepycat.je.Environment environment,
                                         com.sleepycat.je.Database database,
                                         BdbRuntimeConfig config,
                                         RoutingStrategy strategy)
Method Detail

entries

public ClosableIterator<Pair<ByteArray,Versioned<byte[]>>> entries(int partition)
Description copied from interface: StorageEngine
Get an iterator over pairs of entries in a store's partition. The key is the first element in the pair and the versioned value is the second element. Note that the iterator need not be threadsafe, and that it must be manually closed after use.

Specified by:
entries in interface StorageEngine<ByteArray,byte[],byte[]>
Overrides:
entries in class BdbStorageEngine
Parameters:
partition - partition whose entries are to be fetched
Returns:
An iterator over the entries in this StorageEngine.

keys

public ClosableIterator<ByteArray> keys(int partition)
Description copied from interface: StorageEngine
Get an iterator over keys in the store's partition Note that the iterator need not be threadsafe, and that it must be manually closed after use.

Specified by:
keys in interface StorageEngine<ByteArray,byte[],byte[]>
Overrides:
keys in class BdbStorageEngine
Parameters:
partition - partition whose keys are to be fetched
Returns:
An iterator over the keys in this StorageEngine.

get

public java.util.List<Versioned<byte[]>> get(ByteArray key,
                                             byte[] transforms)
                                      throws PersistenceFailureException
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 BdbStorageEngine
Parameters:
key - The key to check for
Returns:
The value associated with the key or an empty list if no values are found.
Throws:
PersistenceFailureException

put

public void put(ByteArray key,
                Versioned<byte[]> value,
                byte[] transforms)
         throws PersistenceFailureException
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 BdbStorageEngine
Parameters:
key - The key to use
value - The value to store and its version.
Throws:
PersistenceFailureException

delete

public boolean delete(ByteArray key,
                      Version version)
               throws PersistenceFailureException
Description copied from interface: Store
Delete all entries prior to the given version

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

multiVersionPut

public java.util.List<Versioned<byte[]>> multiVersionPut(ByteArray key,
                                                         java.util.List<Versioned<byte[]>> values)
Description copied from interface: StorageEngine
Atomically update storage with the list of versioned values for the given key, to improve storage efficiency.

Specified by:
multiVersionPut in interface StorageEngine<ByteArray,byte[],byte[]>
Overrides:
multiVersionPut in class BdbStorageEngine
Parameters:
key - Key to write
values - List of versioned values to be written atomically.
Returns:
list of obsolete versions that were rejected

getLogger

protected org.apache.log4j.Logger getLogger()
Overrides:
getLogger in class BdbStorageEngine

isPartitionScanSupported

public boolean isPartitionScanSupported()
Description copied from interface: StorageEngine
Does the storage engine support efficient scanning of a single partition?

Specified by:
isPartitionScanSupported in interface StorageEngine<ByteArray,byte[],byte[]>
Overrides:
isPartitionScanSupported in class AbstractStorageEngine<ByteArray,byte[],byte[]>
Returns:
true if the storage engine implements the capability. false otherwise


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