Server IP : 104.21.38.3 / Your IP : 172.69.176.121 Web Server : Apache System : Linux krdc-ubuntu-s-2vcpu-4gb-amd-blr1-01.localdomain 5.15.0-142-generic #152-Ubuntu SMP Mon May 19 10:54:31 UTC 2025 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /www/server/mysql/src/mysql-test/suite/ndb_rpl/t/ |
Upload File : |
# The include statement below is a temp one for tests that are yet to #be ported to run with InnoDB, #but needs to be kept for tests that would need MyISAM in future. --source include/force_myisam_default.inc -- source include/have_ndb.inc -- source include/master-slave.inc -- source include/have_binlog_format_mixed_or_row.inc -- source include/have_multi_ndb.inc --source suite/ndb/t/have_ndb_dist_priv.inc let $load_sql_file = $NDB_DIST_PRIV_SQL; connection server1; --disable_query_log --disable_result_log --exec $MYSQL < $load_sql_file call mysql.mysql_cluster_backup_privileges(); --enable_result_log --enable_query_log connection server2; --disable_query_log --disable_result_log let $MYSQL2 = $EXE_MYSQL --defaults-file=$MYSQLTEST_VARDIR/my.cnf; let $MYSQL2 = $MYSQL2 --defaults-group-suffix=.2.1; --exec $MYSQL2 < $load_sql_file call mysql.mysql_cluster_backup_privileges(); --enable_result_log --enable_query_log connection server1; call mysql.mysql_cluster_move_privileges(); select mysql.mysql_cluster_privileges_are_distributed(); CREATE TABLE t1 (pk INT PRIMARY KEY, a INT) engine = ndb; # Save the current binlog position to use as start when # showing CREATE/DROP USER and GRANTs are written as statements # in binlog connection server1; let $binlog_start_server1= query_get_value(SHOW MASTER STATUS, Position, 1); connection server2; let $binlog_start_server2= query_get_value(SHOW MASTER STATUS, Position, 1); connection server1; CREATE USER 'user'@'localhost' IDENTIFIED by 'mypass'; GRANT UPDATE ON t1 TO 'user'@'localhost'; SET PASSWORD FOR 'user'@'localhost'= 'newpass'; RENAME USER 'user'@'localhost' TO 'newuser'@'localhost'; GRANT SELECT ON test.* TO 'newuser'@'localhost' IDENTIFIED by 'mypass2'; CREATE USER 'user2'@'localhost' IDENTIFIED by 'mypass'; GRANT SELECT ON test.t1 TO 'user2'@'localhost'; select distinct User,Authentication_string from mysql.user order by User; select User,Table_priv from mysql.tables_priv ORDER BY User; CREATE USER 'user'@'localhost'; grant ALL PRIVILEGES on test.* to user@localhost with GRANT OPTION; select User,Table_priv from mysql.tables_priv ORDER BY User; GRANT SELECT ON test.t1 TO 'user'@'localhost'; select User,Table_priv from mysql.tables_priv ORDER BY User; connection server2; FLUSH PRIVILEGES; select User,Table_priv from mysql.tables_priv ORDER BY User; REVOKE SELECT ON test.t1 FROM 'user'@'localhost'; select User,Table_priv from mysql.tables_priv ORDER BY User; CREATE USER 'user3'@'localhost' IDENTIFIED by 'mypass'; select distinct User,Authentication_string from mysql.user order by User; select User,Table_priv from mysql.tables_priv ORDER BY User; connection master; sync_slave_with_master; select distinct User,Authentication_string from mysql.user order by User; select User,Table_priv from mysql.tables_priv ORDER BY User; connection server2; FLUSH PRIVILEGES; REVOKE UPDATE ON t1 FROM 'newuser'@'localhost'; REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'user2'@'localhost'; select User,Table_priv from mysql.tables_priv ORDER BY User; GRANT SELECT (a) ON test.t1 TO 'user'@'localhost'; select User, Table_name, Column_name from mysql.columns_priv ORDER BY User; connection server1; FLUSH PRIVILEGES; select distinct User,Authentication_string from mysql.user order by User; select User,Table_priv from mysql.tables_priv ORDER BY User; select User, Table_name, Column_name from mysql.columns_priv ORDER BY User; connection master; sync_slave_with_master; select distinct User,Authentication_string from mysql.user order by User; select User,Table_priv from mysql.tables_priv ORDER BY User; select User, Table_name, Column_name from mysql.columns_priv ORDER BY User; connection server2; DROP USER 'newuser'@'localhost'; # Show that all the above CREATE/DROP USER and GRANT's # have been written as statements to binlog # on both server1 and server2 connection server1; echo == Showing binlog server1 ==; let $binlog_start= $binlog_start_server1; --source include/show_binlog_events.inc connection server2; echo == Showing binlog server2 ==; let $binlog_start= $binlog_start_server2; --source include/show_binlog_events.inc connection server1; select distinct User,Authentication_string from mysql.user order by User; select User,Table_priv from mysql.tables_priv ORDER BY User; connection master; sync_slave_with_master; select distinct User,Authentication_string from mysql.user order by User; select User,Table_priv from mysql.tables_priv ORDER BY User; # # Testing that failed DDL transaction does not write into binlog # connection server1; BEGIN; UPDATE mysql.user SET Authentication_string = '' WHERE User = 'user2'; connection server2; # The SET PASSWORD query should fail when it tries to update the same row # as the first connection. --error ER_LOCK_WAIT_TIMEOUT SET PASSWORD FOR 'user2'@'localhost' = 'newpass'; SHOW WARNINGS; echo == Showing binlog server2 ==; let $binlog_start= $binlog_start_server2; --source include/show_binlog_events.inc connection server1; ROLLBACK; --echo === making backup of new users === connection server1; call mysql.mysql_cluster_backup_privileges(); --echo ==== clean up ==== connection server1; DROP USER 'user2'@'localhost'; DROP USER 'user3'@'localhost'; DROP TABLE t1; sync_slave_with_master; STOP SLAVE; # Restore local privileges connection server1; call mysql.mysql_cluster_backup_privileges(); connection server2; call mysql.mysql_cluster_backup_privileges(); connection slave; call mysql.mysql_cluster_backup_privileges(); connection server1; call mysql.mysql_cluster_restore_local_privileges(); connection server2; call mysql.mysql_cluster_restore_local_privileges(); connection slave; call mysql.mysql_cluster_restore_local_privileges(); --disable_query_log --disable_result_log connection server1; # Drop the local backup tables drop table mysql.user_backup; drop table mysql.db_backup; drop table mysql.tables_priv_backup; drop table mysql.columns_priv_backup; drop table mysql.procs_priv_backup; # Drop the distributed backup tables drop table mysql.ndb_user_backup; drop table mysql.ndb_db_backup; drop table mysql.ndb_tables_priv_backup; drop table mysql.ndb_columns_priv_backup; drop table mysql.ndb_procs_priv_backup; # Drop the function and sprocs drop function mysql.mysql_cluster_privileges_are_distributed; drop procedure mysql.mysql_cluster_backup_privileges; drop procedure mysql.mysql_cluster_move_grant_tables; drop procedure mysql.mysql_cluster_restore_local_privileges; drop procedure mysql.mysql_cluster_restore_privileges; drop procedure mysql.mysql_cluster_restore_privileges_from_local; drop procedure mysql.mysql_cluster_move_privileges; connection server2; # Drop the local backup tables drop table mysql.user_backup; drop table mysql.db_backup; drop table mysql.tables_priv_backup; drop table mysql.columns_priv_backup; drop table mysql.procs_priv_backup; # The distributed backup tables should already have been dropped --error ER_NO_SUCH_TABLE select * from mysql.ndb_user_backup; # Drop the function and sprocs drop function mysql.mysql_cluster_privileges_are_distributed; drop procedure mysql.mysql_cluster_backup_privileges; drop procedure mysql.mysql_cluster_move_grant_tables; drop procedure mysql.mysql_cluster_restore_local_privileges; drop procedure mysql.mysql_cluster_restore_privileges; drop procedure mysql.mysql_cluster_restore_privileges_from_local; drop procedure mysql.mysql_cluster_move_privileges; connection slave; # Drop the local backup tables drop table mysql.user_backup; drop table mysql.db_backup; drop table mysql.tables_priv_backup; drop table mysql.columns_priv_backup; drop table mysql.procs_priv_backup; # Drop the distributed backup tables(slave is stopped they # should still be there) drop table mysql.ndb_user_backup; drop table mysql.ndb_db_backup; drop table mysql.ndb_tables_priv_backup; drop table mysql.ndb_columns_priv_backup; drop table mysql.ndb_procs_priv_backup; # Drop the function and sprocs drop function mysql.mysql_cluster_privileges_are_distributed; drop procedure mysql.mysql_cluster_backup_privileges; drop procedure mysql.mysql_cluster_move_grant_tables; drop procedure mysql.mysql_cluster_restore_local_privileges; drop procedure mysql.mysql_cluster_restore_privileges; drop procedure mysql.mysql_cluster_restore_privileges_from_local; drop procedure mysql.mysql_cluster_move_privileges; # Force restart since other tests depend on the _exact_ # order of rows in for example mysql.user --source include/force_restart.inc --enable_query_log --enable_result_log