List:Commits« Previous MessageNext Message »
From:Magnus Blåudd Date:March 24 2011 10:21am
Subject:bzr push into mysql-5.1-telco-7.0 branch (magnus.blaudd:4270 to 4272)
View as plain text  
 4272 Magnus Blåudd	2011-03-24
      ndb dist priv
       - prefix all tables with database name i.e mysql.

    modified:
      storage/ndb/tools/ndb_dist_priv.sql
 4271 Magnus Blåudd	2011-03-24
      ndb dist priv
       - remove fault comment out of host table statements

    modified:
      storage/ndb/tools/ndb_dist_priv.sql
 4270 Magnus Blåudd	2011-03-23
      ndb dist priv - add ndb_dist_priv_util.h to Makefile.am

    modified:
      sql/Makefile.am
=== modified file 'storage/ndb/tools/ndb_dist_priv.sql'
--- a/storage/ndb/tools/ndb_dist_priv.sql	2011-03-23 14:13:38 +0000
+++ b/storage/ndb/tools/ndb_dist_priv.sql	2011-03-24 10:20:38 +0000
@@ -72,10 +72,11 @@ end|
 
 create procedure mysql.mysql_cluster_backup_privileges()
 begin
- declare distributed_privileges bool default 0;        
+ declare distributed_privileges bool default 0;
  declare first_backup bool default 1;
  declare first_distributed_backup bool default 1;
- select mysql_cluster_privileges_are_distributed() into distributed_privileges;
+ select mysql_cluster_privileges_are_distributed()
+   into distributed_privileges;
  select 0 into first_backup
    from information_schema.tables
      where table_schema = "mysql" and table_name = "user_backup";
@@ -83,64 +84,76 @@ begin
    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;
+   create table if not exists mysql.user_backup
+     like mysql.user;
+   create table if not exists mysql.db_backup
+     like mysql.db;
+   create table if not exists mysql.tables_priv_backup
+     like mysql.tables_priv;
+   create table if not exists mysql.columns_priv_backup
+     like mysql.columns_priv;
+   create table if not exists mysql.procs_priv_backup
+     like mysql.procs_priv;
+   create table if not exists mysql.host_backup
+     like mysql.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;
+     alter table mysql.user_backup engine = myisam;
+     alter table mysql.db_backup engine = myisam;
+     alter table mysql.tables_priv_backup engine = myisam;
+     alter table mysql.columns_priv_backup engine = myisam;
+     alter table mysql.procs_priv_backup engine = myisam;
+     alter table mysql.host_backup engine = myisam;
    end if;
  else
-   truncate user_backup;
-   truncate db_backup;
-   truncate tables_priv_backup;
-   truncate columns_priv_backup;
-   truncate procs_priv_backup;
-   truncate host_backup;
+   truncate mysql.user_backup;
+   truncate mysql.db_backup;
+   truncate mysql.tables_priv_backup;
+   truncate mysql.columns_priv_backup;
+   truncate mysql.procs_priv_backup;
+   truncate mysql.host_backup;
  end if;
  if first_distributed_backup = 1 then
-   create table if not exists ndb_user_backup like user;   
-   create table if not exists ndb_db_backup like db;
-   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;
+   create table if not exists mysql.ndb_user_backup
+     like mysql.user;
+   create table if not exists mysql.ndb_db_backup
+     like mysql.db;
+   create table if not exists mysql.ndb_tables_priv_backup
+     like mysql.tables_priv;
+   create table if not exists mysql.ndb_columns_priv_backup
+     like mysql.columns_priv;
+   create table if not exists mysql.ndb_procs_priv_backup
+     like mysql.procs_priv;
+   create table if not exists mysql.ndb_host_backup
+     like mysql.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;
+     alter table mysql.ndb_user_backup engine = ndbcluster;
+     alter table mysql.ndb_db_backup engine = ndbcluster;
+     alter table mysql.ndb_tables_priv_backup engine = ndbcluster;
+     alter table mysql.ndb_columns_priv_backup engine = ndbcluster;
+     alter table mysql.ndb_procs_priv_backup engine = ndbcluster;
+     alter table mysql.ndb_host_backup engine = ndbcluster;
    end if;
  else
-   truncate ndb_user_backup;
-   truncate ndb_db_backup;
-   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;
+   truncate mysql.ndb_user_backup;
+   truncate mysql.ndb_db_backup;
+   truncate mysql.ndb_tables_priv_backup;
+   truncate mysql.ndb_columns_priv_backup;
+   truncate mysql.ndb_procs_priv_backup;
+   truncate mysql.ndb_host_backup;
+ end if;
+ insert into mysql.user_backup select * from mysql.user;
+ insert into mysql.db_backup select * from mysql.db;
+ insert into mysql.tables_priv_backup select * from mysql.tables_priv;
+ insert into mysql.columns_priv_backup select * from mysql.columns_priv;
+ insert into mysql.procs_priv_backup select * from mysql.procs_priv;
+ insert into mysql.host_backup select * from mysql.host;
+
+ insert into mysql.ndb_user_backup select * from mysql.user;
+ insert into mysql.ndb_db_backup select * from mysql.db;
+ insert into mysql.ndb_tables_priv_backup select * from mysql.tables_priv;
+ insert into mysql.ndb_columns_priv_backup select * from mysql.columns_priv;
+ insert into mysql.ndb_procs_priv_backup select * from mysql.procs_priv;
+ insert into mysql.ndb_host_backup select * from mysql.host;
 end|
 
 create procedure mysql.mysql_cluster_restore_privileges_from_local()
