Skip to content

Commit

Permalink
tee files
Browse files Browse the repository at this point in the history
  • Loading branch information
fanyang01 committed Dec 2, 2024
1 parent 295057b commit 617f1bb
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 26 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/mysql-htap-maxscale-setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,18 @@ jobs:
- name: Launch HTAP cluster
run: |
cd devtools/htap-setup-mysql/maxscale
docker compose up -d
sleep 30 # Wait for services to be ready
docker compose up -d --wait
- name: Verify HTAP setup
run: |
# Save server stats before SELECT
docker exec maxscale maxctrl list servers --tsv > servers_before.tsv
docker exec maxscale maxctrl list servers --tsv | tee servers_before.tsv
# Execute READ statement
mysql -h127.0.0.1 -P14000 -ulol -plol -e "SELECT * FROM test;"
mysql -h127.0.0.1 -P14000 -ulol -plol -e "SELECT * FROM db01.test;"
# Save server stats after SELECT
docker exec maxscale maxctrl list servers --tsv > servers_after.tsv
docker exec maxscale maxctrl list servers --tsv | tee servers_after.tsv
# Use DuckDB to check if the Connections count increased
duckdb -c "
Expand All @@ -47,7 +46,8 @@ jobs:
SELECT (after.Connections - before.Connections) AS diff
FROM before JOIN after USING(Server)
WHERE Server = 'myduck-server';
" > connections_diff.txt
" | tee connections_diff.txt
# Verify that Connections increased
if grep -q '^[1-9][0-9]*$' connections_diff.txt; then
Expand Down
11 changes: 5 additions & 6 deletions .github/workflows/mysql-htap-proxysql-setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,25 @@ jobs:
- name: Launch HTAP cluster
run: |
cd devtools/htap-setup-mysql/proxysql
docker compose up -d
sleep 30 # Wait for services to be ready
docker compose up -d --wait
- name: Verify HTAP setup
run: |
# Save stats before SELECT
mysql -h127.0.0.1 -P16032 -uradmin -pradmin --batch --raw -e "SELECT Command, Total_Time_us, Total_cnt FROM stats.stats_mysql_commands_counters WHERE Command='SELECT';" > stats_before.csv
mysql -h127.0.0.1 -P16032 -uradmin -pradmin --batch --raw -e "SELECT Command, Total_Time_us, Total_cnt FROM stats.stats_mysql_commands_counters WHERE Command='SELECT';" | tee stats_before.csv
# Execute READ statement
mysql -h127.0.0.1 -P16033 -ulol -plol -e "SELECT * FROM test;"
mysql -h127.0.0.1 -P16033 -ulol -plol -e "SELECT * FROM db01.test;"
# Save stats after SELECT
mysql -h127.0.0.1 -P16032 -uradmin -pradmin --batch --raw -e "SELECT Command, Total_Time_us, Total_cnt FROM stats.stats_mysql_commands_counters WHERE Command='SELECT';" > stats_after.csv
mysql -h127.0.0.1 -P16032 -uradmin -pradmin --batch --raw -e "SELECT Command, Total_Time_us, Total_cnt FROM stats.stats_mysql_commands_counters WHERE Command='SELECT';" | tee stats_after.csv
# Use DuckDB to check if SELECT count increased
duckdb -c "
CREATE TABLE before AS SELECT * FROM read_csv_auto('stats_before.csv');
CREATE TABLE after AS SELECT * FROM read_csv_auto('stats_after.csv');
SELECT (after.Total_cnt - before.Total_cnt) AS diff FROM before JOIN after USING(Command);
" > select_cnt_diff.txt
" | tee select_cnt_diff.txt
# Verify that SELECT count increased by 1
if grep -q '^1$' select_cnt_diff.txt; then
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/pg-htap-pgpool-setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,18 @@ jobs:
- name: Launch HTAP cluster
run: |
cd devtools/htap-setup-pg/pgpool2
docker compose up -d
sleep 30 # Wait for services to be ready
docker compose up -d --wait
- name: Verify HTAP setup
run: |
# Save SHOW POOL_NODES output before SELECT
docker exec htap-pgpool bash -c "PGPASSWORD=postgres psql -h localhost -U postgres -d postgres -c 'SHOW POOL_NODES;' -F ',' --no-align --field-separator ',' --pset footer=off" > pool_nodes_before.csv
docker exec htap-pgpool bash -c "PGPASSWORD=postgres psql -h localhost -U postgres -d postgres -c 'SHOW POOL_NODES;' -F ',' --no-align --field-separator ',' --pset footer=off" | tee pool_nodes_before.csv
# Execute READ statement
docker exec htap-pgpool bash -c "PGPASSWORD=postgres psql -h localhost -U postgres -d postgres -c 'SELECT * FROM test;'"
# Save SHOW POOL_NODES output after SELECT
docker exec htap-pgpool bash -c "PGPASSWORD=postgres psql -h localhost -U postgres -d postgres -c 'SHOW POOL_NODES;' -F ',' --no-align --field-separator ',' --pset footer=off" > pool_nodes_after.csv
docker exec htap-pgpool bash -c "PGPASSWORD=postgres psql -h localhost -U postgres -d postgres -c 'SHOW POOL_NODES;' -F ',' --no-align --field-separator ',' --pset footer=off" | tee pool_nodes_after.csv
# Use DuckDB to check if select_cnt increased
duckdb -c "
Expand All @@ -47,7 +46,7 @@ jobs:
SELECT (CAST(after.select_cnt AS INTEGER) - CAST(before.select_cnt AS INTEGER)) AS diff
FROM before JOIN after USING(node_id)
WHERE node_id = '1';
" > select_cnt_diff.txt
" | tee select_cnt_diff.txt
# Verify that select_cnt increased by 1
if grep -q '^1$' select_cnt_diff.txt; then
Expand Down
6 changes: 3 additions & 3 deletions devtools/htap-setup-mysql/maxscale/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ services:
container_name: htap-mysql-setup
command: >
sh -c "
mysql -h mysql -u root -e \"create database test;\"
mysql -h mysql -u root -e \"create table test.test (id bigint primary key, s varchar(100), i int);\"
mysql -h mysql -u root -e \"insert into test.test values (1, 'a', 11), (2, 'b', 22);\"
mysql -h mysql -u root -e \"create database db01;\"
mysql -h mysql -u root -e \"create table db01.test (id bigint primary key, s varchar(100), i int);\"
mysql -h mysql -u root -e \"insert into db01.test values (1, 'a', 11), (2, 'b', 22);\"
"
restart: "on-failure"
depends_on:
Expand Down
6 changes: 3 additions & 3 deletions devtools/htap-setup-mysql/proxysql/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ services:
container_name: htap-mysql-setup
command: >
sh -c "
mysql -h mysql -u root -e \"create database test;\"
mysql -h mysql -u root -e \"create table test.test (id bigint primary key, s varchar(100), i int);\"
mysql -h mysql -u root -e \"insert into test.test values (1, 'a', 11), (2, 'b', 22);\"
mysql -h mysql -u root -e \"create database db01;\"
mysql -h mysql -u root -e \"create table db01.test (id bigint primary key, s varchar(100), i int);\"
mysql -h mysql -u root -e \"insert into db01.test values (1, 'a', 11), (2, 'b', 22);\"
"
restart: "on-failure"
depends_on:
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorial/mysql-htap-maxscale-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Go the root path of this project and run the following commands:

```sh
cd devtools/htap-setup-mysql/maxscale
docker compose up -d
docker compose up -d --wait
```

Then you'll get a HTAP cluster. And an account 'lol' with password 'lol' has been created for connecting. Have fun!
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorial/mysql-htap-proxysql-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Go the root path of this project and run the following commands:

```sh
cd devtools/htap-setup-mysql/proxysql
docker compose up -d
docker compose up -d --wait
```

Then you'll get a HTAP cluster. And an account 'lol' with password 'lol' has been created for connecting. Have fun!
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorial/pg-htap-pgpool-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Go the root path of this project and run the following commands:

```sh
cd devtools/htap-setup-pg/pgpool2
docker compose up -d
docker compose up -d --wait
```

Then you'll get a HTAP cluster. Have fun!
Expand Down

0 comments on commit 617f1bb

Please sign in to comment.