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

package batcheval

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

Index

Package Files

cmd_add_sstable.go cmd_begin_transaction.go cmd_clear_range.go cmd_compute_checksum.go cmd_conditional_put.go cmd_delete.go cmd_delete_range.go cmd_end_transaction.go cmd_gc.go cmd_get.go cmd_heartbeat_txn.go cmd_increment.go cmd_init_put.go cmd_lease.go cmd_lease_info.go cmd_lease_request.go cmd_lease_transfer.go cmd_merge.go cmd_push_txn.go cmd_put.go cmd_query_intent.go cmd_query_txn.go cmd_range_stats.go cmd_recompute_stats.go cmd_recover_txn.go cmd_refresh.go cmd_refresh_range.go cmd_resolve_intent.go cmd_resolve_intent_range.go cmd_reverse_scan.go cmd_revert_range.go cmd_scan.go cmd_subsume.go cmd_truncate_log.go command.go declare.go eval_context.go intent.go split_stats_helper.go stateloader.go transaction.go

Constants

const (
    ReplicaChecksumVersion    = 4
    ReplicaChecksumGCInterval = time.Hour
)

Version numbers for Replica checksum computation. Requests silently no-op unless the versions are compatible.

const ClearRangeBytesThreshold = 512 << 10 // 512KiB

ClearRangeBytesThreshold is the threshold over which the ClearRange command will use engine.ClearRange to efficiently perform a range deletion. Otherwise, will revert to iterating through the values and clearing them individually with engine.Clear.

Variables

var ErrTransactionUnsupported = errors.New("not supported within a transaction")

ErrTransactionUnsupported is returned when a non-transactional command is evaluated in the context of a transaction.

var TxnAutoGC = true

TxnAutoGC controls whether Transaction entries are automatically gc'ed upon EndTransaction if they only have local intents (which can be resolved synchronously with EndTransaction). Certain tests become simpler with this being turned off.

func BeginTransaction Uses

func BeginTransaction(
    ctx context.Context, batch engine.ReadWriter, cArgs CommandArgs, resp roachpb.Response,
) (result.Result, error)

BeginTransaction writes the initial transaction record. Fails in the event that a transaction record is already written. This may occur if a transaction is started with a batch containing writes to different ranges, and the range containing the txn record fails to receive the write batch before a heartbeat or txn push is performed first and aborts the transaction.

func CanCreateTxnRecord Uses

func CanCreateTxnRecord(rec EvalContext, txn *roachpb.Transaction) error

CanCreateTxnRecord determines whether a transaction record can be created for the provided transaction. If not, the function will return an error. If so, the function may modify the provided transaction.

func CanForwardCommitTimestampWithoutRefresh Uses

func CanForwardCommitTimestampWithoutRefresh(
    txn *roachpb.Transaction, args *roachpb.EndTransactionRequest,
) bool

CanForwardCommitTimestampWithoutRefresh returns whether a txn can be safely committed with a timestamp above its read timestamp without requiring a read refresh (see txnSpanRefresher). This requires that the transaction's timestamp has not leaked and that the transaction has encountered no spans which require refreshing at the forwarded timestamp. If either of those conditions are true, a client-side retry is required.

func CanPushWithPriority Uses

func CanPushWithPriority(pusher, pushee *roachpb.Transaction) bool

CanPushWithPriority returns true if the given pusher can push the pushee based on its priority.

func ClearRange Uses

func ClearRange(
    ctx context.Context, batch engine.ReadWriter, cArgs CommandArgs, resp roachpb.Response,
) (result.Result, error)

ClearRange wipes all MVCC versions of keys covered by the specified span, adjusting the MVCC stats accordingly.

Note that "correct" use of this command is only possible for key spans consisting of user data that we know is not being written to or queried any more, such as after a DROP or TRUNCATE table, or DROP index.

func CollectIntentRows Uses

func CollectIntentRows(
    ctx context.Context, batch engine.ReadWriter, cArgs CommandArgs, intents []roachpb.Intent,
) ([]roachpb.KeyValue, error)

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

func ComputeChecksum(
    ctx context.Context, batch engine.ReadWriter, cArgs CommandArgs, resp roachpb.Response,
) (result.Result, error)

ComputeChecksum starts the process of computing a checksum on the replica at a particular snapshot. The checksum is later verified through a CollectChecksumRequest.

func ConditionalPut Uses

func ConditionalPut(
    ctx context.Context, batch engine.ReadWriter, cArgs CommandArgs, resp roachpb.Response,
) (result.Result, error)

