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
F14063498: D12098.diff
Mon, Nov 18, 6:47 PM
F13981190: D12098.id.diff
Oct 19 2024, 2:48 PM
F13980527: D12098.id29103.diff
Oct 19 2024, 11:14 AM
F13978013: D12098.diff
Oct 18 2024, 9:06 PM
F13978002: D12098.diff
Oct 18 2024, 9:05 PM
F13977990: D12098.diff
Oct 18 2024, 9:01 PM
F13972351: D12098.id.diff
Oct 17 2024, 6:30 PM
F13962406: D12098.id29107.diff
Oct 15 2024, 9:53 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
Branch
import1
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 4910
Build 4928: [Placeholder Plan] Wait for 30 Seconds

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.