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 LocalResult Uses

type LocalResult struct {
    Reply *roachpb.BatchResponse

    // EncounteredIntents 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.
    EncounteredIntents []roachpb.Intent
    // UpdatedTxns stores transaction records that have been updated by
    // calls to EndTxn, PushTxn, and RecoverTxn.
    UpdatedTxns []*roachpb.Transaction
    // 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

    // 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

    // Metrics contains counters which are to be passed to the
    // metrics subsystem.
    Metrics *Metrics
}

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) DetachEncounteredIntents Uses

func (lResult *LocalResult) DetachEncounteredIntents() []roachpb.Intent

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

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 EndTxn command succeeded.

func (*LocalResult) IsZero Uses

func (lResult *LocalResult) IsZero() bool

IsZero reports whether lResult is the zero value.

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 FromEncounteredIntents Uses

func FromEncounteredIntents(intents []roachpb.Intent) Result

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

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 (*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 31 packages. Updated 2020-01-18. Refresh now. Tools for package owners.