Skip to content

Commit 384d854

Browse files
committed
Merge branch 'view/implement_select_view' of https://github.com/AndrewDi/tidb into view/implement_select_view
2 parents 941cec9 + 0c62b6f commit 384d854

39 files changed

+2052
-1606
lines changed

ddl/db_integration_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ func (s *testIntegrationSuite) SetUpSuite(c *C) {
8282
session.SetSchemaLease(s.lease)
8383
session.SetStatsLease(0)
8484
s.dom, err = session.BootstrapSession(s.store)
85+
c.Assert(err, IsNil)
8586

8687
se, err := session.CreateSession4Test(s.store)
8788
c.Assert(err, IsNil)

ddl/ddl_worker_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,7 @@ func (s *testDDLSuite) TestCancelJob(c *C) {
504504
Options: []*ast.ColumnOption{},
505505
}
506506
col, _, err := buildColumnAndConstraint(ctx, 2, newColumnDef, nil)
507+
c.Assert(err, IsNil)
507508
addColumnArgs := []interface{}{col, &ast.ColumnPosition{Tp: ast.ColumnPositionNone}, 0}
508509
doDDLJobErrWithSchemaState(ctx, d, c, dbInfo.ID, tblInfo.ID, model.ActionAddColumn, addColumnArgs, &cancelState)
509510
c.Check(errors.ErrorStack(checkErr), Equals, "")

docs/tidb_http_api.md

+193
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@
77
```shell
88
curl http://{TiDBIP}:10080/status
99
```
10+
```shell
11+
$curl http://127.0.0.1:10080/status
12+
{
13+
"connections": 0,
14+
"git_hash": "f572e33854e1c0f942f031e9656d0004f99995c6",
15+
"version": "5.7.10-TiDB-v2.1.0-rc.3-355-gf572e3385-dirty"
16+
}
17+
```
1018

1119
1. Get all metrics of TiDB
1220

@@ -19,30 +27,131 @@
1927
```shell
2028
curl http://{TiDBIP}:10080/regions/meta
2129
```
30+
```shell
31+
$curl http://127.0.0.1:10080/regions/meta
32+
[
33+
{
34+
"leader": {
35+
"id": 5,
36+
"store_id": 1
37+
},
38+
"peers": [
39+
{
40+
"id": 5,
41+
"store_id": 1
42+
}
43+
],
44+
"region_epoch": {
45+
"conf_ver": 1,
46+
"version": 2
47+
},
48+
"region_id": 4
49+
}
50+
]
51+
```
2252

2353
1. Get the table/index of hot regions
2454

2555
```shell
2656
curl http://{TiDBIP}:10080/regions/hot
2757
```
58+
```shell
59+
$curl http://127.0.0.1:10080/regions/hot
60+
{
61+
"read": [
62+
63+
],
64+
"write": [
65+
{
66+
"db_name": "sbtest1",
67+
"table_name": "sbtest13",
68+
"index_name": "",
69+
"flow_bytes": 220718,
70+
"max_hot_degree": 12,
71+
"region_count": 1
72+
}
73+
]
74+
}
75+
```
2876

2977
1. Get the information of a specific region by ID
3078

3179
```shell
3280
curl http://{TiDBIP}:10080/regions/{regionID}
3381
```
82+
```shell
83+
$curl http://127.0.0.1:10080/regions/4001
84+
{
85+
"end_key": "dIAAAAAAAAEk",
86+
"frames": [
87+
{
88+
"db_name": "test",
89+
"is_record": true,
90+
"table_id": 286,
91+
"table_name": "t1"
92+
}
93+
],
94+
"region_id": 4001,
95+
"start_key": "dIAAAAAAAAEe"
96+
}
97+
```
3498

3599
1. Get regions Information from db.table
36100

37101
```shell
38102
curl http://{TiDBIP}:10080/tables/{db}/{table}/regions
39103
```
104+
```shell
105+
$curl http://127.0.0.1:10080/tables/test/t1/regions
106+
{
107+
"id": 286,
108+
"indices": [],
109+
"name": "t1",
110+
"record_regions": [
111+
{
112+
"leader": {
113+
"id": 4002,
114+
"store_id": 1
115+
},
116+
"peers": [
117+
{
118+
"id": 4002,
119+
"store_id": 1
120+
}
121+
],
122+
"region_epoch": {
123+
"conf_ver": 1,
124+
"version": 83
125+
},
126+
"region_id": 4001
127+
}
128+
]
129+
}
130+
```
40131

41132
1. Get schema Information about all db
42133

43134
```shell
44135
curl http://{TiDBIP}:10080/schema
45136
```
137+
```shell
138+
$curl http://127.0.0.1:10080/schema
139+
[
140+
{
141+
"charset": "utf8mb4",
142+
"collate": "utf8mb4_bin",
143+
"db_name": {
144+
"L": "test",
145+
"O": "test"
146+
},
147+
"id": 266,
148+
"state": 5
149+
},
150+
.
151+
.
152+
.
153+
]
154+
```
46155

47156
1. Get schema Information about db
48157

@@ -75,12 +184,41 @@
75184
```shell
76185
curl http://{TiDBIP}:10080/mvcc/key/{db}/{table}/{handle}
77186
```
187+
```shell
188+
$curl http://127.0.0.1:10080/mvcc/key/test/t1/1
189+
{
190+
"info": {
191+
"writes": [
192+
{
193+
"commit_ts": 405179368526053380,
194+
"short_value": "CAICAkE=",
195+
"start_ts": 405179368526053377
196+
}
197+
]
198+
}
199+
}
200+
```
78201

79202
1. Get MVCC Information of the first key in the table with a specified start ts
80203

81204
```shell
82205
curl http://{TiDBIP}:10080/mvcc/txn/{startTS}/{db}/{table}
83206
```
207+
```shell
208+
$curl http://127.0.0.1:10080/mvcc/txn/405179368526053377/test/t1
209+
{
210+
"info": {
211+
"writes": [
212+
{
213+
"commit_ts": 405179368526053380,
214+
"short_value": "CAICAkE=",
215+
"start_ts": 405179368526053377
216+
}
217+
]
218+
},
219+
"key": "dIAAAAAAAAEzX3KAAAAAAAAAAQ=="
220+
}
221+
```
84222

85223
1. Get MVCC Information by a hex value
86224

@@ -95,6 +233,20 @@
95233
```
96234
*Hint: For the index column which column type is timezone dependent, e.g. `timestamp`, convert its value to UTC
97235
timezone.*
236+
```shell
237+
$curl http://127.0.0.1:10080/mvcc/index/test/t1/idx/1\?a\=A
238+
{
239+
"info": {
240+
"writes": [
241+
{
242+
"commit_ts": 405179523374252037,
243+
"short_value": "MA==",
244+
"start_ts": 405179523374252036
245+
}
246+
]
247+
}
248+
}
249+
```
98250

99251
1. Scatter regions of the specified table, add a `scatter-range` scheduler for the PD and the range is same as the table range.
100252

@@ -121,12 +273,53 @@ timezone.*
121273
```shell
122274
curl http://{TiDBIP}:10080/info
123275
```
276+
```shell
277+
$curl http://127.0.0.1:10080/info
278+
{
279+
"ddl_id": "f7e73ed5-63b4-4cb4-ba7c-42b32dc74e77",
280+
"git_hash": "f572e33854e1c0f942f031e9656d0004f99995c6",
281+
"ip": "",
282+
"is_owner": true,
283+
"lease": "45s",
284+
"listening_port": 4000,
285+
"status_port": 10080,
286+
"version": "5.7.10-TiDB-v2.1.0-rc.3-355-gf572e3385-dirty"
287+
}
288+
```
124289

125290
1. Get TiDB cluster all servers information.
126291

127292
```shell
128293
curl http://{TiDBIP}:10080/info/all
129294
```
295+
```shell
296+
$curl http://127.0.0.1:10080/info/all
297+
{
298+
"all_servers_info": {
299+
"275a19ae-d248-4dc0-b78c-6613a7509423": {
300+
"ddl_id": "275a19ae-d248-4dc0-b78c-6613a7509423",
301+
"git_hash": "f572e33854e1c0f942f031e9656d0004f99995c6",
302+
"ip": "192.168.197.206",
303+
"lease": "45s",
304+
"listening_port": 4001,
305+
"status_port": 10081,
306+
"version": "5.7.10-TiDB-v2.1.0-rc.3-355-gf572e3385-dirty"
307+
},
308+
"f7e73ed5-63b4-4cb4-ba7c-42b32dc74e77": {
309+
"ddl_id": "f7e73ed5-63b4-4cb4-ba7c-42b32dc74e77",
310+
"git_hash": "f572e33854e1c0f942f031e9656d0004f99995c6",
311+
"ip": "192.168.197.206",
312+
"lease": "45s",
313+
"listening_port": 4000,
314+
"status_port": 10080,
315+
"version": "5.7.10-TiDB-v2.1.0-rc.3-355-gf572e3385-dirty"
316+
}
317+
},
318+
"is_all_server_version_consistent": true,
319+
"owner_id": "f7e73ed5-63b4-4cb4-ba7c-42b32dc74e77",
320+
"servers_num": 2
321+
}
322+
```
130323

131324
1. Enable/Disable TiDB server general log
132325

0 commit comments

Comments
 (0)