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

chore: simplify SchemaApi::truncate_table() #16506

Merged
merged 4 commits into from
Sep 25, 2024

Conversation

drmingdrmer
Copy link
Member

@drmingdrmer drmingdrmer commented Sep 24, 2024

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

Summary

chore: simplify SchemaApi::truncate_table()
refactor: when SchemaApi::truncate_table(), no need to assert table seq

truncate_table() first lists all copied files belonging to a table,
then deletes them in small chunks. The delete operations assert that
the seq of each file does not change.

With this approach, there is no need to assert that the seq of the
containing table does not change.

refactor: SchemaApi::list_tables() should specify db-id instead of db-name
  • Change list_tables() to accept db_id instead of db_name for better precision
  • Modify return type from TableInfo to (table_name, table_id,
    SeqV<table_meta>).
    Because some info in TableInfo can not be provided by SchemaApi

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-chore this PR only has small changes that no need to record, like coding styles. label Sep 24, 2024
@drmingdrmer drmingdrmer marked this pull request as ready for review September 24, 2024 11:06
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Sep 24, 2024
@dosubot dosubot bot added the pr-refactor this PR changes the code base without new features or bugfix label Sep 24, 2024
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Sep 24, 2024
@TCeason
Copy link
Collaborator

TCeason commented Sep 24, 2024

truncate_table is lgtm

@drmingdrmer drmingdrmer force-pushed the 159-list-tables branch 2 times, most recently from 7c0f68e to f4d37ba Compare September 24, 2024 16:01
…-name

- Change list_tables() to accept db_id instead of db_name for better precision
- Modify return type from TableInfo to (table_name, table_id,
  SeqV<table_meta>).
  Because some info in TableInfo can not be provided by SchemaApi
truncate_table() first lists all copied files belonging to a table,
then deletes them in small chunks. The delete operations assert that
the seq of each file does not change.

With this approach, there is no need to assert that the seq of the
containing table does not change.
@drmingdrmer drmingdrmer merged commit b4e3025 into databendlabs:main Sep 25, 2024
71 of 72 checks passed
@drmingdrmer drmingdrmer deleted the 159-list-tables branch September 25, 2024 06:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm This PR has been approved by a maintainer pr-chore this PR only has small changes that no need to record, like coding styles. pr-refactor this PR changes the code base without new features or bugfix size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants