Bug #82464 MySQL Cluster Distributed Privileges validation fails
Submitted: 4 Aug 2016 19:42 Modified: 23 Sep 2016 15:00
Reporter: Jim Dowling Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S3 (Non-critical)
Version:7.5.3 OS:Ubuntu (14.04)
Assigned to: CPU Architecture:Any

[4 Aug 2016 19:42] Jim Dowling
Description:

The check to see if distributed privileges are enabled from the Manual
https://dev.mysql.com/doc/refman/5.7/en/mysql-cluster-privilege-distribution.html

returns false when distributed privileges are enabled.

How to repeat:
How to repeat:
1) Start MySQL Server (with --insecure-initialize)

 bin/mysqld --initialize-insecure --user=mysql

2) Enable Distributed Privs
   mysql -uroot < ./cluster/share/ndb_dist_priv.sql

mysql> CALL mysql.mysql_cluster_move_privileges();

3) Check to see if distributed privileges are enabled (this is from the Manual):
https://dev.mysql.com/doc/refman/5.7/en/mysql-cluster-privilege-distribution.html

mysql -uroot -e "SELECT CONCAT('Conversion ', IF(mysql.mysql_cluster_privileges_are_distributed(), 'succeeded', 'failed'), '.') AS Result;" | grep "Conversion succeeded"
   
This should return '0' if it succeeded but it returns false.

Suggested fix:
The distributed privileges appear to work ok (as far as i can tell), but as I have not build in debug mode, i couldn't check the actual function: 'show function mysql_cluster_privileges_are_distributed()' to see what is causing the error.
[9 Aug 2016 7:42] MySQL Verification Team
Hello Jim Dowling,

Thank you for the report.

Thanks,
Umesh
[9 Aug 2016 7:45] MySQL Verification Team
--

[umshastr@hod03]/export/umesh/cluster/mysql-cluster-7.5.3: cat docs/INFO_SRC
commit: 49285b1794476fc96bfbb9c1fd75add12f3a99ab
date: 2016-06-22 13:55:53 +0530
build-date: 2016-06-22 17:53:18 +0200
short: 49285b1
branch: mysql-cluster-7.5.3-release

MySQL source 5.7.13

[umshastr@hod03]/export/umesh/cluster/mysql-cluster-7.5.3: bin/ndb_mgm
-- NDB Cluster -- Management Client --
ndb_mgm> show
Connected to Management Server at: localhost:1186
Cluster Configuration
---------------------
[ndbd(NDB)]     2 node(s)
id=1    @127.0.0.1  (mysql-5.7.13 ndb-7.5.3, Nodegroup: 0, *)
id=2    @127.0.0.1  (mysql-5.7.13 ndb-7.5.3, Nodegroup: 0)

[ndb_mgmd(MGM)] 1 node(s)
id=3    @127.0.0.1  (mysql-5.7.13 ndb-7.5.3)

[mysqld(API)]   12 node(s)
id=4 (not connected, accepting connect from localhost)
id=5 (not connected, accepting connect from localhost)
id=6 (not connected, accepting connect from any host)
id=7 (not connected, accepting connect from any host)
id=8 (not connected, accepting connect from any host)
id=9 (not connected, accepting connect from any host)
id=10 (not connected, accepting connect from any host)
id=11 (not connected, accepting connect from any host)
id=12 (not connected, accepting connect from any host)
id=13 (not connected, accepting connect from any host)
id=14 (not connected, accepting connect from any host)
id=15 (not connected, accepting connect from any host)

ndb_mgm>

[umshastr@hod03]/export/umesh/cluster/mysql-cluster-7.5.3: bin/mysql -uroot < share/ndb_dist_priv.sql
[umshastr@hod03]/export/umesh/cluster/mysql-cluster-7.5.3: bin/mysql -uroot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.13-ndb-7.5.3-cluster-gpl-log MySQL Cluster Community Server (GPL)

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> SELECT ROUTINE_NAME, ROUTINE_SCHEMA, ROUTINE_TYPE
    ->     FROM INFORMATION_SCHEMA.ROUTINES
    ->     WHERE ROUTINE_NAME LIKE 'mysql_cluster%'
    ->     ORDER BY ROUTINE_TYPE;
+---------------------------------------------+----------------+--------------+
| ROUTINE_NAME                                | ROUTINE_SCHEMA | ROUTINE_TYPE |
+---------------------------------------------+----------------+--------------+
| mysql_cluster_privileges_are_distributed    | mysql          | FUNCTION     |
| mysql_cluster_backup_privileges             | mysql          | PROCEDURE    |
| mysql_cluster_move_grant_tables             | mysql          | PROCEDURE    |
| mysql_cluster_move_privileges               | mysql          | PROCEDURE    |
| mysql_cluster_restore_local_privileges      | mysql          | PROCEDURE    |
| mysql_cluster_restore_privileges            | mysql          | PROCEDURE    |
| mysql_cluster_restore_privileges_from_local | mysql          | PROCEDURE    |
+---------------------------------------------+----------------+--------------+
7 rows in set (0.00 sec)

mysql>  CALL mysql.mysql_cluster_move_privileges();
Query OK, 1 row affected (2.86 sec)

mysql> SELECT CONCAT('Conversion ', IF(mysql.mysql_cluster_privileges_are_distributed(), 'succeeded', 'failed'), '.') AS Result;
+--------------------+
| Result             |
+--------------------+
| Conversion failed. |
+--------------------+
1 row in set (0.00 sec)

mysql> SELECT TABLE_NAME, ENGINE FROM INFORMATION_SCHEMA.TABLES
    ->      WHERE TABLE_SCHEMA = 'mysql' AND TABLE_NAME LIKE '%backup'
    ->      ORDER BY ENGINE;
+-------------------------+------------+
| TABLE_NAME              | ENGINE     |
+-------------------------+------------+
| db_backup               | MyISAM     |
| user_backup             | MyISAM     |
| columns_priv_backup     | MyISAM     |
| tables_priv_backup      | MyISAM     |
| proxies_priv_backup     | MyISAM     |
| procs_priv_backup       | MyISAM     |
| ndb_user_backup         | ndbcluster |
| ndb_tables_priv_backup  | ndbcluster |
| ndb_proxies_priv_backup | ndbcluster |
| ndb_procs_priv_backup   | ndbcluster |
| ndb_db_backup           | ndbcluster |
| ndb_columns_priv_backup | ndbcluster |
+-------------------------+------------+
12 rows in set (0.01 sec)

mysql>
[23 Sep 2016 15:00] Jon Stephens
Documented fix as follows in the NDB 7.5.4 changelog:

    Distribution of MySQL privileges was incomplete due to the 
    failure of the mysql_cluster_move_privileges() procedure to convert 
    the mysql.proxies_priv table to NDB.

Closed.