ConditionalPut sets the value for a specified key only if the expected value matches. If not, the return value contains the actual value.

func DeclareKeysForBatch Uses

func DeclareKeysForBatch(
    desc *roachpb.RangeDescriptor, header roachpb.Header, spans *spanset.SpanSet,
)

DeclareKeysForBatch adds all keys that the batch with the provided header touches to the given SpanSet. This does not include keys touched during the processing of the batch's individual commands.

func DefaultDeclareKeys Uses

func DefaultDeclareKeys(
    _ *roachpb.RangeDescriptor, header roachpb.Header, req roachpb.Request, spans *spanset.SpanSet,
)

DefaultDeclareKeys is the default implementation of Command.DeclareKeys.

func Delete Uses

func Delete(
    ctx context.Context, batch engine.ReadWriter, cArgs CommandArgs, resp roachpb.Response,
) (result.Result, error)

Delete deletes the key and value specified by key.

func DeleteRange Uses

func DeleteRange(
    ctx context.Context, batch engine.ReadWriter, cArgs CommandArgs, resp roachpb.Response,
) (result.Result, error)

DeleteRange deletes the range of key/value pairs specified by start and end keys.

func EndTransaction Uses

func EndTransaction(
    ctx context.Context, batch engine.ReadWriter, cArgs CommandArgs, resp roachpb.Response,
) (result.Result, error)

EndTransaction either commits or aborts (rolls back) an extant transaction according to the args.Commit parameter. Rolling back an already rolled-back txn is ok.

func EvalAddSSTable Uses

func EvalAddSSTable(
    ctx context.Context, batch engine.ReadWriter, cArgs CommandArgs, _ roachpb.Response,
) (result.Result, error)

EvalAddSSTable evaluates an AddSSTable command.

func GC Uses

func GC(
    ctx context.Context, batch engine.ReadWriter, cArgs CommandArgs, resp roachpb.Response,
) (result.Result, error)

GC iterates through the list of keys to garbage collect specified in the arguments. MVCCGarbageCollect is invoked on each listed key along with the expiration timestamp. The GC metadata specified in the args is persisted after GC.

func Get Uses

func Get(
    ctx context.Context, batch engine.ReadWriter, cArgs CommandArgs, resp roachpb.Response,
) (result.Result, error)

Get returns the value for a specified key.

func HeartbeatTxn Uses

func HeartbeatTxn(
    ctx context.Context, batch engine.ReadWriter, cArgs CommandArgs, resp roachpb.Response,
) (result.Result, error)

HeartbeatTxn updates the transaction status and heartbeat timestamp after receiving transaction heartbeat messages from coordinator. Returns the updated transaction.

func Increment Uses

func Increment(
    ctx context.Context, batch engine.ReadWriter, cArgs CommandArgs, resp roachpb.Response,
) (result.Result, error)

Increment increments the value (interpreted as varint64 encoded) and returns the newly incremented value (encoded as varint64). If no value exists for the key, zero is incremented.

func InitPut Uses

func InitPut(
    ctx context.Context, batch engine.ReadWriter, cArgs CommandArgs, resp roachpb.Response,
) (result.Result, error)

InitPut sets the value for a specified key only if it doesn't exist. It returns a ConditionFailedError if the key exists with an existing value that is different from the value provided. If FailOnTombstone is set to true, tombstones count as mismatched values and will cause a ConditionFailedError.

func IsEndTransactionExceedingDeadline Uses

func IsEndTransactionExceedingDeadline(t hlc.Timestamp, args *roachpb.EndTransactionRequest) bool

IsEndTransactionExceedingDeadline returns true if the transaction exceeded its deadline.

func IsEndTransactionTriggeringRetryError Uses

func IsEndTransactionTriggeringRetryError(
    txn *roachpb.Transaction, args *roachpb.EndTransactionRequest,
) (retry bool, reason roachpb.TransactionRetryReason, extraMsg string)

IsEndTransactionTriggeringRetryError returns true if the EndTransactionRequest cannot be committed and needs to return a TransactionRetryError. It also returns the reason and possibly an extra message to be used for the error.

func LeaseInfo Uses

func LeaseInfo(
    ctx context.Context, batch engine.ReadWriter, cArgs CommandArgs, resp roachpb.Response,
) (result.Result, error)

LeaseInfo returns information about the lease holder for the range.

func MakeStateLoader Uses

func MakeStateLoader(rec EvalContext) stateloader.StateLoader

MakeStateLoader creates a StateLoader for the EvalContext.

