Skip to content

Commit

Permalink
Check MySQL version when printing rocksdb_bulk_load session variables…
Browse files Browse the repository at this point in the history
… in mysqldump

Summary:
As we prepare to migrate to MySQL 8.0, update the check for RockDB support to ensure that dumps from 5.6 can be loaded into 8.0.

Adding this patch to 8.0 will also make sure that dumps from 8.0 will
enable rocksdb_bulk_load in MyRocks.

The controller you requested could not be found.: rocksdb

Reviewed By: lth

Differential Revision: D9136323

fbshipit-source-id: 0ab7d89
  • Loading branch information
Aliaksei Sandryhaila authored and facebook-github-bot committed Aug 6, 2018
1 parent 801facf commit ca31a6b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
14 changes: 11 additions & 3 deletions client/mysqldump.c
Original file line number Diff line number Diff line change
Expand Up @@ -853,9 +853,17 @@ static void write_header(FILE *sql_file, char *db_name)

if (opt_rocksdb_bulk_load)
fprintf(sql_file,
"/*!50601 SELECT count(*) INTO @is_rocksdb_supported FROM"
" information_schema.SESSION_VARIABLES WHERE"
" variable_name='rocksdb_bulk_load' */;\n"
"/*!50601 SELECT count(*) INTO @is_mysql8 FROM"
" information_schema.TABLES WHERE"
" table_schema='performance_schema' AND"
" table_name='session_variables' */;\n"
"/*!50601 SET @check_rocksdb = CONCAT("
" 'SELECT count(*) INTO @is_rocksdb_supported FROM ',"
" IF (@is_mysql8, 'performance', 'information'),"
" '_schema.session_variables WHERE"
" variable_name=\\'rocksdb_bulk_load\\'') */;\n"
"/*!50601 PREPARE s FROM @check_rocksdb */;\n"
"/*!50601 EXECUTE s */;\n"
"/*!50601 SET @enable_bulk_load = IF (@is_rocksdb_supported,"
" 'SET SESSION rocksdb_bulk_load=1', 'SET @dummy = 0') */;\n"
"/*!50601 PREPARE s FROM @enable_bulk_load */;\n"
Expand Down
5 changes: 4 additions & 1 deletion mysql-test/suite/rocksdb/r/mysqldump.result
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ update r1 set value1=value1+100 where id1=1 and id2=1 and id3='1';
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
/*!50601 SELECT count(*) INTO @is_rocksdb_supported FROM information_schema.SESSION_VARIABLES WHERE variable_name='rocksdb_bulk_load' */;
/*!50601 SELECT count(*) INTO @is_mysql8 FROM information_schema.TABLES WHERE table_schema='performance_schema' AND table_name='session_variables' */;
/*!50601 SET @check_rocksdb = CONCAT( 'SELECT count(*) INTO @is_rocksdb_supported FROM ', IF (@is_mysql8, 'performance', 'information'), '_schema.session_variables WHERE variable_name=\'rocksdb_bulk_load\'') */;
/*!50601 PREPARE s FROM @check_rocksdb */;
/*!50601 EXECUTE s */;
/*!50601 SET @enable_bulk_load = IF (@is_rocksdb_supported, 'SET SESSION rocksdb_bulk_load=1', 'SET @dummy = 0') */;
/*!50601 PREPARE s FROM @enable_bulk_load */;
/*!50601 EXECUTE s */;
Expand Down

0 comments on commit ca31a6b

Please sign in to comment.