You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+38-12
Original file line number
Diff line number
Diff line change
@@ -1,15 +1,25 @@
1
1
# VT Utilities
2
2
3
-
The `vt` binary encapsulates several utility tools for Vitess, providing a comprehensive suite for testing, summarizing, and query analysis.
3
+
The `vt` binary encapsulates several utility tools for Vitess, providing a comprehensive suite for testing, summarizing,
4
+
and query analysis.
4
5
5
6
## Tools Included
6
-
-**`vt test`**: A testing utility using the same test files as the [MySQL Test Framework](https://github.com/mysql/mysql-server/tree/8.0/mysql-test). It compares the results of identical queries executed on both MySQL and Vitess (vtgate), helping to ensure compatibility.
7
-
-**`vt keys`**: A utility that analyzes query logs and provides information about queries, tables, joins, and column usage.
8
-
-**`vt transactions`**: A tool that analyzes query logs to identify transaction patterns and outputs a JSON report detailing these patterns.
9
-
-**`vt trace`**: A tool that generates execution traces for queries without comparing against MySQL. It helps analyze query behavior and performance in Vitess environments.
7
+
8
+
-**`vt test`**: A testing utility using the same test files as
9
+
the [MySQL Test Framework](https://github.com/mysql/mysql-server/tree/8.0/mysql-test). It compares the results of
10
+
identical queries executed on both MySQL and Vitess (vtgate), helping to ensure compatibility.
11
+
-**`vt keys`**: A utility that analyzes query logs and provides information about queries, tables, joins, and column
12
+
usage.
13
+
-**`vt transactions`**: A tool that analyzes query logs to identify transaction patterns and outputs a JSON report
14
+
detailing these patterns.
15
+
-**`vt trace`**: A tool that generates execution traces for queries without comparing against MySQL. It helps analyze
16
+
query behavior and performance in Vitess environments.
10
17
-**`vt summarize`**: A tool used to summarize or compare trace logs or key logs for easier human consumption.
18
+
-**`vt dbinfo`**: A tool that provides information about the database schema, including row counts, useful column
19
+
attributes and relevant subset of global variables.
11
20
12
21
## Installation
22
+
13
23
You can install `vt` using the following command:
14
24
15
25
```bash
@@ -18,7 +28,8 @@ go install github.com/vitessio/vt/go/vt@latest
18
28
19
29
## Testing Methodology
20
30
21
-
To verify compatibility and correctness, the testing strategy involves running identical queries on both MySQL and vtgate, followed by a comparison of results. The process includes:
31
+
To verify compatibility and correctness, the testing strategy involves running identical queries on both MySQL and
32
+
vtgate, followed by a comparison of results. The process includes:
22
33
23
34
1.**Query Execution**: Each test query is executed on both MySQL and vtgate.
24
35
2.**Result Comparison**: The returned data, result set structure (column types, order), and errors are compared.
@@ -27,7 +38,9 @@ To verify compatibility and correctness, the testing strategy involves running i
27
38
This dual-testing strategy ensures high confidence in vtgate's compatibility with MySQL.
28
39
29
40
### Sharded Testing Strategy
30
-
Vitess operates in a sharded environment, presenting unique challenges, especially during schema changes (DDL). The `vt test` tool handles these by converting DDL statements into VSchema commands.
41
+
42
+
Vitess operates in a sharded environment, presenting unique challenges, especially during schema changes (DDL). The
43
+
`vt test` tool handles these by converting DDL statements into VSchema commands.
`vt trace` accepts most of the same configuration flags as `vt test`, including:
63
-
-`--sharded`: Enable auto-sharded mode - uses primary keys as sharding keys. Not a good idea for a production environment, but can be used to ensure that all queries work in a sharded environment.
76
+
77
+
-`--sharded`: Enable auto-sharded mode - uses primary keys as sharding keys. Not a good idea for a production
78
+
environment, but can be used to ensure that all queries work in a sharded environment.
64
79
-`--vschema`: Specify the VSchema configuration
65
80
-`--backup-path`: Initialize from a backup
66
81
-`--number-of-shards`: Specify the number of shards to bring up
This command generates a `keys-log.json` file that contains a detailed analysis of table and column usage from the queries.
125
+
This command generates a `keys-log.json` file that contains a detailed analysis of table and column usage from the
126
+
queries.
110
127
111
128
2.**Summarize the `keys-log` using `vt summarize`**:
112
129
113
130
```bash
114
131
vt summarize keys-log.json
115
132
```
116
133
117
-
This command summarizes the key analysis, providing insight into which tables and columns are used across queries, and how frequently they are involved in filters, groupings, and joins.
134
+
This command summarizes the key analysis, providing insight into which tables and columns are used across queries,
135
+
and how frequently they are involved in filters, groupings, and joins.
118
136
[Here](https://github.com/vitessio/vt/blob/main/go/summarize/testdata/keys-summary.md) is an example summary report.
119
137
138
+
If you have access to the running database, you can use `vt dbinfo > dbinfo.json` and pass it to `summarize` so
139
+
that the analysis can take into the account the additional information from the database schema and configuration:
140
+
141
+
```bash
142
+
vt summarize keys-log.json dbinfo.json
143
+
```
144
+
120
145
## Transaction Analysis with vt transactions
121
146
The `vt transactions` command is designed to analyze query logs and identify patterns of transactional queries.
122
147
It processes the logs to find sequences of queries that form transactions and outputs a JSON report summarizing these patterns.
@@ -156,4 +181,5 @@ Vitess Tester is licensed under the Apache 2.0 license. See the [LICENSE](./LICE
156
181
157
182
## Acknowledgments
158
183
159
-
Vitess Tester started as a fork from [pingcap/mysql-tester](https://github.com/pingcap/mysql-tester). We thank the original authors for their foundational work.
184
+
Vitess Tester started as a fork from [pingcap/mysql-tester](https://github.com/pingcap/mysql-tester). We thank the
0 commit comments