#At file:///C:/mysql/7.0-dist-priv/ based on revid:magnus.blaudd@stripped
4256 Magnus Blåudd 2011-03-23
ndb dist priv
- ad mysql.host to list of tables to distribute
modified:
mysql-test/suite/ndb/t/ndb_distribute_user.test
mysql-test/suite/rpl_ndb/t/rpl_ndb_distribute_user.test
scripts/mysql_load_distribute_privilege_procedures.sql
sql/ndb_dist_priv_util.h
=== modified file 'mysql-test/suite/ndb/t/ndb_distribute_user.test'
--- a/mysql-test/suite/ndb/t/ndb_distribute_user.test 2011-03-19 13:19:44 +0000
+++ b/mysql-test/suite/ndb/t/ndb_distribute_user.test 2011-03-23 12:06:50 +0000
@@ -128,11 +128,13 @@ drop table if exists mysql.db_backup;
drop table if exists mysql.tables_priv_backup;
drop table if exists mysql.columns_priv_backup;
drop table if exists mysql.procs_priv_backup;
+drop table if exists mysql.host_backup;
drop table if exists mysql.ndb_user_backup;
drop table if exists mysql.ndb_db_backup;
drop table if exists mysql.ndb_tables_priv_backup;
drop table if exists mysql.ndb_columns_priv_backup;
drop table if exists mysql.ndb_procs_priv_backup;
+drop table if exists mysql.ndb_host_backup;
drop function if exists mysql.mysql_cluster_privileges_are_distributed;
drop procedure if exists mysql.mysql_cluster_backup_privileges;
drop procedure if exists mysql.mysql_cluster_move_grant_tables;
@@ -156,11 +158,13 @@ drop table if exists mysql.db_backup;
drop table if exists mysql.tables_priv_backup;
drop table if exists mysql.columns_priv_backup;
drop table if exists mysql.procs_priv_backup;
+drop table if exists mysql.host_backup;
drop table if exists mysql.ndb_user_backup;
drop table if exists mysql.ndb_db_backup;
drop table if exists mysql.ndb_tables_priv_backup;
drop table if exists mysql.ndb_columns_priv_backup;
drop table if exists mysql.ndb_procs_priv_backup;
+drop table if exists mysql.ndb_host_backup;
drop function if exists mysql.mysql_cluster_privileges_are_distributed;
drop procedure if exists mysql.mysql_cluster_backup_privileges;
drop procedure if exists mysql.mysql_cluster_move_grant_tables;
=== modified file 'mysql-test/suite/rpl_ndb/t/rpl_ndb_distribute_user.test'
--- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_distribute_user.test 2011-03-19 13:19:44 +0000
+++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_distribute_user.test 2011-03-23 12:06:50 +0000
@@ -152,11 +152,13 @@ drop table if exists mysql.db_backup;
drop table if exists mysql.tables_priv_backup;
drop table if exists mysql.columns_priv_backup;
drop table if exists mysql.procs_priv_backup;
+drop table if exists mysql.host_backup;
drop table if exists mysql.ndb_user_backup;
drop table if exists mysql.ndb_db_backup;
drop table if exists mysql.ndb_tables_priv_backup;
drop table if exists mysql.ndb_columns_priv_backup;
drop table if exists mysql.ndb_procs_priv_backup;
+drop table if exists mysql.ndb_host_backup;
drop function if exists mysql.mysql_cluster_privileges_are_distributed;
drop procedure if exists mysql.mysql_cluster_backup_privileges;
drop procedure if exists mysql.mysql_cluster_move_grant_tables;
@@ -180,11 +182,13 @@ drop table if exists mysql.db_backup;
drop table if exists mysql.tables_priv_backup;
drop table if exists mysql.columns_priv_backup;
drop table if exists mysql.procs_priv_backup;
+drop table if exists mysql.host_backup;
drop table if exists mysql.ndb_user_backup;
drop table if exists mysql.ndb_db_backup;
drop table if exists mysql.ndb_tables_priv_backup;
drop table if exists mysql.ndb_columns_priv_backup;
drop table if exists mysql.ndb_procs_priv_backup;
+drop table if exists mysql.ndb_host_backup;
drop function if exists mysql.mysql_cluster_privileges_are_distributed;
drop procedure if exists mysql.mysql_cluster_backup_privileges;
drop procedure if exists mysql.mysql_cluster_move_grant_tables;
@@ -209,11 +213,13 @@ drop table if exists mysql.db_backup;
drop table if exists mysql.tables_priv_backup;
drop table if exists mysql.columns_priv_backup;
drop table if exists mysql.procs_priv_backup;
+drop table if exists mysql.host_backup;
drop table if exists mysql.ndb_user_backup;
drop table if exists mysql.ndb_db_backup;
drop table if exists mysql.ndb_tables_priv_backup;
drop table if exists mysql.ndb_columns_priv_backup;
drop table if exists mysql.ndb_procs_priv_backup;
+drop table if exists mysql.ndb_host_backup;
drop function if exists mysql.mysql_cluster_privileges_are_distributed;
drop procedure if exists mysql.mysql_cluster_backup_privileges;
drop procedure if exists mysql.mysql_cluster_move_grant_tables;
=== modified file 'scripts/mysql_load_distribute_privilege_procedures.sql'
--- a/scripts/mysql_load_distribute_privilege_procedures.sql 2011-03-23 10:10:37 +0000
+++ b/scripts/mysql_load_distribute_privilege_procedures.sql 2011-03-23 12:06:50 +0000
@@ -11,19 +11,38 @@ drop procedure if exists mysql.mysql_clu
create function mysql.mysql_cluster_privileges_are_distributed()
returns bool
begin
- declare distributed_user bool default 0;
- declare distributed_db bool default 0;
- declare distributed_tables_priv bool default 0;
- declare distributed_columns_priv bool default 0;
- declare distributed_procs_priv bool default 0;
-
- select engine = 'ndbcluster' into distributed_user from information_schema.tables where table_name = "user";
- select engine = 'ndbcluster' into distributed_db from information_schema.tables where table_name = "db";
- select engine = 'ndbcluster' into distributed_tables_priv from information_schema.tables where table_name = "tables_priv";
- select engine = 'ndbcluster' into distributed_columns_priv from information_schema.tables where table_name = "columns_priv";
- select engine = 'ndbcluster' into distributed_procs_priv from information_schema.tables where table_name = "procs_priv";
-
- if distributed_user = 1 and distributed_db = 1 and distributed_tables_priv = 1 and distributed_columns_priv = 1 and distributed_procs_priv = 1 then
+ declare distributed_user bool default 0;
+ declare distributed_db bool default 0;
+ declare distributed_tables_priv bool default 0;
+ declare distributed_columns_priv bool default 0;
+ declare distributed_procs_priv bool default 0;
+ declare distributed_host bool default 0;
+
+ select engine = 'ndbcluster' into distributed_user
+ from information_schema.tables
+ where table_schema = "mysql" and table_name = "user";
+ select engine = 'ndbcluster' into distributed_db
+ from information_schema.tables
+ where table_schema = "mysql" and table_name = "db";
+ select engine = 'ndbcluster' into distributed_tables_priv
+ from information_schema.tables
+ where table_schema = "mysql" and table_name = "tables_priv";
+ select engine = 'ndbcluster' into distributed_columns_priv
+ from information_schema.tables
+ where table_schema = "mysql" and table_name = "columns_priv";
+ select engine = 'ndbcluster' into distributed_procs_priv
+ from information_schema.tables
+ where table_schema = "mysql" and table_name = "procs_priv";
+ select engine = 'ndbcluster' into distributed_host
+ from information_schema.tables
+ where table_schema = "mysql" and table_name = "host";
+
+ if distributed_user = 1 and
+ distributed_db = 1 and
+ distributed_tables_priv = 1 and
+ distributed_columns_priv = 1 and
+ distributed_procs_priv = 1 and
+ distributed_host = 1 then
return 1;
else
return 0;
@@ -36,20 +55,26 @@ begin
declare first_backup bool default 1;
declare first_distributed_backup bool default 1;
select mysql_cluster_privileges_are_distributed() into distributed_privileges;
- select 0 into first_backup from information_schema.tables where table_name = "user_backup";
- select 0 into first_distributed_backup from information_schema.tables where table_name = "ndb_user_backup";
+ select 0 into first_backup
+ from information_schema.tables
+ where table_schema = "mysql" and table_name = "user_backup";
+ select 0 into first_distributed_backup
+ from information_schema.tables
+ where table_schema = "mysql" and table_name = "ndb_user_backup";
if first_backup = 1 then
create table if not exists user_backup like user;
create table if not exists db_backup like db;
create table if not exists tables_priv_backup like tables_priv;
create table if not exists columns_priv_backup like columns_priv;
create table if not exists procs_priv_backup like procs_priv;
+ create table if not exists host_backup like host;
if distributed_privileges = 1 then
alter table user_backup engine = myisam;
alter table db_backup engine = myisam;
alter table tables_priv_backup engine = myisam;
alter table columns_priv_backup engine = myisam;
alter table procs_priv_backup engine = myisam;
+ alter table host_backup engine = myisam;
end if;
else
truncate user_backup;
@@ -57,6 +82,7 @@ begin
truncate tables_priv_backup;
truncate columns_priv_backup;
truncate procs_priv_backup;
+ truncate host_backup;
end if;
if first_distributed_backup = 1 then
create table if not exists ndb_user_backup like user;
@@ -64,12 +90,14 @@ begin
create table if not exists ndb_tables_priv_backup like tables_priv;
create table if not exists ndb_columns_priv_backup like columns_priv;
create table if not exists ndb_procs_priv_backup like procs_priv;
+ create table if not exists ndb_host_backup like host;
if distributed_privileges = 0 then
alter table ndb_user_backup engine = ndbcluster;
alter table ndb_db_backup engine = ndbcluster;
alter table ndb_tables_priv_backup engine = ndbcluster;
alter table ndb_columns_priv_backup engine = ndbcluster;
alter table ndb_procs_priv_backup engine = ndbcluster;
+ alter table ndb_host_backup engine = ndbcluster;
end if;
else
truncate ndb_user_backup;
@@ -77,18 +105,21 @@ begin
truncate ndb_tables_priv_backup;
truncate ndb_columns_priv_backup;
truncate ndb_procs_priv_backup;
+ truncate ndb_host_backup;
end if;
insert into user_backup select * from user;
insert into db_backup select * from db;
insert into tables_priv_backup select * from tables_priv;
insert into columns_priv_backup select * from columns_priv;
insert into procs_priv_backup select * from procs_priv;
+ insert into host_backup select * from host;
insert into ndb_user_backup select * from user;
insert into ndb_db_backup select * from db;
insert into ndb_tables_priv_backup select * from tables_priv;
insert into ndb_columns_priv_backup select * from columns_priv;
insert into ndb_procs_priv_backup select * from procs_priv;
+ insert into ndb_host_backup select * from host;
end|
create procedure mysql.mysql_cluster_restore_privileges_from_local()
@@ -105,6 +136,7 @@ begin
create table if not exists tables_priv like tables_priv_backup;
create table if not exists columns_priv like columns_priv_backup;
create table if not exists procs_priv like procs_priv_backup;
+ create table if not exists host like host_backup;
delete from user;
insert into user select * from user_backup;
delete from db;
@@ -115,6 +147,8 @@ begin
insert into columns_priv select * from columns_priv_backup;
delete from procs_priv;
insert into procs_priv select * from procs_priv_backup;
+ delete from host;
+ insert into host select * from host_backup;
end if;
end if;
end|
@@ -133,6 +167,7 @@ begin
create table if not exists tables_priv like ndb_tables_priv_backup;
create table if not exists columns_priv like ndb_columns_priv_backup;
create table if not exists procs_priv like ndb_procs_priv_backup;
+ create table if not exists host like ndb_host_backup;
delete from user;
insert into user select * from ndb_user_backup;
delete from db;
@@ -143,6 +178,8 @@ begin
insert into columns_priv select * from ndb_columns_priv_backup;
delete from procs_priv;
insert into procs_priv select * from ndb_procs_priv_backup;
+ delete from host;
+ insert into host select * from ndb_host_backup;
end if;
else
call mysql_cluster_restore_privileges_from_local();
@@ -160,6 +197,7 @@ begin
drop table tables_priv;
drop table columns_priv;
drop table procs_priv;
+ drop table host;
end;
end if;
call mysql_cluster_restore_privileges();
@@ -178,6 +216,7 @@ begin
alter table tables_priv engine = ndb;
alter table columns_priv engine = ndb;
alter table procs_priv engine = ndb;
+ alter table host engine = ndb;
end;
end if;
if revert = 1 then
=== modified file 'sql/ndb_dist_priv_util.h'
--- a/sql/ndb_dist_priv_util.h 2011-03-23 10:02:55 +0000
+++ b/sql/ndb_dist_priv_util.h 2011-03-23 12:06:50 +0000
@@ -32,7 +32,7 @@ public:
const char* iter_next_table()
{
static const char* tables[] =
- { "user", "db", "tables_priv", "columns_priv", "procs_priv" };
+ { "user", "db", "tables_priv", "columns_priv", "procs_priv", "host" };
if (m_iter_curr_table >= (sizeof(tables) / sizeof(tables[0])))
return NULL;
Attachment: [text/bzr-bundle] bzr/magnus.blaudd@sun.com-20110323120650-y2qv33m4o1564kpn.bundle
| Thread |
|---|
| • bzr commit into mysql-5.1-telco-7.0 branch (magnus.blaudd:4256) | Magnus Blåudd | 23 Mar |