-
Type:
Bug
-
Status: Done
-
Priority:
Low
-
Resolution: Cannot Reproduce
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: Documentation
-
Launchpad URL:
**Reported in Launchpad by Pedro Ibáñez last update 09-11-2014 04:17:20
[In:Percona Toolkit Documentation]
Hi,
I'm using pt-online-schema-change percona-toolkit-2.2.8-1 into a script for changing around 100 tables , before I run the command with the --execute flag I like to run it with the --dry-run flag and I found out what looks like a bug, the percona script always returns 1 even when it does not fail:
pt-online-schema-change --alter ADD KEY index_2(TIPO,ID,CALIFICADOR) h=X.X.X.X,u=root,p=XXXXXX,D=MYBBDD,t=DATOSAUX --nocheck-plan --alter-foreign-keys-method auto --statistics --dry-run
Operation, tries, wait:
copy_rows, 10, 0.25
create_triggers, 10, 1
drop_triggers, 10, 1
swap_tables, 10, 1
update_foreign_keys, 10, 1
No foreign keys reference `MYBBDD`.`DATOSAUX`; ignoring --alter-foreign-keys-method.
Starting a dry run. `MYBBDD`.`DATOSAUX` will not be altered. Specify --execute instead of --dry-run to alter the table.
Creating new table...
Created new table MYBBDD._DATOSAUX_new OK.
Altering new table...
Altered `MYBBDD`.`_DATOSAUX_new` OK.
Not creating triggers because this is a dry run.
Not copying rows because this is a dry run.
Not swapping tables because this is a dry run.
Not dropping old table because this is a dry run.
Not dropping triggers because this is a dry run.
2014-07-07T10:25:28 Dropping new table...
2014-07-07T10:25:28 Dropped new table OK.
- Event Count
- ====== =====
- INSERT 0
Dry run complete. `MYBBDD`.`DATOSAUX` was not altered.
Ret:1
The script didn't fail and returns 1 ??
Now I altered the table manually and launch the script again:
pt-online-schema-change --alter ADD KEY index_2(TIPO,ID,CALIFICADOR) h=X.X.X.X,u=root,p=XXXXXX,D=MYBBDD,t=DATOSAUX --nocheck-plan --alter-foreign-keys-method auto --statistics --dry-run
Operation, tries, wait:
copy_rows, 10, 0.25
create_triggers, 10, 1
drop_triggers, 10, 1
swap_tables, 10, 1
update_foreign_keys, 10, 1
No foreign keys reference `MYBBDD`.`DATOSAUX`; ignoring --alter-foreign-keys-method.
Starting a dry run. `MYBBDD`.`DATOSAUX` will not be altered. Specify --execute instead of --dry-run to alter the table.
Creating new table...
Created new table MYBBDD._DATOSAUX_new OK.
Altering new table...
2014-07-07T10:25:28 Dropping new table...
2014-07-07T10:25:28 Dropped new table OK.
- Event Count
- ====== =====
- INSERT 0
Dry run complete. `MYBBDD`.`DATOSAUX` was not altered.
(in cleanup) Error altering new table `MYBBDD`.`_DATOSAUX_new`: BD::mysql:db do failed: Duplicate key name 'index_2' [for statement "ALTER TABLE `MYBBDD`.`_DATOSAUX_new` ADD KEY index_2(TIPO,ID,CALIFICADOR)"] at /usr/bin/pt-online-schema-change line 8588.
- Event Count
- ====== =====
- INSERT 0
Dry run complete. `MYBBDD`.`DATOSAUX` was not altered.
Ret:1
It fails and returns 1, so, how can I check inside a script that the dry-run worked properly? is it the normal behavior of the pt-online-schema-change?
Thank you