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: table route for metric engine #3053

Merged

Conversation

MichaelScofield
Copy link
Collaborator

@MichaelScofield MichaelScofield commented Dec 29, 2023

I hereby agree to the terms of the GreptimeDB CLA

What's changed and what's your intention?

Now metric engine table can be created. Basic insertion is supported:

mysql> create table physical_table(ts timestamp time index) engine = metric with (physical_metric_table = true);
Query OK, 0 rows affected (0.03 sec)

mysql> select * from information_schema.tables where engine = 'metric';
+---------------+--------------+----------------+------------+----------+--------+
| table_catalog | table_schema | table_name     | table_type | table_id | engine |
+---------------+--------------+----------------+------------+----------+--------+
| greptime      | public       | physical_table | BASE TABLE |     1044 | metric |
+---------------+--------------+----------------+------------+----------+--------+
1 row in set (0.48 sec)

mysql> create table l1(ts timestamp time index, i int) engine = metric with (on_physical_table = 'physical_table');
Query OK, 0 rows affected (0.05 sec)

mysql> insert into l1 values (1,1);
Query OK, 1 row affected (0.01 sec)

mysql> select * from l1;
+----------------------------+------+
| ts                         | i    |
+----------------------------+------+
| 1970-01-01 00:00:00.001000 |    1 |
+----------------------------+------+
1 row in set (0.03 sec)

mysql> create table l2(ts timestamp time index, s string) engine = metric with (on_physical_table = 'physical_table');
Query OK, 0 rows affected (0.05 sec)

mysql> insert into l2 values(1,"a");
Query OK, 1 row affected (0.00 sec)

Basic query is also supported:

mysql> select * from l2;
+----------------------------+------+
| ts                         | s    |
+----------------------------+------+
| 1970-01-01 00:00:00.001000 | NULL | <-- Not expected line, might be related to some unfinished metric engine works though. Ignore it now.
| 1970-01-01 00:00:00.001000 | a    |
+----------------------------+------+
2 rows in set (0.01 sec)

Will add more tests in the next PR.

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)

#2864

@github-actions github-actions bot added docs-required This change requires docs update. Size: M labels Dec 29, 2023
@MichaelScofield MichaelScofield added docs-not-required This change does not impact docs. and removed docs-required This change requires docs update. labels Dec 29, 2023
@github-actions github-actions bot added docs-required This change requires docs update. and removed docs-not-required This change does not impact docs. labels Dec 29, 2023
@WenyXu WenyXu mentioned this pull request Dec 29, 2023
14 tasks
Copy link

codecov bot commented Dec 29, 2023

Codecov Report

Attention: 98 lines in your changes are missing coverage. Please review.

Comparison is base (5c66ce6) 85.66% compared to head (99bd516) 85.12%.
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3053      +/-   ##
==========================================
- Coverage   85.66%   85.12%   -0.55%     
==========================================
  Files         805      804       -1     
  Lines      130889   131031     +142     
==========================================
- Hits       112132   111536     -596     
- Misses      18757    19495     +738     

@fengjiachun
Copy link
Collaborator

@waynexia PTAL

@MichaelScofield MichaelScofield force-pushed the feat/metric-table-route branch from eca7dc8 to bdd39bd Compare January 2, 2024 03:45
@fengys1996 fengys1996 self-requested a review January 3, 2024 04:00
Copy link
Collaborator

@fengjiachun fengjiachun left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@fengjiachun fengjiachun left a comment

Choose a reason for hiding this comment

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

I conducted a test: after restarting, the two logical tables l1 and l2 could not be found.

@MichaelScofield MichaelScofield force-pushed the feat/metric-table-route branch from bdd39bd to 2d55f18 Compare January 3, 2024 13:02
@MichaelScofield
Copy link
Collaborator Author

@fengjiachun PTAL

@github-actions github-actions bot added docs-not-required This change does not impact docs. and removed docs-required This change requires docs update. labels Jan 3, 2024
Copy link
Member

@waynexia waynexia left a comment

Choose a reason for hiding this comment

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

This LGTM in general 👍

src/partition/src/metrics.rs Outdated Show resolved Hide resolved
src/datanode/src/region_server.rs Show resolved Hide resolved
@fengjiachun fengjiachun enabled auto-merge January 4, 2024 04:28
@fengjiachun fengjiachun added this pull request to the merge queue Jan 4, 2024
Merged via the queue into GreptimeTeam:main with commit ec43b91 Jan 4, 2024
16 checks passed
@MichaelScofield MichaelScofield deleted the feat/metric-table-route branch January 4, 2024 07:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs-not-required This change does not impact docs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants