-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sql: add support to the InternalExecutor to execute multiple SQL queries #71467
Comments
@ajwerner @andreimatei @knz going out on a limb and tagging y'all as folks who know this part of the code better. Are there any obvious blockers that I might have missed? I'll keep digging and fleshing out a strawman. |
Can the multiple statement execution happen via outside Db.Txn with a loop that executes multiple statements? |
Consider adding session support in the form of a gosql driver implementation that talks to the |
@RichardJCai this is timely give the discussions yesterday on #69495. |
You mean a single per usage point? We can't have a single isntance of connExecutor for IE needs of a SQL server: there are many goroutines that use the IE concurrently. Each of them needs a different instance. So what would be the lifecycle of an IE? |
I think the main shortcoming is that this approach does not maintain cockroach/pkg/sql/conn_executor.go Line 1122 in 014874e
connExecutor . Whether this matters for IMPORT is still something I don't have a clear vision of.
|
Yup, that's right I misspoke.
I'm interested in further discussing @ajwerner's suggestion #71246 (comment) of injecting information to tighter bind the IE to the current state of the parent It raises the question of whether we want, one IE that initializes a Both the above options do rely on us hanging a factory of the |
An important case is when there is no "parent In the cases where there is a parent |
Can someone explain what in what way this was done? I don't see something obvious in the InternalExecutor's interface. |
HI @andreimatei, in #82477 we modified how the conn executor inherits and processes txn-related metadata from the outer caller of the internal executor. With those changes, now an internal executor can be used to run multiple sql queries, but only if they are initialized with the new interfaces we introduced. Tests to run multiple queries with an Internal Executor in |
Some new interfaces were added, but it seems to me that we're far from being able to use the
Given how reasonable the expectation that using the database from inside it should not be a lot harder than using it from the outside is, I think we should keep this issue open for this goal. |
I agree that the current internal executor is not versatile, but I wonder how much we want to expect from an internal executor, how far we can possibly go with it, and is it possible to sheer to other ways (such as using the Also, though we're still far, maybe it'd be helpful if we can break this issue into smaller ones to track the progress. |
Today, the
InternalExecutor
exposes several methods such asExecEx
,QueryRowEx
that take a single SQL statement and execute it using aconnExecutor
. A new executor is initialized for every statement and is closed once query execution completes. One consequence of this is that an internal executor cannot maintainextraTxnState
across multiple SQL queries, and so we cannot run multiple statements in a txn using an internal executor.This issue tracks work to expand the internal executor to support multiple queries that can be run in an explicit txn, or in a higher-level SQL transaction. For the most part this would require having a single, long-lived
connExectuor
that reads multiple statements, pushed by the ie, via thestmtBuf
.A motivation for this change is to prototype #67076 (comment).
Epic CRDB-14492
Jira issue: CRDB-10591
The text was updated successfully, but these errors were encountered: