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

feat: truncate table in standalone mode #2090

Merged
merged 7 commits into from
Aug 8, 2023

Conversation

DevilExileSu
Copy link
Contributor

@DevilExileSu DevilExileSu commented Aug 3, 2023

I hereby agree to the terms of the GreptimeDB CLA

What's changed and what's your intention?

  1. Implement truncate table procedure in standalone mode.
  2. Implement reset version.
  3. Implement truncate region.
    1. Acquires the RegionWriter lock.
    2. Create RegionMetaAction::Truncate to store committed_sequence and persist it for recovery from the manifest.
    3. Mark all data in the WAL as obsolete.
    4. Mark all SSTs as deleted.
    5. Reset Version.
  4. Recover from RegionMetaAction::Truncate.
    1. Mark all SSTs as deleted.
    2. Reset the Version and set the committed_sequence from RegionMetaAction::Truncate as the Version's flushed_sequence.

Checklist

  • I have written the necessary rustdoc comments.
  • I have added the necessary unit tests and integration tests.

Refer to a related PR or issue link (optional)

@DevilExileSu DevilExileSu marked this pull request as ready for review August 3, 2023 10:10
@codecov
Copy link

codecov bot commented Aug 3, 2023

Codecov Report

Merging #2090 (a35715f) into develop (f1f8a1d) will decrease coverage by 0.30%.
Report is 1 commits behind head on develop.
The diff coverage is 85.04%.

@@             Coverage Diff             @@
##           develop    #2090      +/-   ##
===========================================
- Coverage    84.87%   84.57%   -0.30%     
===========================================
  Files          687      689       +2     
  Lines       108586   108988     +402     
===========================================
+ Hits         92163    92182      +19     
- Misses       16423    16806     +383     

@DevilExileSu DevilExileSu marked this pull request as draft August 3, 2023 10:37
@DevilExileSu DevilExileSu marked this pull request as ready for review August 3, 2023 14:39
@DevilExileSu DevilExileSu marked this pull request as draft August 4, 2023 02:46
@DevilExileSu DevilExileSu marked this pull request as ready for review August 4, 2023 13:38
src/datanode/src/sql/truncate_table.rs Outdated Show resolved Hide resolved
src/table-procedure/src/truncate.rs Outdated Show resolved Hide resolved
@evenyag evenyag requested a review from WenyXu August 8, 2023 06:43
Copy link
Contributor

@evenyag evenyag left a comment

Choose a reason for hiding this comment

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

Rest LGTM

@evenyag
Copy link
Contributor

evenyag commented Aug 8, 2023

@DevilExileSu Could you please format the code?

@evenyag evenyag added this pull request to the merge queue Aug 8, 2023
Merged via the queue into GreptimeTeam:develop with commit 57836e7 Aug 8, 2023
11 checks passed
@DevilExileSu DevilExileSu deleted the feat/standalone-truncate branch August 8, 2023 11:49
paomian pushed a commit to paomian/greptimedb that referenced this pull request Oct 19, 2023
* feat: impl table procedure in standalone mode

* chore: remove useless changes

* test: add some tests

* Update src/table-procedure/src/truncate.rs

Co-authored-by: Yingwen <[email protected]>

* CR

* Update src/datanode/src/sql/truncate_table.rs

Co-authored-by: Yingwen <[email protected]>

* chore: fmt

---------

Co-authored-by: Yingwen <[email protected]>
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

Successfully merging this pull request may close these issues.

3 participants