Commit fa1d0098 authored by guilhem@mysql.com's avatar guilhem@mysql.com

Mark tables 'updating' in sql_acl.cc (mysql_grant(), mysql_table_grant()) so that

tables_ok() does not ignore them. This fixes random bug #980.
parent 4eccbd87
...@@ -2107,8 +2107,17 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list, ...@@ -2107,8 +2107,17 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
GRANT and REVOKE are applied the slave in/exclusion rules as they are GRANT and REVOKE are applied the slave in/exclusion rules as they are
some kind of updates to the mysql.% tables. some kind of updates to the mysql.% tables.
*/ */
if (thd->slave_thread && table_rules_on && !tables_ok(0, tables)) if (thd->slave_thread && table_rules_on)
{
/*
The tables must be marked "updating" so that tables_ok() takes them into
account in tests.
*/
tables[0].updating=tables[1].updating=tables[2].updating=1;
if (!tables_ok(0, tables))
DBUG_RETURN(0); DBUG_RETURN(0);
tables[0].updating=tables[1].updating=tables[2].updating=0;
}
#endif #endif
if (open_and_lock_tables(thd,tables)) if (open_and_lock_tables(thd,tables))
...@@ -2279,8 +2288,17 @@ int mysql_grant (THD *thd, const char *db, List <LEX_USER> &list, ...@@ -2279,8 +2288,17 @@ int mysql_grant (THD *thd, const char *db, List <LEX_USER> &list,
GRANT and REVOKE are applied the slave in/exclusion rules as they are GRANT and REVOKE are applied the slave in/exclusion rules as they are
some kind of updates to the mysql.% tables. some kind of updates to the mysql.% tables.
*/ */
if (thd->slave_thread && table_rules_on && !tables_ok(0, tables)) if (thd->slave_thread && table_rules_on)
{
/*
The tables must be marked "updating" so that tables_ok() takes them into
account in tests.
*/
tables[0].updating=tables[1].updating=1;
if (!tables_ok(0, tables))
DBUG_RETURN(0); DBUG_RETURN(0);
tables[0].updating=tables[1].updating=0;
}
#endif #endif
if (open_and_lock_tables(thd,tables)) if (open_and_lock_tables(thd,tables))
......
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