nextcloud / server

☁️ Nextcloud server, a safe home for all your data
https://nextcloud.com
GNU Affero General Public License v3.0
26.25k stars 3.96k forks source link

[Bug]: Upgrade to 29.0.0 leads to "General error: 1709 Index column size too large. The maximum column size is 767 bytes" #45050

Open x86dev opened 2 months ago

x86dev commented 2 months ago

⚠️ This issue respects the following points: ⚠️

Bug description

When upgrading my Docker image from latest 28 to 29.0.0, the Updater shows the following exception:

Exception: Database error when running migration 1030Date20240205103243 for app dav An exception occurred while executing a query: SQLSTATE[HY000]: General error: 1709 Index column size too large. The maximum column size is 767 bytes

How am I supposed to know for which table of the 'dav' app the column size is too small? How to fix this error?

Steps to reproduce

  1. Run any Nextcloud 28
  2. Docker (via docker-compose) using nextcloud:latest, to upgrade to 29

Expected behavior

Update to 29 should work.

Installation method

Official All-in-One appliance

Nextcloud Server version

28

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.0

Web server

None

Database engine version

None

Is this bug present after an update or on a fresh install?

Upgraded to a MAJOR version (ex. 22 to 23)

Are you using the Nextcloud Server Encryption module?

None

What user-backends are you using?

Configuration report

No response

List of activated Apps

No response

Nextcloud Signing status

No response

Nextcloud Logs

No response

Additional info

No response

x86dev commented 2 months ago

These are my current row formats (MariaDB):

Query:

