cockroach: github.com/cockroachdb/cockroach/pkg/kv/kvnemesis Index | Files

package kvnemesis

import "github.com/cockroachdb/cockroach/pkg/kv/kvnemesis"

Package kvnemesis exercises the KV api with random traffic and then validates that the observed behaviors are consistent with our guarantees.

A set of Operations are generated which represent usage of the public KV api. These include both "workload" operations like Gets and Puts as well as "admin" operations like rebalances. These Operations can be handed to an Applier, which runs them against the KV api and records the results.

Operations do allow for concurrency (this testing is much less interesting otherwise), which means that the state of the KV map is not recoverable from _only_ the input. TODO(dan): We can use RangeFeed to recover the exact KV history. This plus some Kyle magic can be used to check our transactional guarantees.

TODO - CPut/InitPut/Increment/Delete - DeleteRange/ClearRange/RevertRange/ReverseScan - TransferLease - ExportRequest - AddSSTable - Root and leaf transactions - GCRequest - Protected timestamps

Index

Package Files

applier.go doc.go engine.go generator.go kvnemesis.go operations.go operations.pb.go validator.go watcher.go

Variables

var (
    ErrInvalidLengthOperations = fmt.Errorf("proto: negative length found during unmarshaling")
    ErrIntOverflowOperations   = fmt.Errorf("proto: integer overflow")
)
var ClosureTxnType_name = map[int32]string{
    0:  "Commit",
    1:  "Rollback",
}
var ClosureTxnType_value = map[string]int32{
    "Commit":   0,
    "Rollback": 1,
}
var ResultType_name = map[int32]string{
    0:  "Unknown",
    1:  "NoError",
    2:  "Error",
    3:  "Value",
    4:  "Values",
}
var ResultType_value = map[string]int32{
    "Unknown": 0,
    "NoError": 1,
    "Error":   2,
    "Value":   3,
    "Values":  4,
}

func GeneratorDataSpan Uses

func GeneratorDataSpan() roachpb.Span

GeneratorDataSpan returns a span that contains all of the operations created by this Generator.

func RunNemesis Uses

func RunNemesis(
    ctx context.Context,
    rng *rand.Rand,
    ct ClosedTimestampTargetInterval,
    config GeneratorConfig,
    dbs ...*kv.DB,
) ([]error, error)

RunNemesis generates and applies a series of Operations to exercise the KV api. It returns a slice of the logical failures encountered.

Ideas for conditions to be added to KV nemesis: - Transactions being abandoned by their coordinator. - CPuts, and continuing after CPut errors (generally continuing after errors is not allowed, but it is allowed after ConditionFailedError as a special case).

func Validate Uses

func Validate(steps []Step, kvs *Engine) []error

Validate checks for violations of our kv api guarantees. The Steps must all have been applied and the kvs the result of those applications.

For transactions, it is verified that all of their writes are present if and only if the transaction committed (which is inferred from the KV data on ambiguous results). Non-transactional read/write operations are treated as though they had been wrapped in a transaction and are verified accordingly.

TODO(dan): Verify that the results of reads match the data visible at the commit timestamp. We should be able to construct a validity timespan for each read in the transaction and fail if there isn't some timestamp that overlaps all of them.

TODO(dan): Verify that there is no causality inversion between steps. That is, if transactions corresponding to two steps are sequential (i.e. txn1CommitStep.After < txn2BeginStep.Before) then the commit timestamps need to reflect this ordering.

TODO(dan): Consider changing all of this validation to be based on the commit timestamp as given back by kv.Txn. This doesn't currently work for nontransactional read-only ops (i.e. single read or batch of only reads) but that could be fixed by altering the API to communicating the timestamp back.

Splits and merges are not verified for anything other than that they did not return an error.

type Applier Uses

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

Applier executes Steps.

func MakeApplier Uses

func MakeApplier(dbs ...*kv.DB) *Applier

MakeApplier constructs an Applier that executes against the given DB.

func (*Applier) Apply Uses

func (a *Applier) Apply(ctx context.Context, step *Step) (retErr error)

Apply executes the given Step and mutates it with the result of execution. An error is only returned from Apply if there is an internal coding error within Applier, errors from a Step execution are saved in the Step itself.

type BatchOperation Uses

type BatchOperation struct {
    Ops    []Operation `protobuf:"bytes,1,rep,name=ops,proto3" json:"ops"`
    Result Result      `protobuf:"bytes,2,opt,name=result,proto3" json:"result"`
}

