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: flush or compact table and region functions #3363

Merged
merged 11 commits into from Feb 27, 2024

Conversation

killme2008
Copy link
Contributor

@killme2008 killme2008 commented Feb 22, 2024

I hereby agree to the terms of the GreptimeDB CLA

What's changed and what's your intention?

This PR implements SQL functions:

  • flush_table(table_name) to flush a table memtables into SST.
  • compact_table(table_name) to schedule a compaction task for a table.
  • flush_region(region_id) to flush a region by the region id.
  • compact_region(region_id) to schedule a compaction task for the region.

For example:

mysql> select flush_table("test");
+---------------------------+
| flush_table(Utf8("test")) |
+---------------------------+
|                         0 |
+---------------------------+
1 row in set (0.04 sec)

mysql> select compact_table("test");
+-----------------------------+
| compact_table(Utf8("test")) |
+-----------------------------+
|                           0 |
+-----------------------------+
1 row in set (0.01 sec)

Add:

Reduce some tech debts:

  • Duplicated AffectedRows definitions.
  • Move table_idents_to_full_name to the session crate etc.

Checklist

  • I have written the necessary rustdoc comments.
  • I have added the necessary unit tests and integration tests.
  • This PR does not require documentation updates.

Refer to a related PR or issue link (optional)

#3161 #2921 #3365
close #2899

@github-actions github-actions bot added docs-not-required This change does not impact docs. docs-required This change requires docs update. and removed docs-not-required This change does not impact docs. labels Feb 22, 2024
@killme2008 killme2008 marked this pull request as ready for review February 24, 2024 09:50
@killme2008 killme2008 changed the title feat: flush or compact table functions feat: flush or compact table and region functions Feb 24, 2024
@killme2008 killme2008 added the C-user-experience Category User Experience label Feb 24, 2024
@killme2008 killme2008 added the C-enhancement Category Enhancements label Feb 24, 2024
Copy link

codecov bot commented Feb 24, 2024

Codecov Report

Attention: Patch coverage is 68.67008% with 245 lines in your changes are missing coverage. Please review.

Project coverage is 84.42%. Comparing base (3544c93) to head (ea2bbec).
Report is 1 commits behind head on main.

❗ Current head ea2bbec differs from pull request most recent head 4409efb. Consider uploading reports for the commit 4409efb to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3363      +/-   ##
==========================================
- Coverage   84.90%   84.42%   -0.49%     
==========================================
  Files         893      899       +6     
  Lines      147320   147833     +513     
==========================================
- Hits       125084   124803     -281     
- Misses      22236    23030     +794     

@killme2008
Copy link
Contributor Author

@waynexia @zhongzc @fengjiachun Please take a look.

@fengjiachun
Copy link
Collaborator

fengjiachun commented Feb 26, 2024

SIze: XXL 🐶

@zhongzc
Copy link
Contributor

zhongzc commented Feb 26, 2024

rest LGTM

@killme2008
Copy link
Contributor Author

SIze: XXL 🐶

Don't be afraid. Lots of boilerplate code and tests.

src/common/macro/src/admin_fn.rs Outdated Show resolved Hide resolved
src/common/macro/src/admin_fn.rs Show resolved Hide resolved
Copy link
Contributor

@zhongzc zhongzc left a comment

Choose a reason for hiding this comment

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

LGTM

@waynexia waynexia added this pull request to the merge queue Feb 27, 2024
Merged via the queue into GreptimeTeam:main with commit 4b36c28 Feb 27, 2024
15 checks passed
@killme2008 killme2008 deleted the feature/flush-table-region branch March 4, 2024 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category Enhancements C-user-experience Category User Experience docs-required This change requires docs update.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

flush_table function to flush a table's memtable
4 participants