1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

Backport of:

------------------------------------------------------------
revno: 2630.13.16
committer: Davi Arnaut <Davi.Arnaut@Sun.COM>
branch nick: WL#4284
timestamp: Sat 2008-07-26 13:38:20 -0300
message:
WL#4284: Transactional DDL locking

SQL statements' effect on transactions.

Currently the MySQL server and its storage engines are not
capable of rolling back operations that define or modify data
structures (also known as DDL statements) or operations that
alter any of the system tables (the mysql database). Allowing
these group of statements to participate in transactions
is unfeasible at this time (since rollback has no effect
whatsoever on them) and goes against the design of our metadata
locking subsystem.

The solution is to issue implicit commits before and after
those statements execution. This effectively confines each of
those statements to its own special transaction and ensures
that metadata locks taken during this special transaction
are not leaked into posterior statements/transactions.
This commit is contained in:
Konstantin Osipov
2009-12-03 18:47:20 +03:00
parent 37edcc7e26
commit 4ae05129dc
12 changed files with 2484 additions and 153 deletions

View File

@ -18436,6 +18436,59 @@ static void test_bug36004()
DBUG_VOID_RETURN;
}
/**
Test that COM_REFRESH issues a implicit commit.
*/
static void test_wl4284_1()
{
int rc;
MYSQL_ROW row;
MYSQL_RES *result;
DBUG_ENTER("test_wl4284_1");
myheader("test_wl4284_1");
/* set AUTOCOMMIT to OFF */
rc= mysql_autocommit(mysql, FALSE);
myquery(rc);
rc= mysql_query(mysql, "DROP TABLE IF EXISTS trans");
myquery(rc);
rc= mysql_query(mysql, "CREATE TABLE trans (a INT) ENGINE= InnoDB");
myquery(rc);
rc= mysql_query(mysql, "INSERT INTO trans VALUES(1)");
myquery(rc);
rc= mysql_refresh(mysql, REFRESH_GRANT | REFRESH_TABLES);
myquery(rc);
rc= mysql_rollback(mysql);
myquery(rc);
rc= mysql_query(mysql, "SELECT * FROM trans");
myquery(rc);
result= mysql_use_result(mysql);
mytest(result);
row= mysql_fetch_row(result);
mytest(row);
mysql_free_result(result);
/* set AUTOCOMMIT to OFF */
rc= mysql_autocommit(mysql, FALSE);
myquery(rc);
rc= mysql_query(mysql, "DROP TABLE trans");
myquery(rc);
DBUG_VOID_RETURN;
}
static void test_bug38486(void)
{
@ -19197,6 +19250,7 @@ static struct my_tests_st my_tests[]= {
{ "test_wl4166_3", test_wl4166_3 },
{ "test_wl4166_4", test_wl4166_4 },
{ "test_bug36004", test_bug36004 },
{ "test_wl4284_1", test_wl4284_1 },
{ "test_wl4435", test_wl4435 },
{ "test_wl4435_2", test_wl4435_2 },
{ "test_bug38486", test_bug38486 },