Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
52 lines (47 sloc) 1.47 KB
// Copyright 2014 The Cockroach Authors.
// Use of this software is governed by the Business Source License
// included in the file licenses/BSL.txt.
// As of the Change Date specified in that file, in accordance with
// the Business Source License, use of this software will be governed
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.
package batcheval
import (
// CollectIntentRows collects the key-value pairs for each intent provided. It
// also verifies that the ReturnIntents option is allowed.
// TODO(nvanbenschoten): mvccGetInternal should return the intent values directly
// when ReturnIntents is true. Since this will initially only be used for
// RangeLookups and since this is how they currently collect intent values, this
// is ok for now.
func CollectIntentRows(
ctx context.Context, batch engine.ReadWriter, cArgs CommandArgs, intents []roachpb.Intent,
) ([]roachpb.KeyValue, error) {
if len(intents) == 0 {
return nil, nil
res := make([]roachpb.KeyValue, 0, len(intents))
for _, intent := range intents {
val, _, err := engine.MVCCGetAsTxn(
ctx, batch, intent.Key, intent.Txn.Timestamp, intent.Txn,
if err != nil {
return nil, err
if val == nil {
// Intent is a deletion.
res = append(res, roachpb.KeyValue{
Key: intent.Key,
Value: *val,
return res, nil
You can’t perform that action at this time.