restore: skip dropped/missing descriptors during restore revert#166116
restore: skip dropped/missing descriptors during restore revert#166116trunk-io[bot] merged 1 commit intocockroachdb:masterfrom
Conversation
|
😎 Merged successfully - details. |
| // as dropped here. | ||
| typDesc := details.TypeDescs[i] | ||
| mutType, err := descsCol.MutableByID(txn.KV()).Type(ctx, typDesc.ID) | ||
| mutType, err := descsCol.MutableByID(txn.KV()).Desc(ctx, typDesc.ID) |
There was a problem hiding this comment.
I switched all the lookup calls to Desc so that we could do a simple comparison against catalog.ErrDescriptorNotFound. The type-specific lookup calls like Database() or Schema() always replace the error with a type-specific pgcode:
cockroach/pkg/sql/catalog/descs/getters.go
Lines 56 to 62 in d608df0
I don't think there's any difference here aside from the fact that we lose the checking that the ID is specifically of that object type, but I don't think that makes much of a difference. But if anyone thinks otherwise, I'm open to changing this.
There was a problem hiding this comment.
maybe add a comment here, the first place you do this?
f8997dc to
9954fb4
Compare
| // as dropped here. | ||
| typDesc := details.TypeDescs[i] | ||
| mutType, err := descsCol.MutableByID(txn.KV()).Type(ctx, typDesc.ID) | ||
| mutType, err := descsCol.MutableByID(txn.KV()).Desc(ctx, typDesc.ID) |
There was a problem hiding this comment.
maybe add a comment here, the first place you do this?
Previously, if a user dropped descriptors (tables, types, functions, schemas) that were created by an online restore while the download job was paused, canceling the download job would get stuck in the reverting state. This happened because both `setDescriptorsOffline` and `dropDescriptors` would fail when trying to look up descriptors that had already been dropped. Fix this by skipping descriptors that are already dropped or not found. Fixes: cockroachdb#165789 Release note: None
9954fb4 to
a5b1fb2
Compare
|
TFTR! /trunk merge |
Previously, if a user dropped descriptors (tables, types, functions, schemas) that were created by an online restore while the download job was paused, canceling the download job would get stuck in the reverting state. This happened because both
setDescriptorsOfflineanddropDescriptorswould fail when trying to look up descriptors that had already been dropped.Fix this by skipping descriptors that are already dropped or not found.
Fixes: #165789
Release note: None