| Bug #118771 | stats_persistent show value wrong in debug mode | ||
|---|---|---|---|
| Submitted: | 2 Aug 4:47 | Modified: | 4 Aug 5:04 |
| Reporter: | zongyi chen (OCA) | Email Updates: | |
| Status: | Verified | Impact on me: | |
| Category: | MySQL Server: InnoDB storage engine | Severity: | S6 (Debug Builds) |
| Version: | 8.0.42, 8.0.43, 8.4.6, 9.4.0 | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
[4 Aug 5:04]
MySQL Verification Team
Hello zongyi chen, Thank you for the report and test case. Verified as described. regards, Umesh
[4 Aug 5:05]
MySQL Verification Team
-- 8.0.43 [umshastr@bug118411:/bv/ushastry/Work/Binaries/mysql-8.0.43/mysql-test]$ ./mtr --nocheck-testcases bug118771 --debug-server Logging: ./mtr --nocheck-testcases bug118771 --debug-server MySQL Version 8.0.43 Checking supported features - Binaries are debug compiled Using 'all' suites Collecting tests Checking leftover processes Removing old var directory Creating var directory '/bv/ushastry/Work/Binaries/mysql-8.0.43/mysql-test/var' Installing system database Using parallel: 1 ============================================================================== TEST NAME RESULT TIME (ms) COMMENT ------------------------------------------------------------------------------ SET SESSION debug = '+d,skip_dd_table_access_check'; create table t (a int) stats_persistent = 1; SELECT options FROM mysql.tables where name = 't'; options avg_row_length=0;encrypt_type=N;key_block_size=0;keys_disabled=0;pack_record=0;stats_auto_recalc=0;stats_persistent=4096;stats_sample_pages=0; [ 50%] main.bug118771 [ pass ] 59 [100%] shutdown_report [ pass ] ------------------------------------------------------------------------------ The servers were restarted 0 times The servers were reinitialized 0 times Spent 0.059 of 17 seconds executing testcases Completed: All 2 tests were successful.
[4 Aug 5:10]
MySQL Verification Team
-- 8.4.6 [umshastr@bug118411:/bv/ushastry/Work/Binaries/mysql-8.4.6/mysql-test]$ ./mtr --nocheck-testcases bug118771 --debug-server Logging: ./mtr --nocheck-testcases bug118771 --debug-server MySQL Version 8.4.6 Checking supported features - Binaries are debug compiled Using 'all' suites Collecting tests Checking leftover processes Removing old var directory Creating var directory '/bv/ushastry/Work/Binaries/mysql-8.4.6/mysql-test/var' Installing system database Using parallel: 1 ============================================================================== TEST NAME RESULT TIME (ms) COMMENT ------------------------------------------------------------------------------ SET SESSION debug = '+d,skip_dd_table_access_check'; create table t (a int) stats_persistent = 1; SELECT options FROM mysql.tables where name = 't'; options avg_row_length=0;encrypt_type=N;key_block_size=0;keys_disabled=0;pack_record=0;stats_auto_recalc=0;stats_persistent=4096;stats_sample_pages=0; [ 50%] main.bug118771 [ pass ] 53 [100%] shutdown_report [ pass ] ------------------------------------------------------------------------------ The servers were restarted 0 times The servers were reinitialized 0 times Spent 0.053 of 23 seconds executing testcases Completed: All 2 tests were successful.
[4 Aug 5:15]
MySQL Verification Team
-- 9.4.0 [umshastr@bug118411:/bv/ushastry/Work/Binaries/mysql-9.4.0/mysql-test]$ ./mtr --nocheck-testcases bug118771 --debug-server Logging: ./mtr --nocheck-testcases bug118771 --debug-server MySQL Version 9.4.0 Checking supported features - Binaries are debug compiled Using 'all' suites Collecting tests Checking leftover processes Removing old var directory Creating var directory '/bv/ushastry/Work/Binaries/mysql-9.4.0/mysql-test/var' Installing system database Using parallel: 1 ports_per_thread:30 ============================================================================== TEST NAME RESULT TIME (ms) COMMENT ------------------------------------------------------------------------------ SET SESSION debug = '+d,skip_dd_table_access_check'; create table t (a int) stats_persistent = 1; SELECT options FROM mysql.tables where name = 't'; options avg_row_length=0;encrypt_type=N;key_block_size=0;keys_disabled=0;pack_record=0;stats_auto_recalc=0;stats_persistent=4096;stats_sample_pages=0; [ 50%] main.bug118771 [ pass ] 56 [100%] shutdown_report [ pass ] ------------------------------------------------------------------------------ The servers were restarted 0 times The servers were reinitialized 0 times Spent 0.056 of 23 seconds executing testcases Completed: All 2 tests were successful.
[4 Aug 5:17]
MySQL Verification Team
Hello zongyi chen, Please ensure to reupload the patch via "Contribution" tab of this bug page otherwise we may not be able to use it. Thank you. regards, Umesh

Description: mysql> SET SESSION debug = '+d,skip_dd_table_access_check'; Query OK, 0 rows affected (0.00 sec) mysql> create table t (a int) stats_persistent = 1; Query OK, 0 rows affected (5.84 sec) mysql> SELECT options FROM mysql.tables where name = 't'; +------------------------------------------------------------------------------------------------------------------------------------------------+ | options | +------------------------------------------------------------------------------------------------------------------------------------------------+ | avg_row_length=0;encrypt_type=N;key_block_size=0;keys_disabled=0;pack_record=0;stats_auto_recalc=0;stats_persistent=4096;stats_sample_pages=0; | +------------------------------------------------------------------------------------------------------------------------------------------------+ 1 row in set (0.01 sec) Noted that the value of stats_persistent is 4096, instead of the expected 1. How to repeat: be as above Suggested fix: diff --git a/sql/dd/dd_table.cc b/sql/dd/dd_table.cc index 32e0d28..cbf0d70 100644 --- a/sql/dd/dd_table.cc +++ b/sql/dd/dd_table.cc @@ -2077,7 +2077,7 @@ static bool fill_dd_table_from_create_info( (HA_OPTION_STATS_PERSISTENT | HA_OPTION_NO_STATS_PERSISTENT)); table_options->set("stats_persistent", (create_info->table_options & - HA_OPTION_STATS_PERSISTENT)); + HA_OPTION_STATS_PERSISTENT) ? 1 : 0); }