public class StoreWAL extends StoreDirect
| Modifier and Type | Field and Description |
|---|---|
protected long[] |
indexVals |
protected boolean[] |
indexValsModified |
protected Volume |
log |
protected static long |
LOG_MASK_OFFSET |
protected static long |
LOG_SEAL
added to offset 8 into log file, indicates that log was synced and closed
|
protected java.util.concurrent.atomic.AtomicInteger |
logChecksum |
protected long |
logSize |
protected LongMap<byte[]> |
longStackPages |
protected LongConcurrentHashMap<long[]> |
modified |
protected static long[] |
PREALLOC |
protected boolean |
replayPending |
protected static long[] |
TOMBSTONE |
static java.lang.String |
TRANS_LOG_FILE_EXT |
protected Volume.Factory |
volFac |
protected static byte |
WAL_INDEX_LONG |
protected static byte |
WAL_LONGSTACK_PAGE |
protected static byte |
WAL_PHYS_ARRAY |
protected static byte |
WAL_PHYS_ARRAY_ONE_LONG |
protected static byte |
WAL_SEAL
last instruction in log file
|
protected static byte |
WAL_SKIP_REST_OF_BLOCK |
DATA_FILE_EXT, deleteFilesAfterClose, freeSize, HEADER, index, indexSize, IO_FREE_RECID, IO_FREE_SIZE, IO_INDEX_SIZE, IO_INDEX_SUM, IO_PHYS_SIZE, IO_USER_START, LONG_STACK_PREF_COUNT, LONG_STACK_PREF_COUNT_ALTER, LONG_STACK_PREF_SIZE, LONG_STACK_PREF_SIZE_ALTER, MASK_ARCHIVE, MASK_DISCARD, MASK_LINKED, MASK_OFFSET, MAX_REC_SIZE, maxUsedIoList, phys, PHYS_FREE_SLOTS_COUNT, physSize, readOnly, sizeLimit, spaceReclaimReuse, spaceReclaimSplit, spaceReclaimTrack, STORE_VERSION, syncOnCommitDisabledchecksum, CHECKSUM_FLAG_MASK, CHUNK_SIZE, CHUNK_SIZE_MOD_MASK, closeListeners, compress, COMPRESS_FLAG_MASK, encrypt, ENCRYPT_FLAG_MASK, encryptionXTEA, locks, LOG, LZF, newRecidLock, password, recycledDataOuts, serializerPojo, serializerPojoInitLock, structuralLockCATALOG_RECID, CHECK_RECORD, CLASS_INFO_RECID, LAST_RESERVED_RECID| Constructor and Description |
|---|
StoreWAL(Volume.Factory volFac) |
StoreWAL(Volume.Factory volFac,
boolean readOnly,
boolean deleteFilesAfterClose,
int spaceReclaimMode,
boolean syncOnCommitDisabled,
long sizeLimit,
boolean checksum,
boolean compress,
byte[] password,
boolean disableLocks,
int sizeIncrement) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canRollback() |
protected void |
checkHeaders() |
protected void |
checkLogRounding() |
void |
close()
Close store/cache.
|
void |
commit()
Makes all changes made since the previous commit/rollback permanent.
|
protected void |
compactPostUnderLock()
subclasses put additional cleanup after compaction finishes here
|
protected void |
compactPreUnderLock()
subclasses put additional checks before compaction starts here
|
<A> boolean |
compareAndSwap(long recid,
A expectedOldValue,
A newValue,
Serializer<A> serializer)
Updates existing record in atomic (Compare And Swap) manner.
|
<A> void |
delete(long recid,
Serializer<A> serializer)
Remove existing record from store/cache
Recid must be a number returned by 'put' method.
|
<A> A |
get(long recid,
Serializer<A> serializer)
Get existing record.
|
protected <A> A |
get2(long ioRecid,
Serializer<A> serializer) |
protected long[] |
getLinkedRecordsFromLog(long ioRecid) |
protected long |
indexHeaderChecksumUncommited() |
protected long[] |
logAllocate(long[] physPos) |
protected void |
logChecksumAdd(int cs) |
protected boolean |
logDirty() |
protected void |
logReset() |
protected byte[] |
longStackGetPage(long offset) |
protected static long |
longStackGetSixLong(byte[] page,
int pos) |
protected void |
longStackPut(long ioList,
long offset,
boolean recursive) |
protected static void |
longStackPutSixLong(byte[] page,
int pos,
long value) |
protected long |
longStackTake(long ioList,
boolean recursive) |
long |
preallocate()
Preallocates recid for not yet created record.
|
void |
preallocate(long[] recids)
Preallocates recids for not yet created record.
|
<A> long |
put(A value,
Serializer<A> serializer)
Insert new record.
|
protected void |
reloadIndexFile() |
protected void |
replayLogFile() |
void |
rollback()
Undoes all changes made in the current transaction.
|
<A> void |
update(long recid,
A value,
Serializer<A> serializer)
Update existing record with new value.
|
protected boolean |
verifyLogFile() |
protected void |
walIndexVal(long logPos,
long ioRecid,
long indexVal) |
protected void |
walPhysArray(DataOutput2 out,
long[] physPos,
long[] logPos) |
calculateStatistics, clearCache, compact, countLongStackItems, createStructure, freeIoRecidPut, freeIoRecidTake, freePhysPut, freePhysTake, getCurrSize, getFreeRecids, getFreeSize, getLinkedRecordsIndexVals, getMaxRecid, getRaw, getSizeLimit, indexHeaderChecksum, isClosed, isReadOnly, physAllocate, put2, roundTo16, size2ListIoRecid, update2, updateRawcanSnapshot, closeListenerRegister, closeListenerUnregister, deserialize, expectedMasks, forDB, forEngine, getSerializerPojo, lockAllWrite, lockPos, newDataOut2, printStatistics, serialize, snapshot, unlockAllWriteprotected static final long LOG_MASK_OFFSET
protected static final byte WAL_INDEX_LONG
protected static final byte WAL_LONGSTACK_PAGE
protected static final byte WAL_PHYS_ARRAY_ONE_LONG
protected static final byte WAL_PHYS_ARRAY
protected static final byte WAL_SKIP_REST_OF_BLOCK
protected static final byte WAL_SEAL
protected static final long LOG_SEAL
public static final java.lang.String TRANS_LOG_FILE_EXT
protected static final long[] TOMBSTONE
protected static final long[] PREALLOC
protected final Volume.Factory volFac
protected Volume log
protected volatile long logSize
protected final LongConcurrentHashMap<long[]> modified
protected final LongMap<byte[]> longStackPages
protected final long[] indexVals
protected final boolean[] indexValsModified
protected boolean replayPending
protected final java.util.concurrent.atomic.AtomicInteger logChecksum
public StoreWAL(Volume.Factory volFac)
public StoreWAL(Volume.Factory volFac, boolean readOnly, boolean deleteFilesAfterClose, int spaceReclaimMode, boolean syncOnCommitDisabled, long sizeLimit, boolean checksum, boolean compress, byte[] password, boolean disableLocks, int sizeIncrement)
protected void checkHeaders()
checkHeaders in class StoreDirectprotected void reloadIndexFile()
protected void logReset()
public long preallocate()
Enginepreallocate in interface Enginepreallocate in class StoreDirectpublic void preallocate(long[] recids)
Enginepreallocate in interface Enginepreallocate in class StoreDirectrecids - array to put result intopublic <A> long put(A value,
Serializer<A> serializer)
Engineput in interface Engineput in class StoreDirectvalue - records to be addedserializer - used to convert record into/from binary formprotected void walPhysArray(DataOutput2 out, long[] physPos, long[] logPos)
protected void walIndexVal(long logPos,
long ioRecid,
long indexVal)
protected long[] logAllocate(long[] physPos)
protected void checkLogRounding()
public <A> A get(long recid,
Serializer<A> serializer)
Engineget in interface Engineget in class StoreDirectrecid - (record identifier) under which record was persistedserializer - used to deserialize record from binary formprotected <A> A get2(long ioRecid,
Serializer<A> serializer)
throws java.io.IOException
get2 in class StoreDirectjava.io.IOExceptionpublic <A> void update(long recid,
A value,
Serializer<A> serializer)
Engineupdate in interface Engineupdate in class StoreDirectrecid - (record identifier) under which record was persisted.value - new record value to be storedserializer - used to serialize record into binary formpublic <A> boolean compareAndSwap(long recid,
A expectedOldValue,
A newValue,
Serializer<A> serializer)
EngineoldValue==expectedOldValue when old value is found in instance cacheoldValue using serializer and checking oldValue.equals(expectedOldValue)expectedOldValue using serializer and comparing binary array with already serialized oldValue
compareAndSwap in interface EnginecompareAndSwap in class StoreDirectrecid - (record identifier) under which record was persisted.expectedOldValue - old value to be compared with existing recordnewValue - to be written if values are matchingserializer - used to serialize record into binary formpublic <A> void delete(long recid,
Serializer<A> serializer)
Enginedelete in interface Enginedelete in class StoreDirectrecid - (record identifier) under which was record persistedserializer - which may be used in some circumstances to deserialize and store old objectpublic void commit()
Enginecommit in interface Enginecommit in class StoreDirectprotected boolean logDirty()
protected long indexHeaderChecksumUncommited()
protected boolean verifyLogFile()
protected void replayLogFile()
public void rollback()
throws java.lang.UnsupportedOperationException
EngineUnsupportedOperationException.rollback in interface Enginerollback in class StoreDirectjava.lang.UnsupportedOperationException - if transactions are disabledprotected long[] getLinkedRecordsFromLog(long ioRecid)
protected long longStackTake(long ioList,
boolean recursive)
longStackTake in class StoreDirectprotected void longStackPut(long ioList,
long offset,
boolean recursive)
longStackPut in class StoreDirectprotected static long longStackGetSixLong(byte[] page,
int pos)
protected static void longStackPutSixLong(byte[] page,
int pos,
long value)
protected byte[] longStackGetPage(long offset)
public void close()
EngineNullPointerException
There is an configuration option DBMaker.closeOnJvmShutdown() which uses shutdown hook to automatically
close Engine when JVM shutdowns.close in interface Engineclose in class StoreDirectprotected void compactPreUnderLock()
StoreDirectcompactPreUnderLock in class StoreDirectprotected void compactPostUnderLock()
StoreDirectcompactPostUnderLock in class StoreDirectpublic boolean canRollback()
canRollback in interface EnginecanRollback in class StoreDirectprotected void logChecksumAdd(int cs)