func Merge Uses

func Merge(
    ctx context.Context, batch engine.ReadWriter, cArgs CommandArgs, resp roachpb.Response,
) (result.Result, error)

Merge is used to merge a value into an existing key. Merge is an efficient accumulation operation which is exposed by RocksDB, used by CockroachDB for the efficient accumulation of certain values. Due to the difficulty of making these operations transactional, merges are not currently exposed directly to clients. Merged values are explicitly not MVCC data.

func PushTxn Uses

func PushTxn(
    ctx context.Context, batch engine.ReadWriter, cArgs CommandArgs, resp roachpb.Response,
) (result.Result, error)

PushTxn resolves conflicts between concurrent txns (or between a non-transactional reader or writer and a txn) in several ways, depending on the statuses and priorities of the conflicting transactions. The PushTxn operation is invoked by a "pusher" (args.PusherTxn -- the writer trying to abort a conflicting txn or the reader trying to push a conflicting txn's commit timestamp forward), who attempts to resolve a conflict with a "pushee" (args.PusheeTxn -- the pushee txn whose intent(s) caused the conflict). A pusher is either transactional, in which case PusherTxn is completely initialized, or not, in which case the PusherTxn has only the priority set.

The request arrives and immediately tries to determine the current disposition of the pushee transaction by reading its transaction record. If it finds one, it continues with the push. If not, it uses knowledge from the existence of the conflicting intent to determine the current state of the pushee. It's possible that the transaction record is missing either because it hasn't been written yet or because it has already been GCed after being finalized. Once the request determines which case its in, it decides whether to continue with the push. There are a number of different outcomes that a push can result in, based on the state that the pushee's transaction record is found in:

Txn already committed/aborted: If the pushee txn is committed or aborted return success.

Txn record expired: If the pushee txn is pending, its last heartbeat timestamp is observed to determine the latest client activity. This heartbeat is forwarded by the conflicting intent's timestamp because that timestamp also indicates definitive client activity. This time of "last activity" is compared against the current time to determine whether the transaction has expired. If so, it is aborted. NOTE: the intent timestamp used is not updated on intent pushes. This is important because it allows us to use its timestamp as an indication of recent activity. If this is ever changed, we don't run the risk of any correctness violations, but we do make it possible for intent pushes to look like client activity and extend the waiting period until a transaction is considered expired. This waiting period is a "courtesy" - if we simply aborted txns right away then we would see worse performance under contention, but everything would still be correct.

Txn record not expired: If the pushee txn is not expired, its priority is compared against the pusher's (see CanPushWithPriority).

Push cannot proceed: a TransactionPushError is returned.

Push can proceed but txn record staging: if the transaction record is STAGING then it can't be changed by a pusher without going through the transaction recovery process. An IndeterminateCommitError is returned to kick off recovery.

Push can proceed: the pushee's transaction record is modified and rewritten, based on the value of args.PushType. If args.PushType is PUSH_ABORT, txn.Status is set to ABORTED. If args.PushType is PUSH_TIMESTAMP, txn.Timestamp is set to just after args.PushTo.

If the pushee is aborted, its timestamp will be forwarded to match its last client activity timestamp (i.e. last heartbeat), if available. This is done so that the updated timestamp populates the AbortSpan when the pusher proceeds to resolve intents, allowing the GC queue to purge records for which the transaction coordinator must have found out via its heartbeats that the transaction has failed.

func Put Uses

func Put(
    ctx context.Context, batch engine.ReadWriter, cArgs CommandArgs, resp roachpb.Response,
) (result.Result, error)

Put sets the value for a specified key.

func QueryIntent Uses

func QueryIntent(
    ctx context.Context, batch engine.ReadWriter, cArgs CommandArgs, resp roachpb.Response,
) (result.Result, error)

QueryIntent checks if an intent exists for the specified transaction at the given key. If the intent is missing, the request prevents the intent from ever being written at the specified timestamp (but the actual prevention happens during the timestamp cache update).

QueryIntent returns an error if the intent is missing and its ErrorIfMissing field is set to true. This error is typically an IntentMissingError, but the request is special-cased to return a SERIALIZABLE retry error if a transaction queries its own intent and finds it has been pushed.

func QueryTxn Uses

func QueryTxn(
    ctx context.Context, batch engine.ReadWriter, cArgs CommandArgs, resp roachpb.Response,
) (result.Result, error)

QueryTxn fetches the current state of a transaction. This method is used to continually update the state of a txn which is blocked waiting to resolve a conflicting intent. It fetches the complete transaction record to determine whether priority or status has changed and also fetches a list of other txns which are waiting on this transaction in order to find dependency cycles.

func RangeStats Uses

func RangeStats(
    ctx context.Context, batch engine.ReadWriter, cArgs CommandArgs, resp roachpb.Response,
) (result.Result, error)

RangeStats returns the MVCC statistics for a range.

func RecomputeStats Uses

func RecomputeStats(
    ctx context.Context, _ engine.ReadWriter, cArgs CommandArgs, resp roachpb.Response,
) (result.Result, error)

RecomputeStats recomputes the MVCCStats stored for this range and adjust them accordingly, returning the MVCCStats delta obtained in the process.

func RecoverTxn Uses

func RecoverTxn(
    ctx context.Context, batch engine.ReadWriter, cArgs CommandArgs, resp roachpb.Response,
) (result.Result, error)

RecoverTxn attempts to recover the specified transaction from an indeterminate commit state. Transactions enter this state when abandoned after updating their transaction record with a STAGING status. The RecoverTxn operation is invoked by a caller who encounters a transaction in this state after they have already queried all of the STAGING transaction's declared in-flight writes. The caller specifies whether all of these in-flight writes were found to have succeeded or whether at least one of them was prevented from ever succeeding. This is used by RecoverTxn to determine whether the result of the recovery should be committing the abandoned transaction or aborting it.

func Refresh Uses

func Refresh(
    ctx context.Context, batch engine.ReadWriter, cArgs CommandArgs, resp roachpb.Response,
) (result.Result, error)

Refresh checks the key for more recently written values than the txn's original timestamp and less recently than the txn's current timestamp.

func RefreshRange Uses

func RefreshRange(
    ctx context.Context, batch engine.ReadWriter, cArgs CommandArgs, resp roachpb.Response,
) (result.Result, error)

RefreshRange scans the key range specified by start key through end key, and returns an error on any keys written more recently than the txn's original timestamp and less recently than the txn's current timestamp.

func RegisterCommand Uses

func RegisterCommand(
    method roachpb.Method,
    declare func(*roachpb.RangeDescriptor, roachpb.Header, roachpb.Request, *spanset.SpanSet),
    impl func(context.Context, engine.ReadWriter, CommandArgs, roachpb.Response) (result.Result, error),
)

RegisterCommand makes a command available for execution. It must only be called before any evaluation takes place.

func RequestLease Uses

func RequestLease(
    ctx context.Context, batch engine.ReadWriter, cArgs CommandArgs, resp roachpb.Response,
) (result.Result, error)

RequestLease sets the range lease for this range. The command fails only if the desired start timestamp collides with a previous lease. Otherwise, the start timestamp is wound back to right after the expiration of the previous lease (or zero). If this range replica is already the lease holder, the expiration will be extended or shortened as indicated. For a new lease, all duties required of the range lease holder are commenced, including releasing all latches and clearing the timestamp cache.

func ResolveIntent Uses

func ResolveIntent(
    ctx context.Context, batch engine.ReadWriter, cArgs CommandArgs, resp roachpb.Response,
) (result.Result, error)

ResolveIntent resolves a write intent from the specified key according to the status of the transaction which created it.

func ResolveIntentRange Uses

func ResolveIntentRange(
    ctx context.Context, batch engine.ReadWriter, cArgs CommandArgs, resp roachpb.Response,
) (result.Result, error)

ResolveIntentRange resolves write intents in the specified key range according to the status of the transaction which created it.

func ReverseScan Uses

func ReverseScan(
    ctx context.Context, batch engine.ReadWriter, cArgs CommandArgs, resp roachpb.Response,
) (result.Result, error)

ReverseScan scans the key range specified by start key through end key in descending order up to some maximum number of results. maxKeys stores the number of scan results remaining for this batch (MaxInt64 for no limit).

func RevertRange Uses

func RevertRange(
    ctx context.Context, batch engine.ReadWriter, cArgs CommandArgs, resp roachpb.Response,
) (result.Result, error)

RevertRange wipes all MVCC versions more recent than TargetTime (up to the command timestamp) of the keys covered by the specified span, adjusting the MVCC stats accordingly.

Note: this should only be used when there is no user traffic writing to the target span at or above the target time.

func RunCommitTrigger Uses

func RunCommitTrigger(
    ctx context.Context,
    rec EvalContext,
    batch engine.Batch,
    ms *enginepb.MVCCStats,
    args *roachpb.EndTransactionRequest,
    txn *roachpb.Transaction,
) (result.Result, error)

RunCommitTrigger runs the commit trigger from an end transaction request.

func Scan Uses

func Scan(
    ctx context.Context, batch engine.ReadWriter, cArgs CommandArgs, resp roachpb.Response,
) (result.Result, error)

Scan scans the key range specified by start key through end key in ascending order up to some maximum number of results. maxKeys stores the number of scan results remaining for this batch (MaxInt64 for no limit).

func SetAbortSpan Uses

func SetAbortSpan(
    ctx context.Context,
    rec EvalContext,
    batch engine.ReadWriter,
    ms *enginepb.MVCCStats,
    txn enginepb.TxnMeta,
    poison bool,
) error

SetAbortSpan clears any AbortSpan entry if poison is false. Otherwise, if poison is true, creates an entry for this transaction in the AbortSpan to prevent future reads or writes from spuriously succeeding on this range.

func Subsume Uses

func Subsume(
    ctx context.Context, batch engine.ReadWriter, cArgs CommandArgs, resp roachpb.Response,
) (result.Result, error)

Subsume freezes a range for merging with its left-hand neighbor. When called correctly, it provides important guarantees that ensure there is no moment in time where the ranges involved in the merge could both process commands for the same keys.

Specifically, the receiving replica guarantees that:

1. it is the leaseholder at the time the request executes,
2. when it responds, there are no commands in flight with a timestamp
   greater than the FreezeStart timestamp provided in the response,
3. the MVCC statistics in the response reflect the latest writes,
4. it, and all future leaseholders for the range, will not process another
   command until they refresh their range descriptor with a consistent read
   from meta2, and
5. if it or any future leaseholder for the range finds that its range
   descriptor has been deleted, it self destructs.

To achieve guarantees four and five, when issuing a Subsume request, the caller must have a merge transaction open that has already placed deletion intents on both the local and meta2 copy of the right-hand range descriptor. The intent on the meta2 allows the leaseholder to block until the merge transaction completes by performing a consistent read for its meta2 descriptor. The intent on the local descriptor allows future leaseholders to efficiently check whether a merge is in progress by performing a read of its local descriptor after acquiring the lease.

The period of time after intents have been placed but before the merge transaction is complete is called the merge's "critical phase".

func SynthesizeTxnFromMeta Uses

func SynthesizeTxnFromMeta(rec EvalContext, txn enginepb.TxnMeta) roachpb.Transaction

SynthesizeTxnFromMeta creates a synthetic transaction object from the provided transaction metadata. The synthetic transaction is not meant to be persisted, but can serve as a representation of the transaction for outside observation. The function also checks whether it is possible for the transaction to ever create a transaction record in the future. If not, the returned transaction will be marked as ABORTED and it is safe to assume that the transaction record will never be written in the future.

func TransferLease Uses

func TransferLease(
    ctx context.Context, batch engine.ReadWriter, cArgs CommandArgs, resp roachpb.Response,
) (result.Result, error)

TransferLease sets the lease holder for the range. Unlike with RequestLease(), the new lease is allowed to overlap the old one, the contract being that the transfer must have been initiated by the (soon ex-) lease holder which must have dropped all of its lease holder powers before proposing.

func TruncateLog Uses

func TruncateLog(
    ctx context.Context, batch engine.ReadWriter, cArgs CommandArgs, resp roachpb.Response,
) (result.Result, error)

TruncateLog discards a prefix of the raft log. Truncating part of a log that has already been truncated has no effect. If this range is not the one specified within the request body, the request will also be ignored.

func UnregisterCommand Uses

func UnregisterCommand(method roachpb.Method)

UnregisterCommand is provided for testing and allows removing a command. It is a no-op if the command is not registered.

func VerifyTransaction Uses

func VerifyTransaction(
    h roachpb.Header, args roachpb.Request, permittedStatuses ...roachpb.TransactionStatus,
) error

VerifyTransaction runs sanity checks verifying that the transaction in the header and the request are compatible.

func WriteAbortSpanOnResolve Uses

func WriteAbortSpanOnResolve(status roachpb.TransactionStatus) bool

WriteAbortSpanOnResolve returns true if the abort span must be written when the transaction with the given status is resolved.

type Command Uses

type Command struct {
    // DeclareKeys adds all keys this command touches, and when (if applicable), to the given SpanSet.
    // TODO(nvanbenschoten): rationalize this RangeDescriptor. Can it change
    // between key declaration and cmd evaluation?
    DeclareKeys func(*roachpb.RangeDescriptor, roachpb.Header, roachpb.Request, *spanset.SpanSet)

    // Eval evaluates a command on the given engine. It should populate the
    // supplied response (always a non-nil pointer to the correct type) and
    // return special side effects (if any) in the Result. If it writes to the
    // engine it should also update *CommandArgs.Stats. It should treat the
    // provided request as immutable.
    Eval func(context.Context, engine.ReadWriter, CommandArgs, roachpb.Response) (result.Result, error)
}

A Command is the implementation of a single request within a BatchRequest.

func LookupCommand Uses

func LookupCommand(method roachpb.Method) (Command, bool)

LookupCommand returns the command for the given method, with the boolean indicating success or failure.

type CommandArgs Uses

type CommandArgs struct {
    EvalCtx EvalContext
    Header  roachpb.Header
    Args    roachpb.Request

    // If MaxKeys is non-zero, span requests should limit themselves to
    // that many keys. Commands using this feature should also set
    // NumKeys and ResumeSpan in their responses.
    MaxKeys int64

    // *Stats should be mutated to reflect any writes made by the command.
    Stats *enginepb.MVCCStats
}

CommandArgs contains all the arguments to a command. TODO(bdarnell): consider merging with storagebase.FilterArgs (which would probably require removing the EvalCtx field due to import order constraints).

type EvalContext Uses

type EvalContext interface {
    fmt.Stringer
    ClusterSettings() *cluster.Settings
    EvalKnobs() storagebase.BatchEvalTestingKnobs

    Engine() engine.Engine
    Clock() *hlc.Clock
    DB() *client.DB
    AbortSpan() *abortspan.AbortSpan
    GetTxnWaitQueue() *txnwait.Queue
    GetLimiters() *Limiters

    NodeID() roachpb.NodeID
    StoreID() roachpb.StoreID
    GetRangeID() roachpb.RangeID
    GetNodeLocality() roachpb.Locality

    IsFirstRange() bool
    GetFirstIndex() (uint64, error)
    GetTerm(uint64) (uint64, error)
    GetLeaseAppliedIndex() uint64

    Desc() *roachpb.RangeDescriptor
    ContainsKey(key roachpb.Key) bool

    // CanCreateTxnRecord determines whether a transaction record can be created
    // for the provided transaction information. See Replica.CanCreateTxnRecord
    // for details about its arguments, return values, and preconditions.
    CanCreateTxnRecord(
        txnID uuid.UUID, txnKey []byte, txnMinTS hlc.Timestamp,
    ) (ok bool, minCommitTS hlc.Timestamp, reason roachpb.TransactionAbortedReason)

    // GetMVCCStats returns a snapshot of the MVCC stats for the range.
    // If called from a command that declares a read/write span on the
    // entire range, the stats will be consistent with the data that is
    // visible to the batch. Otherwise, it may return inconsistent
    // results due to concurrent writes.
    GetMVCCStats() enginepb.MVCCStats

    // GetSplitQPS returns the queries/s request rate for this range.
    //
    // NOTE: This should not be used when the load based splitting cluster
    // setting is disabled.
    GetSplitQPS() float64

    GetGCThreshold() hlc.Timestamp
    GetLastReplicaGCTimestamp(context.Context) (hlc.Timestamp, error)
    GetLease() (roachpb.Lease, roachpb.Lease)

    GetExternalStorage(ctx context.Context, dest roachpb.ExternalStorage) (cloud.ExternalStorage, error)
    GetExternalStorageFromURI(ctx context.Context, uri string) (cloud.ExternalStorage, error)
}

EvalContext is the interface through which command evaluation accesses the underlying state.

type Limiters Uses

type Limiters struct {
    BulkIOWriteRate              *rate.Limiter
    ConcurrentImportRequests     limit.ConcurrentRequestLimiter
    ConcurrentExportRequests     limit.ConcurrentRequestLimiter
    ConcurrentAddSSTableRequests limit.ConcurrentRequestLimiter
    // concurrentRangefeedIters is a semaphore used to limit the number of
    // rangefeeds in the "catch-up" state across the store. The "catch-up" state
    // is a temporary state at the beginning of a rangefeed which is expensive
    // because it uses an engine iterator.
    ConcurrentRangefeedIters limit.ConcurrentRequestLimiter
}

Limiters is the collection of per-store limits used during cmd evaluation.

Directories

PathSynopsis
result

Package batcheval imports 33 packages (graph) and is imported by 6 packages. Updated 2019-11-11. Refresh now. Tools for package owners.