Skip to content

Commit b354aae

Browse files
sunshine-Chunfacebook-github-bot
authored andcommitted
Disable DESC for mysql.password_history (#1287)
Summary: Myrocks doesn't support DESC. Disable DESC when creating rocksdb system tables. Pull Request resolved: #1287 Test Plan: Don't break current MTR Reviewed By: luqun Differential Revision: D44598701 Pulled By: sunshine-Chun fbshipit-source-id: 2fab58d
1 parent b08cc53 commit b354aae

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

mysql-test/suite/rocksdb/t/early_load_rocksdb_plugin.test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
--source include/have_rocksdb.inc
2+
--source include/have_debug.inc
23

34
# Set the default ddse to Rocksdb
45
# Bootstrap by starting mysqld with --initialize
@@ -7,8 +8,7 @@
78
let BASEDIR= `select @@basedir`;
89
let DDIR=$MYSQL_TMP_DIR/installdb_test;
910
let MYSQLD_LOG=$MYSQL_TMP_DIR/server.log;
10-
let extra_args=--no-defaults --basedir=$BASEDIR;
11-
11+
let extra_args=--no-defaults --basedir=$BASEDIR --debug=+d,ddse_rocksdb;
1212

1313
--echo # shut server down
1414
--source include/shutdown_mysqld.inc

scripts/mysql_system_tables.sql

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
set @have_innodb= (select count(engine) from information_schema.engines where engine='INNODB' and support != 'NO');
2828
set @is_mysql_encrypted = (select ENCRYPTION from information_schema.INNODB_TABLESPACES where NAME='mysql');
29+
set @ddse= (select @@default_dd_storage_engine);
2930

3031
-- Tables below are NOT treated as DD tables by MySQL server yet.
3132

@@ -183,11 +184,8 @@ SET @cmd = "CREATE TABLE IF NOT EXISTS password_history
183184
Host CHAR(255) CHARACTER SET ASCII DEFAULT '' NOT NULL,
184185
User CHAR(80) BINARY DEFAULT '' NOT NULL,
185186
Password_timestamp TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
186-
Password TEXT,
187-
PRIMARY KEY(Host, User, Password_timestamp DESC)
188-
) engine=InnoDB STATS_PERSISTENT=0 CHARACTER SET utf8 COLLATE utf8_bin
189-
comment='Password history for user accounts' ROW_FORMAT=DYNAMIC TABLESPACE=mysql";
190-
SET @str = CONCAT(@cmd, " ENCRYPTION='", @is_mysql_encrypted, "'");
187+
Password TEXT,";
188+
SET @str = IF(@ddse = 'ROCKSDB', CONCAT(@cmd, "PRIMARY KEY(Host, User, Password_timestamp))", " engine=ROCKSDB CHARACTER SET utf8 COLLATE utf8_bin comment='Password history for user accounts'"), CONCAT(@cmd, "PRIMARY KEY(Host, User, Password_timestamp DESC))", " engine=InnoDB STATS_PERSISTENT=0 CHARACTER SET utf8 COLLATE utf8_bin comment='Password history for user accounts' ROW_FORMAT=DYNAMIC TABLESPACE=mysql", " ENCRYPTION='", @is_mysql_encrypted, "'"));
191189
PREPARE stmt FROM @str;
192190
EXECUTE stmt;
193191
DROP PREPARE stmt;

storage/rocksdb/rdb_native_dd.cc

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
/* This C++ file's header file */
1818
#include "rdb_native_dd.h"
19+
#include <cstring>
1920

2021
/* MySQL header files */
2122
#include "sql/dd/types/table.h" // dd::Table
@@ -64,7 +65,15 @@ bool rocksdb_dict_set_server_version() {
6465
->set_server_version();
6566
};
6667

67-
bool rocksdb_is_supported_system_table(const char *, const char *, bool) {
68+
bool rocksdb_is_supported_system_table([[maybe_unused]] const char *db_name,
69+
[[maybe_unused]] const char *tbl_name,
70+
bool) {
71+
DBUG_EXECUTE_IF("ddse_rocksdb", {
72+
if (strcmp(db_name, "mysql") == 0 &&
73+
strcmp(tbl_name, "password_history") == 0) {
74+
return true;
75+
}
76+
});
6877
return false;
6978
}
7079

0 commit comments

Comments
 (0)