@@ -150,24 +163,30 @@ begin
    from information_schema.tables
     where table_schema = "mysql" and table_name = "user_backup";
  if local_backup = 1 then
-   create table if not exists user like user_backup;
-   create table if not exists db like db_backup;
-   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;
-   insert into db select * from db_backup;
-   delete from tables_priv;
-   insert into tables_priv select * from tables_priv_backup;
-   delete from columns_priv;
-   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;
+   create table if not exists mysql.user
+     like mysql.user_backup;
+   create table if not exists mysql.db
+     like mysql.db_backup;
+   create table if not exists mysql.tables_priv
+     like mysql.tables_priv_backup;
+   create table if not exists mysql.columns_priv
+     like mysql.columns_priv_backup;
+   create table if not exists mysql.procs_priv
+     like mysql.procs_priv_backup;
+   create table if not exists mysql.host
+     like mysql.host_backup;
+   delete from mysql.user;
+   insert into mysql.user select * from mysql.user_backup;
+   delete from mysql.db;
+   insert into mysql.db select * from mysql.db_backup;
+   delete from mysql.tables_priv;
+   insert into mysql.tables_priv select * from mysql.tables_priv_backup;
+   delete from mysql.columns_priv;
+   insert into mysql.columns_priv select * from mysql.columns_priv_backup;
+   delete from mysql.procs_priv;
+   insert into mysql.procs_priv select * from mysql.procs_priv_backup;
+   delete from mysql.host;
+   insert into mysql.host select * from mysql.host_backup;
  end if;
 end|
 
@@ -179,24 +198,36 @@ begin
      where table_schema = "mysql" and table_name = "ndb_user_backup";
  if distributed_backup = 1 then
    flush tables;
-   create table if not exists user like ndb_user_backup;
-   create table if not exists db like ndb_db_backup;
-   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;
-   insert into db select * from ndb_db_backup;
-   delete from tables_priv;
-   insert into tables_priv select * from ndb_tables_priv_backup;
-   delete from columns_priv;
-   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;
+   create table if not exists mysql.user
+     like mysql.ndb_user_backup;
+   create table if not exists mysql.db
+     like mysql.ndb_db_backup;
+   create table if not exists mysql.tables_priv
+     like mysql.ndb_tables_priv_backup;
+   create table if not exists mysql.columns_priv
+     like mysql.ndb_columns_priv_backup;
+   create table if not exists mysql.procs_priv
+     like mysql.ndb_procs_priv_backup;
+   create table if not exists mysql.host
+     like mysql.ndb_host_backup;
+   delete from mysql.user;
+   insert into mysql.user
+     select * from mysql.ndb_user_backup;
+   delete from mysql.db;
+   insert into mysql.db
+     select * from mysql.ndb_db_backup;
+   delete from mysql.tables_priv;
+   insert into mysql.tables_priv
+     select * from mysql.ndb_tables_priv_backup;
+   delete from mysql.columns_priv;
+   insert into mysql.columns_priv
+     select * from mysql.ndb_columns_priv_backup;
+   delete from mysql.procs_priv;
+   insert into mysql.procs_priv
+     select * from mysql.ndb_procs_priv_backup;
+   delete from mysql.host;
+   insert into mysql.host
+     select * from mysql.ndb_host_backup;
  else
    call mysql_cluster_restore_privileges_from_local();
  end if;
@@ -205,15 +236,16 @@ end|
 create procedure mysql.mysql_cluster_restore_local_privileges()
 begin
  declare distributed_privileges bool default 0;
- select mysql.mysql_cluster_privileges_are_distributed() into distributed_privileges;
+ select mysql.mysql_cluster_privileges_are_distributed()
+   into distributed_privileges;
  if distributed_privileges = 1 then
   begin
-    drop table user;
-    drop table db;
-    drop table tables_priv;
-    drop table columns_priv;
-    drop table procs_priv;
-    drop table host;
+    drop table mysql.user;
+    drop table mysql.db;
+    drop table mysql.tables_priv;
+    drop table mysql.columns_priv;
+    drop table mysql.procs_priv;
+    drop table mysql.host;
   end;
  end if;
  call mysql_cluster_restore_privileges_from_local();
@@ -223,16 +255,17 @@ create procedure mysql.mysql_cluster_mov
 begin
  declare distributed_privileges bool default 0;
  declare revert bool default 0;
- select mysql.mysql_cluster_privileges_are_distributed() into distributed_privileges;
+ select mysql.mysql_cluster_privileges_are_distributed()
+   into distributed_privileges;
  if distributed_privileges = 0 then
   begin
    declare exit handler for sqlexception set revert = 1;
-   alter table user engine = ndb;
-   alter table db engine = ndb;
-   alter table tables_priv engine = ndb;
-   alter table columns_priv engine = ndb;
-   alter table procs_priv engine = ndb;
-   alter table host engine = ndb;
+   alter table mysql.user engine = ndb;
+   alter table mysql.db engine = ndb;
+   alter table mysql.tables_priv engine = ndb;
+   alter table mysql.columns_priv engine = ndb;
+   alter table mysql.procs_priv engine = ndb;
+   alter table mysql.host engine = ndb;
   end;
  end if;
  if revert = 1 then

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-5.1-telco-7.0 branch (magnus.blaudd:4270 to 4272) Magnus Blåudd24 Mar