pt-online-schema-change tmp datadir

yurikabyurikab EntrantActive Member Participant
Hello, is there a way to set DATA DIR for temp table (not changing original table datadir) while changing schema via pt-online-schema change ?
I haven't enough free space for temp table.

Comments

  • yurikabyurikab Entrant Active Member Participant
    If i'm right only one solution to do it is:
    1. use pt-online-schema-change with --data-dir, --no-drop-new-table and --no-swap-tables
    2. ALTER TABLE `old_table` DISCARD TABLESPACE;
    3. FLUSH TABLES `new_table` FOR EXPORT;
    4. move idb,cfg from new_table to old_table (mv /tmp/datadir/db/new_table.ibd /old/datadir/db/old_table.idb) and chown to mysql user
    5. UNLOCK TABLES;
    6. ALTER TABLE `old_table` IMPORT TABLESPACE;
    7. drop new_table;

    as i'm right ?
  • carlos.salguerocarlos.salguero Percona Toolkit Developer Percona
    The steps you mentioned are risky and won't be "online"
    You could run pt-osc twice using --data-dir. The first run will alter your table with the new structure and the second time will move it again to the original location.
  • yurikabyurikab Entrant Active Member Participant
    The steps you mentioned are risky and won't be "online"
    You could run pt-osc twice using --data-dir. The first run will alter your table with the new structure and the second time will move it again to the original location.

    Could you help me by step ? =)
Sign In or Register to comment.

MySQL, InnoDB, MariaDB and MongoDB are trademarks of their respective owners.
Copyright ©2005 - 2020 Percona LLC. All rights reserved.