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

Feature: impl rename_database with kv-txn #5197

Closed
wants to merge 1 commit into from
Closed

Feature: impl rename_database with kv-txn #5197

wants to merge 1 commit into from

Conversation

lichuang
Copy link
Contributor

@lichuang lichuang commented May 6, 2022

I hereby agree to the terms of the CLA available at: https://databend.rs/dev/policies/cla/

Summary

Feature: impl rename_database with kv-txn

Changelog

  • New Feature

Related Issues

Fixes Issue #5192

@vercel
Copy link

vercel bot commented May 6, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Updated
databend ⬜️ Ignored (Inspect) May 6, 2022 at 8:14AM (UTC)

@lichuang lichuang requested a review from drmingdrmer May 6, 2022 08:14
@mergify
Copy link
Contributor

mergify bot commented May 6, 2022

Thanks for the contribution!
I have applied any labels matching special text in your PR Changelog.

Please review the labels and make any necessary changes.

@mergify mergify bot added the pr-feature this PR introduces a new feature to the codebase label May 6, 2022
@@ -143,6 +146,35 @@ impl RequestHandler<DropDatabaseReq> for ActionHandler {
}
}

#[async_trait::async_trait]
impl RequestHandler<RenameDatabaseReq> for ActionHandler {
Copy link
Member

@BohuTANG BohuTANG May 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems not a KV API. Is it the old-way meta API?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems not a KV API. Is it the old-way meta API?

After all meta API has impl by KV api, all the meta handlers in old way will be removed. But now, in order to pass compile, it has to impl with an old way API.

Copy link
Member

@drmingdrmer drmingdrmer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When renaming a db, it has to assert the dest db-name does not exist.

BTW, this is not a emergency task for now, it is in the postponed task list. Meanwhile the first to do is to replace the old MetaApi impls with the kv-txn based impl. After that, this PR will be simpler to impl too

let txn_req = TxnRequest {
condition: vec![
self.txn_cond_seq(tenant_dbname, Eq, db_id_seq)?,
self.txn_cond_seq(&db_id_key, Eq, db_meta_seq)?,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a rename does not need to be blocked by db_meta changes.

@lichuang
Copy link
Contributor Author

lichuang commented May 6, 2022

this is not a emergency task for now, it is in the postponed task list.

Ok.

@lichuang lichuang closed this May 6, 2022
@lichuang lichuang deleted the impl-rename_db-with-txn branch May 14, 2022 01:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need-review pr-feature this PR introduces a new feature to the codebase
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rename db
4 participants