func (*BatchOperation) Descriptor Uses

func (*BatchOperation) Descriptor() ([]byte, []int)

func (*BatchOperation) Marshal Uses

func (m *BatchOperation) Marshal() (dAtA []byte, err error)

func (*BatchOperation) MarshalTo Uses

func (m *BatchOperation) MarshalTo(dAtA []byte) (int, error)

func (*BatchOperation) ProtoMessage Uses

func (*BatchOperation) ProtoMessage()

func (*BatchOperation) Reset Uses

func (m *BatchOperation) Reset()

func (*BatchOperation) Size Uses

func (m *BatchOperation) Size() (n int)

func (*BatchOperation) String Uses

func (m *BatchOperation) String() string

func (*BatchOperation) Unmarshal Uses

func (m *BatchOperation) Unmarshal(dAtA []byte) error

func (*BatchOperation) XXX_DiscardUnknown Uses

func (m *BatchOperation) XXX_DiscardUnknown()

func (*BatchOperation) XXX_Marshal Uses

func (m *BatchOperation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*BatchOperation) XXX_Merge Uses

func (dst *BatchOperation) XXX_Merge(src proto.Message)

func (*BatchOperation) XXX_Size Uses

func (m *BatchOperation) XXX_Size() int

func (*BatchOperation) XXX_Unmarshal Uses

func (m *BatchOperation) XXX_Unmarshal(b []byte) error

type BatchOperationConfig Uses

type BatchOperationConfig struct {
    Batch int
    Ops   ClientOperationConfig
}

BatchOperationConfig configures the relative probability of generating a kv.Batch of some number of operations as well as the composition of the operations in the batch itself. These can be run in various ways including kv.DB.Run or kv.Txn.Run.

type ChangeReplicasConfig Uses

type ChangeReplicasConfig struct {
    // AddReplica adds a single replica.
    AddReplica int
    // RemoveReplica removes a single replica.
    RemoveReplica int
    // AtomicSwapReplica adds 1 replica and removes 1 replica in a single
    // ChangeReplicas call.
    AtomicSwapReplica int
}

ChangeReplicasConfig configures the relative probability of generating a ChangeReplicas operation.

type ChangeReplicasOperation Uses

type ChangeReplicasOperation struct {
    Key     []byte                      `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
    Changes []roachpb.ReplicationChange `protobuf:"bytes,2,rep,name=changes,proto3" json:"changes"`
    Result  Result                      `protobuf:"bytes,3,opt,name=result,proto3" json:"result"`
}

func (*ChangeReplicasOperation) Descriptor Uses

func (*ChangeReplicasOperation) Descriptor() ([]byte, []int)

func (*ChangeReplicasOperation) Marshal Uses

func (m *ChangeReplicasOperation) Marshal() (dAtA []byte, err error)

func (*ChangeReplicasOperation) MarshalTo Uses

func (m *ChangeReplicasOperation) MarshalTo(dAtA []byte) (int, error)

func (*ChangeReplicasOperation) ProtoMessage Uses

func (*ChangeReplicasOperation) ProtoMessage()

func (*ChangeReplicasOperation) Reset Uses

func (m *ChangeReplicasOperation) Reset()

func (*ChangeReplicasOperation) Size Uses

func (m *ChangeReplicasOperation) Size() (n int)

func (*ChangeReplicasOperation) String Uses

func (m *ChangeReplicasOperation) String() string

func (*ChangeReplicasOperation) Unmarshal Uses

func (m *ChangeReplicasOperation) Unmarshal(dAtA []byte) error

func (*ChangeReplicasOperation) XXX_DiscardUnknown Uses

func (m *ChangeReplicasOperation) XXX_DiscardUnknown()

func (*ChangeReplicasOperation) XXX_Marshal Uses

func (m *ChangeReplicasOperation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ChangeReplicasOperation) XXX_Merge Uses

func (dst *ChangeReplicasOperation) XXX_Merge(src proto.Message)

func (*ChangeReplicasOperation) XXX_Size Uses

func (m *ChangeReplicasOperation) XXX_Size() int

func (*ChangeReplicasOperation) XXX_Unmarshal Uses

func (m *ChangeReplicasOperation) XXX_Unmarshal(b []byte) error

type ClientOperationConfig Uses

type ClientOperationConfig struct {
    // GetMissing is an operation that Gets a key that definitely doesn't exist.
    GetMissing int
    // GetExisting is an operation that Gets a key that likely exists.
    GetExisting int
    // PutMissing is an operation that Puts a key that definitely doesn't exist.
    PutMissing int
    // PutExisting is an operation that Puts a key that likely exists.
    PutExisting int
    // Scan is an operation that Scans a key range that may contain values.
    Scan int
    // ScanForUpdate is an operation that Scans a key range that may contain
    // values using a per-key locking scan.
    ScanForUpdate int
}

ClientOperationConfig configures the relative probabilities of the bread-and-butter kv operations such as Get/Put/Delete/etc. These can all be run on a DB, a Txn, or a Batch.

type ClosedTimestampTargetInterval Uses

type ClosedTimestampTargetInterval interface {
    Set(context.Context, time.Duration) error
    ResetToDefault(context.Context) error
}

ClosedTimestampTargetInterval allows for setting the closed timestamp target interval.

type ClosureTxnConfig Uses

type ClosureTxnConfig struct {
    TxnClientOps ClientOperationConfig
    TxnBatchOps  BatchOperationConfig

    // Commit is a transaction that commits normally.
    Commit int
    // Rollback is a transaction that encounters an error at the end and has to
    // roll back.
    Rollback int
    // CommitInBatch is a transaction that commits via the CommitInBatchMethod.
    // This is an important part of the 1pc txn fastpath.
    CommitInBatch int
    // When CommitInBatch is selected, CommitBatchOps controls the composition of
    // the kv.Batch used.
    CommitBatchOps ClientOperationConfig
}

ClosureTxnConfig configures the relative probability of running some operations in a transaction by using the closure-based kv.DB.Txn method. This family of operations mainly varies in how it commits (or doesn't commit). The composition of the operations in the txn is controlled by TxnClientOps and TxnBatchOps

type ClosureTxnOperation Uses

type ClosureTxnOperation struct {
    TxnID         string               `protobuf:"bytes,1,opt,name=txn_id,json=txnId,proto3" json:"txn_id,omitempty"`
    Ops           []Operation          `protobuf:"bytes,2,rep,name=ops,proto3" json:"ops"`
    CommitInBatch *BatchOperation      `protobuf:"bytes,3,opt,name=commit_in_batch,json=commitInBatch,proto3" json:"commit_in_batch,omitempty"`
    Type          ClosureTxnType       `protobuf:"varint,4,opt,name=type,proto3,enum=cockroach.kv.kvnemesis.ClosureTxnType" json:"type,omitempty"`
    Result        Result               `protobuf:"bytes,5,opt,name=result,proto3" json:"result"`
    Txn           *roachpb.Transaction `protobuf:"bytes,6,opt,name=txn,proto3" json:"txn,omitempty"`
}

func (*ClosureTxnOperation) Descriptor Uses

func (*ClosureTxnOperation) Descriptor() ([]byte, []int)

func (*ClosureTxnOperation) Marshal Uses

func (m *ClosureTxnOperation) Marshal() (dAtA []byte, err error)

func (*ClosureTxnOperation) MarshalTo Uses

func (m *ClosureTxnOperation) MarshalTo(dAtA []byte) (int, error)

func (*ClosureTxnOperation) ProtoMessage Uses

func (*ClosureTxnOperation) ProtoMessage()

func (*ClosureTxnOperation) Reset Uses

func (m *ClosureTxnOperation) Reset()

func (*ClosureTxnOperation) Size Uses

func (m *ClosureTxnOperation) Size() (n int)

func (*ClosureTxnOperation) String Uses

func (m *ClosureTxnOperation) String() string

func (*ClosureTxnOperation) Unmarshal Uses

func (m *ClosureTxnOperation) Unmarshal(dAtA []byte) error

func (*ClosureTxnOperation) XXX_DiscardUnknown Uses

func (m *ClosureTxnOperation) XXX_DiscardUnknown()

func (*ClosureTxnOperation) XXX_Marshal Uses

func (m *ClosureTxnOperation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ClosureTxnOperation) XXX_Merge Uses

func (dst *ClosureTxnOperation) XXX_Merge(src proto.Message)

func (*ClosureTxnOperation) XXX_Size Uses

func (m *ClosureTxnOperation) XXX_Size() int

func (*ClosureTxnOperation) XXX_Unmarshal Uses

func (m *ClosureTxnOperation) XXX_Unmarshal(b []byte) error

type ClosureTxnType Uses

type ClosureTxnType int32
const (
    ClosureTxnType_Commit   ClosureTxnType = 0
    ClosureTxnType_Rollback ClosureTxnType = 1
)

func (ClosureTxnType) EnumDescriptor Uses

func (ClosureTxnType) EnumDescriptor() ([]byte, []int)

func (ClosureTxnType) String Uses

func (x ClosureTxnType) String() string

type Engine Uses

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

Engine is a simplified version of storage.ReadWriter. It is a multi-version key-value map, meaning that each read or write has an associated timestamp and a read returns the write for the key with the highest timestamp (which is not necessarily the most recently ingested write). Engine is not threadsafe.

func MakeEngine Uses

func MakeEngine() (*Engine, error)

MakeEngine returns a new Engine.

func (*Engine) Close Uses

func (e *Engine) Close()

Close closes the Engine, freeing associated resources.

func (*Engine) DebugPrint Uses

func (e *Engine) DebugPrint(indent string) string

DebugPrint returns the entire contents of this Engine as a string for use in debugging.

func (*Engine) Get Uses

func (e *Engine) Get(key roachpb.Key, ts hlc.Timestamp) roachpb.Value

Get returns the value for this key with the highest timestamp <= ts. If no such value exists, the returned value's RawBytes is nil.

func (*Engine) Iterate Uses

func (e *Engine) Iterate(fn func(key storage.MVCCKey, value []byte, err error))

Iterate calls the given closure with every KV in the Engine, in ascending order.

func (*Engine) Put Uses

func (e *Engine) Put(key storage.MVCCKey, value []byte)

Put inserts a key/value/timestamp tuple. If an exact key/timestamp pair is Put again, it overwrites the previous value.

type Generator Uses

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

Generator incrementally constructs KV traffic designed to maximally test edge cases.

The expected usage is that a number of concurrent worker threads will each repeatedly ask for a Step, finish executing it, then ask for the next Step.

A Step consists of a single Operation, which is a unit of work that must be done serially. It often corresponds 1:1 to a single call to some method on the KV api (such as Get or Put), but some Operations have a set of steps (such as using a transaction).

Generator in itself is deterministic, but it's intended usage is that multiple worker goroutines take turns pulling steps (sequentially) which they then execute concurrently. To improve the efficiency of this pattern, Generator will track which splits and merges could possibly have taken place and takes this into account when generating operations. For example, Generator won't take a OpMergeIsSplit step if it has never previously emitted a split, but it may emit an OpMerge once it has produced an OpSplit even though the worker executing the split may find that the merge has not yet been executed.

func MakeGenerator Uses

func MakeGenerator(config GeneratorConfig, replicasFn GetReplicasFn) (*Generator, error)

MakeGenerator constructs a Generator.

func (*Generator) RandStep Uses

func (g *Generator) RandStep(rng *rand.Rand) Step

RandStep returns a single randomly generated next operation to execute.

RandStep is concurrency safe.

type GeneratorConfig Uses

type GeneratorConfig struct {
    Ops                   OperationConfig
    NumNodes, NumReplicas int
}

GeneratorConfig contains all the tunable knobs necessary to run a Generator.

func NewDefaultConfig Uses

func NewDefaultConfig() GeneratorConfig

NewDefaultConfig returns a GeneratorConfig that is a reasonable default starting point for general KV usage. Nemesis test variants that want to stress particular areas may want to start with this and eliminate some operations/make some operations more likely.

type GetOperation Uses

type GetOperation struct {
    Key    []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
    Result Result `protobuf:"bytes,2,opt,name=result,proto3" json:"result"`
}

func (*GetOperation) Descriptor Uses

func (*GetOperation) Descriptor() ([]byte, []int)

func (*GetOperation) Marshal Uses

func (m *GetOperation) Marshal() (dAtA []byte, err error)

func (*GetOperation) MarshalTo Uses

func (m *GetOperation) MarshalTo(dAtA []byte) (int, error)

func (*GetOperation) ProtoMessage Uses

func (*GetOperation) ProtoMessage()

func (*GetOperation) Reset Uses

func (m *GetOperation) Reset()

func (*GetOperation) Size Uses

func (m *GetOperation) Size() (n int)

func (*GetOperation) String Uses

func (m *GetOperation) String() string

func (*GetOperation) Unmarshal Uses

func (m *GetOperation) Unmarshal(dAtA []byte) error

func (*GetOperation) XXX_DiscardUnknown Uses

func (m *GetOperation) XXX_DiscardUnknown()

func (*GetOperation) XXX_Marshal Uses

func (m *GetOperation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GetOperation) XXX_Merge Uses

func (dst *GetOperation) XXX_Merge(src proto.Message)

func (*GetOperation) XXX_Size Uses

func (m *GetOperation) XXX_Size() int

func (*GetOperation) XXX_Unmarshal Uses

func (m *GetOperation) XXX_Unmarshal(b []byte) error

type GetReplicasFn Uses

type GetReplicasFn func(roachpb.Key) []roachpb.ReplicationTarget

GetReplicasFn is a function that returns the current replicas for the range containing a key.

type KeyValue Uses

type KeyValue struct {
    Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
    // The RawBytes of a roachpb.Value.
    Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
}

func (*KeyValue) Descriptor Uses

func (*KeyValue) Descriptor() ([]byte, []int)

func (*KeyValue) Marshal Uses

func (m *KeyValue) Marshal() (dAtA []byte, err error)

func (*KeyValue) MarshalTo Uses

func (m *KeyValue) MarshalTo(dAtA []byte) (int, error)

func (*KeyValue) ProtoMessage Uses

func (*KeyValue) ProtoMessage()

func (*KeyValue) Reset Uses

func (m *KeyValue) Reset()

func (*KeyValue) Size Uses

func (m *KeyValue) Size() (n int)

func (*KeyValue) String Uses

func (m *KeyValue) String() string

func (*KeyValue) Unmarshal Uses

func (m *KeyValue) Unmarshal(dAtA []byte) error

func (*KeyValue) XXX_DiscardUnknown Uses

func (m *KeyValue) XXX_DiscardUnknown()

func (*KeyValue) XXX_Marshal Uses

func (m *KeyValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*KeyValue) XXX_Merge Uses

func (dst *KeyValue) XXX_Merge(src proto.Message)

func (*KeyValue) XXX_Size Uses

func (m *KeyValue) XXX_Size() int

func (*KeyValue) XXX_Unmarshal Uses

func (m *KeyValue) XXX_Unmarshal(b []byte) error

type MergeConfig Uses

type MergeConfig struct {
    // MergeNotSplit is an operation that Merges at a key that has never been
    // split at (meaning this should be a no-op).
    MergeNotSplit int
    // MergeIsSplit is an operation that Merges at a key that is likely to
    // currently be split.
    MergeIsSplit int
}

MergeConfig configures the relative probability of generating a Merge operation.

type MergeOperation Uses

type MergeOperation struct {
    Key    []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
    Result Result `protobuf:"bytes,2,opt,name=result,proto3" json:"result"`
}

func (*MergeOperation) Descriptor Uses

func (*MergeOperation) Descriptor() ([]byte, []int)

func (*MergeOperation) Marshal Uses

func (m *MergeOperation) Marshal() (dAtA []byte, err error)

func (*MergeOperation) MarshalTo Uses

func (m *MergeOperation) MarshalTo(dAtA []byte) (int, error)

func (*MergeOperation) ProtoMessage Uses

func (*MergeOperation) ProtoMessage()

func (*MergeOperation) Reset Uses

func (m *MergeOperation) Reset()

func (*MergeOperation) Size Uses

func (m *MergeOperation) Size() (n int)

func (*MergeOperation) String Uses

func (m *MergeOperation) String() string

func (*MergeOperation) Unmarshal Uses

func (m *MergeOperation) Unmarshal(dAtA []byte) error

func (*MergeOperation) XXX_DiscardUnknown Uses

func (m *MergeOperation) XXX_DiscardUnknown()

func (*MergeOperation) XXX_Marshal Uses

func (m *MergeOperation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MergeOperation) XXX_Merge Uses

func (dst *MergeOperation) XXX_Merge(src proto.Message)

func (*MergeOperation) XXX_Size Uses

func (m *MergeOperation) XXX_Size() int

func (*MergeOperation) XXX_Unmarshal Uses

func (m *MergeOperation) XXX_Unmarshal(b []byte) error

type Operation Uses

type Operation struct {
    Batch *BatchOperation `protobuf:"bytes,1,opt,name=batch,proto3" json:"batch,omitempty"`
    // TODO(dan): The original prototype of kvnemesis had separate operations for
    // {Begin,Use,Commit,Rollback}Txn, which helped generate more interesting
    // concurrency traffic. This had some issues with deadlock in the txn wait
    // queue, but it seems like it should be possible to bring it back somehow.
    ClosureTxn     *ClosureTxnOperation     `protobuf:"bytes,2,opt,name=closure_txn,json=closureTxn,proto3" json:"closure_txn,omitempty"`
    Get            *GetOperation            `protobuf:"bytes,7,opt,name=get,proto3" json:"get,omitempty"`
    Put            *PutOperation            `protobuf:"bytes,8,opt,name=put,proto3" json:"put,omitempty"`
    Scan           *ScanOperation           `protobuf:"bytes,9,opt,name=scan,proto3" json:"scan,omitempty"`
    Split          *SplitOperation          `protobuf:"bytes,10,opt,name=split,proto3" json:"split,omitempty"`
    Merge          *MergeOperation          `protobuf:"bytes,11,opt,name=merge,proto3" json:"merge,omitempty"`
    ChangeReplicas *ChangeReplicasOperation `protobuf:"bytes,12,opt,name=change_replicas,json=changeReplicas,proto3" json:"change_replicas,omitempty"`
}

func (*Operation) Descriptor Uses

func (*Operation) Descriptor() ([]byte, []int)

func (*Operation) GetValue Uses

func (this *Operation) GetValue() interface{}

func (*Operation) Marshal Uses

func (m *Operation) Marshal() (dAtA []byte, err error)

func (*Operation) MarshalTo Uses

func (m *Operation) MarshalTo(dAtA []byte) (int, error)

func (*Operation) ProtoMessage Uses

func (*Operation) ProtoMessage()

func (*Operation) Reset Uses

func (m *Operation) Reset()

func (Operation) Result Uses

func (op Operation) Result() *Result

Result returns the Result field of the given Operation.

func (*Operation) SetValue Uses

func (this *Operation) SetValue(value interface{}) bool

func (*Operation) Size Uses

func (m *Operation) Size() (n int)

func (Operation) String Uses

func (op Operation) String() string

func (*Operation) Unmarshal Uses

func (m *Operation) Unmarshal(dAtA []byte) error

func (*Operation) XXX_DiscardUnknown Uses

func (m *Operation) XXX_DiscardUnknown()

func (*Operation) XXX_Marshal Uses

func (m *Operation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Operation) XXX_Merge Uses

func (dst *Operation) XXX_Merge(src proto.Message)

func (*Operation) XXX_Size Uses

func (m *Operation) XXX_Size() int

func (*Operation) XXX_Unmarshal Uses

func (m *Operation) XXX_Unmarshal(b []byte) error

type OperationConfig Uses

type OperationConfig struct {
    DB             ClientOperationConfig
    Batch          BatchOperationConfig
    ClosureTxn     ClosureTxnConfig
    Split          SplitConfig
    Merge          MergeConfig
    ChangeReplicas ChangeReplicasConfig
}

OperationConfig configures the relative probabilities of producing various operations.

In this struct and all sub-configurations, wording such as "likely exists" or "definitely doesn't exist" is according to previously generated steps. "likely" is a result of non-determinism due to concurrent execution of the generated operations.

type PutOperation Uses

type PutOperation struct {
    Key    []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
    Value  []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
    Result Result `protobuf:"bytes,3,opt,name=result,proto3" json:"result"`
}

func (*PutOperation) Descriptor Uses

func (*PutOperation) Descriptor() ([]byte, []int)

func (*PutOperation) Marshal Uses

func (m *PutOperation) Marshal() (dAtA []byte, err error)

func (*PutOperation) MarshalTo Uses

func (m *PutOperation) MarshalTo(dAtA []byte) (int, error)

func (*PutOperation) ProtoMessage Uses

func (*PutOperation) ProtoMessage()

func (*PutOperation) Reset Uses

func (m *PutOperation) Reset()

func (*PutOperation) Size Uses

func (m *PutOperation) Size() (n int)

func (*PutOperation) String Uses

func (m *PutOperation) String() string

func (*PutOperation) Unmarshal Uses

func (m *PutOperation) Unmarshal(dAtA []byte) error

func (*PutOperation) XXX_DiscardUnknown Uses

func (m *PutOperation) XXX_DiscardUnknown()

func (*PutOperation) XXX_Marshal Uses

func (m *PutOperation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*PutOperation) XXX_Merge Uses

func (dst *PutOperation) XXX_Merge(src proto.Message)

func (*PutOperation) XXX_Size Uses

func (m *PutOperation) XXX_Size() int

func (*PutOperation) XXX_Unmarshal Uses

func (m *PutOperation) XXX_Unmarshal(b []byte) error

type Result Uses

type Result struct {
    Type ResultType `protobuf:"varint,1,opt,name=type,proto3,enum=cockroach.kv.kvnemesis.ResultType" json:"type,omitempty"`
    // Only set if Type is ResultType_Error.
    Err *errorspb.EncodedError `protobuf:"bytes,2,opt,name=err,proto3" json:"err,omitempty"`
    // Only set if Type is ResultType_Value. The RawBytes of a roachpb.Value.
    Value []byte `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"`
    // Only set if Type is ResultType_Values. The RawBytes of a roachpb.Value.
    Values []KeyValue `protobuf:"bytes,4,rep,name=values,proto3" json:"values"`
}

func (*Result) Descriptor Uses

func (*Result) Descriptor() ([]byte, []int)

func (*Result) Marshal Uses

func (m *Result) Marshal() (dAtA []byte, err error)

func (*Result) MarshalTo Uses

func (m *Result) MarshalTo(dAtA []byte) (int, error)

func (*Result) ProtoMessage Uses

func (*Result) ProtoMessage()

func (*Result) Reset Uses

func (m *Result) Reset()

func (*Result) Size Uses

func (m *Result) Size() (n int)

func (*Result) String Uses

func (m *Result) String() string

func (*Result) Unmarshal Uses

func (m *Result) Unmarshal(dAtA []byte) error

func (*Result) XXX_DiscardUnknown Uses

func (m *Result) XXX_DiscardUnknown()

func (*Result) XXX_Marshal Uses

func (m *Result) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Result) XXX_Merge Uses

func (dst *Result) XXX_Merge(src proto.Message)

func (*Result) XXX_Size Uses

func (m *Result) XXX_Size() int

func (*Result) XXX_Unmarshal Uses

func (m *Result) XXX_Unmarshal(b []byte) error

type ResultType Uses

type ResultType int32
const (
    ResultType_Unknown ResultType = 0
    ResultType_NoError ResultType = 1
    ResultType_Error   ResultType = 2
    ResultType_Value   ResultType = 3
    ResultType_Values  ResultType = 4
)

