-
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: index recommendation code can cause log spam and errors #85875
Comments
cc @rafiss I think this might be related to the case where we get an error but only log it instead of returning it, thus the txn becomes invalid? |
+1 was going to point that out too. Here's an example where that happened before: #85454 Is there any part of this code that uses a transaction/internalExecutor to do something, but then ignores/logs the error without returning it to the txn runner? |
This is the part of the code that is causing the error cockroach/pkg/sql/instrumentation.go Lines 699 to 726 in 4655f97
that is the first time using the executor (on this new function) and we add the log. That functions is called here cockroach/pkg/sql/conn_executor_exec.go Line 1201 in 4655f97
|
Is it intentional that a
|
OK I have a better idea now, my previous comment definitely seems like it's a bug (i.e. the change in aed014f doesn't seem like it fully did what we want cc @ajwerner), but I don't think that's the problem here. The problem is that that cockroach/pkg/sql/conn_executor_exec.go Line 1201 in 65fe1a5
But at this point the transaction may already have committed, probably due to the 1PC fast path optimization. |
It also could be aborted due to a serializability or deadlock error. |
Previously, if a transaction (from planner.txn) was already closed, due to one-phase commit optimization or an error, we were still trying to generate a recommendation, causing log spam. This commit now checks if we have a transaction open that can be used, otherwise it won't try to generate recommendation. This commit also updates the cache, even if the recommendation generations fails, this way we won't keep trying constantly, and instead will wait for the next hour to try again. Fixes cockroachdb#85875 Release note (bug fix): Do a proper check if a transaction is open, before trying to generate index recommendations.
85907: sql: fix log spam during idx recommendation if txn was closed r=maryliag a=maryliag Previously, if a transaction (from planner.txn) was already closed, due to one-phase commit optimization or an error, we were still trying to generate a recommendation, causing log spam. This commit now checks if we have a transaction open that can be used, otherwise it won't try to generate recommendation. This commit also updates the cache, even if the recommendation generations fails, this way we won't keep trying constantly, and instead will wait for the next hour to try again. Fixes #85875 Release note: None 85921: sql: use the correct txn when creating external connection r=benbardin a=adityamaru We need to use the planners' txn when creating an external connection. Using a DB().Txn here was an oversight. Release note: None Co-authored-by: Marylia Gutierrez <[email protected]> Co-authored-by: Aditya Maru <[email protected]>
Describe the problem
I ran an unrelated test and see:
I think there's a few things going on here:
To Reproduce
Run a test that sets short job intervals.
Jira issue: CRDB-18470
The text was updated successfully, but these errors were encountered: