Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support flexible numL0Partitions #178

Open
ZexiLiu opened this issue Oct 4, 2024 · 2 comments
Open

Support flexible numL0Partitions #178

ZexiLiu opened this issue Oct 4, 2024 · 2 comments

Comments

@ZexiLiu
Copy link
Contributor

ZexiLiu commented Oct 4, 2024

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
Copy link
Contributor Author

ZexiLiu commented Oct 12, 2024

#180

PR for solution 1.

@greensky00
Copy link
Contributor

The PR is merged, but one potential issue remains. If multiple threads invoke DB::open, only one thread should adjust L0 partitions, while the others should be blocked. We may need to use compare_exchange_strong and mutex to support it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants