sourcegraph/doc/dev/background-information
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
..
architecture Backport dev docs changes that happened in docsite v2 (#61931) 2024-04-16 16:51:00 +02:00
batch_changes Update marketing website link in monorepo (#58449) 2023-12-01 22:22:34 +00:00
bazel Revert "Revert "refactor: upgrade to rules_oci 2.0 (2nd attempt)"" (#64354) 2024-08-08 09:00:08 +00:00
ci refer to sg help instead of auto-generating markdown docs for sg (#58225) 2023-11-09 23:40:03 -08:00
codeintel chore: Rename Index -> AutoIndexJob (#63955) 2024-07-22 22:18:40 +08:00
codemonitoring Backend: remove EnterpriseDB (#54699) 2023-07-06 20:03:31 -06:00
insights chore: fix typos (#62532) 2024-05-08 09:32:26 +02:00
languages fix broken go-cmp link (#54206) 2023-08-15 13:26:55 -07:00
observability Update cAdvisor documentation (#58440) 2023-11-20 19:37:46 +03:00
sg Doc and README update: Replace all usages of GH discussions with the SG community link. (#64374) 2024-08-08 13:04:13 -07:00
sql database: run tenant_id migration outside of a transaction (#64410) 2024-08-13 07:08:19 +02:00
telemetry chore/sg: remove 'sg telemetry' and related docs (#63763) 2024-07-10 17:25:04 -07:00
test-plans Docs bitbucket server test plan (#55631) 2023-08-08 10:12:31 +00:00
web finish removing chromatic (#63966) 2024-07-21 18:37:02 -07:00
wolfi Wolfi Documentation (#51262) 2023-05-23 13:55:56 +00:00
adding_ping_data.md Add documentation for new license verification (#53300) 2023-06-13 14:31:32 +02:00
backgroundroutine.md Merge enterprise and oss frontend (#56476) 2023-09-11 14:16:38 +02:00
basestore.md [doc] Add docs for basestore map scanner (#48281) 2023-02-27 17:10:33 +01:00
build_p4_fusion.md nix: update p4 fusion openssl3 (#51913) 2023-05-23 12:49:08 +02:00
commit_messages.md doc: refresh review guide, note required reviews (#29146) 2021-12-17 11:58:16 -08:00
dependencies_and_codegen.md doc: note that go generate scripts are deprecated (#35270) 2022-05-11 10:11:54 -07:00
exposing-services.md Move development docs from handbook to doc/dev (#18430) 2021-02-19 12:26:12 +01:00
flat_call_tree.svg Move "Testing web code" from handbook to doc/dev (#18777) 2021-03-02 15:46:34 +01:00
git_gc.md doc: Add background information on git-gc modes of operations (#47798) 2023-02-17 12:32:09 +00:00
github-api-oddities.md Docs and comment updates explaining GitHub rate limit decisions (#50088) 2023-03-29 10:11:36 +02:00
gitserver-api.md gitserver: grpc: create server implementation for GetBehindAhead (#62216) 2024-05-03 10:04:53 -07:00
goland.md docs: Fix typo (#44259) 2022-11-11 09:49:15 +08:00
graphql_api.md Add how-to page for adding a GraphQL query (#31315) 2022-02-22 06:24:11 +00:00
grpc_tutorial.md Backport dev docs changes that happened in docsite v2 (#61931) 2024-04-16 16:51:00 +02:00
honeycomb.md Move development docs from handbook to doc/dev (#18430) 2021-02-19 12:26:12 +01:00
index.md docs: clean up development docs table of contents (#55175) 2023-07-20 20:36:50 -07:00
nested_call_tree.svg Move "Testing web code" from handbook to doc/dev (#18777) 2021-03-02 15:46:34 +01:00
oobmigrations.md Backend: remove enterprise/internal (#54872) 2023-07-12 22:51:02 +02:00
postgresql.md Docs: Replace hyphens in text with em-dashes (#42367) 2023-01-31 13:18:49 +01:00
pull_request_reviews.md Docs: Replace hyphens in text with em-dashes (#42367) 2023-01-31 13:18:49 +01:00
renovate.md chore(ci): disable renovate (#63313) 2024-06-19 13:17:15 +02:00
scim_api.md Backport dev docs changes that happened in docsite v2 (#61931) 2024-04-16 16:51:00 +02:00
scim_postman_collection.json Remove errant comma from scim_postman_collection.json (#60593) 2024-02-16 13:47:16 -05:00
security_patterns.md Merge enterprise and oss frontend (#56476) 2023-09-11 14:16:38 +02:00
tech_stack.md Update handbook links in doc (#26848) 2021-11-02 00:09:49 +08:00
testing_pr.md web: migrate from yarn to pnpm (#46143) 2023-01-11 19:50:09 -08:00
testing_principles.md chore(ci): remove Percy visual tests (#63515) 2024-06-27 16:20:06 +02:00
testing_web_code.md chore(ci): remove Percy visual tests (#63515) 2024-06-27 16:20:06 +02:00
testing-pyramid.svg Move development docs from handbook to doc/dev (#18430) 2021-02-19 12:26:12 +01:00
workers.md Backend: remove enterprise/internal (#54872) 2023-07-12 22:51:02 +02:00