Configurable write buffer manager
This commit is contained in:
parent
4448947cfd
commit
d35840ec03
@ -247,6 +247,7 @@ versions:
|
|||||||
maxOpenFiles: -int
|
maxOpenFiles: -int
|
||||||
blockCache: -long
|
blockCache: -long
|
||||||
compressedBlockCache: -long
|
compressedBlockCache: -long
|
||||||
|
writeBufferManager: -long
|
||||||
spinning: boolean
|
spinning: boolean
|
||||||
defaultColumnOptions: DefaultColumnOptions
|
defaultColumnOptions: DefaultColumnOptions
|
||||||
columnOptions: NamedColumnOptions[]
|
columnOptions: NamedColumnOptions[]
|
||||||
|
@ -46,6 +46,7 @@ public class DefaultDatabaseOptions {
|
|||||||
Nullableint.empty(),
|
Nullableint.empty(),
|
||||||
Nullablelong.empty(),
|
Nullablelong.empty(),
|
||||||
Nullablelong.empty(),
|
Nullablelong.empty(),
|
||||||
|
Nullablelong.empty(),
|
||||||
false,
|
false,
|
||||||
DEFAULT_DEFAULT_COLUMN_OPTIONS,
|
DEFAULT_DEFAULT_COLUMN_OPTIONS,
|
||||||
List.of()
|
List.of()
|
||||||
|
@ -613,6 +613,13 @@ public class LLLocalKeyValueDatabase implements LLKeyValueDatabase {
|
|||||||
options.setUseFsync(false);
|
options.setUseFsync(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
long writeBufferManagerSize;
|
||||||
|
if (databaseOptions.writeBufferManager().isPresent()) {
|
||||||
|
writeBufferManagerSize = databaseOptions.writeBufferManager().get();
|
||||||
|
} else {
|
||||||
|
writeBufferManagerSize = 0;
|
||||||
|
}
|
||||||
|
|
||||||
Cache blockCache;
|
Cache blockCache;
|
||||||
Cache compressedCache;
|
Cache compressedCache;
|
||||||
if (databaseOptions.lowMemory()) {
|
if (databaseOptions.lowMemory()) {
|
||||||
@ -627,8 +634,12 @@ public class LLLocalKeyValueDatabase implements LLKeyValueDatabase {
|
|||||||
.setMaxTotalWalSize(0) // automatic
|
.setMaxTotalWalSize(0) // automatic
|
||||||
;
|
;
|
||||||
// DO NOT USE ClockCache! IT'S BROKEN!
|
// DO NOT USE ClockCache! IT'S BROKEN!
|
||||||
blockCache = new LRUCache(databaseOptions.blockCache().orElse( 8L * SizeUnit.MB));
|
blockCache = new LRUCache(writeBufferManagerSize + databaseOptions.blockCache().orElse( 8L * SizeUnit.MB));
|
||||||
compressedCache = new LRUCache(databaseOptions.compressedBlockCache().orElse( 8L * SizeUnit.MB));
|
if (databaseOptions.compressedBlockCache().isPresent()) {
|
||||||
|
compressedCache = new LRUCache(databaseOptions.compressedBlockCache().get());
|
||||||
|
} else {
|
||||||
|
compressedCache = null;
|
||||||
|
}
|
||||||
|
|
||||||
if (databaseOptions.spinning()) {
|
if (databaseOptions.spinning()) {
|
||||||
options
|
options
|
||||||
@ -658,8 +669,12 @@ public class LLLocalKeyValueDatabase implements LLKeyValueDatabase {
|
|||||||
.setMaxTotalWalSize(80 * SizeUnit.MB) // 80MiB max wal directory size
|
.setMaxTotalWalSize(80 * SizeUnit.MB) // 80MiB max wal directory size
|
||||||
;
|
;
|
||||||
// DO NOT USE ClockCache! IT'S BROKEN!
|
// DO NOT USE ClockCache! IT'S BROKEN!
|
||||||
blockCache = new LRUCache(databaseOptions.blockCache().orElse( 512 * SizeUnit.MB));
|
blockCache = new LRUCache(writeBufferManagerSize + databaseOptions.blockCache().orElse( 512 * SizeUnit.MB));
|
||||||
compressedCache = new LRUCache(databaseOptions.compressedBlockCache().orElse( 512 * SizeUnit.MB));
|
if (databaseOptions.compressedBlockCache().isPresent()) {
|
||||||
|
compressedCache = new LRUCache(databaseOptions.compressedBlockCache().get());
|
||||||
|
} else {
|
||||||
|
compressedCache = null;
|
||||||
|
}
|
||||||
|
|
||||||
if (databaseOptions.useDirectIO()) {
|
if (databaseOptions.useDirectIO()) {
|
||||||
options
|
options
|
||||||
@ -674,7 +689,9 @@ public class LLLocalKeyValueDatabase implements LLKeyValueDatabase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
options.setRowCache(blockCache);
|
options.setRowCache(blockCache);
|
||||||
options.setWriteBufferManager(new WriteBufferManager(256L * 1024L * 1024L, blockCache));
|
if (databaseOptions.writeBufferManager().isPresent()) {
|
||||||
|
options.setWriteBufferManager(new WriteBufferManager(writeBufferManagerSize, blockCache));
|
||||||
|
}
|
||||||
|
|
||||||
if (databaseOptions.useDirectIO()) {
|
if (databaseOptions.useDirectIO()) {
|
||||||
options
|
options
|
||||||
|
Loading…
Reference in New Issue
Block a user