radondb / xenon

The MySQL Cluster Autopilot Management with GTID and Raft
GNU General Public License v3.0
693 stars 162 forks source link

ctl: Add v1/cluster/gtid api. #157

Closed runkecheng closed 2 years ago

runkecheng commented 2 years ago

todo: unit test.

$ xenoncli cluster gtid
+------------------------------------------+----------+-------+-----------------------------------------------+----------------------------------------------------+
|                    ID                    |   Raft   | Mysql |               Executed_GTID_Set               |                 Retrieved_GTID_Set                 |
+------------------------------------------+----------+-------+-----------------------------------------------+----------------------------------------------------+
| sample-mysql-0.sample-mysql.default:8801 | FOLLOWER | ALIVE | 996d2005-93aa-11ec-9c92-9a81352e5bf1:1-209213 | 996d2005-93aa-11ec-9c92-9a81352e5bf1:209212-209213 |
+------------------------------------------+----------+-------+-----------------------------------------------+----------------------------------------------------+
| sample-mysql-2.sample-mysql.default:8801 | FOLLOWER | ALIVE | 996d2005-93aa-11ec-9c92-9a81352e5bf1:1-209213 | 996d2005-93aa-11ec-9c92-9a81352e5bf1:209212-209213 |
+------------------------------------------+----------+-------+-----------------------------------------------+----------------------------------------------------+
| sample-mysql-1.sample-mysql.default:8801 | LEADER   | ALIVE | 996d2005-93aa-11ec-9c92-9a81352e5bf1:1-209213 |                    |
+------------------------------------------+----------+-------+-----------------------------------------------+----------------------------------------------------+

$ curl -i -X GET -u root: http://sample-mysql-1.sample-mysql.default:6601/v1/cluster/gtid
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Date: Wed, 23 Feb 2022 10:38:33 GMT
Content-Length: 93

{"executed_gtid_set":"996d2005-93aa-11ec-9c92-9a81352e5bf1:1-209213","retrieved_gtid_set":""}
codecov[bot] commented 2 years ago

Codecov Report

Merging #157 (f27ad26) into master (bf1bcb8) will decrease coverage by 0%. The diff coverage is 14%.

:exclamation: Current head f27ad26 differs from pull request most recent head 938fc61. Consider uploading reports for the commit 938fc61 to get more accurate results

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #157   +/-   ##
=====================================
- Coverage      69%    68%   -1%     
=====================================
  Files          51     51           
  Lines        4591   4618   +27     
=====================================
  Hits         3178   3178           
- Misses       1162   1187   +25     
- Partials      251    253    +2     
Impacted Files Coverage Δ
src/ctl/v1/cluster.go 51% <0%> (-14%) :arrow_down:
src/mysql/api.go 66% <ø> (ø)
src/mysql/mysql.go 67% <0%> (-2%) :arrow_down:
src/mysql/mysqlbase.go 86% <0%> (-2%) :arrow_down:
src/raft/peer.go 94% <ø> (ø)
src/config/config.go 83% <100%> (+<1%) :arrow_up:
src/raft/follower.go 92% <100%> (+<1%) :arrow_up:
src/raft/candidate.go 87% <0%> (-3%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 21c30dd...938fc61. Read the comment docs.