Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed RPMs assumes that .pid file is located in datadir (bug1201896) #23

Merged
merged 1 commit into from Feb 27, 2015

Conversation

tplavcic
Copy link
Member

If the user had pid file located in directory other than datadir when upgrading the server didn't automatically start if it was started before - reported in bugs 1201896, 1311840 and probably also 1378944.
Also when installing there was this listing which doesn't look nice and it's fixed now to print err files only if they exist (suggested in one of the bug comments):
db-02: ls: cannot access /var/lib/mysql//.err: No such file or directory
db-02: ls: cannot access /var/lib/mysql//
.err: No such file or directory

TEST PACKAGES:
http://jenkins.percona.com/view/Percona-RELEASES/job/percona-server-5.5-redhat-binary/148/
http://jenkins.percona.com/view/Percona-RELEASES/job/percona-server-5.6-redhat-binary/133/

5.5 SOME TESTING:

5.5 install test:

[vagrant@t-centos6-64 ~]$ sudo yum install *.rpm
...
Total size: 97 M
Installed size: 97 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : Percona-Server-shared-55-5.5.40-rel36.1.el6.x86_64 1/3
Installing : Percona-Server-client-55-5.5.40-rel36.1.el6.x86_64 2/3
Installing : Percona-Server-server-55-5.5.40-rel36.1.el6.x86_64 3/3
Error in my_thread_global_end(): 1 threads didn't exit
Error in my_thread_global_end(): 1 threads didn't exit

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h t-centos6-64 password 'new-password'

Alternatively you can run:
/usr/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.

See the manual for more instructions.

Please report any problems at
https://bugs.launchpad.net/percona-server/+filebug

