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

test(meta): check db's seq after create/drop/rename table #5637

Merged
merged 1 commit into from
May 28, 2022
Merged

test(meta): check db's seq after create/drop/rename table #5637

merged 1 commit into from
May 28, 2022

Conversation

RinChanNOWWW
Copy link
Contributor

Signed-off-by: RinChanNOWWW hzy427@gmail.com

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

Summary

Check db's seq after create/drop/rename table, requiring the db's seq before changing is lower than the new one after changing.

Changelog

  • Build/Testing/CI

Related Issues

Fixes #5220

@vercel
Copy link

vercel bot commented May 27, 2022

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

1 Ignored Deployment
Name Status Preview Updated
databend ⬜️ Ignored (Inspect) May 28, 2022 at 9:12AM (UTC)

@mergify
Copy link
Contributor

mergify bot commented May 27, 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-build this PR changes build/testing/ci steps label May 27, 2022
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.

Looks good to me.

Please try to minimize the lines of code.

Comment on lines 2599 to 2604
let get_db_req = GetDatabaseReq {
inner: DatabaseNameIdent {
tenant: tenant.to_string(),
db_name: db_name.to_string(),
},
};
Copy link
Member

Choose a reason for hiding this comment

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

Consider creating a function for building a GetDatabaseReq, to reduce lines of codes.

Something like fn reg_get_db(tenant: impl ToString, db_name: impl ToString) {...}

Copy link
Contributor Author

@RinChanNOWWW RinChanNOWWW May 28, 2022

Choose a reason for hiding this comment

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

How about adding a new function or macro like:

ASSERT_SEQ_INCR(mt.rename_table(..), tenant1, db1, ...);

Copy link
Member

Choose a reason for hiding this comment

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

How about adding a new function or macro like:

ASSERT_SEQ_INCR(mt.rename_table(..), tenant1, db1, ...);

It will encapsulate too many things in one function and make it unclear what it tries to assert.

let tb_ids = {
let old_db = mt.get_database(get_db_req.clone()).await?;
Copy link
Member

Choose a reason for hiding this comment

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

This line does not need to be inside this block

Signed-off-by: hezheyu <rinchannow@bupt.edu.cn>
@RinChanNOWWW
Copy link
Contributor Author

Codes upated. But I'm wondering what is the best place to put req_get_db.

@BohuTANG BohuTANG requested a review from drmingdrmer May 28, 2022 09:18
@drmingdrmer
Copy link
Member

Codes upated. But I'm wondering what is the best place to put req_get_db.

I do not know either. I find it a difficult task to organize methods and files too.

In this case, putting the util functions at bottom of this file would be OK.

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.

Looks good to me

@BohuTANG BohuTANG merged commit 5b23c3f into databendlabs:main May 28, 2022
@RinChanNOWWW RinChanNOWWW deleted the ISSUE-5220 branch May 28, 2022 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need-review pr-build this PR changes build/testing/ci steps
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Test: create/drop/rename table has to increment the seq of db_meta
4 participants