func decodeAbortCacheMVCCKey( encKey engine.MVCCKey, dest []byte, ) (*uuid.UUID, error) { if encKey.IsValue() { return nil, util.Errorf("key %s is not a raw MVCC value", encKey) } return keys.DecodeAbortCacheKey(encKey.Key, dest) }
func tryAbort(kv engine.MVCCKeyValue) (string, error) { if kv.Key.Timestamp != hlc.ZeroTimestamp { return "", errors.New("not an abort cache key") } _, err := keys.DecodeAbortCacheKey(kv.Key.Key, nil) if err != nil { return "", err } var dest roachpb.AbortCacheEntry if err := maybeUnmarshalInline(kv.Value, &dest); err != nil { return "", err } return fmt.Sprintf("key=%q, pri=%d\n", dest.Key, dest.Priority), nil }
// Iterate walks through the abort cache, invoking the given callback for // each unmarshaled entry with the key, the transaction ID and the decoded // entry. func (sc *AbortCache) Iterate( e engine.Engine, f func([]byte, *uuid.UUID, roachpb.AbortCacheEntry), ) { _, _ = engine.MVCCIterate(e, sc.min(), sc.max(), roachpb.ZeroTimestamp, true /* consistent */, nil /* txn */, false, /* !reverse */ func(kv roachpb.KeyValue) (bool, error) { var entry roachpb.AbortCacheEntry txnID, err := keys.DecodeAbortCacheKey(kv.Key, nil) if err != nil { panic(err) // TODO(tschottdorf): ReplicaCorruptionError } if err := kv.Value.GetProto(&entry); err != nil { panic(err) // TODO(tschottdorf): ReplicaCorruptionError } f(kv.Key, txnID, entry) return false, nil }) }