#At file:///Users/cbell/source/bzr/MS10/ based on revid:charles.bell@stripped
3046 Chuck Bell 2010-01-08
Bug#41578 - Drop column/table with grants followed by restore fails.
When a database object like a table or column is dropped,
privileges for these objects are not dropped.
BACKUP includes all privileges that belong to the saved databases.
So it includes privileges for objects that do not exist.
On RESTORE the saved objects are re-created, followed by the
privileges. RESTORE failed when trying to grant a privilege
for a non-existent object.
To be able to restore the same objects and privileges as they existed
at backup time, we do now omit checks for object existence when
granting privileges during RESTORE.
original changeset: 2761.6.1 (mysql-6.0-backup)
@ sql/sql_acl.cc
Missing code port.
modified:
sql/sql_acl.cc
=== modified file 'sql/sql_acl.cc'
--- a/sql/sql_acl.cc 2009-12-22 21:05:00 +0000
+++ b/sql/sql_acl.cc 2010-01-08 18:22:01 +0000
@@ -3060,7 +3060,12 @@ int mysql_table_grant(THD *thd, TABLE_LI
column->column.ptr(), NULL, NULL,
NULL, TRUE, FALSE,
&unused_field_idx, FALSE, &dummy);
- if (f == (Field*)0)
+ /*
+ During RESTORE, we want to restore all privileges that existed
+ at backup time. This includes privileges for non-existing
+ colums.
+ */
+ if ((f == (Field*)0) && (thd->backup_in_progress != SQLCOM_RESTORE))
{
my_error(ER_BAD_FIELD_ERROR, MYF(0),
column->column.c_ptr(), table_list->alias);
@@ -3074,7 +3079,12 @@ int mysql_table_grant(THD *thd, TABLE_LI
}
else
{
- if (!(rights & CREATE_ACL))
+ /*
+ During RESTORE, we want to restore all privileges that existed
+ at backup time. This includes privileges for non-existing
+ tables.
+ */
+ if (!(rights & CREATE_ACL) && (thd->backup_in_progress != SQLCOM_RESTORE))
{
char buf[FN_REFLEN + 1];
build_table_filename(buf, sizeof(buf) - 1, table_list->db,
Attachment: [text/bzr-bundle] bzr/charles.bell@sun.com-20100108182201-61hkrdbh2tm0pxy3.bundle
| Thread |
|---|
| • bzr commit into mysql-backup-backport branch (charles.bell:3046)Bug#41578 | Chuck Bell | 8 Jan |