mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
SQL,Client: mysqldump for TRT fix [#302]
Test results: main. mysqldump mysqldump-max mysqld--help openssl_1
This commit is contained in:
@ -747,6 +747,7 @@ static void write_header(FILE *sql_file, char *db_name)
|
||||
"/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;\n",
|
||||
path?"":"NO_AUTO_VALUE_ON_ZERO",compatible_mode_normal_str[0]==0?"":",",
|
||||
compatible_mode_normal_str);
|
||||
fprintf(sql_file, "/*!100300 SET GLOBAL TRANSACTION_REGISTRY=0 */;\n");
|
||||
check_io(sql_file);
|
||||
}
|
||||
} /* write_header */
|
||||
@ -761,6 +762,7 @@ static void write_footer(FILE *sql_file)
|
||||
}
|
||||
else if (!opt_compact)
|
||||
{
|
||||
fprintf(sql_file, "/*!100300 SET GLOBAL TRANSACTION_REGISTRY=1 */;\n");
|
||||
if (opt_tz_utc)
|
||||
fprintf(sql_file,"/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;\n");
|
||||
|
||||
@ -991,7 +993,9 @@ static int get_options(int *argc, char ***argv)
|
||||
my_hash_insert(&ignore_table,
|
||||
(uchar*) my_strdup("mysql.general_log", MYF(MY_WME))) ||
|
||||
my_hash_insert(&ignore_table,
|
||||
(uchar*) my_strdup("mysql.slow_log", MYF(MY_WME))))
|
||||
(uchar*) my_strdup("mysql.slow_log", MYF(MY_WME))) ||
|
||||
my_hash_insert(&ignore_table,
|
||||
(uchar*) my_strdup("mysql.transaction_registry", MYF(MY_WME))))
|
||||
return(EX_EOM);
|
||||
|
||||
if ((ho_error= handle_options(argc, argv, my_long_options, get_one_option)))
|
||||
@ -2668,7 +2672,8 @@ static inline my_bool general_log_or_slow_log_tables(const char *db,
|
||||
{
|
||||
return (!my_strcasecmp(charset_info, db, "mysql")) &&
|
||||
(!my_strcasecmp(charset_info, table, "general_log") ||
|
||||
!my_strcasecmp(charset_info, table, "slow_log"));
|
||||
!my_strcasecmp(charset_info, table, "slow_log") ||
|
||||
!my_strcasecmp(charset_info, table, "transaction_registry"));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -4583,6 +4588,7 @@ static int dump_all_tables_in_db(char *database)
|
||||
char hash_key[2*NAME_LEN+2]; /* "db.tablename" */
|
||||
char *afterdot;
|
||||
my_bool general_log_table_exists= 0, slow_log_table_exists=0;
|
||||
my_bool transaction_registry_table_exists= 0;
|
||||
int using_mysql_db= !my_strcasecmp(charset_info, database, "mysql");
|
||||
DBUG_ENTER("dump_all_tables_in_db");
|
||||
|
||||
@ -4685,6 +4691,8 @@ static int dump_all_tables_in_db(char *database)
|
||||
general_log_table_exists= 1;
|
||||
else if (!my_strcasecmp(charset_info, table, "slow_log"))
|
||||
slow_log_table_exists= 1;
|
||||
else if (!my_strcasecmp(charset_info, table, "transaction_registry"))
|
||||
transaction_registry_table_exists= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4731,6 +4739,13 @@ static int dump_all_tables_in_db(char *database)
|
||||
verbose_msg("-- Warning: get_table_structure() failed with some internal "
|
||||
"error for 'slow_log' table\n");
|
||||
}
|
||||
if (transaction_registry_table_exists)
|
||||
{
|
||||
if (!get_table_structure((char *) "transaction_registry",
|
||||
database, table_type, &ignore_flag) )
|
||||
verbose_msg("-- Warning: get_table_structure() failed with some internal "
|
||||
"error for 'transaction_registry' table\n");
|
||||
}
|
||||
}
|
||||
if (flush_privileges && using_mysql_db)
|
||||
{
|
||||
|
@ -1255,6 +1255,9 @@ The following options may be given as the first argument:
|
||||
--transaction-read-only
|
||||
Default transaction access mode. True if transactions are
|
||||
read-only.
|
||||
--transaction-registry
|
||||
Enable or disable update of transaction_registry
|
||||
(Defaults to on; use --skip-transaction-registry to disable.)
|
||||
--updatable-views-with-limit=name
|
||||
YES = Don't issue an error message (warning only) if a
|
||||
VIEW without presence of a key of the underlying table is
|
||||
@ -1625,6 +1628,7 @@ transaction-alloc-block-size 8192
|
||||
transaction-isolation REPEATABLE-READ
|
||||
transaction-prealloc-size 4096
|
||||
transaction-read-only FALSE
|
||||
transaction-registry TRUE
|
||||
updatable-views-with-limit YES
|
||||
use-stat-tables NEVER
|
||||
userstat FALSE
|
||||
|
@ -88,6 +88,7 @@ id name
|
||||
/*!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 */;
|
||||
/*!100300 SET GLOBAL TRANSACTION_REGISTRY=0 */;
|
||||
|
||||
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 */;
|
||||
|
||||
@ -164,6 +165,7 @@ CREATE TABLE `t6` (
|
||||
/*!40000 ALTER TABLE `t6` DISABLE KEYS */;
|
||||
INSERT IGNORE INTO `t6` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
|
||||
/*!40000 ALTER TABLE `t6` ENABLE KEYS */;
|
||||
/*!100300 SET GLOBAL TRANSACTION_REGISTRY=1 */;
|
||||
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
||||
|
||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
@ -185,6 +187,7 @@ INSERT IGNORE INTO `t6` VALUES (1,'first value'),(2,'first value'),(3,'first va
|
||||
/*!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 */;
|
||||
/*!100300 SET GLOBAL TRANSACTION_REGISTRY=0 */;
|
||||
|
||||
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 */;
|
||||
|
||||
@ -261,6 +264,7 @@ CREATE TABLE `t6` (
|
||||
/*!40000 ALTER TABLE `t6` DISABLE KEYS */;
|
||||
INSERT INTO `t6` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
|
||||
/*!40000 ALTER TABLE `t6` ENABLE KEYS */;
|
||||
/*!100300 SET GLOBAL TRANSACTION_REGISTRY=1 */;
|
||||
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
||||
|
||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
|
File diff suppressed because one or more lines are too long
@ -113,6 +113,7 @@ INSERT INTO t1 VALUES (1), (2);
|
||||
/*!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 */;
|
||||
/*!100300 SET GLOBAL TRANSACTION_REGISTRY=0 */;
|
||||
DROP TABLE IF EXISTS `t1`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
@ -126,6 +127,7 @@ LOCK TABLES `t1` WRITE;
|
||||
INSERT INTO `t1` VALUES (1),(2);
|
||||
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
/*!100300 SET GLOBAL TRANSACTION_REGISTRY=1 */;
|
||||
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
||||
|
||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
@ -147,6 +149,7 @@ UNLOCK TABLES;
|
||||
/*!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 */;
|
||||
/*!100300 SET GLOBAL TRANSACTION_REGISTRY=0 */;
|
||||
DROP TABLE IF EXISTS `t1`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
@ -160,6 +163,7 @@ LOCK TABLES `t1` WRITE;
|
||||
INSERT INTO `t1` VALUES (1),(2);
|
||||
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
/*!100300 SET GLOBAL TRANSACTION_REGISTRY=1 */;
|
||||
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
||||
|
||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
@ -181,6 +185,7 @@ UNLOCK TABLES;
|
||||
/*!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 */;
|
||||
/*!100300 SET GLOBAL TRANSACTION_REGISTRY=0 */;
|
||||
DROP TABLE IF EXISTS `t1`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
@ -194,6 +199,7 @@ LOCK TABLES `t1` WRITE;
|
||||
INSERT INTO `t1` VALUES (1),(2);
|
||||
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
/*!100300 SET GLOBAL TRANSACTION_REGISTRY=1 */;
|
||||
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
||||
|
||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
|
@ -5204,6 +5204,20 @@ NUMERIC_BLOCK_SIZE 1024
|
||||
ENUM_VALUE_LIST NULL
|
||||
READ_ONLY NO
|
||||
COMMAND_LINE_ARGUMENT REQUIRED
|
||||
VARIABLE_NAME TRANSACTION_REGISTRY
|
||||
SESSION_VALUE NULL
|
||||
GLOBAL_VALUE ON
|
||||
GLOBAL_VALUE_ORIGIN COMPILE-TIME
|
||||
DEFAULT_VALUE ON
|
||||
VARIABLE_SCOPE GLOBAL
|
||||
VARIABLE_TYPE BOOLEAN
|
||||
VARIABLE_COMMENT Enable or disable update of transaction_registry
|
||||
NUMERIC_MIN_VALUE NULL
|
||||
NUMERIC_MAX_VALUE NULL
|
||||
NUMERIC_BLOCK_SIZE NULL
|
||||
ENUM_VALUE_LIST OFF,ON
|
||||
READ_ONLY NO
|
||||
COMMAND_LINE_ARGUMENT OPTIONAL
|
||||
VARIABLE_NAME TX_ISOLATION
|
||||
SESSION_VALUE REPEATABLE-READ
|
||||
GLOBAL_VALUE REPEATABLE-READ
|
||||
|
@ -1453,7 +1453,7 @@ insert into u1 values (4);
|
||||
create view v1 (c1) as select * from t1;
|
||||
|
||||
# Backup should not fail for Bug#21527. Flush priviliges test begins.
|
||||
--exec $MYSQL_DUMP --skip-comments --add-drop-table --flush-privileges --ignore-table=mysql.general_log --ignore-table=mysql.slow_log --databases mysqldump_myDB mysql > $MYSQLTEST_VARDIR/tmp/bug21527.sql
|
||||
--exec $MYSQL_DUMP --skip-comments --add-drop-table --flush-privileges --ignore-table=mysql.general_log --ignore-table=mysql.slow_log --ignore-table=mysql.transaction_registry --databases mysqldump_myDB mysql > $MYSQLTEST_VARDIR/tmp/bug21527.sql
|
||||
|
||||
# Clean up
|
||||
connection root;
|
||||
|
@ -1419,7 +1419,8 @@ int ha_commit_trans(THD *thd, bool all)
|
||||
for (Ha_trx_info *hi= ha_info; hi; hi= hi->next())
|
||||
{
|
||||
handlerton *ht= hi->ht();
|
||||
if ((ht->flags & HTON_NATIVE_SYS_VERSIONING) &&
|
||||
if (transaction_registry &&
|
||||
(ht->flags & HTON_NATIVE_SYS_VERSIONING) &&
|
||||
(thd->lex->sql_command == SQLCOM_ALTER_TABLE ?
|
||||
hi->is_trx_tmp_read_write() :
|
||||
hi->is_trx_read_write()))
|
||||
|
@ -534,6 +534,7 @@ ulonglong slave_skipped_errors;
|
||||
ulong feature_files_opened_with_delayed_keys= 0, feature_check_constraint= 0;
|
||||
ulonglong denied_connections;
|
||||
my_decimal decimal_zero;
|
||||
my_bool transaction_registry= 1;
|
||||
|
||||
/*
|
||||
Maximum length of parameter value which can be set through
|
||||
|
@ -312,6 +312,7 @@ extern my_bool encrypt_tmp_disk_tables, encrypt_tmp_files;
|
||||
extern ulong encryption_algorithm;
|
||||
extern const char *encryption_algorithm_names[];
|
||||
extern const char *quoted_string;
|
||||
extern my_bool transaction_registry;
|
||||
|
||||
#ifdef HAVE_PSI_INTERFACE
|
||||
#ifdef HAVE_MMAP
|
||||
|
@ -7432,7 +7432,7 @@ static bool mysql_inplace_alter_table(THD *thd,
|
||||
TR_table trt(thd, true);
|
||||
if (table->file->native_versioned())
|
||||
{
|
||||
if (trt.update())
|
||||
if (transaction_registry && trt.update())
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -422,6 +422,12 @@ static Sys_var_enum Sys_vers_alter_history(
|
||||
SESSION_VAR(vers_alter_history), CMD_LINE(REQUIRED_ARG),
|
||||
vers_alter_history_keywords, DEFAULT(VERS_ALTER_HISTORY_KEEP));
|
||||
|
||||
static Sys_var_mybool Sys_transaction_registry(
|
||||
"transaction_registry",
|
||||
"Enable or disable update of transaction_registry",
|
||||
GLOBAL_VAR(transaction_registry), CMD_LINE(OPT_ARG),
|
||||
DEFAULT(TRUE));
|
||||
|
||||
static Sys_var_ulonglong Sys_binlog_cache_size(
|
||||
"binlog_cache_size", "The size of the transactional cache for "
|
||||
"updates to transactional engines for the binary log. "
|
||||
|
@ -255,7 +255,7 @@ err:
|
||||
}
|
||||
|
||||
quit:
|
||||
if (!result)
|
||||
if (!result && transaction_registry)
|
||||
{
|
||||
TR_table trt(thd, true);
|
||||
result= trt.update();
|
||||
|
Reference in New Issue
Block a user