The `Clusters::Applications::Runner#prepare_uninstall` does cross-DB modification
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.
The Clusters::Applications::Runner#prepare_uninstall
does method does cross-DB modification,
which writes to clusters_applications_runners, ci_runners
in a single transaction.
module Clusters
module Applications
class Runner < ApplicationRecord
def prepare_uninstall
runner&.update!(active: false)
end
end
end
end
The solution for this can be as simple as using run_after_commit
to delay update of runner to after the transaction:
# example
module Clusters
module Applications
class Runner < ApplicationRecord
def prepare_uninstall
run_after_commit_or_now do
runner&.update!(active: false)
end
end
end
end
end
The !78098 (merged) acknowledges this failure and removes it from allowlist.
Edited by Kamil Trzciński