cockroach: github.com/cockroachdb/cockroach/pkg/storage/batcheval/result Index | Files

package result

import "github.com/cockroachdb/cockroach/pkg/storage/batcheval/result"

Index

Package Files

intent.go metrics.go result.go

type EndTxnIntents Uses

type EndTxnIntents struct {
    Txn    roachpb.Transaction
    Always bool
    Poison bool
}

EndTxnIntents contains a finished transaction and a bool (Always), which indicates whether the intents should be resolved whether or not the command succeeds through Raft.

type IntentsWithArg Uses

type IntentsWithArg struct {
    Arg     roachpb.Request
    Intents []roachpb.Intent
}

IntentsWithArg contains a request and the intents it discovered.

type LocalResult Uses

type LocalResult struct {
    Reply *roachpb.BatchResponse

    // Intents stores any intents encountered but not conflicted with.
    // They should be handed off to asynchronous intent processing on the
    // proposer, so that an attempt to resolve them is made.
    //
    // This is a pointer to allow the zero (and as an unwelcome side effect,
    // all) values to be compared.
    Intents *[]IntentsWithArg
    // EndTxns stores completed transactions. If the transaction
    // contains unresolved intents, they should be handed off for
    // asynchronous intent resolution. A bool in each EndTxnIntents
    // indicates whether or not the intents must be left alone if the
    // corresponding command/proposal didn't succeed. For example,
    // resolving intents of a committing txn should not happen if the
    // commit fails, or we may accidentally make uncommitted values
    // live.
    EndTxns *[]EndTxnIntents
    // Metrics contains counters which are to be passed to the
    // metrics subsystem.
    Metrics *Metrics

    // When set (in which case we better be the first range), call
    // GossipFirstRange if the Replica holds the lease.
    GossipFirstRange bool
    // Call MaybeGossipSystemConfig.
    MaybeGossipSystemConfig bool
    // Call MaybeAddToSplitQueue.
    MaybeAddToSplitQueue bool
    // Call MaybeGossipNodeLiveness with the specified Span, if set.
    MaybeGossipNodeLiveness *roachpb.Span
    // Call maybeWatchForMerge.
    MaybeWatchForMerge bool

    // Set when transaction record(s) are updated, after calls to
    // EndTransaction or PushTxn. This is a pointer to allow the zero
    // (and as an unwelcome side effect, all) values to be compared.
    UpdatedTxns *[]*roachpb.Transaction
}

LocalResult is data belonging to an evaluated command that is only used on the node on which the command was proposed. Note that the proposing node may die before the local results are processed, so any side effects here are only best-effort.

func (*LocalResult) DetachEndTxns Uses

func (lResult *LocalResult) DetachEndTxns(alwaysOnly bool) []EndTxnIntents

DetachEndTxns returns (and removes) the EndTxnIntent objects from the local result. If alwaysOnly is true, the slice is filtered to include only those which have specified returnAlways=true, meaning the intents should be resolved regardless of whether the EndTransaction command succeeded.

func (*LocalResult) DetachIntents Uses

func (lResult *LocalResult) DetachIntents() []IntentsWithArg

DetachIntents returns (and removes) those intents from the LocalEvalResult which are supposed to be handled.

func (*LocalResult) DetachMaybeWatchForMerge Uses

func (lResult *LocalResult) DetachMaybeWatchForMerge() bool

DetachMaybeWatchForMerge returns and clears the MaybeWatchForMerge flag from the local result.

func (*LocalResult) String Uses

func (lResult *LocalResult) String() string

type Metrics Uses

type Metrics struct {
    LeaseRequestSuccess  int // lease request evaluated successfully
    LeaseRequestError    int // lease request error at evaluation time
    LeaseTransferSuccess int // lease transfer evaluated successfully
    LeaseTransferError   int // lease transfer error at evaluation time
    ResolveCommit        int // intent commit evaluated successfully
    ResolveAbort         int // non-poisoning intent abort evaluated successfully
    ResolvePoison        int // poisoning intent abort evaluated successfully
}

Metrics tracks various counters related to command applications and their outcomes.

func (*Metrics) Add Uses

func (mt *Metrics) Add(o Metrics)

Add absorbs the supplied Metrics into the receiver.

type Result Uses

type Result struct {
    Local        LocalResult
    Replicated   storagepb.ReplicatedEvalResult
    WriteBatch   *storagepb.WriteBatch
    LogicalOpLog *storagepb.LogicalOpLog
}

Result is the result of evaluating a KV request. That is, the proposer (which holds the lease, at least in the case in which the command will complete successfully) has evaluated the request and is holding on to:

a) changes to be written to disk when applying the command b) changes to the state which may require special handling (i.e. code

execution) on all Replicas

c) data which isn't sent to the followers but the proposer needs for tasks

it must run when the command has applied (such as resolving intents).

func FromEndTxn Uses

func FromEndTxn(txn *roachpb.Transaction, alwaysReturn, poison bool) Result

FromEndTxn creates a Result communicating that a transaction was completed and its intents should be resolved.

func FromIntents Uses

func FromIntents(intents []roachpb.Intent, args roachpb.Request) Result

FromIntents creates a Result communicating that the intents were encountered by the given request and should be handled.

func (*Result) IsZero Uses

func (p *Result) IsZero() bool

IsZero reports whether p is the zero value.

func (*Result) MergeAndDestroy Uses

func (p *Result) MergeAndDestroy(q Result) error

MergeAndDestroy absorbs the supplied EvalResult while validating that the resulting EvalResult makes sense. For example, it is forbidden to absorb two lease updates or log truncations, or multiple splits and/or merges.

The passed EvalResult must not be used once passed to Merge.

Package result imports 7 packages (graph) and is imported by 11 packages. Updated 2019-08-17. Refresh now. Tools for package owners.