Jungle icon indicating copy to clipboard operation
Jungle copied to clipboard

Support flexible numL0Partitions

Open ZexiLiu opened this issue 4 months ago • 1 comments

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:

  1. 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. 
  1. 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.

ZexiLiu avatar Oct 04 '24 22:10 ZexiLiu