Manually locking the legacy tables for writes on GitLab.com

As part of this MR, we introduced the functionality of automatically locking the writes on the legacy tables in the [decomposed database setup]. This functionality is controlled by the feature flag automatic_lock_writes_on_table which at the time of writing this issue, is enabled on staging, but disabled on production.

(https://docs.gitlab.com/ee/development/database/multiple_databases.html). That means that each time we create a table, this table will be locked for writes on the database where the table is not used. For example locking gitlab_main table on the ci database, and locking gitlab_ci table on the main database.

We have a rake task that used to achieve this, gitlab:db:lock_writes, which we ran against staging and production to lock the writes on the tables back then. We ran this task twice, when we did the decomposition project, and when we truncated the legacy tables.

But between the last run of this rake task, and until we enable the feature flag automatic_lock_writes_on_table on Production, we have missed many tables that have been added, but not locked for writes.

The goal of this issue is create change requests, with the help with someone from the DBRE team, to run the rake tasks manually on the environments staging and production. Check this and this issue for a references.

Edited by Omar Qunsul