Jungle
Jungle copied to clipboard
Support flexible numL0Partitions
Currently numL0Partitions is fixed and once created a DB with a certain number, we cannot change the number because TableMgr
will get the number of L0 partition from table_manifest.
To support flexible numL0Partitions, I think of two solutions:
- Upon each
TableMgr::init()
:Manifest.numL0Partitions means numL0Paritions get from table manifest
if (Manifest.numL0Partitions== DBConfig.numL0Partition) {
skip below logic
}
// Manifest.numL0Partitions != DBConfig.numL0Partition
if (Manifest.numL0Partitions > DBConfig.numL0Partition) {
compact the first (Manifest.numL0Partitions - DBConfig.numL0Partition) L0 tables to L1
} else {
// Manifest.numL0Partitions < DBConfig.numL0Partition
create (DBConfig.numL0Partition - Manifest.numL0Partitions) empty L0 tables
}
run DB as before like the numL0Partition is fixed and defined by DBConfig.
- Let compactor handle the adjustment to the difference.
I think solution 1 is much easier to implement than 2. And there is no need to support DBConfig.numL0Partition
as hot swapable config.
Please kindly let me know your opinion on this. Thanks.