pt-slave-delay not parsing host out of config file (host=true)

Bug #1430090 reported by Daniel Black
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona Toolkit moved to https://jira.percona.com/projects/PT
Confirmed
Undecided
Unassigned

Bug Description

ends up with host=true for master DSN with host=localhost in config (intended for slave DSN)

more /etc/percona-toolkit/pt-slave-delay.conf

delay=24h
interval=60m

daemonize=true
log=/var/log/pt-slave-delay.log

host=localhost
user=openquery
password=XXXX

# /usr/bin/pt-slave-delay
# /usr/bin/perl 5.010001
# Linux tulwaurp009 2.6.32-358.18.1.el6.x86_64 #1 SMP Fri Aug 2 17:04:38 EDT 2013 x86_64 x86_64 x86_64 GNU/Linux
# Arguments:
# OptionParser:275 27768 Option rule: This tool accepts additional command-line arguments. Refer to the SYNOPSIS and usage information for details.
# OptionParser:284 27768 =item --ask-pass
# OptionParser:303 27768 Option has no attributes
# OptionParser:311 27768 Short help: Prompt for a password when connecting to MySQL
# OptionParser:284 27768 =item --charset
# OptionParser:311 27768 Short help: Default character set
# OptionParser:284 27768 =item --config
# OptionParser:311 27768 Short help: Read this comma-separated list of config files; if specified, this must be the first option on the command line
# OptionParser:284 27768 =item --[no]continue
# OptionParser:311 27768 Short help: Continue replication normally on exit
# OptionParser:284 27768 =item --daemonize
# OptionParser:303 27768 Option has no attributes
# OptionParser:311 27768 Short help: Fork to the background and detach from the shell
# OptionParser:284 27768 =item --database
# OptionParser:311 27768 Short help: The database to use for the connection
# OptionParser:284 27768 =item --defaults-file
# OptionParser:311 27768 Short help: Only read mysql options from the given file
# OptionParser:284 27768 =item --delay
# OptionParser:311 27768 Short help: How far the slave should lag its master
# OptionParser:284 27768 =item --help
# OptionParser:303 27768 Option has no attributes
# OptionParser:311 27768 Short help: Show help and exit
# OptionParser:284 27768 =item --host
# OptionParser:311 27768 Short help: Connect to host
# OptionParser:284 27768 =item --interval
# OptionParser:311 27768 Short help: How frequently pt-slave-delay should check whether the slave needs to be started or stopped
# OptionParser:284 27768 =item --log
# OptionParser:311 27768 Short help: Print all output to this file when daemonized
# OptionParser:284 27768 =item --password
# OptionParser:311 27768 Short help: Password to use when connecting
# OptionParser:284 27768 =item --pid
# OptionParser:311 27768 Short help: Create the given PID file
# OptionParser:284 27768 =item --port
# OptionParser:311 27768 Short help: Port number to use for connection
# OptionParser:284 27768 =item --quiet
# OptionParser:311 27768 Short help: Don't print informational messages about operation
# OptionParser:284 27768 =item --run-time
# OptionParser:311 27768 Short help: How long pt-slave-delay should run before exiting
# OptionParser:284 27768 =item --set-vars
# OptionParser:311 27768 Short help: Set the MySQL variables in this comma-separated list of variable=value pairs
# OptionParser:284 27768 =item --socket
# OptionParser:311 27768 Short help: Socket file to use for connection
# OptionParser:284 27768 =item --use-master
# OptionParser:303 27768 Option has no attributes
# OptionParser:311 27768 Short help: Get binlog positions from master, not slave
# OptionParser:284 27768 =item --user
# OptionParser:311 27768 Short help: User for login if not current user
# OptionParser:284 27768 =item --version
# OptionParser:303 27768 Option has no attributes
# OptionParser:311 27768 Short help: Show version and exit
# OptionParser:284 27768 =item --[no]version-check
# OptionParser:311 27768 Short help: Check for the latest version of Percona Toolkit, MySQL, and other programs
# OptionParser:350 27768 Parsing opt spec: group => default spec => ask-pass desc => Prompt for a password when connecting to MySQL
# OptionParser:388 27768 ask-pass type: undef
# OptionParser:350 27768 Parsing opt spec: group => default spec => charset|A=s desc => Default character set
# OptionParser:388 27768 charset type: s
# OptionParser:350 27768 Parsing opt spec: group => default spec => config=A desc => Read this comma-separated list of config files; if specified, this must be the first option on the command line
# OptionParser:388 27768 config type: A
# OptionParser:350 27768 Parsing opt spec: group => default spec => continue! desc => Continue replication normally on exit (default yes)
# OptionParser:388 27768 continue type: undef
# OptionParser:395 27768 continue default: yes
# OptionParser:350 27768 Parsing opt spec: group => default spec => daemonize desc => Fork to the background and detach from the shell
# OptionParser:388 27768 daemonize type: undef
# OptionParser:350 27768 Parsing opt spec: group => default spec => database|D=s desc => The database to use for the connection
# OptionParser:388 27768 database type: s
# OptionParser:350 27768 Parsing opt spec: group => default spec => defaults-file|F=s desc => Only read mysql options from the given file
# OptionParser:388 27768 defaults-file type: s
# OptionParser:350 27768 Parsing opt spec: group => default spec => delay=m desc => How far the slave should lag its master (default 1h)
# OptionParser:388 27768 delay type: m
# OptionParser:395 27768 delay default: 1h
# OptionParser:350 27768 Parsing opt spec: group => default spec => help desc => Show help and exit
# OptionParser:388 27768 help type: undef
# OptionParser:350 27768 Parsing opt spec: group => default spec => host|h=s desc => Connect to host
# OptionParser:388 27768 host type: s
# OptionParser:350 27768 Parsing opt spec: group => default spec => interval=m desc => How frequently pt-slave-delay should check whether the slave needs to be started or stopped (default 1m)
# OptionParser:388 27768 interval type: m
# OptionParser:395 27768 interval default: 1m
# OptionParser:350 27768 Parsing opt spec: group => default spec => log=s desc => Print all output to this file when daemonized
# OptionParser:388 27768 log type: s
# OptionParser:350 27768 Parsing opt spec: group => default spec => password|p=s desc => Password to use when connecting
# OptionParser:388 27768 password type: s
# OptionParser:350 27768 Parsing opt spec: group => default spec => pid=s desc => Create the given PID file
# OptionParser:388 27768 pid type: s
# OptionParser:350 27768 Parsing opt spec: group => default spec => port|P=i desc => Port number to use for connection
# OptionParser:388 27768 port type: i
# OptionParser:350 27768 Parsing opt spec: group => default spec => quiet|q desc => Don't print informational messages about operation
# OptionParser:388 27768 quiet type: undef
# OptionParser:350 27768 Parsing opt spec: group => default spec => run-time=m desc => How long pt-slave-delay should run before exiting
# OptionParser:388 27768 run-time type: m
# OptionParser:350 27768 Parsing opt spec: group => default spec => set-vars=A desc => Set the MySQL variables in this comma-separated list of variable=value pairs
# OptionParser:388 27768 set-vars type: A
# OptionParser:350 27768 Parsing opt spec: group => default spec => socket|S=s desc => Socket file to use for connection
# OptionParser:388 27768 socket type: s
# OptionParser:350 27768 Parsing opt spec: group => default spec => use-master desc => Get binlog positions from master, not slave
# OptionParser:388 27768 use-master type: undef
# OptionParser:350 27768 Parsing opt spec: group => default spec => user|u=s desc => User for login if not current user
# OptionParser:388 27768 user type: s
# OptionParser:350 27768 Parsing opt spec: group => default spec => version desc => Show version and exit
# OptionParser:388 27768 version type: undef
# OptionParser:350 27768 Parsing opt spec: group => default spec => version-check! desc => Check for the latest version of Percona Toolkit, MySQL, and other programs (default yes)
# OptionParser:388 27768 version-check type: undef
# OptionParser:395 27768 version-check default: yes
# OptionParser:410 27768 Parsing rule: This tool accepts additional command-line arguments. Refer to the SYNOPSIS and usage information for details.
# OptionParser:466 27768 Participants for This tool accepts additional command-line arguments. Refer to the SYNOPSIS and usage information for details. :
# OptionParser:442 27768 Strict mode disabled by rule
# OptionParser:194 27768 Parsing DSN OPTIONS
# OptionParser:284 27768 =item * A
# OptionParser:311 27768 Short help: Default character set
# OptionParser:284 27768 =item * D
# OptionParser:311 27768 Short help: Default database
# OptionParser:284 27768 =item * F
# OptionParser:311 27768 Short help: Only read default options from the given file
# OptionParser:284 27768 =item * h
# OptionParser:311 27768 Short help: Connect to host
# OptionParser:284 27768 =item * p
# OptionParser:311 27768 Short help: Password to use when connecting
# OptionParser:284 27768 =item * P
# OptionParser:311 27768 Short help: Port number to use for connection
# OptionParser:284 27768 =item * S
# OptionParser:311 27768 Short help: Socket file to use for connection
# OptionParser:284 27768 =item * u
# OptionParser:311 27768 Short help: User for login if not current user
# DSNParser:1860 27768 DSN option: copy=1, dsn=charset, desc=Default character set, key=A
# DSNParser:1860 27768 DSN option: copy=1, dsn=database, desc=Default database, key=D
# DSNParser:1860 27768 DSN option: copy=1, dsn=mysql_read_default_file, desc=Only read default options from the given file, key=F
# DSNParser:1860 27768 DSN option: copy=1, dsn=host, desc=Connect to host, key=h
# DSNParser:1860 27768 DSN option: copy=1, dsn=password, desc=Password to use when connecting, key=p
# DSNParser:1860 27768 DSN option: copy=1, dsn=port, desc=Port number to use for connection, key=P
# DSNParser:1860 27768 DSN option: copy=1, dsn=mysql_socket, desc=Socket file to use for connection, key=S
# DSNParser:1860 27768 DSN option: copy=1, dsn=user, desc=User for login if not current user, key=u
# OptionParser:238 27768 pt-slave-delay 2.2.12
# OptionParser:560 27768 Cannot open /etc/percona-toolkit/percona-toolkit.conf: No such file or directory
#
# OptionParser:560 27768 Cannot open /root/.percona-toolkit.conf: No such file or directory
#
# OptionParser:560 27768 Cannot open /root/.pt-slave-delay.conf: No such file or directory
#
# OptionParser:528 27768 Got option delay = 24h
# OptionParser:528 27768 Got option interval = 60m
# OptionParser:528 27768 Got option daemonize = 1
# OptionParser:528 27768 Got option log = /var/log/pt-slave-delay.log
# OptionParser:528 27768 Got option host = localhost
# OptionParser:528 27768 Got option user = openquery
# OptionParser:528 27768 Got option password = XXXX
# OptionParser:699 27768 Parsing option delay as a time value
# OptionParser:713 27768 Setting option delay to 86400
# OptionParser:748 27768 Nothing to validate for option run-time type m value undef
# OptionParser:748 27768 Nothing to validate for option password type s value XXXX
# OptionParser:748 27768 Nothing to validate for option pid type s value undef
# OptionParser:748 27768 Nothing to validate for option user type s value openquery
# OptionParser:748 27768 Nothing to validate for option log type s value /var/log/pt-slave-delay.log
# OptionParser:748 27768 Nothing to validate for option charset type s value undef
# OptionParser:699 27768 Parsing option interval as a time value
# OptionParser:713 27768 Setting option interval to 3600
# OptionParser:748 27768 Nothing to validate for option port type i value undef
# OptionParser:748 27768 Nothing to validate for option socket type s value undef
# OptionParser:748 27768 Nothing to validate for option defaults-file type s value undef
# OptionParser:748 27768 Nothing to validate for option host type s value localhost
# OptionParser:748 27768 Nothing to validate for option database type s value undef
# OptionParser:1142 27768 --set-vars: $VAR1 = {wait_timeout => {default => 1,val => '10000'}};
# DSNParser:1876 27768 Setting set-vars property
# DSNParser:1948 27768 DSN string made from options: p=XXXX,u=openquery,h=localhost
# DSNParser:1888 27768 Parsing p=XXXX,u=openquery,h=localhost
# DSNParser:1907 27768 Finding value for S
# DSNParser:1917 27768 Copying value for S from defaults
# DSNParser:1907 27768 Finding value for F
# DSNParser:1917 27768 Copying value for F from defaults
# DSNParser:1907 27768 Finding value for A
# DSNParser:1917 27768 Copying value for A from defaults
# DSNParser:1907 27768 Finding value for P
# DSNParser:1917 27768 Copying value for P from defaults
# DSNParser:1907 27768 Finding value for p
# DSNParser:1907 27768 Finding value for u
# DSNParser:1907 27768 Finding value for h
# DSNParser:1907 27768 Finding value for D
# DSNParser:1917 27768 Copying value for D from defaults
# DSNParser:1888 27768 Parsing true
# DSNParser:1901 27768 Interpreting true as h= true
# DSNParser:1907 27768 Finding value for S
# DSNParser:1917 27768 Copying value for S from defaults
# DSNParser:1907 27768 Finding value for F
# DSNParser:1917 27768 Copying value for F from defaults
# DSNParser:1907 27768 Finding value for A
# DSNParser:1917 27768 Copying value for A from defaults
# DSNParser:1907 27768 Finding value for P
# DSNParser:1917 27768 Copying value for P from defaults
# DSNParser:1907 27768 Finding value for p
# DSNParser:1913 27768 Copying value for p from previous DSN
# DSNParser:1907 27768 Finding value for u
# DSNParser:1913 27768 Copying value for u from previous DSN
# DSNParser:1907 27768 Finding value for h
# DSNParser:1907 27768 Finding value for D
# DSNParser:1917 27768 Copying value for D from defaults
# OptionParser:822 27768 Getting description and usage from SYNOPSIS in /usr/bin/pt-slave-delay
# OptionParser:1075 27768 Parsing SYNOPSIS in /usr/bin/pt-slave-delay
# OptionParser:1088 27768 Raw SYNOPSIS text: Usage: pt-slave-delay [OPTIONS] SLAVE_DSN [MASTER_DSN]
#
# pt-slave-delay starts and stops a slave server as needed to make it lag
# behind the master. The SLAVE_DSN and MASTER_DSN use DSN syntax, and
# values are copied from the SLAVE_DSN to the MASTER_DSN if omitted.
#
#
# OptionParser:826 27768 Description: pt-slave-delay starts and stops a slave server as needed to make it lag behind the master. The SLAVE_DSN and MASTER_DSN use DSN syntax, and values are copied from the SLAVE_DSN to the MASTER_DSN if omitted.
# Usage: pt-slave-delay [OPTIONS] SLAVE_DSN [MASTER_DSN]
# DSNParser:2001 27768 DBI:mysql:;host=true;mysql_read_default_group=client
# DSNParser:2050 27768 DBI:mysql:;host=true;mysql_read_default_group=client openquery XXXX mysql_enable_utf8=>0, ShowErrorStatement=>1, AutoCommit=>1, RaiseError=>1, PrintError=>0
# DSNParser:2050 27768 DBI:mysql:;host=true;mysql_read_default_group=client openquery XXXX mysql_enable_utf8=>0, ShowErrorStatement=>1, AutoCommit=>1, RaiseError=>1, PrintError=>0
DBI connect(';host=true;mysql_read_default_group=client','openquery',...) failed: Unknown MySQL server host 'true' (4) at /usr/bin/pt-slave-delay line 2052

