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

refactor: SchemaApi::get_table_meta_history() #16586

Merged
merged 1 commit into from
Oct 10, 2024

Conversation

drmingdrmer
Copy link
Member

@drmingdrmer drmingdrmer commented Oct 10, 2024

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

Summary

refactor: SchemaApi::get_table_meta_history()

It does not need to accept a database-name argument just for building
an error.

It does not need to return application level error: if a table is not
found, just return an empty list.

Tests

  • Unit Test
  • Logic Test
  • Benchmark Test
  • No Test - Explain why

Type of change

  • Refactoring

Related Issues


This change is Reviewable

@github-actions github-actions bot added the pr-refactor this PR changes the code base without new features or bugfix label Oct 10, 2024
@drmingdrmer drmingdrmer marked this pull request as ready for review October 10, 2024 08:10
let metas = get_table_meta_history(self, &now, table_id_list).await?;
history_ident: &TableIdHistoryIdent,
) -> Result<Vec<(TableId, SeqV<TableMeta>)>, MetaError> {
let Some(seq_table_id_list) = self.get_pb(history_ident).await? else {
Copy link
Collaborator

@TCeason TCeason Oct 10, 2024

Choose a reason for hiding this comment

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

So this means : if a table under a db which contains 100 tables is invalid, list table from this db will return empty result?

cc @flaneur2020

I think it's better to print a warn or error log to point the err.

Copy link
Member Author

Choose a reason for hiding this comment

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

I do think so. 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

my mistake。the method name should be get-retainable-x x x

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed. Please review it again

It does not need to accept a `database-name` argument just for building
an error.

It does not need to return application level error: if a table is not
found, just return an empty list.

Rename SchemaApi::get_tables_history to list_retainable_tables;
Rename SchemaApi::get_table_meta_history to get_retainable_tables;

refactor: rename list_tables_history->list_gc_ready_tables;get_table_meta_history->get_gc_ready_tables;
@drmingdrmer drmingdrmer merged commit 9e5ffba into databendlabs:main Oct 10, 2024
71 checks passed
@drmingdrmer drmingdrmer deleted the 159-get-table branch October 31, 2024 00:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-refactor this PR changes the code base without new features or bugfix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants