Our way of supporting using databases other than the default one is a bit heavy-handed, and also error-prone. Whenever any database interaction occurs, we have to remember to call setDb() before it, and to undo that later with resetDb() only if the database was really changed at the first point (and not already earlier). Rather confusing, on the whole, and I also recently realized one problem: when an exception is thrown out of the class, we currently don't change the database connection back, leaking our database information out into the rest of the Drupal installation (and thereby having to hope for only a fatal error, and not severe data corruption).

As far as I know, only very few people are actually using this feature, but as long as it's there it should of course be properly supported.

Comments

drunken monkey’s picture

Status: Active » Needs review
StatusFileSize
new14.63 KB

The attached patch uses the much, much more elegant way of saving a connection object when the service class is instantiated and then relying on that instead of the various db_* helper functions for interacting with the database. (Had I known of this back when I first wrote this module, I would very likely have gone for that from the start.)

Status: Needs review » Needs work

The last submitted patch, 1: 2147361-1--database_connection_handling.patch, failed testing.

drunken monkey’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 1: 2147361-1--database_connection_handling.patch, failed testing.

drunken monkey’s picture

Status: Needs work » Needs review
drunken monkey’s picture

Status: Needs review » Fixed

Committed.

drunken monkey’s picture

Status: Fixed » Needs review
StatusFileSize
new9.93 KB

I don't know how it happened but apparently I missed quite a few places. Patch attached.
I'll commit and create a new release very soon, but please, if you are using a non-default database with your search server, try out this patch and see if it fixes support for that feature!

drunken monkey’s picture

Priority: Normal » Major
drunken monkey’s picture

Status: Needs review » Fixed

Since it's certainly at least better than what's currently there and it blocks #2155767: Improve the speed of full text searches by using a single index table, I've just gone ahead and committed this. If you are using a non-default database and encounter any errors in the latest dev version, please re-open this issue and report your problems.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

  • Commit 8e0ba26 on 7.x-1.x by drunken monkey:
    Follow-up to #2147361 by drunken monkey: Fixed some more left-over...