Merge lp:~tplavcic/percona-server/ps-bld-228-5.1 into lp:percona-server/5.1

Proposed by Tomislav Plavcic
Status: Merged
Approved by: Laurynas Biveinis
Approved revision: no longer in the source branch.
Merged at revision: 626
Proposed branch: lp:~tplavcic/percona-server/ps-bld-228-5.1
Merge into: lp:percona-server/5.1
Diff against target: 22 lines (+8/-2)
1 file modified
build/debian/percona-server-server-5.1.mysql.init (+8/-2)
To merge this branch: bzr merge lp:~tplavcic/percona-server/ps-bld-228-5.1
Reviewer Review Type Date Requested Status
Laurynas Biveinis (community) Approve
Review via email: mp+243775@code.launchpad.net

Description of the change

Debian init script (start) has hardcoded wait for 14sec and if the server is not pingable in that time it fails - which is not good in some cases.
Change has been made to wait forever and exit if server responds to ping and also after first 10 sec start to check for pid also and if it doesn't exists then we assume server died and fail.

Testing has been done for 5.5 and 5.6 using packages from main repo and just replaced with the new init script.

PS 5.5 - ubuntu 14.04
= looks ok
=====================
vagrant@t-ubuntu14:~$ sudo /etc/init.d/mysql start
 * Starting MySQL (Percona Server) database server mysqld
   ...done.
 * Checking for corrupt, not cleanly closed and upgrade needing tables.
vagrant@t-ubuntu14:~$ mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 37
Server version: 5.5.40-36.1 Percona Server (GPL), Release 36.1, Revision 707

Copyright (c) 2009-2014 Percona LLC and/or its affiliates
Copyright (c) 2000, 2014, 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> quit;
Bye
vagrant@t-ubuntu14:~$ sudo /etc/init.d/mysql stop
 * Stopping MySQL (Percona Server) mysqld
   ...done.

PS 5.5 - ubuntu 14.04 - simulated server not started by commenting mysqld_safe
= script waited 10 sec to check for pid and then failed
==============================================================================
vagrant@t-ubuntu14:~$ sudo /etc/init.d/mysql start
 * Starting MySQL (Percona Server) database server mysqld
   ...fail!
vagrant@t-ubuntu14:~$ mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

PS 5.6 - ubuntu 14.04
= looks ok
=====================
vagrant@t-ubuntu14:~$ sudo /etc/init.d/mysql start
 * Starting MySQL (Percona Server) database server mysqld
   ...done.
 * Checking for corrupt, not cleanly closed and upgrade needing tables.
vagrant@t-ubuntu14:~$ mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 45
Server version: 5.6.21-70.1 Percona Server (GPL), Release 70.1, Revision 698

Copyright (c) 2009-2014 Percona LLC and/or its affiliates
Copyright (c) 2000, 2014, 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> quit;
Bye
vagrant@t-ubuntu14:~$ sudo /etc/init.d/mysql stop
 * Stopping MySQL (Percona Server) mysqld
   ...done.

PS 5.6 - ubuntu 14.04 - simulated server not started by commenting mysqld_safe
= script waited 10 sec to check for pid and then failed
==============================================================================
vagrant@t-ubuntu14:~$ sudo /etc/init.d/mysql start
 * Starting MySQL (Percona Server) database server mysqld
   ...fail!
vagrant@t-ubuntu14:~$ mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

To post a comment you must log in.
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :

Was 5.1 tested too? The description mentions 5.5 and 5.6

review: Needs Information
Revision history for this message
Tomislav Plavcic (tplavcic) wrote :

Not initially, but I tested now - results look the same as for 5.5/5.6 (see below):

# normal startup (ubuntu precise)
= looks ok
vagrant@t-ubuntu1204-64:/vagrant$ sudo /etc/init.d/mysql start
 * /etc/init.d/mysql: WARNING: /etc/mysql/my.cnf cannot be read. See README.Debian.gz
 * Starting MySQL (Percona Server) mysqld
   ...done.
 * Checking for corrupt, not cleanly closed and upgrade needing tables.
vagrant@t-ubuntu1204-64:/vagrant$ mysql
ERROR 1045 (28000): Access denied for user 'vagrant'@'localhost' (using password: NO)
vagrant@t-ubuntu1204-64:/vagrant$ mysql -uroot
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 36
Server version: 5.1.73-14.12 Percona Server (GPL), 14.12, Revision 624

Copyright (c) 2009-2013 Percona LLC and/or its affiliates
Copyright (c) 2000, 2013, 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> quit
Bye
vagrant@t-ubuntu1204-64:/vagrant$ sudo /etc/init.d/mysql stop
 * Stopping MySQL (Percona Server) mysqld
   ...done.

# commented mysqld_safe in the script
= script waited for 10s and then failed when no pid found
vagrant@t-ubuntu1204-64:/vagrant$ sudo /etc/init.d/mysql start
 * /etc/init.d/mysql: WARNING: /etc/mysql/my.cnf cannot be read. See README.Debian.gz
 * Starting MySQL (Percona Server) mysqld
   ...fail!

vagrant@t-ubuntu1204-64:/vagrant$ mysql -uroot
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

Revision history for this message
Laurynas Biveinis (laurynas-biveinis) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'build/debian/percona-server-server-5.1.mysql.init'
2--- build/debian/percona-server-server-5.1.mysql.init 2011-04-11 10:39:39 +0000
3+++ build/debian/percona-server-server-5.1.mysql.init 2014-12-05 10:43:42 +0000
4@@ -103,10 +103,16 @@
5 log_end_msg 0
6 else
7 /usr/bin/mysqld_safe > /dev/null 2>&1 &
8- # 6s was reported in #352070 to be too few when using ndbcluster
9- for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14; do
10+ dead_check_counter=0
11+ while true; do
12 sleep 1
13 if mysqld_status check_alive nowarn ; then break; fi
14+ # wait 10sec before start checking if pid file created or server is dead
15+ if [ $dead_check_counter -lt 10 ]; then
16+ dead_check_counter=$(( dead_check_counter + 1 ))
17+ else
18+ if mysqld_status check_dead nowarn; then break; fi
19+ fi
20 log_progress_msg "."
21 done
22 if mysqld_status check_alive warn; then

Subscribers

People subscribed via source and target branches