Percona recommends that all production deployments be protected with a support
contract (http://www.percona.com/mysql-suppport/) to ensure the highest uptime,
be eligible for hot fixes, and boost your team's productivity.
Percona Server is distributed with several useful UDF (User Defined Function) from Percona Toolkit.
Run the following commands to create these functions:
mysql -e "CREATE FUNCTION fnv1a_64 RETURNS INTEGER SONAME 'libfnv1a_udf.so'"
mysql -e "CREATE FUNCTION fnv_64 RETURNS INTEGER SONAME 'libfnv_udf.so'"
mysql -e "CREATE FUNCTION murmur_hash RETURNS INTEGER SONAME 'libmurmur_udf.so'"
See http://www.percona.com/doc/percona-server/5.5/management/udf_percona_toolkit.html for more details
Verifying : Percona-Server-client-55-5.5.40-rel36.1.el6.x86_64 1/3
Verifying : Percona-Server-shared-55-5.5.40-rel36.1.el6.x86_64 2/3
Verifying : Percona-Server-server-55-5.5.40-rel36.1.el6.x86_64 3/3

Installed:
Percona-Server-client-55.x86_64 0:5.5.40-rel36.1.el6 Percona-Server-server-55.x86_64 0:5.5.40-rel36.1.el6 Percona-Server-shared-55.x86_64 0:5.5.40-rel36.1.el6

Complete!

5.5 UPGRADE TEST WHEN PID FILE IS IN DATADIR:

STATUS BEFORE:

[vagrant@t-centos6-64 ~]$ sudo service mysql status
SUCCESS! MySQL (Percona Server) running (1366)
[vagrant@t-centos6-64 ~]$ sudo ls /var/lib/mysql/.pid
/var/lib/mysql/t-centos6-64.pid
[vagrant@t-centos6-64 ~]$ sudo ls /var/lib/mysql/
.sock
/var/lib/mysql/mysql.sock

UPGRADE:

[vagrant@t-centos6-64 ~]$ sudo yum install *.rpm
...
Dependencies Resolved
...
Upgrade 3 Package(s)

Total size: 97 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Updating : Percona-Server-shared-55-5.5.40-rel36.1.el6.x86_64 1/6
Updating : Percona-Server-client-55-5.5.40-rel36.1.el6.x86_64 2/6
Updating : Percona-Server-server-55-5.5.40-rel36.1.el6.x86_64 3/6
Giving mysqld 5 seconds to exit nicely
Starting MySQL (Percona Server).. SUCCESS!
Giving mysqld 5 seconds to start
Percona Server is distributed with several useful UDF (User Defined Function) from Percona Toolkit.
Run the following commands to create these functions:
mysql -e "CREATE FUNCTION fnv1a_64 RETURNS INTEGER SONAME 'libfnv1a_udf.so'"
mysql -e "CREATE FUNCTION fnv_64 RETURNS INTEGER SONAME 'libfnv_udf.so'"
mysql -e "CREATE FUNCTION murmur_hash RETURNS INTEGER SONAME 'libmurmur_udf.so'"
See http://www.percona.com/doc/percona-server/5.5/management/udf_percona_toolkit.html for more details
Cleanup : Percona-Server-server-55-5.5.39-rel36.0.el6.x86_64 4/6
Cleanup : Percona-Server-client-55-5.5.39-rel36.0.el6.x86_64 5/6
Cleanup : Percona-Server-shared-55-5.5.39-rel36.0.el6.x86_64 6/6
Verifying : Percona-Server-server-55-5.5.40-rel36.1.el6.x86_64 1/6
Verifying : Percona-Server-shared-55-5.5.40-rel36.1.el6.x86_64 2/6
Verifying : Percona-Server-client-55-5.5.40-rel36.1.el6.x86_64 3/6
Verifying : Percona-Server-client-55-5.5.39-rel36.0.el6.x86_64 4/6
Verifying : Percona-Server-shared-55-5.5.39-rel36.0.el6.x86_64 5/6
Verifying : Percona-Server-server-55-5.5.39-rel36.0.el6.x86_64 6/6

Updated:
Percona-Server-client-55.x86_64 0:5.5.40-rel36.1.el6 Percona-Server-server-55.x86_64 0:5.5.40-rel36.1.el6 Percona-Server-shared-55.x86_64 0:5.5.40-rel36.1.el6

Complete!

STATUS AFTER UPGRADE:

[vagrant@t-centos6-64 ~]$ sudo service mysql status
SUCCESS! MySQL (Percona Server) running (2491)
[vagrant@t-centos6-64 ~]$ sudo ls /var/lib/mysql/.sock
/var/lib/mysql/mysql.sock
[vagrant@t-centos6-64 ~]$ sudo ls /var/lib/mysql/
.pid
/var/lib/mysql/t-centos6-64.pid

5.5 UPGRADE TEST WHEN PID FILE IS NOT IN DATADIR:

STATUS BEFORE:

[vagrant@t-centos6-64 ~]$ sudo /etc/init.d/mysql start
Starting MySQL (Percona Server).. SUCCESS!
[vagrant@t-centos6-64 ~]$ ls /tmp/.pid
/tmp/mysqld.pid
[vagrant@t-centos6-64 ~]$ ls /var/lib/mysql/
.pid
ls: cannot access /var/lib/mysql/.pid: No such file or directory
[vagrant@t-centos6-64 ~]$ ls /var/lib/mysql/
.sock
/var/lib/mysql/mysql.sock

UPGRADE:

[vagrant@t-centos6-64 ~]$ sudo yum install *.rpm
...
Dependencies Resolved
...
Upgrade 3 Package(s)

Total size: 97 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Updating : Percona-Server-shared-55-5.5.40-rel36.1.el6.x86_64 1/6
Updating : Percona-Server-client-55-5.5.40-rel36.1.el6.x86_64 2/6
Updating : Percona-Server-server-55-5.5.40-rel36.1.el6.x86_64 3/6
Giving mysqld 5 seconds to exit nicely
Starting MySQL (Percona Server).. SUCCESS!
Giving mysqld 5 seconds to start
Percona Server is distributed with several useful UDF (User Defined Function) from Percona Toolkit.
Run the following commands to create these functions:
mysql -e "CREATE FUNCTION fnv1a_64 RETURNS INTEGER SONAME 'libfnv1a_udf.so'"
mysql -e "CREATE FUNCTION fnv_64 RETURNS INTEGER SONAME 'libfnv_udf.so'"
mysql -e "CREATE FUNCTION murmur_hash RETURNS INTEGER SONAME 'libmurmur_udf.so'"
See http://www.percona.com/doc/percona-server/5.5/management/udf_percona_toolkit.html for more details
Cleanup : Percona-Server-server-55-5.5.39-rel36.0.el6.x86_64 4/6
Cleanup : Percona-Server-client-55-5.5.39-rel36.0.el6.x86_64 5/6
Cleanup : Percona-Server-shared-55-5.5.39-rel36.0.el6.x86_64 6/6
Verifying : Percona-Server-server-55-5.5.40-rel36.1.el6.x86_64 1/6
Verifying : Percona-Server-shared-55-5.5.40-rel36.1.el6.x86_64 2/6
Verifying : Percona-Server-client-55-5.5.40-rel36.1.el6.x86_64 3/6
Verifying : Percona-Server-client-55-5.5.39-rel36.0.el6.x86_64 4/6
Verifying : Percona-Server-shared-55-5.5.39-rel36.0.el6.x86_64 5/6
Verifying : Percona-Server-server-55-5.5.39-rel36.0.el6.x86_64 6/6

Updated:
Percona-Server-client-55.x86_64 0:5.5.40-rel36.1.el6 Percona-Server-server-55.x86_64 0:5.5.40-rel36.1.el6 Percona-Server-shared-55.x86_64 0:5.5.40-rel36.1.el6

Complete!

STATUS AFTER UPGRADE:

[vagrant@t-centos6-64 ~]$ sudo service mysql status
SUCCESS! MySQL (Percona Server) running (2981)
[vagrant@t-centos6-64 ~]$ sudo service mysql status
SUCCESS! MySQL (Percona Server) running (2981)
[vagrant@t-centos6-64 ~]$ ls /tmp/.pid
/tmp/mysqld.pid
[vagrant@t-centos6-64 ~]$ ls /var/lib/mysql/
.pid
ls: cannot access /var/lib/mysql/.pid: No such file or directory
[vagrant@t-centos6-64 ~]$ ls /var/lib/mysql/
.sock
/var/lib/mysql/mysql.sock

@@ -635,11 +635,17 @@ rm -rf $RBR%{_sysconfdir}/init.d/mysql
if [ -x %{_bindir}/my_print_defaults ]
then
mysql_datadir=`%{_bindir}/my_print_defaults server mysqld | grep '^--datadir=' | sed -n 's/--datadir=//p' | tail -n 1`
PID_FILE_PATT=`%{_bindir}/my_print_defaults server mysqld | grep '^--pid-file=' | sed -n 's/--pid-file=//p'`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does "PATT" mean here? Could it be a typo for PATH?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe it's PID_FILE_PATT{ERN} (see line 646)

@tplavcic
Copy link
Member Author

Yes, it is pattern as David noticed - in some cases it can contain multiple pids.

laurynas-biveinis added a commit that referenced this pull request Feb 27, 2015
Fixed RPMs assumes that .pid file is located in datadir (bug1201896)
@laurynas-biveinis laurynas-biveinis merged commit c2d6729 into percona:5.5 Feb 27, 2015
@tplavcic tplavcic deleted the 5.5-ps-bug1201896 branch March 9, 2015 15:03
BohuTANG added a commit to xelabs/tokudb that referenced this pull request Dec 24, 2017
Summary:
In the xa transation 'XA END' phase(thd_sql_command is SQLCOM_END), TokuDB slave will create both transaction for trx->sp_level and trx->stmt, this will cause the toku_xids_can_create_child abort since the trx->sp_level->xids is 0x00.

How to reproduce:
With tokudb_debug=32, do the queries on master:
create table t1(a int)engine=tokudb;

xa start 'x1';
insert into t1 values(1);
xa end 'x1';
xa prepare 'x1';
xa commit 'x1';

xa start 'x2';
insert into t1 values(2);
xa end 'x2';
xa prepare 'x2';
xa commit 'x2';

Slave debug info:
xa start 'x1';
insert into t1 values(1);
xa end 'x1';
xa prepare 'x1';
xa commit 'x1';
2123 0x7ff2d44c5830 /u01/tokudb/storage/tokudb/ha_tokudb.cc:6533 ha_tokudb::external_lock trx (nil) (nil) (nil) (nil) 0 0
2123 /u01/tokudb/storage/tokudb/tokudb_txn.h:127 txn_begin begin txn (nil) 0x7ff2d44a3000 67108864 r=0
2123 0x7ff2d44c5830 /u01/tokudb/storage/tokudb/ha_tokudb.cc:6426 ha_tokudb::create_txn created master 0x7ff2d44a3000
2123 /u01/tokudb/storage/tokudb/tokudb_txn.h:127 txn_begin begin txn 0x7ff2d44a3000 0x7ff2d44a3100 1 r=0
2123 0x7ff2d44c5830 /u01/tokudb/storage/tokudb/ha_tokudb.cc:6468 ha_tokudb::create_txn created stmt 0x7ff2d44a3000 sp_level 0x7ff2d44a3100
2123 0x7ff2d44c5830 /u01/tokudb/storage/tokudb/ha_tokudb.cc:4120 ha_tokudb::write_row txn 0x7ff2d44a3100
2123 /u01/tokudb/storage/tokudb/hatoku_hton.cc:942 tokudb_commit commit trx 0 txn 0x7ff2d44a3100 syncflag 512

xa start 'x2';
insert into t1 values(2);
xa end 'x2';
xa prepare 'x2';
xa commit 'x2';
2123 0x7ff2d44c5830 /u01/tokudb/storage/tokudb/ha_tokudb.cc:6533 ha_tokudb::external_lock trx 0x7ff2d44a3000 (nil) 0x7ff2d44a3000 (nil) 0 0
2123 /u01/tokudb/storage/tokudb/tokudb_txn.h:127 txn_begin begin txn 0x7ff2d44a3000 0x7ff2d44a3000 1 r=0
2123 0x7ff2d44c5830 /u01/tokudb/storage/tokudb/ha_tokudb.cc:6468 ha_tokudb::create_txn created stmt 0x7ff2d44a3000 sp_level 0x7ff2d44a3000
2123 0x7ff2d44c5830 /u01/tokudb/storage/tokudb/ha_tokudb.cc:4120 ha_tokudb::write_row txn 0x7ff2d44a3000
2017-12-24T08:36:45.347405Z 11 [ERROR] TokuDB: toku_db_put: Transaction cannot do work when child exists

2017-12-24T08:36:45.347444Z 11 [Warning] Slave: Got error 22 from storage engine Error_code: 1030
2017-12-24T08:36:45.347448Z 11 [ERROR] Error running query, slave SQL thread aborted. Fix the problem, and restart the slave SQL thread with 'SLAVE START'. We stopped at log 'mysql-bin.000001' position 1007
2123 /u01/tokudb/storage/tokudb/hatoku_hton.cc:972 tokudb_rollback rollback 0 txn 0x7ff2d44a3000
Segmentation fault (core dumped)

This crash caused by the parent->xid is 0x00.
The core statck info:
(gdb) bt
#0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=11) at ../sysdeps/unix/sysv/linux/pthread_kill.c:62
#1  0x0000000000f6b647 in my_write_core (sig=sig@entry=11) at /u01/tokudb/mysys/stacktrace.c:249
#2  0x000000000086b945 in handle_fatal_signal (sig=11) at /u01/tokudb/sql/signal_handler.cc:223
#3  <signal handler called>
#4  toku_xids_can_create_child (xids=0x0) at /u01/tokudb/storage/tokudb/PerconaFT/ft/txn/xids.cc:93
#5  0x000000000080531f in toku_txn_begin_with_xid (parent=0x7f0bf501c280, txnp=0x7f0bf50a3490, logger=0x7f0c415e66c0, xid=..., snapshot_type=TXN_SNAPSHOT_CHILD, container_db_txn=0x7f0bf50a3400, for_recovery=false, read_only=false) at /u01/tokudb/storage/tokudb/PerconaFT/ft/txn/txn.cc:137
#6  0x00000000007aa6a2 in toku_txn_begin (env=0x7f0c819fde00, stxn=0x7f0bf50a3300, txn=0x7f0bf500dca8, flags=<optimized out>) at /u01/tokudb/storage/tokudb/PerconaFT/src/ydb_txn.cc:579
#7  0x0000000000f99323 in txn_begin (thd=0x7f0bf504bfc0, flags=1, txn=0x7f0bf500dca8, parent=0x7f0bf50a3300, env=<optimized out>) at /u01/tokudb/storage/tokudb/tokudb_txn.h:116
#8  ha_tokudb::create_txn (this=0x7f0bf50c8830, thd=0x7f0bf504bfc0, trx=0x7f0bf500dca0) at /u01/tokudb/storage/tokudb/ha_tokudb.cc:6458
#9  0x0000000000fa48f9 in ha_tokudb::external_lock (this=0x7f0bf50c8830, thd=0x7f0bf504bfc0, lock_type=1) at /u01/tokudb/storage/tokudb/ha_tokudb.cc:6544
#10 0x00000000008d46eb in handler::ha_external_lock (this=0x7f0bf50c8830, thd=thd@entry=0x7f0bf504bfc0, lock_type=lock_type@entry=1) at /u01/tokudb/sql/handler.cc:8352
#11 0x0000000000e4f3b4 in lock_external (count=1, tables=0x7f0bf5050688, thd=0x7f0bf504bfc0) at /u01/tokudb/sql/lock.cc:389
#12 mysql_lock_tables (thd=thd@entry=0x7f0bf504bfc0, tables=<optimized out>, count=<optimized out>, flags=0) at /u01/tokudb/sql/lock.cc:325
#13 0x0000000000cd0b6d in lock_tables (thd=thd@entry=0x7f0bf504bfc0, tables=0x7f0bf4d11020, count=<optimized out>, flags=flags@entry=0) at /u01/tokudb/sql/sql_base.cc:6705
#14 0x0000000000cd61f2 in open_and_lock_tables (thd=0x7f0bf504bfc0, tables=0x7f0bf4d11020, flags=flags@entry=0, prelocking_strategy=prelocking_strategy@entry=0x7f0c89629680) at /u01/tokudb/sql/sql_base.cc:6523
percona#15 0x0000000000ee09eb in open_and_lock_tables (flags=0, tables=<optimized out>, thd=<optimized out>) at /u01/tokudb/sql/sql_base.h:484
percona#16 Rows_log_event::do_apply_event (this=0x7f0bf50ab4a0, rli=0x7f0c87762800) at /u01/tokudb/sql/log_event.cc:10911
percona#17 0x0000000000ed71c0 in Log_event::apply_event (this=this@entry=0x7f0bf50ab4a0, rli=rli@entry=0x7f0c87762800) at /u01/tokudb/sql/log_event.cc:3329
percona#18 0x0000000000f1d233 in apply_event_and_update_pos (ptr_ev=ptr_ev@entry=0x7f0c89629940, thd=thd@entry=0x7f0bf504bfc0, rli=rli@entry=0x7f0c87762800) at /u01/tokudb/sql/rpl_slave.cc:4761
percona#19 0x0000000000f280a8 in exec_relay_log_event (rli=0x7f0c87762800, thd=0x7f0bf504bfc0) at /u01/tokudb/sql/rpl_slave.cc:5276
percona#20 handle_slave_sql (arg=<optimized out>) at /u01/tokudb/sql/rpl_slave.cc:7491
percona#21 0x00000000013c6184 in pfs_spawn_thread (arg=0x7f0bf5bea820) at /u01/tokudb/storage/perfschema/pfs.cc:2185
percona#22 0x00007f0c885126ba in start_thread (arg=0x7f0c8962a700) at pthread_create.c:333
percona#23 0x00007f0c87d293dd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
(gdb) f 10
#10 0x00000000008d46eb in handler::ha_external_lock (this=0x7f0bf50c8830, thd=thd@entry=0x7f0bf504bfc0, lock_type=lock_type@entry=1) at /u01/tokudb/sql/handler.cc:8352
8352    /u01/tokudb/sql/handler.cc: No such file or directory.
(gdb) p thd->lex->sql_command
 = SQLCOM_END

With the fixed patch, the debug info is:
xa start 'x1';
insert into t1 values(1);
xa end 'x1';
xa prepare 'x1';
xa commit 'x1';
24111 0x7f4aba6c4830 /u01/tokudb/storage/tokudb/ha_tokudb.cc:6534 ha_tokudb::external_lock trx (nil) (nil) (nil) (nil) 0 0
24111 /u01/tokudb/storage/tokudb/tokudb_txn.h:127 txn_begin begin txn (nil) 0x7f4aba689000 67108864 r=0
24111 0x7f4aba6c4830 /u01/tokudb/storage/tokudb/ha_tokudb.cc:6469 ha_tokudb::create_txn created stmt (nil) sp_level 0x7f4aba689000
24111 0x7f4aba6c4830 /u01/tokudb/storage/tokudb/ha_tokudb.cc:4120 ha_tokudb::write_row txn 0x7f4aba689000
24111 /u01/tokudb/storage/tokudb/hatoku_hton.cc:942 tokudb_commit commit trx 0 txn 0x7f4aba689000 syncflag 512

xa start 'x2';
insert into t1 values(2);
xa end 'x2';
xa prepare 'x2';
xa commit 'x2';
24111 0x7f4aba6c4830 /u01/tokudb/storage/tokudb/ha_tokudb.cc:6534 ha_tokudb::external_lock trx (nil) (nil) (nil) (nil) 0 0
24111 /u01/tokudb/storage/tokudb/tokudb_txn.h:127 txn_begin begin txn (nil) 0x7f4aba689000 67108864 r=0
24111 0x7f4aba6c4830 /u01/tokudb/storage/tokudb/ha_tokudb.cc:6469 ha_tokudb::create_txn created stmt (nil) sp_level 0x7f4aba689000
24111 0x7f4aba6c4830 /u01/tokudb/storage/tokudb/ha_tokudb.cc:4120 ha_tokudb::write_row txn 0x7f4aba689000
24111 /u01/tokudb/storage/tokudb/hatoku_hton.cc:942 tokudb_commit commit trx 0 txn 0x7f4aba689000 syncflag 512

Test:
mtr --suite=tokudb xa

Reviewed by: Rik
ldonoso pushed a commit to ldonoso/percona-server that referenced this pull request Nov 4, 2021
Fold init_handler_for_statement() into start_statement()

Change-Id: Iff526970ec3bd6f03e71760239bbc78adbaaab44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants