AnonSec Shell
Server IP : 185.86.78.101  /  Your IP : 216.73.216.124
Web Server : Apache
System : Linux 675867-vds-valikoshka1996.gmhost.pp.ua 5.4.0-150-generic #167-Ubuntu SMP Mon May 15 17:35:05 UTC 2023 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 : OFF
Directory :  /www/server/mysql/mysql-test/t/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /www/server/mysql/mysql-test/t/wl3836.test
# Created: Atanu Ghosh 2014-05-07
# WL#3836: Method to bring servers off line
 
--source include/not_embedded.inc
--source include/not_threadpool.inc
	  
--echo #
--echo # WL#3836:  Method to bring servers off line
--echo #

--disable_query_log
CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
--enable_query_log

# Save the global value to be used to restore the original value.
SET @global_saved_tmp =  @@global.offline_mode;

# Create a database to be used by all the connections.
# This is to ensure that all sessions connected to this DB is counted in this test case.

CREATE DATABASE wl3836;
USE wl3836;

--echo # Should report 1
SELECT COUNT(USER) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE DB LIKE 'wl3836';

# Create 2 non-super users

CREATE USER 'user1'@'localhost';
CREATE USER 'user2'@'localhost';

GRANT ALL ON wl3836.* TO 'user1'@'localhost', 'user2'@'localhost';
--connect(conu1,localhost,user1,'',wl3836)

# Non-super user cannot set this value
--error 1227
SET GLOBAL offline_mode=ON;

CREATE TABLE t1 (id INT PRIMARY KEY AUTO_INCREMENT) ENGINE=MYISAM;
CREATE TABLE t2 (id INT UNSIGNED NOT NULL);

INSERT INTO t1 VALUES
(0),(0),(0),(0),(0),(0),(0),(0), (0),(0),(0),(0),(0),(0),(0),(0),
(0),(0),(0),(0),(0),(0),(0),(0), (0),(0),(0),(0),(0),(0),(0),(0),
(0),(0),(0),(0),(0),(0),(0),(0), (0),(0),(0),(0),(0),(0),(0),(0),
(0),(0),(0),(0),(0),(0),(0),(0), (0),(0),(0),(0),(0),(0),(0),(0);
--disable_warnings
INSERT t1 SELECT 0 FROM t1 AS a1, t1 AS a2 LIMIT 4032;
--enable_warnings

INSERT INTO t2 SELECT id FROM t1;

--source include/turn_off_only_full_group_by.inc

# Intentionally create a long running query
send SELECT id FROM t1 WHERE id IN
     (SELECT DISTINCT a.id FROM t2 a, t2 b, t2 c, t2 d
     GROUP BY ACOS(1/a.id), b.id, c.id, d.id
     HAVING a.id BETWEEN 10 AND 20);

--connect(conu2,localhost,user2,'',wl3836)

--connection default

--echo # Should report 3
SELECT COUNT(USER) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE DB LIKE 'wl3836';

SET GLOBAL offline_mode = ON;

# Wait until all non super user have been disconnected (for slow machines)
let $wait_condition=SELECT COUNT(USER) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE DB LIKE 'wl3836';
--source include/wait_condition.inc

--echo # Should report 1
SELECT COUNT(USER) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE DB LIKE 'wl3836';

# No other non-super user should be allowed to connect
--error ER_SERVER_OFFLINE_MODE
--connection conu1

--echo # Root user should be allowed to connect
--connect(conu3,localhost,root,'',wl3836)

--connection default

--echo # Should report 2
SELECT COUNT(USER) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE DB LIKE 'wl3836';

SET GLOBAL offline_mode=OFF;

DROP DATABASE wl3836;

DROP USER 'user1'@'localhost';
DROP USER 'user2'@'localhost';

--echo # Test for replication slave threads

--source include/master-slave.inc
connection slave;
connection master;
--echo # Should report 7 root processes
SELECT COUNT(USER) FROM INFORMATION_SCHEMA.PROCESSLIST;
SET GLOBAL offline_mode=ON;
# Connection count should remain same as Binlog dump thread should not be killed
--echo # Should report 7 root processes
SELECT COUNT(USER) FROM INFORMATION_SCHEMA.PROCESSLIST;
--connection slave
SET @slave_saved_tmp = @@global.offline_mode;
--echo # Should report 6 root processes
SELECT COUNT(USER) FROM INFORMATION_SCHEMA.PROCESSLIST;
SET GLOBAL offline_mode=ON;
# Connection count should remain same as slave threads should not be killed
--echo # Should report 6 root processes
SELECT COUNT(USER) FROM INFORMATION_SCHEMA.PROCESSLIST;

#Restore back original value
SET GLOBAL offline_mode = @slave_saved_tmp;
--source include/rpl_end.inc

--connection default
# Wait until all user have been disconnected (for slow machines)
#let $wait_condition=SELECT COUNT(USER) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST;
#--source include/wait_condition.inc

--echo # Restoring the original values.
SET @@global.offline_mode = @global_saved_tmp;

Anon7 - 2022
AnonSec Team