shouldCatchPanic checks whether the panic that was emitted from panicEmittedFrom line of code (which contains the full path to the function where the panic originated) should be caught by the vectorized engine. The vectorized engine uses the panic-catch mechanism of error propagation, so we need to
(panicEmittedFrom string)
| 191 | // |
| 192 | // panicEmittedFrom must be trimmed to not have any white spaces in the prefix. |
| 193 | func shouldCatchPanic(panicEmittedFrom string) bool { |
| 194 | // In crdb_test builds we do not catch runtime panics even if they originate |
| 195 | // from within the vectorized execution engine. These panics probably |
| 196 | // represent bugs in vectorized execution, and we want them to fail loudly in |
| 197 | // tests (but not in production clusters). |
| 198 | if buildutil.CrdbTestBuild && !testingKnobShouldCatchPanic { |
| 199 | return false |
| 200 | } |
| 201 | |
| 202 | const panicFromTheCatcherItselfPrefix = "github.com/cockroachdb/cockroachdb-parser/pkg/sql/colexecerror.CatchVectorizedRuntimeError" |
| 203 | if strings.HasPrefix(panicEmittedFrom, panicFromTheCatcherItselfPrefix) { |
| 204 | // This panic came from the catcher itself, so we will propagate it |
| 205 | // unchanged by the higher-level catchers. |
| 206 | return false |
| 207 | } |
| 208 | const nonCatchablePanicPrefix = "github.com/cockroachdb/cockroachdb-parser/pkg/sql/colexecerror.NonCatchablePanic" |
| 209 | if strings.HasPrefix(panicEmittedFrom, nonCatchablePanicPrefix) { |
| 210 | // This panic came from NonCatchablePanic() method and should not be |
| 211 | // caught. |
| 212 | return false |
| 213 | } |
| 214 | return strings.HasPrefix(panicEmittedFrom, colPackagesPrefix) || |
| 215 | strings.HasPrefix(panicEmittedFrom, encodingPackagePrefix) || |
| 216 | strings.HasPrefix(panicEmittedFrom, execinfraPackagePrefix) || |
| 217 | strings.HasPrefix(panicEmittedFrom, sqlColPackagesPrefix) || |
| 218 | strings.HasPrefix(panicEmittedFrom, sqlRowPackagesPrefix) || |
| 219 | strings.HasPrefix(panicEmittedFrom, sqlSemPackagesPrefix) || |
| 220 | strings.HasPrefix(panicEmittedFrom, testSqlColPackagesPrefix) |
| 221 | } |
| 222 | |
| 223 | // StorageError is an error that was created by a component below the sql |
| 224 | // stack, such as the network or storage layers. A StorageError will be bubbled |
no outgoing calls
no test coverage detected
searching dependent graphs…