func (ResultType) EnumDescriptor Uses

func (ResultType) EnumDescriptor() ([]byte, []int)

func (ResultType) String Uses

func (x ResultType) String() string

type ScanOperation Uses

type ScanOperation struct {
    Key       []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
    EndKey    []byte `protobuf:"bytes,2,opt,name=end_key,json=endKey,proto3" json:"end_key,omitempty"`
    ForUpdate bool   `protobuf:"varint,3,opt,name=for_update,json=forUpdate,proto3" json:"for_update,omitempty"`
    Result    Result `protobuf:"bytes,4,opt,name=result,proto3" json:"result"`
}

func (*ScanOperation) Descriptor Uses

func (*ScanOperation) Descriptor() ([]byte, []int)

func (*ScanOperation) Marshal Uses

func (m *ScanOperation) Marshal() (dAtA []byte, err error)

func (*ScanOperation) MarshalTo Uses

func (m *ScanOperation) MarshalTo(dAtA []byte) (int, error)

func (*ScanOperation) ProtoMessage Uses

func (*ScanOperation) ProtoMessage()

func (*ScanOperation) Reset Uses

func (m *ScanOperation) Reset()

func (*ScanOperation) Size Uses

func (m *ScanOperation) Size() (n int)

func (*ScanOperation) String Uses

func (m *ScanOperation) String() string

func (*ScanOperation) Unmarshal Uses

func (m *ScanOperation) Unmarshal(dAtA []byte) error

func (*ScanOperation) XXX_DiscardUnknown Uses

func (m *ScanOperation) XXX_DiscardUnknown()

func (*ScanOperation) XXX_Marshal Uses

func (m *ScanOperation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ScanOperation) XXX_Merge Uses

func (dst *ScanOperation) XXX_Merge(src proto.Message)

func (*ScanOperation) XXX_Size Uses

func (m *ScanOperation) XXX_Size() int

func (*ScanOperation) XXX_Unmarshal Uses

func (m *ScanOperation) XXX_Unmarshal(b []byte) error

type SplitConfig Uses

type SplitConfig struct {
    // SplitNew is an operation that Splits at a key that has never previously
    // been a split point.
    SplitNew int
    // SplitAgain is an operation that Splits at a key that likely has
    // previously been a split point, though it may or may not have been merged
    // since.
    SplitAgain int
}

SplitConfig configures the relative probability of generating a Split operation.

type SplitOperation Uses

type SplitOperation struct {
    Key    []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
    Result Result `protobuf:"bytes,2,opt,name=result,proto3" json:"result"`
}

func (*SplitOperation) Descriptor Uses