Revision history for this message
Daniel Black (daniel-black) wrote :

actually more so, any use of the config file seems to prevent specifying DSN

Revision history for this message
Nilnandan Joshi (nilnandan-joshi) wrote :
Download full text (15.5 KiB)

Verified with 2.2.13.

nilnandan@desktop:~$ cat .pt-slave-delay.conf
delay=24h
interval=60m

daemonize=true
log=/var/log/pt-slave-delay.log

host=localhost
user=root
password=root
nilnandan@desktop:~$

nilnandan@desktop:~$ PTDEBUG=1 pt-slave-delay
# /usr/bin/perl 5.020001
# Linux desktop 3.16.0-31-generic #41-Ubuntu SMP Tue Feb 10 15:24:04 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
# Arguments:
# OptionParser:275 7910 Option rule: This tool accepts additional command-line arguments. Refer to the SYNOPSIS and usage information for details.
# OptionParser:284 7910 =item --ask-pass
# OptionParser:303 7910 Option has no attributes
# OptionParser:311 7910 Short help: Prompt for a password when connecting to MySQL
# OptionParser:284 7910 =item --charset
# OptionParser:311 7910 Short help: Default character set
# OptionParser:284 7910 =item --config
# OptionParser:311 7910 Short help: Read this comma-separated list of config files; if specified, this must be the first option on the command line
# OptionParser:284 7910 =item --[no]continue
# OptionParser:311 7910 Short help: Continue replication normally on exit
# OptionParser:284 7910 =item --daemonize
# OptionParser:303 7910 Option has no attributes
# OptionParser:311 7910 Short help: Fork to the background and detach from the shell
# OptionParser:284 7910 =item --database
# OptionParser:311 7910 Short help: The database to use for the connection
# OptionParser:284 7910 =item --defaults-file
# OptionParser:311 7910 Short help: Only read mysql options from the given file
# OptionParser:284 7910 =item --delay
# OptionParser:311 7910 Short help: How far the slave should lag its master
# OptionParser:284 7910 =item --help
# OptionParser:303 7910 Option has no attributes
# OptionParser:311 7910 Short help: Show help and exit
# OptionParser:284 7910 =item --host
# OptionParser:311 7910 Short help: Connect to host
# OptionParser:284 7910 =item --interval
# OptionParser:311 7910 Short help: How frequently pt-slave-delay should check whether the slave needs to be started or stopped
# OptionParser:284 7910 =item --log
# OptionParser:311 7910 Short help: Print all output to this file when daemonized
# OptionParser:284 7910 =item --password
# OptionParser:311 7910 Short help: Password to use when connecting
# OptionParser:284 7910 =item --pid
# OptionParser:311 7910 Short help: Create the given PID file
# OptionParser:284 7910 =item --port
# OptionParser:311 7910 Short help: Port number to use for connection
# OptionParser:284 7910 =item --quiet
# OptionParser:311 7910 Short help: Don't print informational messages about operation
# OptionParser:284 7910 =item --run-time
# OptionParser:311 7910 Short help: How long pt-slave-delay should run before exiting
# OptionParser:284 7910 =item --set-vars
# OptionParser:311 7910 Short help: Set the MySQL variables in this comma-separated list of variable=value pairs
# OptionParser:284 7910 =item --socket
# OptionParser:311 7910 Short help: Socket file to use for connection
# OptionParser:284 7910 =item --use-master
# OptionParser:303 7910 Option has no attributes
# OptionParser:311 7910 Short help: Get binlog positions from master, not slave
# OptionParser:284 7910 =i...

Changed in percona-toolkit:
status: New → Confirmed
Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PT-1272

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.