Class LocalHashTableV2<K,V>
java.lang.Object
com.orientechnologies.common.concur.resource.OSharedResourceAbstract
com.orientechnologies.orient.core.storage.impl.local.paginated.base.ODurableComponent
com.orientechnologies.orient.core.storage.index.hashindex.local.v2.LocalHashTableV2<K,V>
- All Implemented Interfaces:
OHashTable<K,V>
Implementation of hash index which is based on extendible hashing algorithm. The
directory for extindible hashing is implemented in
HashTableDirectory class. Directory is
not implemented according to classic algorithm because of its big memory consumption in case of
non-uniform data distribution instead it is implemented according too "Multilevel Extendible
Hashing Sven Helmer, Thomas Neumann, Guido Moerkotte April 17, 2002". Which has much less memory
consumption in case of nonuniform data distribution. Index itself uses so called "multilevel
schema" when first level contains 256 buckets, when bucket is split it is put at the end of other
file which represents second level. So if data which are put has distribution close to uniform
(this index was designed to be use as rid index for DHT storage) buckets split will be preformed
in append only manner to speed up index write speed. So hash index bucket itself has following
structure:
- Bucket depth - 1 byte.
- Bucket's size - amount of entities (key, value) in one bucket, 4 bytes
- Page indexes of parents of this bucket, page indexes of buckets split of which created current bucket - 64*8 bytes.
- Offsets of entities stored in this bucket relatively to it's beginning. It is array of int values of undefined size.
- Entities itself
- It will generate write ahead log of enormous size.
- The more amount of memory is affected in operation the less speed we will have. In worst case 60 kb of memory should be moved.
- Is level removed (in case all buckets are empty or level was not created yet) - 1 byte
- File's level id - 8 bytes
- Amount of buckets in given level - 8 bytes.
- Index of page of first removed bucket (is not split but removed) - 8 bytes
- Since:
- 12.03.13
- Author:
- Andrey Lomakin (a.lomakin-at-orientdb.com)
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.orientechnologies.orient.core.storage.index.hashindex.local.OHashTable
OHashTable.BucketPath, OHashTable.BucketSplitResult, OHashTable.Entry<K,V>, OHashTable.KeyHashCodeComparator<K>, OHashTable.NodeSplitResult, OHashTable.RawEntry -
Field Summary
Fields inherited from class com.orientechnologies.orient.core.storage.impl.local.paginated.base.ODurableComponent
atomicOperationsManager, readCache, storage, writeCacheFields inherited from class com.orientechnologies.common.concur.resource.OSharedResourceAbstract
lock -
Constructor Summary
ConstructorsConstructorDescriptionLocalHashTableV2(String name, String metadataConfigurationFileExtension, String treeStateFileExtension, String bucketFileExtension, String nullBucketFileExtension, OAbstractPaginatedStorage abstractPaginatedStorage) -
Method Summary
Modifier and TypeMethodDescriptionvoidAcquires exclusive lock in the active atomic operation running on the current thread for this hash table.OHashTable.Entry<K,V>[] ceilingEntries(K key) voidclose()voidcreate(OAtomicOperation atomicOperation, OBinarySerializer<K> keySerializer, OBinarySerializer<V> valueSerializer, OType[] keyTypes, OEncryption encryption, OHashFunction<K> keyHashFunction, boolean nullKeyIsSupported) voiddelete(OAtomicOperation atomicOperation) OHashTable.Entry<K,V>[] floorEntries(K key) voidflush()OHashTable.Entry<K,V>[] higherEntries(K key) OHashTable.Entry<K,V>[] higherEntries(K key, int limit) booleanvoidload(String name, OType[] keyTypes, boolean nullKeyIsSupported, OEncryption encryption, OHashFunction<K> keyHashFunction, OBinarySerializer<K> keySerializer, OBinarySerializer<V> valueSerializer) OHashTable.Entry<K,V>[] lowerEntries(K key) voidput(OAtomicOperation atomicOperation, K key, V value) remove(OAtomicOperation atomicOperation, K k) longsize()booleanvalidatedPut(OAtomicOperation atomicOperation, K key, V value, IndexEngineValidator<K, V> validator) Puts the given value under the given key into this hash table.Methods inherited from class com.orientechnologies.orient.core.storage.impl.local.paginated.base.ODurableComponent
addFile, addPage, calculateInsideComponentOperation, deleteFile, executeInsideComponentOperation, getExtension, getFilledUpTo, getFullName, getLockName, getName, isFileExists, loadOrAddPageForWrite, loadPageForRead, loadPageForWrite, openFile, releasePageFromRead, releasePageFromWrite, setName, truncateFile, tryExecuteInsideComponentOperationMethods inherited from class com.orientechnologies.common.concur.resource.OSharedResourceAbstract
acquireExclusiveLock, acquireSharedLock, releaseExclusiveLock, releaseSharedLockMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.orientechnologies.orient.core.storage.index.hashindex.local.OHashTable
getName
-
Constructor Details
-
LocalHashTableV2
-
-
Method Details
-
create
public void create(OAtomicOperation atomicOperation, OBinarySerializer<K> keySerializer, OBinarySerializer<V> valueSerializer, OType[] keyTypes, OEncryption encryption, OHashFunction<K> keyHashFunction, boolean nullKeyIsSupported) throws IOException - Specified by:
createin interfaceOHashTable<K,V> - Throws:
IOException
-
get
- Specified by:
getin interfaceOHashTable<K,V>
-
isNullKeyIsSupported
public boolean isNullKeyIsSupported()- Specified by:
isNullKeyIsSupportedin interfaceOHashTable<K,V>
-
put
- Specified by:
putin interfaceOHashTable<K,V>
-
validatedPut
public boolean validatedPut(OAtomicOperation atomicOperation, K key, V value, IndexEngineValidator<K, V> validator) Description copied from interface:OHashTablePuts the given value under the given key into this hash table. Validates the operation using the provided validator.- Specified by:
validatedPutin interfaceOHashTable<K,V> key- the key to put the value under.value- the value to put.validator- the operation validator.- Returns:
trueif the validator allowed the put,falseotherwise.- See Also:
-
remove
- Specified by:
removein interfaceOHashTable<K,V>
-
higherEntries
- Specified by:
higherEntriesin interfaceOHashTable<K,V>
-
higherEntries
- Specified by:
higherEntriesin interfaceOHashTable<K,V>
-
load
public void load(String name, OType[] keyTypes, boolean nullKeyIsSupported, OEncryption encryption, OHashFunction<K> keyHashFunction, OBinarySerializer<K> keySerializer, OBinarySerializer<V> valueSerializer) - Specified by:
loadin interfaceOHashTable<K,V>
-
ceilingEntries
- Specified by:
ceilingEntriesin interfaceOHashTable<K,V>
-
firstEntry
- Specified by:
firstEntryin interfaceOHashTable<K,V>
-
lastEntry
- Specified by:
lastEntryin interfaceOHashTable<K,V>
-
lowerEntries
- Specified by:
lowerEntriesin interfaceOHashTable<K,V>
-
floorEntries
- Specified by:
floorEntriesin interfaceOHashTable<K,V>
-
size
public long size()- Specified by:
sizein interfaceOHashTable<K,V>
-
close
public void close()- Specified by:
closein interfaceOHashTable<K,V>
-
delete
- Specified by:
deletein interfaceOHashTable<K,V> - Throws:
IOException
-
flush
public void flush()- Specified by:
flushin interfaceOHashTable<K,V>
-
acquireAtomicExclusiveLock
public void acquireAtomicExclusiveLock()Description copied from interface:OHashTableAcquires exclusive lock in the active atomic operation running on the current thread for this hash table.- Specified by:
acquireAtomicExclusiveLockin interfaceOHashTable<K,V>
-