Package org.h2.mvstore
Class AppendOnlyMultiFileStore
java.lang.Object
org.h2.mvstore.FileStore<org.h2.mvstore.MFChunk>
org.h2.mvstore.AppendOnlyMultiFileStore
Class AppendOnlyMultiFileStore.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.h2.mvstore.FileStore
FileStore.PageSerializationManager -
Field Summary
Fields inherited from class org.h2.mvstore.FileStore
lastChunk, META_ID_KEY, PIPE_LENGTH, readBytes, readCount, recoveryMode, saveChunkLock, storeHeader, writeBytes, writeCount -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidMake persistent changes after lastChunk was resetprotected voidallocateChunkSpace(org.h2.mvstore.MFChunk chunk, WriteBuffer buff) Allocate logical space and assign position of the buffer within the store.voidbackup(ZipOutputStream out) voidclose()Close this store.protected voidcompactStore(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 final org.h2.mvstore.MFChunkcreateChunk(int newChunkId) org.h2.mvstore.MFChunkBuild a Chunk from the given string.protected org.h2.mvstore.MFChunkcreateChunk(Map<String, String> map) protected voiddoHousekeeping(MVStore mvStore) protected voidfreeChunkSpace(Iterable<org.h2.mvstore.MFChunk> chunks) Mark the space occupied by specified chunks as free.intprotected voidinitializeStoreHeader(long time) voidmarkUsed(long pos, int length) Mark the space as in use.voidreadFully(org.h2.mvstore.MFChunk chunk, long pos, int len) Read data from the store.protected voidreadStoreHeader(boolean recoveryMode) booleanshouldSaveNow(int unsavedMemory, int autoCommitMemory) Decision about autocommit is delegated to storeprotected voidshrinkStoreIfPossible(int minPercent) Shrink store if possible, and if at least a given percentage can be saved.protected booleanvalidateFileLength(String msg) protected voidwriteChunk(org.h2.mvstore.MFChunk chunk, WriteBuffer buff) Write buffer associated with chunk into store at chunk's allocated positionprotected voidPerforms final preparation before store is closed normallyprotected voidwriteFully(org.h2.mvstore.MFChunk chunk, long pos, ByteBuffer src) Write to the file.Methods inherited from class org.h2.mvstore.FileStore
accountForRemovedPage, bind, clear, 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, getRewriteCandidates, getRootPos, getStoreHeader, getTocCacheHitRatio, getWriteBuffer, getWriteCount, hasChangesSince, hasPersistentData, init, initializeCommonHeaderAttributes, isIdle, isKnownVersion, isReadOnly, isRegularMap, isSpaceReused, lastChunkVersion, populateInfo, processCommonHeaderAttributes, readChunkFooter, readChunkHeaderAndFooter, readChunkHeaderOptionally, readChunkHeaderOptionally, readFully, registerDeadChunk, releaseWriteBuffer, rewriteChunks, rollbackTo, saveChunkMetadataChanges, setAutoCommitDelay, setCacheSize, setLastChunk, setRetentionTime, setReuseSpace, setSize, size, start, stop, store, sync, writeCleanShutdown
-
Constructor Details
-
AppendOnlyMultiFileStore
-
-
Method Details
-
createChunk
protected final org.h2.mvstore.MFChunk createChunk(int newChunkId) - Specified by:
createChunkin classFileStore<org.h2.mvstore.MFChunk>
-
createChunk
Description copied from class:FileStoreBuild a Chunk from the given string.- Specified by:
createChunkin classFileStore<org.h2.mvstore.MFChunk>- Parameters:
s- the string- Returns:
- the Chunk created
-
createChunk
- Specified by:
createChunkin classFileStore<org.h2.mvstore.MFChunk>
-
shouldSaveNow
public boolean shouldSaveNow(int unsavedMemory, int autoCommitMemory) Description copied from class:FileStoreDecision about autocommit is delegated to store- Specified by:
shouldSaveNowin classFileStore<org.h2.mvstore.MFChunk>- Parameters:
unsavedMemory- amount of unsaved memory, so farautoCommitMemory- configured limit on amount of unsaved memory- Returns:
- true if commit should happen now
-
open
-
open
-
close
public void close()Close this store. -
writeFully
Description copied from class:FileStoreWrite to the file.- Specified by:
writeFullyin classFileStore<org.h2.mvstore.MFChunk>- Parameters:
chunk- to writepos- the write positionsrc- the source buffer
-
readFully
Description copied from class:FileStoreRead data from the store. -
initializeStoreHeader
protected void initializeStoreHeader(long time) - Specified by:
initializeStoreHeaderin classFileStore<org.h2.mvstore.MFChunk>
-
readStoreHeader
protected void readStoreHeader(boolean recoveryMode) - Specified by:
readStoreHeaderin classFileStore<org.h2.mvstore.MFChunk>
-
allocateChunkSpace
Description copied from class:FileStoreAllocate logical space and assign position of the buffer within the store.- Specified by:
allocateChunkSpacein classFileStore<org.h2.mvstore.MFChunk>- Parameters:
chunk- to allocate space forbuff- to allocate space for
-
writeChunk
Description copied from class:FileStoreWrite buffer associated with chunk into store at chunk's allocated position- Specified by:
writeChunkin classFileStore<org.h2.mvstore.MFChunk>- Parameters:
chunk- chunk to writebuff- to write
-
writeCleanShutdownMark
protected void writeCleanShutdownMark()Description copied from class:FileStorePerforms final preparation before store is closed normally- Specified by:
writeCleanShutdownMarkin classFileStore<org.h2.mvstore.MFChunk>
-
adjustStoreToLastChunk
protected void adjustStoreToLastChunk()Description copied from class:FileStoreMake persistent changes after lastChunk was reset- Specified by:
adjustStoreToLastChunkin classFileStore<org.h2.mvstore.MFChunk>
-
compactStore
protected void compactStore(int thresholdFillRate, long maxCompactTime, int maxWriteSize, MVStore mvStore) Description copied from class:FileStoreCompact store file, that is, compact blocks that have a low fill rate, and move chunks next to each other. This will typically shrink the file. Changes are flushed to the file, and old chunks are overwritten.- Specified by:
compactStorein classFileStore<org.h2.mvstore.MFChunk>- Parameters:
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 FileStore
-
doHousekeeping
- Specified by:
doHousekeepingin classFileStore<org.h2.mvstore.MFChunk>- Throws:
InterruptedException
-
getFillRate
public int getFillRate()- Specified by:
getFillRatein classFileStore<org.h2.mvstore.MFChunk>
-
shrinkStoreIfPossible
protected void shrinkStoreIfPossible(int minPercent) Description copied from class:FileStoreShrink store if possible, and if at least a given percentage can be saved.- Specified by:
shrinkStoreIfPossiblein classFileStore<org.h2.mvstore.MFChunk>- Parameters:
minPercent- the minimum percentage to save
-
markUsed
public void markUsed(long pos, int length) Description copied from class:FileStoreMark the space as in use. -
freeChunkSpace
Description copied from class:FileStoreMark the space occupied by specified chunks as free.- Specified by:
freeChunkSpacein classFileStore<org.h2.mvstore.MFChunk>- Parameters:
chunks- chunks to be processed
-
validateFileLength
- Specified by:
validateFileLengthin classFileStore<org.h2.mvstore.MFChunk>
-
backup
- Specified by:
backupin classFileStore<org.h2.mvstore.MFChunk>- Throws:
IOException
-