1

I have a table of 4GB(18 Million Rows) in MYISAM Engine on one of my slave server, and I want to convert it to INNODB Engine, the server is replicating from a master. I tried to use the pt-online-schema-change tool which says that it will take more than 1 day, and server lag is increasing because there a lot of insertions in this table,so every query has to be executed twice because of the trigger that the tool creates so that no-downtime is faced.

But I can afford a downtime since it is a slave, is it advisable to just simply run the Alter Engine command ,and how much approximate time will it take to execute?

Also I fear that the replication may break,once the alteration takes place. I am replicating from a 5.5 Master and My Slave is on 5.6.

What am I advised to do in this case, Any help would be appreciated since I am very new to this field.

Thank You

1

Hmmm... puzzling that a 4GB operation of any sort should take a day.

I recently answered a question on binary compatibility between versions here. The relevant IMHO bit from that post is quoted below (from the documentation):

 - Export and Import (mysqldump)

You can use mysqldump to dump your tables on one machine and then
import the dump files on the other machine. Using this method, 
It does not matter whether the formats differ or if your tables 
contain floating-point data.

I would always advise that users, if at all possible, use plain text solutions (scripts and the like). This is in the vein of Unix philosophy and therefore, what I would strongly advise you to do is to:

  • Stop replication

  • Backup your single table as per the community wiki here, i.e. using mysqldump.

  • Manually edit the mysqldump script to change the engine from MyIsam to InnoDB. Check out Rolando's more detailled answer above mine - although he did say it was "short and sweet" :-). Use this command sed -i 's/ENGINE=MyISAM/ENGINE=InnoDB/g' your_schema_dump.sql as per here.

  • Reload table as per wiki.

  • Recommence replication (same reference as for stopping).

Et voilà!

I don't know your disk setup, but I'm willing to bet that it will take nothing like 24 hours (minutes maybe? :-) ).

  • Sure , seems good , will definitely give a try and then revert here. Thanks :) – user1512186 Mar 6 '16 at 19:18
  • Well, report back here if you have found that my solution worked (and give me a"correct answer" :-) ). I would be genuinely interested in what you find (whether you mark me up or not!). It's always interesting to find solutions to problems - and I hope what I have suggested sorts out your issue. – Vérace Mar 6 '16 at 20:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.