-
Type:
Bug
-
Status: Open
-
Priority:
Medium
-
Resolution: Unresolved
-
Affects Version/s: 3.2.1
-
Fix Version/s: None
-
Component/s: pt-online-schema-change
-
Labels:
pt-online-schema-change --alter "ADD COLUMN \`c_name\` VARCHAR(50) COMMENT '用户名'" --print --charset=utf8 --chunk-time 0.5 --critical-load Threads_connected:200,Threads_running:200 --max-load Threads_connected:250,Threads_running:250 --recurse=1 --check-interval 1 --no-check-replication-filters --alter-foreign-keys-method=rebuild_constraints --execute --statistics --max-lag=1 --no-version-check --recursion-method=processlist --progress percentage,1 --user="yearning_admin" --password="****" --host=172.16.0.11 --port=3366 D=sre_test,t=candles
The DEBUG message is
# OptionParser:921 4190 Description: pt-online-schema-change alters a table's structure without blocking reads or writes. Specify the database and table in the DSN. Do not use this tool before reading its documentation and checking your backups carefully. # Usage: pt-online-schema-change [OPTIONS] DSN # DSNParser:2246 4190 DSN string made from options: A=utf8,P=3366,u=yearning_admin,p=****,h=172.16.0.11 # DSNParser:2186 4190 Parsing A=utf8,P=3366,u=yearning_admin,p=****,h=172.16.0.11 # DSNParser:2205 4190 Finding value for S # DSNParser:2215 4190 Copying value for S from defaults # DSNParser:2205 4190 Finding value for F # DSNParser:2215 4190 Copying value for F from defaults # DSNParser:2205 4190 Finding value for A # DSNParser:2205 4190 Finding value for P # DSNParser:2205 4190 Finding value for u # DSNParser:2205 4190 Finding value for p # DSNParser:2205 4190 Finding value for h # DSNParser:2205 4190 Finding value for D # DSNParser:2215 4190 Copying value for D from defaults # DSNParser:2205 4190 Finding value for t # DSNParser:2215 4190 Copying value for t from defaults # DSNParser:2299 4190 DBI:mysql:sre_test;host=172.16.0.11;charset=utf8;mysql_read_default_group=client # DSNParser:2348 4190 DBI:mysql:sre_test;host=172.16.0.11;charset=utf8;mysql_read_default_group=client yearning_admin **** mysql_enable_utf8=>1, ShowErrorStatement=>1, AutoCommit=>1, RaiseError=>1, PrintError=>0 # DSNParser:2348 4190 DBI:mysql:sre_test;host=172.16.0.11;charset=utf8;mysql_read_default_group=client yearning_admin **** mysql_enable_utf8=>1, ShowErrorStatement=>1, AutoCommit=>1, RaiseError=>1, PrintError=>0 Cannot connect to MySQL: DBI connect('sre_test;host=172.16.0.11;charset=utf8;mysql_read_default_group=client','yearning_admin',...) failed: Can't connect to MySQL server on '172.16.0.11' (111) at /usr/bin/pt-online-schema-change line 2350.
Then I change the options like this
pt-online-schema-change --alter "ADD COLUMN \`c_name\` VARCHAR(50) COMMENT '用户名'" --print --charset=utf8 --chunk-time 0.5 --critical-load Threads_connected:200,Threads_running:200 --max-load Threads_connected:250,Threads_running:250 --recurse=1 --check-interval 1 --no-check-replication-filters --alter-foreign-keys-method=rebuild_constraints --execute --statistics --max-lag=1 --no-version-check --recursion-method=processlist --progress percentage,1 --user="yearning_admin" --password="****" --host=172.16.0.11 D=sre_test,t=candles,P=3366
It's OK,and the DEBUG message is
- # OptionParser:921 4211 Description: pt-online-schema-change alters a table's structure without blocking reads or writes. Specify the database and table in the DSN. Do not use this tool before reading its documentation and checking your backups carefully.
- # Usage: pt-online-schema-change [OPTIONS] DSN
- # DSNParser:2246 4211 DSN string made from options: A=utf8,u=yearning_admin,p=****,h=172.16.0.11
- # DSNParser:2186 4211 Parsing A=utf8,u=yearning_admin,p=****,h=172.16.0.11
- # DSNParser:2205 4211 Finding value for S
- # DSNParser:2215 4211 Copying value for S from defaults
- # DSNParser:2205 4211 Finding value for F
- # DSNParser:2215 4211 Copying value for F from defaults
- # DSNParser:2205 4211 Finding value for A
- # DSNParser:2205 4211 Finding value for P
- # DSNParser:2215 4211 Copying value for P from defaults
- # DSNParser:2205 4211 Finding value for u
- # DSNParser:2205 4211 Finding value for p
- # DSNParser:2205 4211 Finding value for h
- # DSNParser:2205 4211 Finding value for D
- # DSNParser:2215 4211 Copying value for D from defaults
- # DSNParser:2205 4211 Finding value for t
- # DSNParser:2215 4211 Copying value for t from defaults
- # DSNParser:2299 4211 DBI:mysql:sre_test;host=172.16.0.11;port=3366;charset=utf8;mysql_read_default_group=client
- # DSNParser:2348 4211 DBI:mysql:sre_test;host=172.16.0.11;port=3366;charset=utf8;mysql_read_default_group=client yearning_admin ***** mysql_enable_utf8=>1, ShowErrorStatement=>1, AutoCommit=>1, RaiseError=>1, PrintError=>0
- # DSNParser:2377 4211 DBI::db=HASH(0x17c4858) /!40101 SET NAMES "utf8"/ # DSNParser:2382 4211 Enabling charset for STDOUT
- # DSNParser:2529 4211 DBI::db=HASH(0x17c4858) SET SESSION innodb_lock_wait_timeout=1
- # DSNParser:2529 4211 DBI::db=HASH(0x17c4858) SET SESSION lock_wait_timeout=60
- # DSNParser:2529 4211 DBI::db=HASH(0x17c4858) SET SESSION wait_timeout=10000
- # DSNParser:2397 4211 DBI::db=HASH(0x17c4858) SELECT @@SQL_MODE