Gitea Upgrade Failure #4151

Closed
opened 2025-11-02 05:40:27 -06:00 by GiteaMirror · 3 comments
Owner

Originally created by @satouriko on GitHub (Oct 20, 2019).

  • Gitea version (or commit ref): v1.9.3
  • Git version: 2.16.5
  • Operating system: Debian GNU/Linux 9 (stretch)
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

Description

Unable to upgrade to v1.9.3 from v1.3.2, seems like a database migrate issue:

2019/10/20 12:56:20 ...-xorm/xorm/engine.go:329:Ping() [I] PING DATABASE mysql
2019/10/20 12:56:20 .../xorm/session_raw.go:143:queryBytes() [I] [SQL] SELECT `TABLE_NAME` from `INFORMATION_SCHEMA`.`TABLES` WHERE `TABLE_SCHEMA`=? and `TABLE_NAME`=? []interface {}{"gitea", "version"}
2019/10/20 12:56:20 ...m.io/core/dialect.go:161:HasRecords() [I] [SQL] SELECT `COLUMN_NAME` FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE `TABLE_SCHEMA` = ? AND `TABLE_NAME` = ? AND `COLUMN_NAME` = ? [gitea version id]
2019/10/20 12:56:20 ...m.io/core/dialect.go:161:HasRecords() [I] [SQL] SELECT `COLUMN_NAME` FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE `TABLE_SCHEMA` = ? AND `TABLE_NAME` = ? AND `COLUMN_NAME` = ? [gitea version version]
2019/10/20 12:56:20 .../xorm/session_get.go:99:nocacheGet() [I] [SQL] SELECT `id`, `version` FROM `version` WHERE `id`=? LIMIT 1 []interface {}{1}
2019/10/20 12:56:20 ...ations/migrations.go:272:Migrate() [I] Migration[81]: update U2F counter type
2019/10/20 12:56:20 .../xorm/session_raw.go:226:Exec() [I] [SQL] ALTER TABLE `u2f_registration` MODIFY `counter` BIGINT
2019/10/20 12:56:20 routers/init.go:86:GlobalInit() [F] ORM engine initialization failed: migrate: do migrate: Error changing u2f_registration counter column type: Error 1146: Table 'gitea.u2f_registration' doesn't exist
2019/10/20 12:56:23 ...dules/setting/log.go:269:newLogService() [I] Gitea Log Mode: File(File:info)
2019/10/20 12:56:23 ...les/setting/cache.go:42:newCacheService() [I] Cache Service Enabled
2019/10/20 12:56:23 ...s/setting/session.go:45:newSessionService() [I] Session Service Enabled
2019/10/20 12:56:23 ...es/setting/mailer.go:105:newMailService() [I] Mail Service Enabled
2019/10/20 12:56:23 ...es/setting/mailer.go:127:newNotifyMailService() [I] Notify Mail Service Enabled
2019/10/20 12:56:23 routers/init.go:49:initDBEngine() [I] Beginning ORM engine initialization.
2019/10/20 12:56:23 routers/init.go:51:initDBEngine() [I] ORM engine initialization attempt #1/10...
2019/10/20 12:56:23 ...-xorm/xorm/engine.go:329:Ping() [I] PING DATABASE mysql
2019/10/20 12:56:23 .../xorm/session_raw.go:143:queryBytes() [I] [SQL] SELECT `TABLE_NAME` from `INFORMATION_SCHEMA`.`TABLES` WHERE `TABLE_SCHEMA`=? and `TABLE_NAME`=? []interface {}{"gitea", "version"}
2019/10/20 12:56:23 ...m.io/core/dialect.go:161:HasRecords() [I] [SQL] SELECT `COLUMN_NAME` FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE `TABLE_SCHEMA` = ? AND `TABLE_NAME` = ? AND `COLUMN_NAME` = ? [gitea version id]
2019/10/20 12:56:23 ...m.io/core/dialect.go:161:HasRecords() [I] [SQL] SELECT `COLUMN_NAME` FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE `TABLE_SCHEMA` = ? AND `TABLE_NAME` = ? AND `COLUMN_NAME` = ? [gitea version version]
2019/10/20 12:56:23 .../xorm/session_get.go:99:nocacheGet() [I] [SQL] SELECT `id`, `version` FROM `version` WHERE `id`=? LIMIT 1 []interface {}{1}
2019/10/20 12:56:23 ...ations/migrations.go:272:Migrate() [I] Migration[81]: update U2F counter type
2019/10/20 12:56:23 .../xorm/session_raw.go:226:Exec() [I] [SQL] ALTER TABLE `u2f_registration` MODIFY `counter` BIGINT
2019/10/20 12:56:23 routers/init.go:58:initDBEngine() [I] Backing off for 3 seconds
2019/10/20 12:56:26 routers/init.go:51:initDBEngine() [I] ORM engine initialization attempt #2/10...
2019/10/20 12:56:26 ...-xorm/xorm/engine.go:329:Ping() [I] PING DATABASE mysql
2019/10/20 12:56:26 .../xorm/session_raw.go:143:queryBytes() [I] [SQL] SELECT `TABLE_NAME` from `INFORMATION_SCHEMA`.`TABLES` WHERE `TABLE_SCHEMA`=? and `TABLE_NAME`=? []interface {}{"gitea", "version"}
2019/10/20 12:56:26 ...m.io/core/dialect.go:161:HasRecords() [I] [SQL] SELECT `COLUMN_NAME` FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE `TABLE_SCHEMA` = ? AND `TABLE_NAME` = ? AND `COLUMN_NAME` = ? [gitea version id]
2019/10/20 12:56:26 ...m.io/core/dialect.go:161:HasRecords() [I] [SQL] SELECT `COLUMN_NAME` FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE `TABLE_SCHEMA` = ? AND `TABLE_NAME` = ? AND `COLUMN_NAME` = ? [gitea version version]
2019/10/20 12:56:26 .../xorm/session_get.go:99:nocacheGet() [I] [SQL] SELECT `id`, `version` FROM `version` WHERE `id`=? LIMIT 1 []interface {}{1}
2019/10/20 12:56:26 ...ations/migrations.go:272:Migrate() [I] Migration[81]: update U2F counter type
2019/10/20 12:56:26 .../xorm/session_raw.go:226:Exec() [I] [SQL] ALTER TABLE `u2f_registration` MODIFY `counter` BIGINT
2019/10/20 12:56:26 routers/init.go:58:initDBEngine() [I] Backing off for 3 seconds

