Commit cc40a32d authored by marko's avatar marko

branches/zip: row_merge_drop_temp_indexes(): Do not lock the rows of

SYS_INDEXES when looking for partially created indexes.  Use the
transaction isolation level READ UNCOMMITTED to avoid interfering with
locks held by incomplete transactions that will be rolled back in a
subsequent step in the recovery.  (Issue #152)

Approved by Heikki Tuuri
parent 9c34e5f9
......@@ -1833,7 +1833,7 @@ row_merge_drop_temp_indexes(void)
"PROCEDURE DROP_TEMP_INDEXES_PROC () IS\n"
"indexid CHAR;\n"
"DECLARE CURSOR c IS SELECT ID FROM SYS_INDEXES\n"
"WHERE SUBSTR(NAME,0,1)='\377' FOR UPDATE;\n"
"WHERE SUBSTR(NAME,0,1)='\377';\n"
"BEGIN\n"
"\tOPEN c;\n"
"\tWHILE 1=1 LOOP\n"
......@@ -1842,7 +1842,7 @@ row_merge_drop_temp_indexes(void)
"\t\t\tEXIT;\n"
"\t\tEND IF;\n"
"\t\tDELETE FROM SYS_FIELDS WHERE INDEX_ID = indexid;\n"
"\t\tDELETE FROM SYS_INDEXES WHERE CURRENT OF c;\n"
"\t\tDELETE FROM SYS_INDEXES WHERE ID = indexid;\n"
"\tEND LOOP;\n"
"\tCLOSE c;\n"
"\tCOMMIT WORK;\n"
......@@ -1852,6 +1852,15 @@ row_merge_drop_temp_indexes(void)
trx->op_info = "dropping partially created indexes";
row_mysql_lock_data_dictionary(trx);
/* Incomplete transactions may be holding some locks on the
data dictionary tables. However, they should never have been
able to lock the records corresponding to the partially
created indexes that we are attempting to delete, because the
table was locked when the indexes were being created. We will
drop the partially created indexes before the rollback of
incomplete transactions is initiated. Thus, this should not
interfere with the incomplete transactions. */
trx->isolation_level = TRX_ISO_READ_UNCOMMITTED;
err = que_eval_sql(NULL, drop_temp_indexes, FALSE, trx);
ut_a(err == DB_SUCCESS);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment