Page MenuHomePhabricator

Allow LiskDAO to be forced to use a specific connection
ClosedPublic

Authored by epriestley on Mar 17 2015, 7:39 PM.
Tags
None
Referenced Files
F12852906: D12098.id29107.diff
Fri, Mar 29, 7:52 AM
Unknown Object (File)
Wed, Mar 27, 4:08 PM
Unknown Object (File)
Feb 5 2024, 7:10 PM
Unknown Object (File)
Jan 26 2024, 2:43 PM
Unknown Object (File)
Jan 26 2024, 2:43 PM
Unknown Object (File)
Jan 15 2024, 9:42 AM
Unknown Object (File)
Jan 4 2024, 4:10 PM
Unknown Object (File)
Dec 18 2023, 5:09 AM
Subscribers

Details

Summary

Ref T7522. This seems like the least-bad approach to a messy issue:

  • When backfilling accounts from an imported instance, I need to write ExternalAccount rows to the instance to link instance accounts with upstream accounts.
  • We do this in the daemons in some other cases, which lets us run all the code in the context of the instance. However, I really want to do this in-process here because it's way way simpler and we need to do writes to both the instance and the upstream, and they're interleaved, and they depend on one another.
  • I can hard-code the query with qsprintf() but that feels like 100x worse than this.

This allows me to do this:

id(new PhabricatorExternalAccount())
  ->setForcedConnnection($instance_conn)
  ->...
  ->save();

...and get a write to the instance database, which is at least not completely a minefield.

Test Plan

Backfilled instance accounts and got interleaved instance and upstream writes as expected.

Diff Detail

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

epriestley retitled this revision from to Allow LiskDAO to be forced to use a specific connection.
epriestley updated this object.
epriestley edited the test plan for this revision. (Show Details)
epriestley added a reviewer: btrahan.
btrahan edited edge metadata.

I agree on the approach, in particular that versus a qsprintf this is MUCH better.

src/infrastructure/storage/lisk/LiskDAO.php
983–985

this can maybe move up a bit since the previous conditional has no effect afaik

This revision is now accepted and ready to land.Mar 17 2015, 8:09 PM
src/infrastructure/storage/lisk/LiskDAO.php
983–985

Ah, that's a good point. This should probably be stronger than the unit test stuff.

epriestley edited edge metadata.
  • Make forced connections stronger.
This revision was automatically updated to reflect the committed changes.