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

Support SHOW SESSION STATUS LIKE "Compression"; #44473

Closed
yahonda opened this issue Jun 7, 2023 · 5 comments · Fixed by #48152
Closed

Support SHOW SESSION STATUS LIKE "Compression"; #44473

yahonda opened this issue Jun 7, 2023 · 5 comments · Fixed by #48152
Labels
compatibility-mysql8 This is a compatibility issue with MySQL 8.0(but NOT 5.7) severity/minor type/compatibility type/feature-request Categorizes issue or PR as related to a new feature.

Comments

@yahonda
Copy link
Member

yahonda commented Jun 7, 2023

Feature Request

Since #36780 has been merged to master branch, tiup playground nightly supports MySQL compressed protocol.

To see if the compression is actually enabled or not, SHOW SESSION STATUS LIKE "Compression"; can be used for MySQL which is not available for TiDB yet. Refer to https://stackoverflow.com/questions/27427041/checking-connection-compression-usage

Describe the feature you'd like:
I wish TiDB support SHOW SESSION STATUS LIKE "Compression"; as MySQL does. Here are TiDB and MySQL behaviors.

--- TiDB

$ tiup playground nightly
$ mysql --comments --host 127.0.0.1 --port 4000 -u root --compress
mysql> SHOW SESSION STATUS LIKE "Compression";
Empty set (0.02 sec)

mysql>
mysql> select tidb_version()\G
*************************** 1. row ***************************
tidb_version(): Release Version: v7.2.0-alpha
Edition: Community
Git Commit Hash: be8d86504402cf6e9648fa4972d29e6ac3f9e9a8
Git Branch: heads/refs/tags/v7.2.0-alpha
UTC Build Time: 2023-06-05 14:25:17
GoVersion: go1.20.3
Race Enabled: false
Check Table Before Drop: false
Store: tikv
1 row in set (0.00 sec)

mysql>

--- MySQL

% mysql --comments --host 127.0.0.1 --port 3306 -u root --compress

WARNING: --compress is deprecated and will be removed in a future version. Use --compression-algorithms instead.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.33 Homebrew

Copyright (c) 2000, 2023, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> SHOW SESSION STATUS LIKE "compression";
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| Compression   | ON    |
+---------------+-------+
1 row in set (0.01 sec)

mysql> 

Describe alternatives you've considered:

\status is available for both TiDB and MySQL by cheking Protocol: Compressed. However, this feature is only available if the connection is made by mysql cli, not other application access like PHP with PDO::MYSQL_ATTR_COMPRESS.

% mysql --comments --host 127.0.0.1 --port 4000 -u root --compress

WARNING: --compress is deprecated and will be removed in a future version. Use --compression-algorithms instead.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 407
Server version: 8.0.11-TiDB-v7.2.0-alpha TiDB Server (Apache License 2.0) Community Edition, MySQL 8.0 compatible

Copyright (c) 2000, 2023, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> \status
--------------
mysql  Ver 8.0.33 for macos13.3 on x86_64 (Homebrew)

Connection id:		407
Current database:
Current user:		root@127.0.0.1
SSL:			Cipher in use is TLS_AES_128_GCM_SHA256
Current pager:		stdout
Using outfile:		''
Using delimiter:	;
Server version:		8.0.11-TiDB-v7.2.0-alpha TiDB Server (Apache License 2.0) Community Edition, MySQL 8.0 compatible
Protocol version:	10
Connection:		127.0.0.1 via TCP/IP
Server characterset:	utf8mb4
Db     characterset:	utf8mb4
Client characterset:	utf8mb4
Conn.  characterset:	utf8mb4
TCP port:		4000
Protocol:		Compressed
Binary data as:		Hexadecimal
Uptime:			3 min 2 sec

Threads: 0  Questions: 0  Slow queries: 0  Opens: 0  Flush tables: 0  Open tables: 0  Queries per second avg: 0.000
--------------

Teachability, Documentation, Adoption, Migration Strategy:

@yahonda yahonda added the type/feature-request Categorizes issue or PR as related to a new feature. label Jun 7, 2023
@xuyukeviki
Copy link

Can I implement this now?

@xuyukeviki
Copy link

/assign

@dveeden
Copy link
Contributor

dveeden commented Jun 9, 2023

This would be very useful. Note that MySQL has 3 session variables for this.

sql> SHOW SESSION STATUS LIKE 'Compression%';
+-----------------------+-------+
| Variable_name         | Value |
+-----------------------+-------+
| Compression           | OFF   |
| Compression_algorithm |       |
| Compression_level     | 0     |
+-----------------------+-------+
3 rows in set (0.0029 sec)

sql> SELECT VERSION();
+-----------+
| VERSION() |
+-----------+
| 8.0.33    |
+-----------+
1 row in set (0.0007 sec)

@dveeden
Copy link
Contributor

dveeden commented Jul 11, 2023

@xuyukeviki any progress? anything I can do to help?

@dveeden
Copy link
Contributor

dveeden commented Sep 4, 2023

@xuyukeviki any update on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compatibility-mysql8 This is a compatibility issue with MySQL 8.0(but NOT 5.7) severity/minor type/compatibility type/feature-request Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants