Class BackupEngineOptions
- All Implemented Interfaces:
AutoCloseable
BackupEngineOptions controls the behavior of a
BackupEngine.
Note that dispose() must be called before an Options instance become out-of-scope to release the allocated memory in c++.
- See Also:
-
Field Summary
Fields inherited from class org.rocksdb.RocksObject
nativeHandle_Fields inherited from class org.rocksdb.AbstractImmutableNativeReference
owningHandle_ -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the path to the BackupEngine directory.Backup Env object.booleanReturn information if log files shall be persisted.longReturn backup rate limit which described the max bytes that can be transferred in a second during backup.Backup rate limiter.longDuring backup user can get callback every time next#callbackTriggerIntervalSize()bytes being copied.booleanReturns if old data will be destroyed will performing new backups.protected final voiddisposeInternal(long handle) infoLog()Set the logger to use for Backup info and error messagesintUp to this many background threads will copy files forBackupEngine.createNewBackup(RocksDB, boolean)andBackupEngine.restoreDbFromBackup(int, String, String, RestoreOptions)Default: 1longReturn restore rate limit which described the max bytes that can be transferred in a second during restore.Restore rate limiter.setBackupEnv(Env env) Backup Env object.setBackupLogFiles(boolean backupLogFiles) Set if log files shall be persisted.setBackupRateLimit(long backupRateLimit) Set backup rate limit.setBackupRateLimiter(RateLimiter backupRateLimiter) Backup rate limiter.setCallbackTriggerIntervalSize(long callbackTriggerIntervalSize) During backup user can get callback every time nextcallbackTriggerIntervalSize()bytes being copied.setDestroyOldData(boolean destroyOldData) Set if old data will be destroyed.setInfoLog(Logger logger) Set the logger to use for Backup info and error messagessetMaxBackgroundOperations(int maxBackgroundOperations) Up to this many background threads will copy files forBackupEngine.createNewBackup(RocksDB, boolean)andBackupEngine.restoreDbFromBackup(int, String, String, RestoreOptions)Default: 1setRestoreRateLimit(long restoreRateLimit) Set restore rate limit.setRestoreRateLimiter(RateLimiter restoreRateLimiter) Restore rate limiter.setShareFilesWithChecksum(boolean shareFilesWithChecksum) Only used if share_table_files is set to true.setShareTableFiles(boolean shareTableFiles) Share table files between backups.setSync(boolean sync) Set synchronous backups.booleanReturn of share files with checksum is active.booleanShare table files between backups.booleansync()Are synchronous backups activated.Methods inherited from class org.rocksdb.RocksObject
disposeInternal, getNativeHandleMethods inherited from class org.rocksdb.AbstractImmutableNativeReference
close, disOwnNativeHandle, isOwningHandle
-
Constructor Details
-
BackupEngineOptions
BackupEngineOptions constructor.
- Parameters:
path- Where to keep the backup files. Has to be different from db name. Best to set this todb name_ + "/backups"- Throws:
IllegalArgumentException- if illegal path is used.
-
-
Method Details
-
backupDir
Returns the path to the BackupEngine directory.
- Returns:
- the path to the BackupEngine directory.
-
setBackupEnv
Backup Env object. It will be used for backup file I/O. If it's null, backups will be written out using DBs Env. Otherwise, backup's I/O will be performed using this object.Default: null
- Parameters:
env- The environment to use- Returns:
- instance of current BackupEngineOptions.
-
backupEnv
Backup Env object. It will be used for backup file I/O. If it's null, backups will be written out using DBs Env. Otherwise, backup's I/O will be performed using this object.Default: null
- Returns:
- The environment in use
-
setInfoLog
Set the logger to use for Backup info and error messages- Parameters:
logger- The logger to use for the backup- Returns:
- instance of current BackupEngineOptions.
-
infoLog
Set the logger to use for Backup info and error messagesDefault: null
- Returns:
- The logger in use for the backup
-
setSync
Set synchronous backups.
- Parameters:
sync- Ifsync == true, we can guarantee you'll get consistent backup even on a machine crash/reboot. Backup process is slower with sync enabled. Ifsync == false, we don't guarantee anything on machine reboot. However, chances are some backups are consistent.Default: true
- Returns:
- instance of current BackupEngineOptions.
-
sync
public boolean sync()Are synchronous backups activated.
- Returns:
- boolean value if synchronous backups are configured.
-
setDestroyOldData
Set if old data will be destroyed.
- Parameters:
destroyOldData- If true, it will delete whatever backups there are already.Default: false
- Returns:
- instance of current BackupEngineOptions.
-
destroyOldData
public boolean destroyOldData()Returns if old data will be destroyed will performing new backups.
- Returns:
- boolean value indicating if old data will be destroyed.
-
setBackupLogFiles
Set if log files shall be persisted.
- Parameters:
backupLogFiles- If false, we won't back up log files. This option can be useful for backing up in-memory databases where log file are persisted, but table files are in memory.Default: true
- Returns:
- instance of current BackupEngineOptions.
-
backupLogFiles
public boolean backupLogFiles()Return information if log files shall be persisted.
- Returns:
- boolean value indicating if log files will be persisted.
-
setBackupRateLimit
Set backup rate limit.
- Parameters:
backupRateLimit- Max bytes that can be transferred in a second during backup. If 0 or negative, then go as fast as you can.Default: 0
- Returns:
- instance of current BackupEngineOptions.
-
backupRateLimit
public long backupRateLimit()Return backup rate limit which described the max bytes that can be transferred in a second during backup.
- Returns:
- numerical value describing the backup transfer limit in bytes per second.
-
setBackupRateLimiter
Backup rate limiter. Used to control transfer speed for backup. If this is not null,backupRateLimit()is ignored.Default: null
- Parameters:
backupRateLimiter- The rate limiter to use for the backup- Returns:
- instance of current BackupEngineOptions.
-
backupRateLimiter
Backup rate limiter. Used to control transfer speed for backup. If this is not null,backupRateLimit()is ignored.Default: null
- Returns:
- The rate limiter in use for the backup
-
setRestoreRateLimit
Set restore rate limit.
- Parameters:
restoreRateLimit- Max bytes that can be transferred in a second during restore. If 0 or negative, then go as fast as you can.Default: 0
- Returns:
- instance of current BackupEngineOptions.
-
restoreRateLimit
public long restoreRateLimit()Return restore rate limit which described the max bytes that can be transferred in a second during restore.
- Returns:
- numerical value describing the restore transfer limit in bytes per second.
-
setRestoreRateLimiter
Restore rate limiter. Used to control transfer speed during restore. If this is not null,restoreRateLimit()is ignored.Default: null
- Parameters:
restoreRateLimiter- The rate limiter to use during restore- Returns:
- instance of current BackupEngineOptions.
-
restoreRateLimiter
Restore rate limiter. Used to control transfer speed during restore. If this is not null,restoreRateLimit()is ignored.Default: null
- Returns:
- The rate limiter in use during restore
-
setMaxBackgroundOperations
Up to this many background threads will copy files forBackupEngine.createNewBackup(RocksDB, boolean)andBackupEngine.restoreDbFromBackup(int, String, String, RestoreOptions)Default: 1- Parameters:
maxBackgroundOperations- The maximum number of background threads- Returns:
- instance of current BackupEngineOptions.
-
maxBackgroundOperations
public int maxBackgroundOperations()Up to this many background threads will copy files forBackupEngine.createNewBackup(RocksDB, boolean)andBackupEngine.restoreDbFromBackup(int, String, String, RestoreOptions)Default: 1- Returns:
- The maximum number of background threads
-
setCallbackTriggerIntervalSize
During backup user can get callback every time nextcallbackTriggerIntervalSize()bytes being copied.Default: 4194304
- Parameters:
callbackTriggerIntervalSize- The interval size for the callback trigger- Returns:
- instance of current BackupEngineOptions.
-
callbackTriggerIntervalSize
public long callbackTriggerIntervalSize()During backup user can get callback every time next#callbackTriggerIntervalSize()bytes being copied.Default: 4194304
- Returns:
- The interval size for the callback trigger
-
disposeInternal
protected final void disposeInternal(long handle) - Specified by:
disposeInternalin classRocksObject
-