delete_pipeline_subscriptions in EE::Projects::TransferService causes CrossDatabaseModificationAcrossUnsupportedTablesError
Per https://docs.gitlab.com/ee/development/database/multiple_databases.html#removing-cross-database-transactions we do not allow you to write to 2 different databases within the context of a single transaction.
Currently this is happening when transferring a project to a group without the license subscription to allow downstream subscriptions at https://gitlab.com/gitlab-org/gitlab/-/blob/68009d711f1e09b8d2ca210172f3ffb7a98aa2e9/ee/app/services/ee/projects/transfer_service.rb#L67 which happens in the context of transaction started at https://gitlab.com/gitlab-org/gitlab/-/blob/68009d711f1e09b8d2ca210172f3ffb7a98aa2e9/app/services/projects/transfer_service.rb#L79.
How to test this
This failure has been added to either spec/support/database/cross-database-modification-allowlist.yml
or an explicit allow_cross_database_modification_within_transaction
has been wrapped around the offending code. Removing the corresponding allowlist item and running any RSpec test that executes this code path should reveal the problem
How to fix this
This failure has been added to either spec/support/database/cross-database-modification-allowlist.yml
or an explicit allow_cross_database_modification_within_transaction
has been wrapped around the offending code. A fix for this problem should remove the corresponding allowlist items.
See possible solutions for this at https://docs.gitlab.com/ee/development/database/multiple_databases.html#removing-cross-database-transactions .
You may also be able to search for fixes to similar problems or you can ask in #g_sharding
if something is unclear.