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: support DDL show cluster to display cluster info #453

Merged
merged 1 commit into from
Jan 5, 2024

Conversation

xmh1011
Copy link
Contributor

@xmh1011 xmh1011 commented Jan 3, 2024

What problem does this PR solve?

Issue Number: resolve #452

What is changed and how it works?

Please describe how it works

➜  openGemini git:(cluster-status) ts-cli
2024/01/04 17:18:53 proto: duplicate proto type registered: influxql.Measurements
2024/01/04 17:18:53 proto: duplicate proto type registered: influxql.Measurement
openGemini CLI 0.1.0 (rev-revision)
Please use `quit`, `exit` or `Ctrl-D` to exit this program.
> show cluster
+---------------------+--------+----------------+--------+----------+
| time                | status | hostname       | nodeID | nodeType |
+---------------------+--------+----------------+--------+----------+
| 1704359936579799000 | 0      | 127.0.0.3:8091 | 1      | meta     |
| 1704359936579799000 | 0      | 127.0.0.1:8091 | 2      | meta     |
| 1704359936579799000 | 0      | 127.0.0.2:8091 | 3      | meta     |
| 1704359936579799000 | 1      | 127.0.0.1:8400 | 4      | data     |
| 1704359936579799000 | 1      | 127.0.0.2:8400 | 5      | data     |
| 1704359936579799000 | 1      | 127.0.0.3:8400 | 6      | data     |
+---------------------+--------+----------------+--------+----------+
5 columns, 6 rows in set

> show cluster where nodeID = 1
+---------------------+--------+----------------+--------+----------+
| time                | status | hostname       | nodeID | nodeType |
+---------------------+--------+----------------+--------+----------+
| 1704359951958993000 | 0      | 127.0.0.3:8091 | 1      | meta     |
+---------------------+--------+----------------+--------+----------+
5 columns, 1 rows in set

> show cluster where nodeID = 1 and nodeType = meta
+---------------------+--------+----------------+--------+----------+
| time                | status | hostname       | nodeID | nodeType |
+---------------------+--------+----------------+--------+----------+
| 1704359960034243000 | 0      | 127.0.0.3:8091 | 1      | meta     |
+---------------------+--------+----------------+--------+----------+
5 columns, 1 rows in set

> show cluster where nodeType = meta
+---------------------+--------+----------------+--------+----------+
| time                | status | hostname       | nodeID | nodeType |
+---------------------+--------+----------------+--------+----------+
| 1704359965726427000 | 0      | 127.0.0.3:8091 | 1      | meta     |
| 1704359965726427000 | 0      | 127.0.0.1:8091 | 2      | meta     |
| 1704359965726427000 | 0      | 127.0.0.2:8091 | 3      | meta     |
+---------------------+--------+----------------+--------+----------+
5 columns, 3 rows in set

> show cluster where nodeType = mda
ERR: invalid node type%!(EXTRA string=mda)
> show cluster where nodeID = de
ERR: error parsing query: Invalid where clause

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Test A
  • Test B
  • Test cases to be added
  • No code

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@xmh1011 xmh1011 force-pushed the cluster-status branch 6 times, most recently from 3e255f2 to 2db6a6c Compare January 4, 2024 05:13
open_src/influx/meta/data.go Outdated Show resolved Hide resolved
open_src/influx/meta/data.go Outdated Show resolved Hide resolved
open_src/influx/meta/data.go Outdated Show resolved Hide resolved
open_src/influx/meta/data.go Outdated Show resolved Hide resolved
Copy link

codecov bot commented Jan 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (da625c8) 74.45% compared to head (1626a5c) 74.46%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #453      +/-   ##
==========================================
+ Coverage   74.45%   74.46%   +0.01%     
==========================================
  Files         502      503       +1     
  Lines      106427   106523      +96     
==========================================
+ Hits        79236    79324      +88     
- Misses      22318    22326       +8     
  Partials     4873     4873              

@xmh1011 xmh1011 changed the title feat: support DDL like show cluster status feat: support DDL show cluster status Jan 4, 2024
open_src/influx/influxql/ast.go Outdated Show resolved Hide resolved
open_src/influx/influxql/sql.y Outdated Show resolved Hide resolved
open_src/influx/influxql/sql.y Outdated Show resolved Hide resolved
@xmh1011 xmh1011 force-pushed the cluster-status branch 6 times, most recently from 0843175 to b837c76 Compare January 4, 2024 11:15
@xmh1011 xmh1011 requested a review from shilinlee January 4, 2024 11:19
@shilinlee shilinlee changed the title feat: support DDL show cluster status feat: support DDL show cluster to display cluster info Jan 4, 2024
lib/errno/message.go Outdated Show resolved Hide resolved
lib/errno/message.go Outdated Show resolved Hide resolved
Signed-off-by: xmh1011 <1197843839@qq.com>
Copy link
Contributor

@fx408 fx408 left a comment

Choose a reason for hiding this comment

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

ok

@scuzyj scuzyj merged commit f23027d into openGemini:main Jan 5, 2024
8 checks passed
@xmh1011 xmh1011 deleted the cluster-status branch January 5, 2024 01:36
@scuzyj
Copy link
Member

scuzyj commented Jan 5, 2024

image
it is better to convert status to a string,because the meanings of numbers cannot be understood.

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.

support DDL like show cluster to display cluster info
4 participants