forked from facebook/mysql-5.6
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: Implement a CRC32 checksum over the resultset field headers and row contents. Enablement is controlled by a global variable + the query checksum feature being enabled. The query_checksum attribute was renamed to checksum for symmetry. The idea being the an attribute with key 'checksum' contains a value reflecting a checksum of the entity (query or resultset) to which that attribute is attached. Reviewed By: jkedgar Differential Revision: D20186509
- Loading branch information
1 parent
ce5aa84
commit ef7b250
Showing
19 changed files
with
522 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
SET @@global.enable_resultset_checksum = ON; | ||
SET @@session.session_track_response_attributes = ON; | ||
Creating a table for later tests | ||
CREATE TABLE data (a VARCHAR(1024), b TEXT, c INT); | ||
No Checksum: ; | ||
Check charset, which impacts encoding and thus checksums | ||
SET NAMES 'latin1'; | ||
No Checksum: ; | ||
SELECT @@session.character_set_client; | ||
@@session.character_set_client | ||
latin1 | ||
Verify SELECTS of variables | ||
SELECT @@session.character_set_connection; | ||
@@session.character_set_connection | ||
latin1 | ||
Checksum: 1525358488; | ||
Add some dummy data | ||
INSERT INTO data (a, b, c) VALUES ('testing', 'result checksums', 0); | ||
No Checksum: ; | ||
INSERT INTO data (a, b, c) VALUES ('testing', 'result checksums', 1); | ||
INSERT INTO data (a, b, c) VALUES ('testing', 'result checksums', 2); | ||
INSERT INTO data (a, b, c) VALUES ('testing', 'result checksums', 3); | ||
INSERT INTO data (a, b, c) VALUES ('testing', 'result checksums', 4); | ||
INSERT INTO data (a, b, c) VALUES ('testing', 'result checksums', 5); | ||
INSERT INTO data (a, b, c) VALUES ('testing', 'result checksums', 6); | ||
Verify multiple fields in a single row | ||
SELECT * FROM data WHERE c = 1; | ||
a b c | ||
testing result checksums 1 | ||
Checksum: 1134867259; | ||
Verify multiple fields in multiple rows | ||
SELECT * FROM data ORDER BY c; | ||
a b c | ||
testing result checksums 0 | ||
testing result checksums 1 | ||
testing result checksums 2 | ||
testing result checksums 3 | ||
testing result checksums 4 | ||
testing result checksums 5 | ||
testing result checksums 6 | ||
Checksum: 4204762635; | ||
Verify single massive result row | ||
Checksum: 2267222966; | ||
Verify multiple massive rows | ||
Checksum: 2166497371; | ||
Test around 16MB packet boundaries | ||
Checksum: 2512256286; | ||
Checksum: 982468368; | ||
Checksum: 1437851346; | ||
Checksum: 2699967101; | ||
Checksum: 261522601; | ||
Checksum: 1879284586; | ||
Checksum: 2282180928; | ||
Several random row sizes | ||
SELECT REPEAT('a', 255); | ||
REPEAT('a', 255) | ||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | ||
Checksum: 2275529303; | ||
SELECT REPEAT('a', 256); | ||
REPEAT('a', 256) | ||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | ||
Checksum: 1932162976; | ||
SELECT REPEAT('a', 257); | ||
REPEAT('a', 257) | ||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | ||
Checksum: 2889758595; | ||
verify SHOW SLAVE HOSTS output | ||
SHOW REPLICAS; | ||
Server_Id Host Port Source_Id Replica_UUID Is_semi_sync_slave Replication_status | ||
Checksum: 3702298611; | ||
Verify SHOW TABLES output | ||
SHOW TABLES; | ||
Tables_in_test | ||
data | ||
Checksum: 3251735689; | ||
Verify SHOW GRANTS output | ||
SHOW GRANTS; | ||
Grants for root@localhost | ||
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE, CREATE ROLE, DROP ROLE ON *.* TO `root`@`localhost` WITH GRANT OPTION | ||
GRANT APPLICATION_PASSWORD_ADMIN,AUDIT_ABORT_EXEMPT,AUDIT_ADMIN,AUTHENTICATION_POLICY_ADMIN,BACKUP_ADMIN,BINLOG_ADMIN,BINLOG_ENCRYPTION_ADMIN,CLONE_ADMIN,CONNECTION_ADMIN,ENCRYPTION_KEY_ADMIN,FLUSH_OPTIMIZER_COSTS,FLUSH_STATUS,FLUSH_TABLES,FLUSH_USER_RESOURCES,GROUP_REPLICATION_ADMIN,GROUP_REPLICATION_STREAM,INNODB_REDO_LOG_ARCHIVE,INNODB_REDO_LOG_ENABLE,PASSWORDLESS_USER_ADMIN,PERSIST_RO_VARIABLES_ADMIN,REPLICATION_APPLIER,REPLICATION_SLAVE_ADMIN,RESOURCE_GROUP_ADMIN,RESOURCE_GROUP_USER,ROLE_ADMIN,SERVICE_CONNECTION_ADMIN,SESSION_VARIABLES_ADMIN,SET_USER_ID,SHOW_ROUTINE,SYSTEM_USER,SYSTEM_VARIABLES_ADMIN,TABLE_ENCRYPTION_ADMIN,XA_RECOVER_ADMIN ON *.* TO `root`@`localhost` WITH GRANT OPTION | ||
GRANT PROXY ON ``@`` TO `root`@`localhost` WITH GRANT OPTION | ||
Checksum: 428322074; | ||
Verify CHECK TABLE output | ||
CHECK TABLE data; | ||
Table Op Msg_type Msg_text | ||
test.data check status OK | ||
Checksum: 2020821564; | ||
SET @@global.enable_resultset_checksum = default; | ||
DROP TABLE data; |
15 changes: 15 additions & 0 deletions
15
mysql-test/suite/sys_vars/r/enable_resultset_checksum_basic.result
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
Default value of enable_resultset_checksum is false | ||
SELECT @@global.enable_resultset_checksum; | ||
@@global.enable_resultset_checksum | ||
0 | ||
SELECT @@session.enable_resultset_checksum; | ||
ERROR HY000: Variable 'enable_resultset_checksum' is a GLOBAL variable | ||
Expected error 'Variable is a GLOBAL variable' | ||
SET @@global.enable_resultset_checksum = true; | ||
SELECT @@global.enable_resultset_checksum; | ||
@@global.enable_resultset_checksum | ||
1 | ||
SET @@global.enable_resultset_checksum = default; | ||
SELECT @@global.enable_resultset_checksum; | ||
@@global.enable_resultset_checksum | ||
0 |
23 changes: 23 additions & 0 deletions
23
mysql-test/suite/sys_vars/t/enable_resultset_checksum_basic.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
-- source include/load_sysvars.inc | ||
|
||
#### | ||
# Verify default value false | ||
#### | ||
--echo Default value of enable_resultset_checksum is false | ||
SELECT @@global.enable_resultset_checksum; | ||
|
||
#### | ||
# Verify that this is not a session variable | ||
#### | ||
--Error ER_INCORRECT_GLOBAL_LOCAL_VAR | ||
SELECT @@session.enable_resultset_checksum; | ||
--echo Expected error 'Variable is a GLOBAL variable' | ||
|
||
#### | ||
## Actual tests which enables this are in different file which test this feature | ||
#### | ||
SET @@global.enable_resultset_checksum = true; | ||
SELECT @@global.enable_resultset_checksum; | ||
|
||
SET @@global.enable_resultset_checksum = default; | ||
SELECT @@global.enable_resultset_checksum; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.