func (*SplitOperation) Descriptor() ([]byte, []int)

func (*SplitOperation) Marshal Uses

func (m *SplitOperation) Marshal() (dAtA []byte, err error)

func (*SplitOperation) MarshalTo Uses

func (m *SplitOperation) MarshalTo(dAtA []byte) (int, error)

func (*SplitOperation) ProtoMessage Uses

func (*SplitOperation) ProtoMessage()

func (*SplitOperation) Reset Uses

func (m *SplitOperation) Reset()

func (*SplitOperation) Size Uses

func (m *SplitOperation) Size() (n int)

func (*SplitOperation) String Uses

func (m *SplitOperation) String() string

func (*SplitOperation) Unmarshal Uses

func (m *SplitOperation) Unmarshal(dAtA []byte) error

func (*SplitOperation) XXX_DiscardUnknown Uses

func (m *SplitOperation) XXX_DiscardUnknown()

func (*SplitOperation) XXX_Marshal Uses

func (m *SplitOperation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*SplitOperation) XXX_Merge Uses

func (dst *SplitOperation) XXX_Merge(src proto.Message)

func (*SplitOperation) XXX_Size Uses

func (m *SplitOperation) XXX_Size() int

func (*SplitOperation) XXX_Unmarshal Uses

func (m *SplitOperation) XXX_Unmarshal(b []byte) error

