public abstract class RandomAccessStore extends FileStore<org.h2.mvstore.SFChunk>
FileStore.PageSerializationManager| Modifier and Type | Field and Description |
|---|---|
protected FreeSpaceBitSet |
freeSpace
The free spaces between the chunks.
|
lastChunk, META_ID_KEY, PIPE_LENGTH, readBytes, readCount, recoveryMode, saveChunkLock, storeHeader, writeBytes, writeCount| Constructor and Description |
|---|
RandomAccessStore(java.util.Map<java.lang.String,java.lang.Object> config) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
adjustStoreToLastChunk()
Make persistent changes after lastChunk was reset
|
protected void |
allocateChunkSpace(org.h2.mvstore.SFChunk chunk,
WriteBuffer buff)
Allocate logical space and assign position of the buffer within the store.
|
void |
clear()
Mark the file as empty.
|
void |
compactMoveChunks(int targetFillRate,
long moveSize,
MVStore mvStore)
Compact the store by moving all chunks next to each other, if there is
free space between chunks.
|
protected void |
compactStore(int thresholdFillRate,
long maxCompactTime,
int maxWriteSize,
MVStore mvStore)
Compact store file, that is, compact blocks that have a low
fill rate, and move chunks next to each other.
|
protected org.h2.mvstore.SFChunk |
createChunk(int newChunkId) |
protected org.h2.mvstore.SFChunk |
createChunk(java.util.Map<java.lang.String,java.lang.String> map) |
org.h2.mvstore.SFChunk |
createChunk(java.lang.String s)
Build a Chunk from the given string.
|
protected void |
doHousekeeping(MVStore mvStore) |
protected void |
free(long pos,
int length)
Mark the space as free.
|
protected void |
freeChunkSpace(java.lang.Iterable<org.h2.mvstore.SFChunk> chunks)
Mark the space occupied by specified chunks as free.
|
protected long |
getAfterLastBlock_() |
int |
getFillRate() |
int |
getMovePriority(int block)
Calculates relative "priority" for chunk to be moved.
|
java.util.Collection<org.h2.mvstore.SFChunk> |
getRewriteCandidates() |
protected void |
initializeStoreHeader(long time) |
boolean |
isSpaceReused() |
void |
markUsed(long pos,
int length)
Mark the space as in use.
|
protected void |
readStoreHeader(boolean recoveryMode) |
void |
setReuseSpace(boolean reuseSpace) |
boolean |
shouldSaveNow(int unsavedMemory,
int autoCommitMemory)
Decision about autocommit is delegated to store
|
protected void |
shrinkStoreIfPossible(int minPercent)
Shrink the store if possible, and if at least a given percentage can be
saved.
|
protected abstract void |
truncate(long size) |
protected boolean |
validateFileLength(java.lang.String msg) |
protected void |
writeChunk(org.h2.mvstore.SFChunk chunk,
WriteBuffer buffer)
Write buffer associated with chunk into store at chunk's allocated position
|
protected void |
writeCleanShutdownMark()
Performs final preparation before store is closed normally
|
accountForRemovedPage, backup, bind, close, compact, compactStore, deregisterMapRoot, discoverChunk, dropUnusedChunks, executeFilestoreOperation, findLastChunkWithCompleteValidChunkSet, getAutoCommitDelay, getAutoCompactFillRate, getCacheHitRatio, getCacheSize, getCacheSizeUsed, getChunks, getChunksFillRate, getChunksFromLayoutMap, getCreationTime, getDefaultRetentionTime, getFileName, getLayoutMap, getMaxPageSize, getMetaMapId, getMvStore, getReadBytes, getReadCount, getRetentionTime, getRootPos, getStoreHeader, getTocCacheHitRatio, getWriteBuffer, getWriteCount, hasChangesSince, hasPersistentData, init, initializeCommonHeaderAttributes, isIdle, isKnownVersion, isReadOnly, isRegularMap, lastChunkVersion, open, open, populateInfo, processCommonHeaderAttributes, readChunkFooter, readChunkHeaderAndFooter, readChunkHeaderOptionally, readChunkHeaderOptionally, readFully, readFully, registerDeadChunk, releaseWriteBuffer, rewriteChunks, rollbackTo, saveChunkMetadataChanges, setAutoCommitDelay, setCacheSize, setLastChunk, setRetentionTime, setSize, size, start, stop, store, sync, writeCleanShutdown, writeFullyprotected final FreeSpaceBitSet freeSpace
public RandomAccessStore(java.util.Map<java.lang.String,java.lang.Object> config)
protected final org.h2.mvstore.SFChunk createChunk(int newChunkId)
createChunk in class FileStore<org.h2.mvstore.SFChunk>public org.h2.mvstore.SFChunk createChunk(java.lang.String s)
FileStorecreateChunk in class FileStore<org.h2.mvstore.SFChunk>s - the stringprotected org.h2.mvstore.SFChunk createChunk(java.util.Map<java.lang.String,java.lang.String> map)
createChunk in class FileStore<org.h2.mvstore.SFChunk>public void markUsed(long pos,
int length)
public boolean shouldSaveNow(int unsavedMemory,
int autoCommitMemory)
FileStoreshouldSaveNow in class FileStore<org.h2.mvstore.SFChunk>unsavedMemory - amount of unsaved memory, so farautoCommitMemory - configured limit on amount of unsaved memorypublic boolean isSpaceReused()
isSpaceReused in class FileStore<org.h2.mvstore.SFChunk>public void setReuseSpace(boolean reuseSpace)
setReuseSpace in class FileStore<org.h2.mvstore.SFChunk>protected void freeChunkSpace(java.lang.Iterable<org.h2.mvstore.SFChunk> chunks)
FileStorefreeChunkSpace in class FileStore<org.h2.mvstore.SFChunk>chunks - chunks to be processedprotected void free(long pos,
int length)
pos - the position in byteslength - the number of bytespublic int getFillRate()
getFillRate in class FileStore<org.h2.mvstore.SFChunk>protected final boolean validateFileLength(java.lang.String msg)
validateFileLength in class FileStore<org.h2.mvstore.SFChunk>protected void readStoreHeader(boolean recoveryMode)
readStoreHeader in class FileStore<org.h2.mvstore.SFChunk>protected void initializeStoreHeader(long time)
initializeStoreHeader in class FileStore<org.h2.mvstore.SFChunk>protected final void allocateChunkSpace(org.h2.mvstore.SFChunk chunk,
WriteBuffer buff)
FileStoreallocateChunkSpace in class FileStore<org.h2.mvstore.SFChunk>chunk - to allocate space forbuff - to allocate space forprotected final void writeChunk(org.h2.mvstore.SFChunk chunk,
WriteBuffer buffer)
FileStorewriteChunk in class FileStore<org.h2.mvstore.SFChunk>chunk - chunk to writebuffer - to writeprotected final void writeCleanShutdownMark()
FileStorewriteCleanShutdownMark in class FileStore<org.h2.mvstore.SFChunk>protected final void adjustStoreToLastChunk()
FileStoreadjustStoreToLastChunk in class FileStore<org.h2.mvstore.SFChunk>protected void compactStore(int thresholdFillRate,
long maxCompactTime,
int maxWriteSize,
MVStore mvStore)
compactStore in class FileStore<org.h2.mvstore.SFChunk>thresholdFillRate - do not compact if store fill rate above this value (0-100)maxCompactTime - the maximum time in milliseconds to compactmaxWriteSize - the maximum amount of data to be written as part of this callmvStore - that owns this FileStorepublic void compactMoveChunks(int targetFillRate,
long moveSize,
MVStore mvStore)
targetFillRate - do nothing if the file store fill rate is higher
than thismoveSize - the number of bytes to movemvStore - owner of this storeprotected void shrinkStoreIfPossible(int minPercent)
shrinkStoreIfPossible in class FileStore<org.h2.mvstore.SFChunk>minPercent - the minimum percentage to saveprotected void doHousekeeping(MVStore mvStore) throws java.lang.InterruptedException
doHousekeeping in class FileStore<org.h2.mvstore.SFChunk>java.lang.InterruptedExceptionprotected abstract void truncate(long size)
public void clear()
public int getMovePriority(int block)
block - where chunk startsprotected long getAfterLastBlock_()
public java.util.Collection<org.h2.mvstore.SFChunk> getRewriteCandidates()
getRewriteCandidates in class FileStore<org.h2.mvstore.SFChunk>