SQL: disable versioned DML for transaction_registry=off [closes #364]
This commit is contained in:
parent
dcc00d2be3
commit
f924a94d2f
@ -355,6 +355,11 @@ rollback to a;
|
||||
commit;
|
||||
call verify_vtq;
|
||||
No A B C D
|
||||
set global transaction_registry= off;
|
||||
insert into t2(x) values (1);
|
||||
insert into t1(x) values (1);
|
||||
ERROR HY000: Some versioned DML requires `transaction_registry` to be set to ON.
|
||||
set global transaction_registry= on;
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
drop procedure test_01;
|
||||
|
@ -185,6 +185,12 @@ rollback to a;
|
||||
commit;
|
||||
call verify_vtq;
|
||||
|
||||
set global transaction_registry= off;
|
||||
insert into t2(x) values (1);
|
||||
--error ER_VERS_TRT_IS_DISABLED
|
||||
insert into t1(x) values (1);
|
||||
set global transaction_registry= on;
|
||||
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
|
||||
|
@ -1414,16 +1414,14 @@ int ha_commit_trans(THD *thd, bool all)
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (rw_trans && use_transaction_registry)
|
||||
if (rw_trans)
|
||||
{
|
||||
ulonglong trx_start_id= 0, trx_end_id= 0;
|
||||
for (Ha_trx_info *ha_info= trans->ha_list; ha_info;
|
||||
ha_info= ha_info->next())
|
||||
for (Ha_trx_info *ha_info= trans->ha_list; ha_info; ha_info= ha_info->next())
|
||||
{
|
||||
if (ulonglong (*prepare)(THD*,ulonglong*)= ha_info->ht()->
|
||||
prepare_commit_versioned)
|
||||
if (ha_info->ht()->prepare_commit_versioned)
|
||||
{
|
||||
trx_end_id= prepare(thd, &trx_start_id);
|
||||
trx_end_id= ha_info->ht()->prepare_commit_versioned(thd, &trx_start_id);
|
||||
if (trx_end_id)
|
||||
break; // FIXME: use a common ID for cross-engine transactions
|
||||
}
|
||||
@ -1431,6 +1429,11 @@ int ha_commit_trans(THD *thd, bool all)
|
||||
|
||||
if (trx_end_id)
|
||||
{
|
||||
if (!use_transaction_registry)
|
||||
{
|
||||
my_error(ER_VERS_TRT_IS_DISABLED, MYF(0));
|
||||
goto err;
|
||||
}
|
||||
DBUG_ASSERT(trx_start_id);
|
||||
TR_table trt(thd, true);
|
||||
if (trt.update(trx_start_id, trx_end_id))
|
||||
|
@ -7913,3 +7913,6 @@ ER_NOT_LOG_TABLE
|
||||
|
||||
ER_VERS_GENERATED_ALWAYS_NOT_EMPTY
|
||||
eng "Can not modify column `%s` to GENERATED ALWAYS AS ROW START/END for non-empty table"
|
||||
|
||||
ER_VERS_TRT_IS_DISABLED
|
||||
eng "Some versioned DML requires `transaction_registry` to be set to ON."
|
||||
|
@ -7442,15 +7442,21 @@ static bool mysql_inplace_alter_table(THD *thd,
|
||||
|
||||
{
|
||||
TR_table trt(thd, true);
|
||||
if (trt == *table_list || !use_transaction_registry);
|
||||
else if (ulonglong (*prepare)(THD*,ulonglong*)= table->file->ht->
|
||||
prepare_commit_versioned)
|
||||
if (trt != *table_list && table->file->ht->prepare_commit_versioned)
|
||||
{
|
||||
ulonglong trx_start_id, trx_end_id= prepare(thd, &trx_start_id);
|
||||
if (trx_end_id && trt.update(trx_start_id, trx_end_id))
|
||||
ulonglong trx_start_id= 0;
|
||||
ulonglong trx_end_id= table->file->ht->prepare_commit_versioned(thd, &trx_start_id);
|
||||
if (trx_end_id)
|
||||
{
|
||||
my_error(ER_UNKNOWN_ERROR, MYF(0));
|
||||
goto rollback;
|
||||
if (!use_transaction_registry)
|
||||
{
|
||||
my_error(ER_VERS_TRT_IS_DISABLED, MYF(0));
|
||||
goto rollback;
|
||||
}
|
||||
if (trt.update(trx_start_id, trx_end_id))
|
||||
{
|
||||
goto rollback;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -423,11 +423,18 @@ 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_ERROR));
|
||||
|
||||
static bool update_transaction_registry(sys_var *self, THD *thd, enum_var_type type)
|
||||
{
|
||||
use_transaction_registry= opt_transaction_registry;
|
||||
return false;
|
||||
}
|
||||
|
||||
static Sys_var_mybool Sys_transaction_registry(
|
||||
"transaction_registry",
|
||||
"Enable or disable update of transaction_registry",
|
||||
GLOBAL_VAR(opt_transaction_registry), CMD_LINE(OPT_ARG),
|
||||
DEFAULT(TRUE));
|
||||
DEFAULT(TRUE), NO_MUTEX_GUARD, NOT_IN_BINLOG,
|
||||
0, ON_UPDATE(update_transaction_registry));
|
||||
|
||||
static Sys_var_ulonglong Sys_binlog_cache_size(
|
||||
"binlog_cache_size", "The size of the transactional cache for "
|
||||
|
@ -255,12 +255,12 @@ err:
|
||||
}
|
||||
|
||||
quit:
|
||||
if (result || !use_transaction_registry);
|
||||
else if (ulonglong (*prepare)(THD*,ulonglong*)= vtmd.table->file->ht->
|
||||
prepare_commit_versioned)
|
||||
if (!result && vtmd.table->file->ht->prepare_commit_versioned)
|
||||
{
|
||||
DBUG_ASSERT(use_transaction_registry); // FIXME: disable survival mode while TRT is disabled
|
||||
TR_table trt(thd, true);
|
||||
ulonglong trx_start_id, trx_end_id= prepare(thd, &trx_start_id);
|
||||
ulonglong trx_start_id= 0;
|
||||
ulonglong trx_end_id= vtmd.table->file->ht->prepare_commit_versioned(thd, &trx_start_id);
|
||||
result= trx_end_id && trt.update(trx_start_id, trx_end_id);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user