...

Screenshots

Originally created by @satouriko on GitHub (Oct 20, 2019). <!-- NOTE: If your issue is a security concern, please send an email to security@gitea.io instead of opening a public issue --> <!-- 1. Please speak English, this is the language all maintainers can speak and write. 2. Please ask questions or configuration/deploy problems on our Discord server (https://discord.gg/gitea) or forum (https://discourse.gitea.io). 3. Please take a moment to check that your issue doesn't already exist. 4. Please give all relevant information below for bug reports, because incomplete details will be handled as an invalid report. --> - Gitea version (or commit ref): v1.9.3 - Git version: 2.16.5 - Operating system: Debian GNU/Linux 9 (stretch) - Database (use `[x]`): - [ ] PostgreSQL - [x] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [x] Not relevant - Log gist: ## Description Unable to upgrade to v1.9.3 from v1.3.2, seems like a database migrate issue: ``` 2019/10/20 12:56:20 ...-xorm/xorm/engine.go:329:Ping() [I] PING DATABASE mysql 2019/10/20 12:56:20 .../xorm/session_raw.go:143:queryBytes() [I] [SQL] SELECT `TABLE_NAME` from `INFORMATION_SCHEMA`.`TABLES` WHERE `TABLE_SCHEMA`=? and `TABLE_NAME`=? []interface {}{"gitea", "version"} 2019/10/20 12:56:20 ...m.io/core/dialect.go:161:HasRecords() [I] [SQL] SELECT `COLUMN_NAME` FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE `TABLE_SCHEMA` = ? AND `TABLE_NAME` = ? AND `COLUMN_NAME` = ? [gitea version id] 2019/10/20 12:56:20 ...m.io/core/dialect.go:161:HasRecords() [I] [SQL] SELECT `COLUMN_NAME` FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE `TABLE_SCHEMA` = ? AND `TABLE_NAME` = ? AND `COLUMN_NAME` = ? [gitea version version] 2019/10/20 12:56:20 .../xorm/session_get.go:99:nocacheGet() [I] [SQL] SELECT `id`, `version` FROM `version` WHERE `id`=? LIMIT 1 []interface {}{1} 2019/10/20 12:56:20 ...ations/migrations.go:272:Migrate() [I] Migration[81]: update U2F counter type 2019/10/20 12:56:20 .../xorm/session_raw.go:226:Exec() [I] [SQL] ALTER TABLE `u2f_registration` MODIFY `counter` BIGINT 2019/10/20 12:56:20 routers/init.go:86:GlobalInit() [F] ORM engine initialization failed: migrate: do migrate: Error changing u2f_registration counter column type: Error 1146: Table 'gitea.u2f_registration' doesn't exist 2019/10/20 12:56:23 ...dules/setting/log.go:269:newLogService() [I] Gitea Log Mode: File(File:info) 2019/10/20 12:56:23 ...les/setting/cache.go:42:newCacheService() [I] Cache Service Enabled 2019/10/20 12:56:23 ...s/setting/session.go:45:newSessionService() [I] Session Service Enabled 2019/10/20 12:56:23 ...es/setting/mailer.go:105:newMailService() [I] Mail Service Enabled 2019/10/20 12:56:23 ...es/setting/mailer.go:127:newNotifyMailService() [I] Notify Mail Service Enabled 2019/10/20 12:56:23 routers/init.go:49:initDBEngine() [I] Beginning ORM engine initialization. 2019/10/20 12:56:23 routers/init.go:51:initDBEngine() [I] ORM engine initialization attempt #1/10... 2019/10/20 12:56:23 ...-xorm/xorm/engine.go:329:Ping() [I] PING DATABASE mysql 2019/10/20 12:56:23 .../xorm/session_raw.go:143:queryBytes() [I] [SQL] SELECT `TABLE_NAME` from `INFORMATION_SCHEMA`.`TABLES` WHERE `TABLE_SCHEMA`=? and `TABLE_NAME`=? []interface {}{"gitea", "version"} 2019/10/20 12:56:23 ...m.io/core/dialect.go:161:HasRecords() [I] [SQL] SELECT `COLUMN_NAME` FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE `TABLE_SCHEMA` = ? AND `TABLE_NAME` = ? AND `COLUMN_NAME` = ? [gitea version id] 2019/10/20 12:56:23 ...m.io/core/dialect.go:161:HasRecords() [I] [SQL] SELECT `COLUMN_NAME` FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE `TABLE_SCHEMA` = ? AND `TABLE_NAME` = ? AND `COLUMN_NAME` = ? [gitea version version] 2019/10/20 12:56:23 .../xorm/session_get.go:99:nocacheGet() [I] [SQL] SELECT `id`, `version` FROM `version` WHERE `id`=? LIMIT 1 []interface {}{1} 2019/10/20 12:56:23 ...ations/migrations.go:272:Migrate() [I] Migration[81]: update U2F counter type 2019/10/20 12:56:23 .../xorm/session_raw.go:226:Exec() [I] [SQL] ALTER TABLE `u2f_registration` MODIFY `counter` BIGINT 2019/10/20 12:56:23 routers/init.go:58:initDBEngine() [I] Backing off for 3 seconds 2019/10/20 12:56:26 routers/init.go:51:initDBEngine() [I] ORM engine initialization attempt #2/10... 2019/10/20 12:56:26 ...-xorm/xorm/engine.go:329:Ping() [I] PING DATABASE mysql 2019/10/20 12:56:26 .../xorm/session_raw.go:143:queryBytes() [I] [SQL] SELECT `TABLE_NAME` from `INFORMATION_SCHEMA`.`TABLES` WHERE `TABLE_SCHEMA`=? and `TABLE_NAME`=? []interface {}{"gitea", "version"} 2019/10/20 12:56:26 ...m.io/core/dialect.go:161:HasRecords() [I] [SQL] SELECT `COLUMN_NAME` FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE `TABLE_SCHEMA` = ? AND `TABLE_NAME` = ? AND `COLUMN_NAME` = ? [gitea version id] 2019/10/20 12:56:26 ...m.io/core/dialect.go:161:HasRecords() [I] [SQL] SELECT `COLUMN_NAME` FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE `TABLE_SCHEMA` = ? AND `TABLE_NAME` = ? AND `COLUMN_NAME` = ? [gitea version version] 2019/10/20 12:56:26 .../xorm/session_get.go:99:nocacheGet() [I] [SQL] SELECT `id`, `version` FROM `version` WHERE `id`=? LIMIT 1 []interface {}{1} 2019/10/20 12:56:26 ...ations/migrations.go:272:Migrate() [I] Migration[81]: update U2F counter type 2019/10/20 12:56:26 .../xorm/session_raw.go:226:Exec() [I] [SQL] ALTER TABLE `u2f_registration` MODIFY `counter` BIGINT 2019/10/20 12:56:26 routers/init.go:58:initDBEngine() [I] Backing off for 3 seconds ``` ... ## Screenshots <!-- **If this issue involves the Web Interface, please include a screenshot** -->
Author
Owner

@lunny commented on GitHub (Oct 20, 2019):

Please upgrade 1.3 -> 1.4 -> 1.5 -> 1.6 -> 1.7 -> 1.8 -> 1.9

@lunny commented on GitHub (Oct 20, 2019): Please upgrade 1.3 -> 1.4 -> 1.5 -> 1.6 -> 1.7 -> 1.8 -> 1.9
Author
Owner

@satouriko commented on GitHub (Oct 20, 2019):

I tried, now it gives things like this from 1.4.3 -> 1.5.0

2019/10/21 00:14:36 [...itea/routers/init.go:60 GlobalInit()] [E] Failed to initialize ORM engine: migrate: do migrate: Insert team units: Error 1062: Duplicate entry '1-1' for key 'UQE_team_unit_s'
2019/10/21 00:14:38 [I] Log Mode: File(Info)
2019/10/21 00:14:38 [I] XORM Log Mode: File(Info)
2019/10/21 00:14:38 [I] Cache Service Enabled
2019/10/21 00:14:38 [I] Session Service Enabled
2019/10/21 00:14:38 [I] Mail Service Enabled
2019/10/21 00:14:38 [I] Notify Mail Service Enabled
2019/10/21 00:14:38 [I] Migration: move team units to team_unit table
2019/10/21 00:14:38 [...itea/routers/init.go:60 GlobalInit()] [E] Failed to initialize ORM engine: migrate: do migrate: Insert team units: Error 1062: Duplicate entry '1-1' for key 'UQE_team_unit_s'
2019/10/21 00:14:40 [I] Log Mode: File(Info)
2019/10/21 00:14:40 [I] XORM Log Mode: File(Info)
2019/10/21 00:14:40 [I] Cache Service Enabled
2019/10/21 00:14:40 [I] Session Service Enabled
2019/10/21 00:14:40 [I] Mail Service Enabled
2019/10/21 00:14:40 [I] Notify Mail Service Enabled
2019/10/21 00:14:40 [I] Migration: move team units to team_unit table
2019/10/21 00:14:40 [...itea/routers/init.go:60 GlobalInit()] [E] Failed to initialize ORM engine: migrate: do migrate: Insert team units: Error 1062: Duplicate entry '1-1' for key 'UQE_team_unit_s'
2019/10/21 00:14:42 [I] Log Mode: File(Info)
2019/10/21 00:14:42 [I] XORM Log Mode: File(Info)
2019/10/21 00:14:42 [I] Cache Service Enabled
2019/10/21 00:14:42 [I] Session Service Enabled
2019/10/21 00:14:42 [I] Mail Service Enabled
2019/10/21 00:14:42 [I] Notify Mail Service Enabled
2019/10/21 00:14:42 [I] Migration: move team units to team_unit table
2019/10/21 00:14:42 [...itea/routers/init.go:60 GlobalInit()] [E] Failed to initialize ORM engine: migrate: do migrate: Insert team units: Error 1062: Duplicate entry '1-1' for key 'UQE_team_unit_s'
@satouriko commented on GitHub (Oct 20, 2019): I tried, now it gives things like this from 1.4.3 -> 1.5.0 ``` 2019/10/21 00:14:36 [...itea/routers/init.go:60 GlobalInit()] [E] Failed to initialize ORM engine: migrate: do migrate: Insert team units: Error 1062: Duplicate entry '1-1' for key 'UQE_team_unit_s' 2019/10/21 00:14:38 [I] Log Mode: File(Info) 2019/10/21 00:14:38 [I] XORM Log Mode: File(Info) 2019/10/21 00:14:38 [I] Cache Service Enabled 2019/10/21 00:14:38 [I] Session Service Enabled 2019/10/21 00:14:38 [I] Mail Service Enabled 2019/10/21 00:14:38 [I] Notify Mail Service Enabled 2019/10/21 00:14:38 [I] Migration: move team units to team_unit table 2019/10/21 00:14:38 [...itea/routers/init.go:60 GlobalInit()] [E] Failed to initialize ORM engine: migrate: do migrate: Insert team units: Error 1062: Duplicate entry '1-1' for key 'UQE_team_unit_s' 2019/10/21 00:14:40 [I] Log Mode: File(Info) 2019/10/21 00:14:40 [I] XORM Log Mode: File(Info) 2019/10/21 00:14:40 [I] Cache Service Enabled 2019/10/21 00:14:40 [I] Session Service Enabled 2019/10/21 00:14:40 [I] Mail Service Enabled 2019/10/21 00:14:40 [I] Notify Mail Service Enabled 2019/10/21 00:14:40 [I] Migration: move team units to team_unit table 2019/10/21 00:14:40 [...itea/routers/init.go:60 GlobalInit()] [E] Failed to initialize ORM engine: migrate: do migrate: Insert team units: Error 1062: Duplicate entry '1-1' for key 'UQE_team_unit_s' 2019/10/21 00:14:42 [I] Log Mode: File(Info) 2019/10/21 00:14:42 [I] XORM Log Mode: File(Info) 2019/10/21 00:14:42 [I] Cache Service Enabled 2019/10/21 00:14:42 [I] Session Service Enabled 2019/10/21 00:14:42 [I] Mail Service Enabled 2019/10/21 00:14:42 [I] Notify Mail Service Enabled 2019/10/21 00:14:42 [I] Migration: move team units to team_unit table 2019/10/21 00:14:42 [...itea/routers/init.go:60 GlobalInit()] [E] Failed to initialize ORM engine: migrate: do migrate: Insert team units: Error 1062: Duplicate entry '1-1' for key 'UQE_team_unit_s' ```
Author
Owner

@satouriko commented on GitHub (Oct 20, 2019):

https://github.com/go-gitea/gitea/issues/7070#issuecomment-496933432
Droping table team_unit worked for me!

@satouriko commented on GitHub (Oct 20, 2019): https://github.com/go-gitea/gitea/issues/7070#issuecomment-496933432 Droping table team_unit worked for me!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#4151