SELECT table_name,Row_format,Avg_row_length FROM information_schema.tables
WHERE table_schema = DATABASE()
table_name,Row_format,Avg_row_length
oc_user_transfer_owner,Compact,"0"
oc_authorized_groups,Compressed,"0"
oc_notes_meta,Compact,"0"
oc_calendar_rooms,Compact,"0"
oc_share_external,Dynamic,"0"
oc_cospend_members,Dynamic,1820
oc_cospend_bill_owers,Dynamic,68
oc_collres_resources,Dynamic,"0"
oc_webauthn,Compact,"0"
oc_deck_boards,Compact,16384
oc_text_steps,Dynamic,4551
oc_ownnote_parts,Compact,"0"
oc_directlink,Compact,"0"
oc_twofactor_providers,Compact,2048
oc_systemtag,Compact,"0"
oc_text_documents,Dynamic,2340
oc_bookmarks_folders_public,Dynamic,"0"
oc_files_versions,Dynamic,69
oc_vcategory_to_object,Compact,4096
oc_bookmarks_shared_to_shares,Compressed,"0"
oc_cospend_projects,Dynamic,5461
oc_calendar_resources,Compact,"0"
oc_photos_albums,Dynamic,"0"
oc_external_config,Dynamic,"0"
oc_filecache,Compact,374
oc_text2image_tasks,Dynamic,"0"
oc_circles_groups,Compact,"0"
oc_comments_read_markers,Dynamic,"0"
oc_deck_assigned_labels,Compressed,"0"
oc_bruteforce_attempts,Compact,"0"
oc_ratelimit_entries,Compressed,4096
oc_file_metadata,Dynamic,497
oc_preferences,Dynamic,123
oc_cospend_shares,Dynamic,2340
oc_files_metadata_index,Dynamic,110
oc_federated_reshares,Compressed,"0"
oc_group_admin,Compact,8192
oc_circles_circles,Compact,"0"
oc_deck_stacks,Compact,5461
oc_photos_albums_files,Dynamic,"0"
oc_flow_operations_scope,Compact,"0"
oc_circles_clouds,Compact,"0"
oc_oauth2_clients,Compact,"0"
oc_ownnote,Compact,"0"
oc_files_reminders,Dynamic,"0"
oc_properties,Dynamic,1820
oc_calendar_appt_configs,Compressed,"0"
oc_calendarobjects,Compressed,1712
oc_group_user,Compact,2730
oc_filecache_extended,Dynamic,167
oc_migrations,Compressed,47
oc_appconfig,Dynamic,169
oc_recent_contact,Compact,8192
oc_schedulingobjects,Compact,"0"
oc_calendar_resources_md,Compact,"0"
oc_comments,Dynamic,"0"
oc_known_users,Compressed,"0"
oc_profile_config,Compressed,"0"
oc_bookmarks_tree,Compact,221
oc_jobs,Dynamic,237
oc_twofactor_totp_secrets,Compact,16384
oc_notifications,Compact,1366
oc_external_applicable,Compact,16384
oc_vcategory,Compact,8192
oc_deck_cards,Compact,5461
oc_storages_credentials,Compressed,4096
oc_calendar_invitations,Compact,"0"
oc_textprocessing_tasks,Dynamic,"0"
oc_direct_edit,Dynamic,16384
oc_open_local_editor,Dynamic,"0"
oc_accounts,Compact,2730
oc_users,Compact,2730
oc_files_trash,Dynamic,1559
oc_trusted_servers,Compressed,"0"
oc_reactions,Dynamic,"0"
oc_circles_members,Compact,"0"
oc_calendarchanges,Compact,141
oc_authtoken,Compressed,55854
oc_circles_links,Compact,"0"
oc_deck_attachment,Compact,"0"
oc_cospend_bills,Dynamic,160
oc_calendar_appt_bookings,Compressed,"0"
oc_cospend_currencies,Dynamic,"0"
oc_reader_preferences,Dynamic,"0"
oc_file_locks,Compact,"0"
oc_dav_absence,Dynamic,"0"
oc_collres_collections,Compact,"0"
oc_deck_labels,Compact,4096
oc_cospend_paymentmodes,Dynamic,819
oc_mounts,Compact,1260
oc_reader_bookmarks,Dynamic,"0"
oc_deck_board_acl,Compact,"0"
oc_bookmarks_shares,Dynamic,"0"
oc_twofactor_backupcodes,Compact,1638
oc_systemtag_object_mapping,Dynamic,"0"
oc_privacy_admins,Compact,"0"
oc_addressbookchanges,Compact,712
oc_dav_cal_proxy,Dynamic,"0"
oc_deck_assigned_users,Compact,"0"
oc_bookmarks_folders,Dynamic,58
oc_activity_mq,Dynamic,"0"
oc_mimetypes,Compressed,98
oc_bookmarks_shared_folders,Compact,"0"
oc_flow_checks,Compact,16384
oc_addressbooks,Compressed,1170
oc_files_metadata,Dynamic,4483
oc_groups,Compact,3276
oc_external_mounts,Compact,16384
oc_cards_properties,Compact,120
oc_calendars,Compressed,546
oc_bookmarks,Dynamic,318
oc_systemtag_group,Compressed,"0"
oc_share,Dynamic,630
oc_circles_shares,Compact,"0"
oc_login_flow_v2,Compressed,"0"
oc_text_sessions,Compact,2730
oc_external_options,Compact,"0"
oc_calendar_reminders,Dynamic,585
oc_privatedata,Compact,"0"
oc_user_status,Compressed,1638
oc_calendarsubscriptions,Compressed,2730
oc_notifications_settings,Compressed,1365
oc_cards,Compact,13593
oc_flow_operations,Dynamic,"0"
oc_calendar_rooms_md,Compact,"0"
oc_bookmarks_tags,Compressed,"0"
oc_whats_new,Compact,1024
oc_calendarobjects_props,Compact,148
oc_cospend_categories,Dynamic,372
oc_activity,Compact,314
oc_dav_shares,Dynamic,5461
oc_photos_albums_collabs,Dynamic,"0"
oc_collres_accesscache,Dynamic,"0"
oc_oauth2_access_tokens,Compact,"0"
oc_bookmarks_root_folders,Compact,5461
oc_accounts_data,Compressed,1365
oc_storages,Compact,1092
oc_notifications_pushhash,Compressed,4096
SystemKeeper commented 2 months ago

oc_cards,Compact,13593

From the mentioned migration, it should be the oc_cards table:

https://github.com/nextcloud/server/blob/94282863cbfbb1c798001d828ddbeb944909f192/apps/dav/lib/Migration/Version1030Date20240205103243.php#L34-L50

Can you try changing that to dynamic?

x86dev commented 2 months ago

Thank you very much, @SystemKeeper, that did the trick!

To solve this, one needs to execute the following SQL query:

ALTER TABLE oc_cards ROW_FORMAT=DYNAMIC;

After that, the update process happily continues and the upgrade to NextCloud 29 worked.

However, the question remains how to fix or extend the updater so that people don't run into this at all?

tbejos commented 2 months ago

I ran into the same issue but for 29000Date20240131122720 for app core and was able to fix it with ALTER TABLE oc_properties ROW_FORMAT=DYNAMIC;

x86dev commented 2 months ago

Interesting ... seems like a more general error then, depending on the actual installation's database state. Wondering why it differs though ... shouldn't the updater take care of this so that the database scheme is guaranteed to be all the same when reaching a new major version?

krichenbauer commented 2 weeks ago

Ran into the same issue updating vom 28 to 29.3. Fixed with ALTER TABLE oc_cards ROW_FORMAT=DYNAMIC;

now everything runs fine.