After upgrade to Seafile 12.06 can't upload files because database table missing

This is all I have so far, but I can’t really continue testing without a fix (or at least a work-around) for this one, and the perpetual chown one.

After the upgrade, I cannot upload a file into any library. I tried through the web, through the SeaDrive client, and through the Seafile agent.

The agent log shows these errors:

[12/23/24 15:08:32] http-tx-mgr.c(1160): Transfer repo 'bc309d8f': ('normal', 'init') --> ('normal', 'check')
[12/23/24 15:08:32] http-tx-mgr.c(1160): Transfer repo 'bc309d8f': ('normal', 'check') --> ('normal', 'commit')
[12/23/24 15:08:32] http-tx-mgr.c(2979): Bad response code for PUT https://test-seafile.mydomain.com/seafhttp/repo/bc309d8f-71fb-466d-9558-09b7782aefb5/commit/a0c3126d49c9031d87879338b20ec71f17c8cd43: 500.
[12/23/24 15:08:32] http-tx-mgr.c(3950): Failed to send head commit for repo bc309d8f.
[12/23/24 15:08:32] http-tx-mgr.c(1160): Transfer repo 'bc309d8f': ('normal', 'commit') --> ('error', 'finished')
[12/23/24 15:08:32] sync-mgr.c(640): Repo 'neon' sync state transition from uploading to 'error': 'Server error'.
[12/23/24 15:09:03] sync-mgr.c(602): Repo 'neon' sync state transition from 'synchronized' to 'uploading'.
[12/23/24 15:09:03] http-tx-mgr.c(1160): Transfer repo 'bc309d8f': ('normal', 'init') --> ('normal', 'check')
[12/23/24 15:09:04] http-tx-mgr.c(1160): Transfer repo 'bc309d8f': ('normal', 'check') --> ('normal', 'commit')
[12/23/24 15:09:04] http-tx-mgr.c(2979): Bad response code for PUT https://test-seafile.mydomain.com/seafhttp/repo/bc309d8f-71fb-466d-9558-09b7782aefb5/commit/a0c3126d49c9031d87879338b20ec71f17c8cd43: 500.
[12/23/24 15:09:04] http-tx-mgr.c(3950): Failed to send head commit for repo bc309d8f.
[12/23/24 15:09:04] http-tx-mgr.c(1160): Transfer repo 'bc309d8f': ('normal', 'commit') --> ('error', 'finished')
[12/23/24 15:09:04] sync-mgr.c(640): Repo 'neon' sync state transition from uploading to 'error': 'Server error'.

And the server log says:

[2024-12-23 15:08:32] [ERROR] path /repo/bc309d8f-71fb-466d-9558-09b7782aefb5/commit/a0c3126d49c9031d87879338b20ec71f17c8cd43 internal server error: Failed to save gc id: Error 1146: Table 'seafile_db.GCID' doesn't exist

It’s strange because the upgrade script did create other tables, like OrgDownloadRateLimit and OrgUploadRateLimit.

Running a seaf-gc didn’t create that table, but it did complain many times about the absence of that table. It also claimed that every library is broken and should be fixed with seaf-fsck, but the seaf-fsck reported no problems with any library. Also the seaf-fsck did not fix the problem.

1 Like

First, please check if the database name is seafile_db or seafile-db, version 12.0 uses the default value seafile_db in .env.

Then, if only the GCID table is missing, so you need to create this table manually. By the way, the GCID table was added 5 years ago.

sql path in docker container: /opt/seafile/seafile-server-12.0.6/sql/mysql/seafile.sql

CREATE TABLE IF NOT EXISTS GCID (
  id BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
  repo_id CHAR(36),
  gc_id CHAR(36),
  UNIQUE INDEX(repo_id)
) ENGINE=INNODB;
1 Like

seafile-db was database name used by old version of Seafile. Newly installed instances use seafile_db

Thank you. My database was named seafile-db, but setting the db_name in seafile.conf didn’t seem to be working, so I renamed the databases, like this:

mysqldump --all-databases | sed 's/ccnet-db/ccnet_db/g' | sed 's/seafile-db/seafile_db/g' | sed 's/seahub-db/seahub_db/g' > all_databases.sql
mysql < all_databases.sql

# Then delete the old databases:
mariadb
drop database `ccnet-db` ;
drop database `seafile-db` ;
drop database `seahub-db` ;

I thought that table was new because the seafile version 11 server logs don’t have any complaints about it, but this explains why that table is missing when other tables were created during the upgrade. Thank you!

I was able to confirm that creating that table fixed the problem with the uploads. I actually just executed that .sql file since it looked like I might be missing more tables. Thanks again.

Thanks this fixed my upload issue, but the logs state that another table is still missing:

[2025-01-10 08:35:41] [WARNING] …/common/seaf-db.c(928): Failed to prepare sql SELECT 1 FROM LastGCID WHERE repo_id = ? AND client_id = ?: Table ‘seafile_db.LastGCID’ doesn’t exist
[2025-01-10 08:35:41] [WARNING] …/common/seaf-db.c(928): Failed to prepare sql INSERT INTO LastGCID (repo_id, client_id, gc_id) VALUES (?, ?, ?): Table ‘seafile_db.LastGCID’ doesn’t exist
[2025-01-10 08:35:42] [WARNING] …/common/seaf-db.c(928): Failed to prepare sql SELECT 1 FROM LastGCID WHERE repo_id = ? AND client_id = ?: Table ‘seafile_db.LastGCID’ doesn’t exist

How to create that one?