type Step Uses

type Step struct {
    Op     Operation     `protobuf:"bytes,1,opt,name=op,proto3" json:"op"`
    Before hlc.Timestamp `protobuf:"bytes,2,opt,name=before,proto3" json:"before"`
    After  hlc.Timestamp `protobuf:"bytes,3,opt,name=after,proto3" json:"after"`
    DBID   int32         `protobuf:"varint,4,opt,name=db_id,json=dbId,proto3" json:"db_id,omitempty"`
    // Trace will contain the recording of the Step's execution. Used to print it
    // out when the test fails.
    Trace string `protobuf:"bytes,5,opt,name=trace,proto3" json:"trace,omitempty"`
}

func (*Step) Descriptor Uses

func (*Step) Descriptor() ([]byte, []int)

func (*Step) Marshal Uses

func (m *Step) Marshal() (dAtA []byte, err error)

func (*Step) MarshalTo Uses

func (m *Step) MarshalTo(dAtA []byte) (int, error)

func (*Step) ProtoMessage Uses

func (*Step) ProtoMessage()

func (*Step) Reset Uses

func (m *Step) Reset()

func (*Step) Size Uses

func (m *Step) Size() (n int)

func (Step) String Uses

func (s Step) String() string

func (*Step) Unmarshal Uses

func (m *Step) Unmarshal(dAtA []byte) error

func (*Step) XXX_DiscardUnknown Uses

func (m *Step) XXX_DiscardUnknown()

func (*Step) XXX_Marshal Uses

func (m *Step) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Step) XXX_Merge Uses

func (dst *Step) XXX_Merge(src proto.Message)

func (*Step) XXX_Size Uses

func (m *Step) XXX_Size() int

func (*Step) XXX_Unmarshal Uses

func (m *Step) XXX_Unmarshal(b []byte) error

type Watcher Uses

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

Watcher slurps all changes that happen to some span of kvs using RangeFeed.

func Watch Uses

func Watch(
    ctx context.Context, dbs []*kv.DB, ct ClosedTimestampTargetInterval, dataSpan roachpb.Span,
) (*Watcher, error)

Watch starts a new Watcher over the given span of kvs. See Watcher.

func (*Watcher) Finish Uses

func (w *Watcher) Finish() *Engine

Finish tears down the Watcher and returns all the kvs it has ingested. It may be called multiple times, though not concurrently.

func (*Watcher) WaitForFrontier Uses

func (w *Watcher) WaitForFrontier(ctx context.Context, ts hlc.Timestamp) (retErr error)

WaitForFrontier blocks until all kv changes <= the given timestamp are guaranteed to have been ingested.

Package kvnemesis imports 32 packages (graph). Updated 2020-08-12. Refresh now. Tools for package owners.