[Plugin: HyperDB] "Hiding" a reserved DB for slow-query usage
So my employer has been using HyperDB for some time now, which I’ve been tweaking to add some little bugfixes/features (bugfixes for *our* implementation).
What I need to do now:
1. “Hide” a database instance (possibly using $wpdb->add_database(array()) )
2. Identify “slow queries” (we call them “Cursed Queries”) using SQL comments (//done)
3. Force HyperDB to use the VIP/hidden database instance when a Cursed Query arrives – unless of course it follows a write (the write override is default to HyperDB)
4. Disable future connections from using the VIP until it has freed it’s result
So… looks like 1,3,4 are where I’m having trouble. I have been able to identify the Cursed Queries (super-simple), but creating and hiding a database instance (which would get added to the $dbh via $hyper_servers, I’d imagine) is throwing me.
I can’t use the “dataset” to my customization as it’s used for sharding (which we don’t do), and I’d really rather not hard-code my DB instance info into the db.php HyperDB code itself.
Ideally, I’d like to identify the Cursed Query (readonly && not following a write) and override the chosen database server (I could just clear out all the db servers in the stack, run my query with the only ‘newly added’ db server, and then re-add the originals, right?).
Anyone with some smart ideas? I’m spinning my wheels here, and the sprint task had me at completing this in 2 days (ha!).
- The topic ‘[Plugin: HyperDB] "Hiding" a reserved DB for slow-query usage’ is closed to new replies.