Sonarqube バージョン 5.6 から 6.0 にアップグレードすると、アップグレード プロセスが次のエラーで失敗します。
2016.08.12 14:56:35 ERROR web[o.s.s.d.m.DatabaseMigrator] Fail to execute database migration: org.sonar.db.version.v60.DropUnusedMeasuresColumns
java.lang.IllegalStateException: Fail to execute ALTER TABLE project_measures DROP COLUMN rules_category_id, DROP COLUMN tendency, DROP COLUMN measure_date, DROP COLUMN url, DROP COLUMN rule_priority, DROP COLUMN characteristic_id, DROP COLUMN rule_id
現在のテーブルは次のように表示され、削除されるはずの列がありません。
CREATE TABLE `project_measures` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`value` decimal(38,20) DEFAULT NULL,
`metric_id` int(11) NOT NULL,
`snapshot_id` int(11) DEFAULT NULL,
`text_value` varchar(4000) COLLATE utf8_bin DEFAULT NULL,
`project_id` int(11) DEFAULT NULL,
`alert_status` varchar(5) COLLATE utf8_bin DEFAULT NULL,
`alert_text` varchar(4000) COLLATE utf8_bin DEFAULT NULL,
`description` varchar(4000) COLLATE utf8_bin DEFAULT NULL,
`variation_value_1` decimal(38,20) DEFAULT NULL,
`variation_value_2` decimal(38,20) DEFAULT NULL,
`variation_value_3` decimal(38,20) DEFAULT NULL,
`variation_value_4` decimal(38,20) DEFAULT NULL,
`variation_value_5` decimal(38,20) DEFAULT NULL,
`person_id` int(11) DEFAULT NULL,
`measure_data` longblob,
PRIMARY KEY (`id`),
KEY `measures_sid_metric` (`snapshot_id`,`metric_id`),
KEY `measures_person` (`person_id`)
) ENGINE=InnoDB AUTO_INCREMENT=81903974 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
テーブルには 350 万件のレコードがあり、時間をかけて 5.4 から 5.5、5.6 に問題なくアップグレードしました。
アップグレードプロセスを続行できるように、これを手動で修正する方法を知っている人はいますか?
アップデート
以下は、2 回目の試行を行ったときの移行ログです。DropUnusedMeasuresColumns がハングしているようです。
2016.08.16 08:29:12 INFO web[o.s.s.d.m.PlatformDatabaseMigration] Starting DB Migration
2016.08.16 08:29:14 INFO web[DbMigration] == UpdateUsersExternalIdentityWhenEmpty: migrating ===========================
2016.08.16 08:29:14 INFO web[o.s.d.v.MassUpdate] 0 users processed (0 items/sec)
2016.08.16 08:29:14 INFO web[DbMigration] == UpdateUsersExternalIdentityWhenEmpty: migrated (0.0950s) ==================
2016.08.16 08:29:14 INFO web[DbMigration]
2016.08.16 08:29:14 INFO web[DbMigration] == CreatePermTemplatesCharacteristics: migrating =============================
2016.08.16 08:29:14 INFO web[DbMigration] -- create_table("perm_tpl_characteristics", {})
2016.08.16 08:29:15 INFO web[DbMigration] -> 0.5600s
2016.08.16 08:29:15 INFO web[DbMigration] -> 0 rows
2016.08.16 08:29:15 INFO web[DbMigration] -- index_exists?("perm_tpl_characteristics", ["template_id", "permission_key"], {:name=>"uniq_perm_tpl_charac"})
2016.08.16 08:29:15 INFO web[DbMigration] -> 0.0650s
2016.08.16 08:29:15 INFO web[DbMigration] -- add_index("perm_tpl_characteristics", ["template_id", "permission_key"], {:name=>"uniq_perm_tpl_charac", :unique
=>true})
2016.08.16 08:29:15 INFO web[DbMigration] -> 0.6200s
2016.08.16 08:29:15 INFO web[DbMigration] -> 0 rows
2016.08.16 08:29:15 INFO web[DbMigration] == CreatePermTemplatesCharacteristics: migrated (1.2580s) ====================
2016.08.16 08:29:15 INFO web[DbMigration]
2016.08.16 08:29:15 INFO web[DbMigration] == AddColumnsWithUuidsToResourceIndex: migrating =============================
2016.08.16 08:29:54 INFO web[DbMigration] == AddColumnsWithUuidsToResourceIndex: migrated (38.6700s) ===================
2016.08.16 08:29:54 INFO web[DbMigration]
2016.08.16 08:29:54 INFO web[DbMigration] == PopulateUuidColumnsOfResourceIndex: migrating =============================
2016.08.16 08:30:42 INFO ce[o.s.c.a.WebServerWatcherImpl] Still waiting for WebServer...
2016.08.16 08:31:00 INFO web[o.s.d.v.MassUpdate] 149749 resource index entries processed (2495 items/sec)
2016.08.16 08:32:00 INFO web[o.s.d.v.MassUpdate] 310999 resource index entries processed (2687 items/sec)
2016.08.16 08:32:19 INFO web[o.s.d.v.MassUpdate] 362861 resource index entries processed (864 items/sec)
2016.08.16 08:32:19 INFO web[DbMigration] == PopulateUuidColumnsOfResourceIndex: migrated (145.4370s) ==================
2016.08.16 08:32:19 INFO web[DbMigration]
2016.08.16 08:32:20 INFO web[DbMigration] == CleanOrphanRowsInResourceIndex: migrating =================================
2016.08.16 08:32:20 INFO web[o.s.d.v.MassUpdate] 0 resource index entries processed (0 items/sec)
2016.08.16 08:32:20 INFO web[DbMigration] == CleanOrphanRowsInResourceIndex: migrated (0.1980s) ========================
2016.08.16 08:32:20 INFO web[DbMigration]
2016.08.16 08:32:20 INFO web[DbMigration] == MakeUuidColumnsNotNullOnResourceIndex: migrating ==========================
2016.08.16 08:33:09 INFO web[DbMigration] -- index_exists?(:resource_index, :component_uuid, {:name=>"resource_index_component"})
2016.08.16 08:33:09 INFO web[DbMigration] -> 0.0090s
2016.08.16 08:33:09 INFO web[DbMigration] -- add_index(:resource_index, :component_uuid, {:name=>"resource_index_component"})
2016.08.16 08:33:18 INFO web[DbMigration] -> 9.4810s
2016.08.16 08:33:18 INFO web[DbMigration] -> 0 rows
2016.08.16 08:33:18 INFO web[DbMigration] == MakeUuidColumnsNotNullOnResourceIndex: migrated (58.3240s) ================
2016.08.16 08:33:18 INFO web[DbMigration]
2016.08.16 08:33:18 INFO web[DbMigration] == DropResourceIndexRidFromResourceIndex: migrating ==========================
2016.08.16 08:33:18 INFO web[DbMigration] -- remove_index(:resource_index, {:name=>"resource_index_rid"})
2016.08.16 08:33:19 INFO web[DbMigration] -> 0.4860s
2016.08.16 08:33:19 INFO web[DbMigration] -> 0 rows
2016.08.16 08:33:19 INFO web[DbMigration] == DropResourceIndexRidFromResourceIndex: migrated (0.4890s) =================
2016.08.16 08:33:19 INFO web[DbMigration]
2016.08.16 08:33:19 INFO web[DbMigration] == DropIdColumnsFromResourceIndex: migrating =================================
2016.08.16 08:34:08 INFO web[DbMigration] == DropIdColumnsFromResourceIndex: migrated (48.7900s) =======================
2016.08.16 08:34:08 INFO web[DbMigration]
2016.08.16 08:34:08 INFO web[DbMigration] == DropUnusedMeasuresColumns: migrating ======================================
2016.08.16 08:34:57 INFO ce[o.s.c.a.WebServerWatcherImpl] Still waiting for WebServer...
2016.08.16 08:46:31 INFO ce[o.s.c.a.WebServerWatcherImpl] Still waiting for WebServer...