public final class SstFileManager extends RocksObject
| Modifier and Type | Field and Description |
|---|---|
static long |
BYTES_MAX_DELETE_CHUNK_DEFAULT |
static boolean |
DELETE_EXISTING_TRASH_DEFAULT |
static double |
MAX_TRASH_DB_RATION_DEFAULT |
static long |
RATE_BYTES_PER_SEC_DEFAULT |
nativeHandle_owningHandle_| Constructor and Description |
|---|
SstFileManager(Env env)
Create a new SstFileManager that can be shared among multiple RocksDB
instances to track SST file and control there deletion rate.
|
SstFileManager(Env env,
Logger logger)
Create a new SstFileManager that can be shared among multiple RocksDB
instances to track SST file and control there deletion rate.
|
SstFileManager(Env env,
Logger logger,
long rateBytesPerSec)
Create a new SstFileManager that can be shared among multiple RocksDB
instances to track SST file and control there deletion rate.
|
SstFileManager(Env env,
Logger logger,
long rateBytesPerSec,
double maxTrashDbRatio)
Create a new SstFileManager that can be shared among multiple RocksDB
instances to track SST file and control there deletion rate.
|
SstFileManager(Env env,
Logger logger,
long rateBytesPerSec,
double maxTrashDbRatio,
long bytesMaxDeleteChunk)
Create a new SstFileManager that can be shared among multiple RocksDB
instances to track SST file and control there deletion rate.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
disposeInternal(long handle) |
long |
getDeleteRateBytesPerSecond()
Gets the delete rate limit.
|
double |
getMaxTrashDBRatio()
Get the trash/DB size ratio where new files will be deleted immediately.
|
long |
getTotalSize()
Get the total size of all tracked files.
|
Map<String,Long> |
getTrackedFiles()
Gets all tracked files and their corresponding sizes.
|
boolean |
isMaxAllowedSpaceReached()
Determines if the total size of SST files exceeded the maximum allowed
space usage.
|
boolean |
isMaxAllowedSpaceReachedIncludingCompactions()
Determines if the total size of SST files as well as estimated size
of ongoing compactions exceeds the maximums allowed space usage.
|
void |
setCompactionBufferSize(long compactionBufferSize)
Set the amount of buffer room each compaction should be able to leave.
|
void |
setDeleteRateBytesPerSecond(long deleteRate)
Set the delete rate limit.
|
void |
setMaxAllowedSpaceUsage(long maxAllowedSpace)
Update the maximum allowed space that should be used by RocksDB, if
the total size of the SST files exceeds
maxAllowedSpace, writes to
RocksDB will fail. |
void |
setMaxTrashDBRatio(double ratio)
Set the trash/DB size ratio where new files will be deleted immediately.
|
disposeInternal, getNativeHandleclose, disOwnNativeHandle, isOwningHandlepublic static final long RATE_BYTES_PER_SEC_DEFAULT
public static final boolean DELETE_EXISTING_TRASH_DEFAULT
public static final double MAX_TRASH_DB_RATION_DEFAULT
public static final long BYTES_MAX_DELETE_CHUNK_DEFAULT
public SstFileManager(Env env) throws RocksDBException
env - the environment.RocksDBException - thrown if error happens in underlying native library.public SstFileManager(Env env, Logger logger) throws RocksDBException
env - the environment.logger - if not null, the logger will be used to log errors.RocksDBException - thrown if error happens in underlying native library.public SstFileManager(Env env, Logger logger, long rateBytesPerSec) throws RocksDBException
env - the environment.logger - if not null, the logger will be used to log errors.
== Deletion rate limiting specific arguments ==rateBytesPerSec - how many bytes should be deleted per second, If
this value is set to 1024 (1 Kb / sec) and we deleted a file of size
4 Kb in 1 second, we will wait for another 3 seconds before we delete
other files, Set to 0 to disable deletion rate limiting.RocksDBException - thrown if error happens in underlying native library.public SstFileManager(Env env, Logger logger, long rateBytesPerSec, double maxTrashDbRatio) throws RocksDBException
env - the environment.logger - if not null, the logger will be used to log errors.
== Deletion rate limiting specific arguments ==rateBytesPerSec - how many bytes should be deleted per second, If
this value is set to 1024 (1 Kb / sec) and we deleted a file of size
4 Kb in 1 second, we will wait for another 3 seconds before we delete
other files, Set to 0 to disable deletion rate limiting.maxTrashDbRatio - if the trash size constitutes for more than this
fraction of the total DB size we will start deleting new files passed
to DeleteScheduler immediately.RocksDBException - thrown if error happens in underlying native library.public SstFileManager(Env env, Logger logger, long rateBytesPerSec, double maxTrashDbRatio, long bytesMaxDeleteChunk) throws RocksDBException
env - the environment.logger - if not null, the logger will be used to log errors.
== Deletion rate limiting specific arguments ==rateBytesPerSec - how many bytes should be deleted per second, If
this value is set to 1024 (1 Kb / sec) and we deleted a file of size
4 Kb in 1 second, we will wait for another 3 seconds before we delete
other files, Set to 0 to disable deletion rate limiting.maxTrashDbRatio - if the trash size constitutes for more than this
fraction of the total DB size we will start deleting new files passed
to DeleteScheduler immediately.bytesMaxDeleteChunk - if a single file is larger than delete chunk,
ftruncate the file by this size each time, rather than dropping the whole
file. 0 means to always delete the whole file.RocksDBException - thrown if error happens in underlying native library.public void setMaxAllowedSpaceUsage(long maxAllowedSpace)
maxAllowedSpace, writes to
RocksDB will fail.
Setting maxAllowedSpace to 0 will disable this feature;
maximum allowed space will be infinite (Default value).maxAllowedSpace - the maximum allowed space that should be used by
RocksDB.public void setCompactionBufferSize(long compactionBufferSize)
compactionBufferSize available on the disk so
that other background functions may continue, such as logging and flushing.compactionBufferSize - the amount of buffer room each compaction
should be able to leave.public boolean isMaxAllowedSpaceReached()
public boolean isMaxAllowedSpaceReachedIncludingCompactions()
public long getTotalSize()
public Map<String,Long> getTrackedFiles()
public long getDeleteRateBytesPerSecond()
public void setDeleteRateBytesPerSecond(long deleteRate)
deleteRate - the delete rate limit (in bytes per second).public double getMaxTrashDBRatio()
public void setMaxTrashDBRatio(double ratio)
ratio - the trash/DB size ratio.protected final void disposeInternal(long handle)
disposeInternal in class RocksObjectCopyright © 2022. All rights reserved.