我有以下 MySQL RoR 迁移:
class ReindexRpushNotification < ActiveRecord::Migration
def up
execute("DROP INDEX `index_rpush_notifications_multi` ON rpush_notifications;")
execute("ALTER TABLE rpush_notifications ADD INDEX index_rpush_notifications_multi (delivered, failed, processing, deliver_after), ALGORITHM=INPLACE, LOCK=NONE;")
end
def down
execute("DROP INDEX `index_rpush_notifications_multi` ON rpush_notifications;")
execute("ALTER TABLE rpush_notifications ADD INDEX index_rpush_notifications_multi (delivered, failed), ALGORITHM=INPLACE, LOCK=NONE;")
end
end
Run Code Online (Sandbox Code Playgroud)
在这次迁移期间,我正在尝试执行一些请求(GET、COUNT、DELETE、UPDATE)但没有任何效果,所有这些请求都在等待
我在这里找到了有关在后台创建索引的信息
http://dev.mysql.com/doc/refman/5.6/en/innodb-create-index-overview.html
但它对我们不起作用
有人试过LOCK=NONE吗?
我们在 AWS RDS 上使用 MySQL 5.6.23