Page MenuHomePhabricator

[keyserver] only wrap migration in transaction if specified in migrationType
ClosedPublic

Authored by will on Aug 30 2024, 8:29 AM.
Tags
None
Referenced Files
F3197536: D13212.diff
Sat, Nov 9, 8:54 AM
Unknown Object (File)
Thu, Nov 7, 2:00 AM
Unknown Object (File)
Sun, Nov 3, 4:25 PM
Unknown Object (File)
Sat, Oct 26, 3:56 AM
Unknown Object (File)
Fri, Oct 25, 12:41 PM
Unknown Object (File)
Fri, Oct 25, 2:16 AM
Unknown Object (File)
Tue, Oct 22, 6:29 PM
Unknown Object (File)
Tue, Oct 22, 1:18 PM
Subscribers

Details

Summary

If the migration type is wrap_in_transaction_and_block_requests, we wrap the migration in a transaction. Only if it was wrapped in transaction do we run rollback if the query failed.

Depends on D13209

Test Plan

I console logged and made sure that transaction and rollback queries were only being run if the migration in migrations specified wrapping in a transaction.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Harbormaster returned this revision to the author for changes because remote builds failed.Aug 30 2024, 8:40 AM
Harbormaster failed remote builds in B31372: Diff 43816!
will requested review of this revision.Aug 30 2024, 9:00 AM
ashoat added inline comments.
keyserver/src/database/migrations.js
51–52 ↗(On Diff #43816)

Let's avoid copy-pasting these two lines. Can't we just individually wrap startTransaction and commitTransaction in the conditional?

This revision is now accepted and ready to land.Sep 4 2024, 11:20 PM
keyserver/src/database/migrations.js
51–52 ↗(On Diff #43816)

That makes sense! I originally had them both individually wrapped but thought this looked cleaner. I'll go by the maxim of reducing copy-paste of non-conditionals from now on