sourcegraph/doc
Keegan Carruthers-Smith cbd12608b5
database: run tenant_id migration outside of a transaction (#64410)
We hit a deadlock when deploying this migration to s2. This is because
within our transaction of the migration we likely didn't obtain table
locks in the same order as a transaction in our application code.

So this commit introduces a new migration metadata field
"noTransaction". The documentation for migrator says you should create a
migration per needed transactions. However, this would require us to
create 100s of migrations. We believe the better approach is introducing
this field and barely advertising it.

When reading the code which actually runs migrations, there is no extra
logic done outside of BEGIN; run_migration; COMMIT; so this change is
safe.

We update the migrations to avoid duplicating the function name we
introduce in case something goes wrong (now that the transaction could
leak out the function name).

Test Plan: The actual migrations are tested by go test. I added a test
assertion that we don't call Transact, but to be honest that is super
sketchy. However, we couldn't actually find any test fixtures which
actually run against the DB. So that would require a much deeper
investment for how simple the code change is.

Co-authored-by: Erik Seliger <erikseliger@me.com>
2024-08-13 07:08:19 +02:00
..
_resources Chore: remove plausible scripts (#63054) 2024-06-03 17:33:40 -06:00
admin dotcom: Remove on-demand cloning of repositories (#63321) 2024-06-26 14:53:14 -07:00
cli/references chore(docs): remove outdated content (#61687) 2024-04-08 16:20:45 +02:00
dev database: run tenant_id migration outside of a transaction (#64410) 2024-08-13 07:08:19 +02:00
_generated.push.sh fix(docs): no delivery if triggered without changes (#61578) 2024-04-04 09:08:41 +00:00
BUILD.bazel chore(docs): remove outdated content (#61687) 2024-04-08 16:20:45 +02:00
CHANGELOG.md doc: symlink CHANGELOG.md to docs for better search results (#22918) 2021-07-16 23:25:02 +08:00
CODENOTIFY chore: clean up CODENOTIFY for @sourcegraph/delivery (#57046) 2023-09-26 15:20:42 -04:00
dependency_decisions.yml chore/otel-collector: upgrade to v0.103.0, remove jaegerexporter (#63171) 2024-07-10 09:01:41 -07:00
docsite.json insights: re-index docs (#32415) 2022-03-10 10:05:59 -07:00
index.md Doc and README update: Replace all usages of GH discussions with the SG community link. (#64374) 2024-08-08 13:04:13 -07:00
KNOWN-ISSUES.md Ajb doc update 23 (#56656) 2023-09-15 17:04:23 +00:00
serve.sh bzl: bazelify docsite and doc/cli/reference generation (#54538) 2023-07-03 16:12:44 +02:00
sidebar.md chore(docs): remove outdated content (#61687) 2024-04-08 16:20:45 +02:00
test.sh bzl: wrap docsite check into //doc:test (#54376) 2023-06-28 21:00:54 +02:00