We have 1 master & 3
slave database.
In master db,we create an
index for the huge tables,about 1 Million
entry, the index field has so many
duplicated values(It seems we make an mistake to
create index for this field).
While we run the
'alter table add index' sql statement
to create index, all of the connection said
'Waiting for xxx table'
We wait about 15 minutes,
the 'create index' sql still
running.
So we just break it, and
restart the mysql database.
Then all of the slave
crushed by the 'alter table' sql statment,we add
the skip counter to fix that in slave
database.
Now the master database
contains the table with an index, but slave
doesn't.
We believe the mysql db
doens't finish add index for the table in master
db,even 'show create table' statment show the
index.
We afraid to crush the
slave again, do any way to fix the
problem?
On my other exp, we alter
table to set the defaul value to some huge
table, the processing time exceed 2 hours,we
also break it. Do any way safely to alter
table?It always scare me.
Best
regards.
|