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

package abortspan

import "github.com/cockroachdb/cockroach/pkg/storage/abortspan"

Index

Package Files

abortspan.go

func MaxKey Uses

func MaxKey(rangeID roachpb.RangeID) roachpb.Key

MaxKey returns the upper bound of the key span associated to an instance for the given RangeID.

func MinKey Uses

func MinKey(rangeID roachpb.RangeID) roachpb.Key

MinKey returns the lower bound of the key span associated to an instance for the given RangeID.

type AbortSpan Uses

type AbortSpan struct {
    // contains filtered or unexported fields
}

An AbortSpan sets markers for aborted transactions to provide protection against an aborted but active transaction not reading values it wrote (due to its intents having been removed).

The span is range-specific. It is updated when an intent for an aborted txn is cleared from a range, and is consulted before read commands are processed on a range.

An AbortSpan is not thread safe.

func New Uses

func New(rangeID roachpb.RangeID) *AbortSpan

New returns a new AbortSpan. Every range replica maintains an AbortSpan, not just the lease holder.

func (*AbortSpan) ClearData Uses

func (sc *AbortSpan) ClearData(e engine.Engine) error

ClearData removes all persisted items stored in the cache.

func (*AbortSpan) CopyTo Uses

func (sc *AbortSpan) CopyTo(
    ctx context.Context,
    r engine.Reader,
    w engine.ReadWriter,
    ms *enginepb.MVCCStats,
    ts hlc.Timestamp,
    newRangeID roachpb.RangeID,
) error

CopyTo copies the abort span entries to the abort span for the range identified by newRangeID. Entries are read from r and written to w. It is safe for r and w to be the same object.

CopyTo takes care to only copy records that are required: certain workloads create sizable abort spans, and repeated splitting can blow them up further. Once it reaches approximately the Raft MaxCommandSize, splits become impossible, which is pretty bad (see #25233).

func (*AbortSpan) Del Uses

func (sc *AbortSpan) Del(
    ctx context.Context, e engine.ReadWriter, ms *enginepb.MVCCStats, txnID uuid.UUID,
) error

Del removes all AbortSpan entries for the given transaction.

func (*AbortSpan) Get Uses

func (sc *AbortSpan) Get(
    ctx context.Context, e engine.Reader, txnID uuid.UUID, entry *roachpb.AbortSpanEntry,
) (bool, error)

Get looks up an AbortSpan entry recorded for this transaction ID. Returns whether an abort record was found and any error.

func (*AbortSpan) Iterate Uses

func (sc *AbortSpan) Iterate(
    ctx context.Context, e engine.Reader, f func(roachpb.Key, roachpb.AbortSpanEntry) error,
) error

Iterate walks through the AbortSpan, invoking the given callback for each unmarshaled entry with the MVCC key and the decoded entry.

func (*AbortSpan) Put Uses

func (sc *AbortSpan) Put(
    ctx context.Context,
    e engine.ReadWriter,
    ms *enginepb.MVCCStats,
    txnID uuid.UUID,
    entry *roachpb.AbortSpanEntry,
) error

Put writes an entry for the specified transaction ID.

Package abortspan imports 10 packages (graph) and is imported by 8 packages. Updated 2019-11-18. Refresh now. Tools for package owners.