fix: route insert-runner thread safety through a client capability - #849
Open
serhiizghama wants to merge 3 commits into
Open
fix: route insert-runner thread safety through a client capability#849serhiizghama wants to merge 3 commits into
serhiizghama wants to merge 3 commits into
Conversation
Replace the db.name branching in RatedMultiThreadingInsertRunner with a VectorDB.copy_for_thread() hook driven by the existing thread_safe flag, so non-thread-safe clients get a per-thread copy without the runner hardcoding which databases those are.
The mysql.connector-backed clients (SeekDB, VolcMySQL, OceanBase) can't be deep-copied while holding an open socket, and Doris needs its client/table cleared; each now overrides copy_for_thread accordingly. OceanBase was previously missing from the runner's name list entirely, so its fixed-rate insert workers shared one connection.
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: serhiizghama The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #810. The fixed-rate insert runner decided per-thread client handling by checking
db.nameagainst a hardcoded list (PgVector,Doris,SeekDB,VolcMySQL), so clients that declarethread_safe = Falsebut aren't on that list —OceanBase,VectorChord,Adbpg,LanceDB— fell through to the default path and shared one non-thread-safe connection across insert workers.OceanBasewas never in the list at all.I moved the decision onto the existing
thread_safecapability. The runner now branches ondb.thread_safeand asks the client for a per-thread copy via a newVectorDB.copy_for_thread(). The default deep-copies the instance, which already works for the psycopg-family clients and forLanceDB(it has a custom__deepcopy__); themysql.connector-backed clients override it to shallow-copy and drop their open socket soinit()reconnects inside the worker. Behavior for the databases that were already special-cased is unchanged — the capability just also covers the ones the name list missed, and adding a new non-thread-safe client no longer means remembering to edit the runner.Added a unit test that drives
send_insert_taskwith a fake client and checks that thread-safe clients insert through the shared object while non-thread-safe ones go through a copy plusinit().