@@ -156,32 +156,44 @@ func JobExists(
156156 return row != nil , nil
157157}
158158
159- // IsJobTypeColumnDoesNotExistError returns true if the error is of the form
159+ // isJobTypeColumnDoesNotExistError returns true if the error is of the form
160160// `column "job_type" does not exist`.
161161func isJobTypeColumnDoesNotExistError (err error ) bool {
162162 return pgerror .GetPGCode (err ) == pgcode .UndefinedColumn &&
163163 strings .Contains (err .Error (), "column \" job_type\" does not exist" )
164164}
165165
166+ // isJobInfoTableDoesNotExistError returns true if the error is of the form
167+ // `related "job_info" does not exist`.
168+ func isJobInfoTableDoesNotExistError (err error ) bool {
169+ return pgerror .GetPGCode (err ) == pgcode .UndefinedTable &&
170+ strings .Contains (err .Error (), "relation \" system.job_info\" does not exist" )
171+ }
172+
166173// MaybeGenerateForcedRetryableError returns a
167174// TransactionRetryWithProtoRefreshError that will cause the txn to be retried
168- // if the error is because of an undefined job_type column.
175+ // if the error is because of an undefined job_type column or missing job_info
176+ // table.
169177//
170178// In https://github.com/cockroachdb/cockroach/issues/106762 we noticed that if
171179// a query is executed with an AS OF SYSTEM TIME clause that picks a transaction
172180// timestamp before the job_type migration, then parts of the jobs
173181// infrastructure will attempt to query the job_type column even though it
174182// doesn't exist at the transaction's timestamp.
175183//
176- // As a short term fix, when we encounter an `UndefinedColumn` error we
177- // generate a synthetic retryable error so that the txn is pushed to a
178- // higher timestamp at which the upgrade will have completed and the
179- // `job_type` column will be visible. The longer term fix is being tracked
180- // in https://github.com/cockroachdb/cockroach/issues/106764.
184+ // As a short term fix, when we encounter an `UndefinedTable` or
185+ // `UndefinedColumn` error we generate a synthetic retryable error so that the
186+ // txn is pushed to a higher timestamp at which the upgrade will have completed
187+ // and the table/ column will be visible. The longer term fix is being tracked in
188+ // https://github.com/cockroachdb/cockroach/issues/106764.
181189func MaybeGenerateForcedRetryableError (ctx context.Context , txn * kv.Txn , err error ) error {
182190 if err != nil && isJobTypeColumnDoesNotExistError (err ) {
183191 return txn .GenerateForcedRetryableError (ctx , "synthetic error " +
184192 "to push timestamp to after the `job_type` upgrade has run" )
185193 }
194+ if err != nil && isJobInfoTableDoesNotExistError (err ) {
195+ return txn .GenerateForcedRetryableError (ctx , "synthetic error " +
196+ "to push timestamp to after the `job_info` upgrade has run" )
197+ }
186198 return err
187199}
0 commit comments