storagebase

package
v1.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 6, 2017 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package storagebase is a generated protocol buffer package.

It is generated from these files:

cockroach/pkg/storage/storagebase/proposer_kv.proto
cockroach/pkg/storage/storagebase/state.proto

It has these top-level messages:

Split
Merge
ChangeReplicas
ReplicatedEvalResult
WriteBatch
RaftCommand
ReplicaState
RangeInfo

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthProposerKv = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowProposerKv   = fmt.Errorf("proto: integer overflow")
)
View Source
var (
	ErrInvalidLengthState = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowState   = fmt.Errorf("proto: integer overflow")
)

Functions

This section is empty.

Types

type ApplyFilterArgs

type ApplyFilterArgs struct {
	ReplicatedEvalResult
	CmdID   CmdIDKey
	RangeID roachpb.RangeID
	StoreID roachpb.StoreID
}

ApplyFilterArgs groups the arguments to a ReplicaApplyFilter.

type ChangeReplicas

type ChangeReplicas struct {
	cockroach_roachpb1.ChangeReplicasTrigger `protobuf:"bytes,1,opt,name=trigger,embedded=trigger" json:"trigger"`
}

ChangeReplicas is emitted by a Replica which commits a transaction with a ChangeReplicasTrigger.

func (*ChangeReplicas) Descriptor

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

func (*ChangeReplicas) Marshal

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

func (*ChangeReplicas) MarshalTo

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

func (*ChangeReplicas) ProtoMessage

func (*ChangeReplicas) ProtoMessage()

func (*ChangeReplicas) Reset

func (m *ChangeReplicas) Reset()

func (*ChangeReplicas) Size

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

func (*ChangeReplicas) String

func (m *ChangeReplicas) String() string

func (*ChangeReplicas) Unmarshal

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

type CmdIDKey

type CmdIDKey string

CmdIDKey is a Raft command id.

type FilterArgs

type FilterArgs struct {
	Ctx   context.Context
	CmdID CmdIDKey
	Index int
	Sid   roachpb.StoreID
	Req   roachpb.Request
	Hdr   roachpb.Header
}

FilterArgs groups the arguments to a ReplicaCommandFilter.

func (*FilterArgs) InRaftCmd

func (f *FilterArgs) InRaftCmd() bool

InRaftCmd returns true if the filter is running in the context of a Raft command (it could be running outside of one, for example for a read).

type Merge

type Merge struct {
	cockroach_roachpb1.MergeTrigger `protobuf:"bytes,1,opt,name=trigger,embedded=trigger" json:"trigger"`
}

Merge is emitted by a Replica which commits a transaction with a MergeTrigger (i.e. absorbs its right neighbor).

func (*Merge) Descriptor

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

func (*Merge) Marshal

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

func (*Merge) MarshalTo

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

func (*Merge) ProtoMessage

func (*Merge) ProtoMessage()

func (*Merge) Reset

func (m *Merge) Reset()

func (*Merge) Size

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

func (*Merge) String

func (m *Merge) String() string

func (*Merge) Unmarshal

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

type RaftCommand

type RaftCommand struct {
	// proposer_replica is the replica which proposed this command, to be
	// used for lease validation.
	ProposerReplica cockroach_roachpb.ReplicaDescriptor `protobuf:"bytes,2,opt,name=proposer_replica,json=proposerReplica" json:"proposer_replica"`
	// proposer_lease is provided to verify at raft command apply-time that
	// the lease under which the command was proposed remains in effect.
	// If the command was proposed prior to the introduction of epoch leases,
	// proposer_lease will be nil, but the combination of proposer_replica and
	// the request timestamp are used to verify an expiration-based lease.
	//
	// To see why lease verification downstream of Raft is required, consider the
	// following example:
	// - replica 1 receives a client request for a write
	// - replica 1 checks the lease; the write is permitted
	// - replica 1 proposes the command
	// - time passes, replica 2 commits a new lease
	// - the command applies on replica 1
	// - replica 2 serves anomalous reads which don't see the write
	// - the command applies on replica 2
	ProposerLease *cockroach_roachpb1.Lease `protobuf:"bytes,5,opt,name=proposer_lease,json=proposerLease" json:"proposer_lease,omitempty"`
	// When the command is applied, its result is an error if the lease log
	// counter has already reached (or exceeded) max_lease_index.
	//
	// The lease index is a reorder protection mechanism - we don't want Raft
	// commands (proposed by a single node, the one with proposer_lease) executing
	// in a different order than the one in which the corresponding KV requests
	// were evaluated and the commands were proposed. This is important because
	// the CommandQueue does not fully serialize commands - mostly when it comes
	// to updates to the internal state of the range (this should be re-evaluated
	// once proposer-evaluated KV is completed - see #10413).
	// Similar to the Raft applied index, it is strictly increasing, but may have
	// gaps. A command will only apply successfully if its max_lease_index has not
	// been surpassed by the Range's applied lease index (in which case the
	// command may need to be retried, that is, regenerated with a higher
	// max_lease_index). When the command applies, the new lease index will
	// increase to max_lease_index (so a potential later replay will fail).
	//
	// This mechanism was introduced as a simpler alternative to using the Raft
	// applied index, which is fraught with complexity due to the need to predict
	// exactly the log position at which a command will apply, even when the Raft
	// leader is not colocated with the lease holder (which usually proposes all
	// commands).
	//
	// Pinning the lease-index to the assigned slot (as opposed to allowing gaps
	// as we do now) is an interesting venue to explore from the standpoint of
	// parallelization: One could hope to enforce command ordering in that way
	// (without recourse to a higher-level locking primitive such as the command
	// queue). This is a hard problem: First of all, managing the pending
	// commands gets more involved; a command must not be removed if others have
	// been added after it, and on removal, the assignment counters must be
	// updated accordingly. Managing retry of proposals becomes trickier as
	// well as that uproots whatever ordering was originally envisioned.
	MaxLeaseIndex uint64 `protobuf:"varint,4,opt,name=max_lease_index,json=maxLeaseIndex" json:"max_lease_index"`
	// batch_request is the KV command to apply.
	//
	// TODO(bdarnell): This is currently populated even in
	// proposer-evaluated mode in certain tests (only those that use
	// TestingEvalFilter). See #10493
	BatchRequest         *cockroach_roachpb3.BatchRequest `protobuf:"bytes,3,opt,name=batch_request,json=batchRequest" json:"batch_request,omitempty"`
	ReplicatedEvalResult *ReplicatedEvalResult            `protobuf:"bytes,13,opt,name=replicated_eval_result,json=replicatedEvalResult" json:"replicated_eval_result,omitempty"`
	WriteBatch           *WriteBatch                      `protobuf:"bytes,14,opt,name=write_batch,json=writeBatch" json:"write_batch,omitempty"`
}

RaftCommand is the message written to the raft log. It contains some metadata about the proposal itself, then either a BatchRequest (legacy mode) or a ReplicatedEvalResult + WriteBatch (proposer-evaluated KV mode).

func (*RaftCommand) Descriptor

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

func (*RaftCommand) Marshal

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

func (*RaftCommand) MarshalTo

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

func (*RaftCommand) ProtoMessage

func (*RaftCommand) ProtoMessage()

func (*RaftCommand) Reset

func (m *RaftCommand) Reset()

func (*RaftCommand) Size

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

func (*RaftCommand) String

func (m *RaftCommand) String() string

func (*RaftCommand) Unmarshal

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

type RangeInfo

type RangeInfo struct {
	ReplicaState `protobuf:"bytes,1,opt,name=state,embedded=state" json:"state"`
	// The highest (and last) index in the Raft log.
	LastIndex  uint64 `protobuf:"varint,2,opt,name=lastIndex,proto3" json:"lastIndex,omitempty"`
	NumPending uint64 `protobuf:"varint,3,opt,name=num_pending,json=numPending,proto3" json:"num_pending,omitempty"`
	NumDropped uint64 `protobuf:"varint,5,opt,name=num_dropped,json=numDropped,proto3" json:"num_dropped,omitempty"`
	// raft_log_size may be initially inaccurate after a server restart.
	// See storage.Replica.mu.raftLogSize.
	RaftLogSize int64 `protobuf:"varint,6,opt,name=raft_log_size,json=raftLogSize,proto3" json:"raft_log_size,omitempty"`
}

func (*RangeInfo) Descriptor

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

func (*RangeInfo) Marshal

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

func (*RangeInfo) MarshalTo

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

func (*RangeInfo) ProtoMessage

func (*RangeInfo) ProtoMessage()

func (*RangeInfo) Reset

func (m *RangeInfo) Reset()

func (*RangeInfo) Size

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

func (*RangeInfo) String

func (m *RangeInfo) String() string

func (*RangeInfo) Unmarshal

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

type ReplicaApplyFilter

type ReplicaApplyFilter func(args ApplyFilterArgs) *roachpb.Error

A ReplicaApplyFilter can be used in testing to influence the error returned from proposals after they apply.

type ReplicaCommandFilter

type ReplicaCommandFilter func(args FilterArgs) *roachpb.Error

ReplicaCommandFilter may be used in tests through the StoreTestingKnobs to intercept the handling of commands and artificially generate errors. Return nil to continue with regular processing or non-nil to terminate processing with the returned error.

type ReplicaResponseFilter

type ReplicaResponseFilter func(roachpb.BatchRequest, *roachpb.BatchResponse) *roachpb.Error

ReplicaResponseFilter is used in unittests to modify the outbound response returned to a waiting client after a replica command has been processed. This filter is invoked only by the command proposer.

type ReplicaState

type ReplicaState struct {
	// The highest (and last) index applied to the state machine.
	RaftAppliedIndex uint64 `protobuf:"varint,1,opt,name=raft_applied_index,json=raftAppliedIndex,proto3" json:"raft_applied_index,omitempty"`
	// The highest (and last) lease index applied to the state machine.
	LeaseAppliedIndex uint64 `protobuf:"varint,2,opt,name=lease_applied_index,json=leaseAppliedIndex,proto3" json:"lease_applied_index,omitempty"`
	// The Range descriptor.
	// The pointer may change, but the referenced RangeDescriptor struct itself
	// must be treated as immutable; it is leaked out of the lock.
	//
	// Changes of the descriptor should always go through one of the
	// (*Replica).setDesc* methods.
	Desc *cockroach_roachpb.RangeDescriptor `protobuf:"bytes,3,opt,name=desc" json:"desc,omitempty"`
	// The latest range lease, if any.
	Lease *cockroach_roachpb1.Lease `protobuf:"bytes,4,opt,name=lease" json:"lease,omitempty"`
	// The truncation state of the Raft log.
	TruncatedState *cockroach_roachpb4.RaftTruncatedState `protobuf:"bytes,5,opt,name=truncated_state,json=truncatedState" json:"truncated_state,omitempty"`
	// gcThreshold is the GC threshold of the Range, typically updated when keys
	// are garbage collected. Reads and writes at timestamps <= this time will
	// not be served.
	//
	// TODO(tschottdorf): should be nullable to keep ReplicaState small as we are
	// sending it over the wire. Since we only ever increase gc_threshold, that's
	// the only upshot - fields which can return to the zero value must
	// special-case that value simply because otherwise there's no way of
	// distinguishing "no update" to and updating to the zero value.
	GCThreshold cockroach_util_hlc.Timestamp                `protobuf:"bytes,6,opt,name=gc_threshold,json=gcThreshold" json:"gc_threshold"`
	Stats       cockroach_storage_engine_enginepb.MVCCStats `protobuf:"bytes,7,opt,name=stats" json:"stats"`
	// txn_span_gc_threshold is the (maximum) timestamp below which transaction
	// records may have been garbage collected (as measured by txn.LastActive()).
	// Transaction at lower timestamps must not be allowed to write their initial
	// transaction entry.
	//
	// TODO(tschottdorf): should be nullable; see gc_threshold.
	TxnSpanGCThreshold cockroach_util_hlc.Timestamp `protobuf:"bytes,9,opt,name=txn_span_gc_threshold,json=txnSpanGcThreshold" json:"txn_span_gc_threshold"`
}

ReplicaState is the part of the Range Raft state machine which is cached in memory and which is manipulated exclusively through consensus.

The struct is also used to transfer state to Replicas in the context of proposer-evaluated Raft, in which case it does not represent a complete state but instead an update to be applied to an existing state, with each field specified in the update overwriting its counterpart on the receiving ReplicaState.

For the ReplicaState persisted on the Replica, all optional fields are populated (i.e. no nil pointers or enums with the default value).

func (*ReplicaState) Descriptor

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

func (*ReplicaState) Marshal

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

func (*ReplicaState) MarshalTo

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

func (*ReplicaState) ProtoMessage

func (*ReplicaState) ProtoMessage()

func (*ReplicaState) Reset

func (m *ReplicaState) Reset()

func (*ReplicaState) Size

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

func (*ReplicaState) String

func (m *ReplicaState) String() string

func (*ReplicaState) Unmarshal

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

type ReplicatedEvalResult

type ReplicatedEvalResult struct {
	StartKey github_com_cockroachdb_cockroach_pkg_roachpb.RKey `` /* 138-byte string literal not displayed */
	EndKey   github_com_cockroachdb_cockroach_pkg_roachpb.RKey `` /* 132-byte string literal not displayed */
	// Whether to block concurrent readers while processing the proposal data.
	BlockReads bool `protobuf:"varint,1,opt,name=block_reads,json=blockReads" json:"block_reads"`
	// Updates to the Replica's ReplicaState. By convention and as outlined on
	// the comment on the ReplicaState message, this field is sparsely populated
	// and any field set overwrites the corresponding field in the state, perhaps
	// which additional side effects (for instance on a descriptor update).
	State           ReplicaState                               `protobuf:"bytes,2,opt,name=state" json:"state"`
	Split           *Split                                     `protobuf:"bytes,3,opt,name=split" json:"split,omitempty"`
	Merge           *Merge                                     `protobuf:"bytes,4,opt,name=merge" json:"merge,omitempty"`
	ComputeChecksum *cockroach_roachpb3.ComputeChecksumRequest `protobuf:"bytes,5,opt,name=compute_checksum,json=computeChecksum" json:"compute_checksum,omitempty"`
	IsLeaseRequest  bool                                       `protobuf:"varint,6,opt,name=is_lease_request,json=isLeaseRequest" json:"is_lease_request"`
	IsFreeze        bool                                       `protobuf:"varint,7,opt,name=is_freeze,json=isFreeze" json:"is_freeze"`
	// Duplicates BatchRequest.Timestamp for proposer-evaluated KV. Used
	// to verify the validity of the command (for lease coverage and GC
	// threshold).
	Timestamp            cockroach_util_hlc.Timestamp `protobuf:"bytes,8,opt,name=timestamp" json:"timestamp"`
	IsConsistencyRelated bool                         `protobuf:"varint,9,opt,name=is_consistency_related,json=isConsistencyRelated" json:"is_consistency_related"`
	// The stats delta corresponding to the data in this WriteBatch. On
	// a split, contains only the contributions to the left-hand side.
	Delta          cockroach_storage_engine_enginepb.MVCCStats `protobuf:"bytes,10,opt,name=delta" json:"delta"`
	ChangeReplicas *ChangeReplicas                             `protobuf:"bytes,12,opt,name=change_replicas,json=changeReplicas" json:"change_replicas,omitempty"`
	RaftLogDelta   *int64                                      `protobuf:"varint,13,opt,name=raft_log_delta,json=raftLogDelta" json:"raft_log_delta,omitempty"`
}

ReplicatedEvalResult is the structured information which together with a RocksDB WriteBatch constitutes the proposal payload in proposer-evaluated KV. For the majority of proposals, we expect ReplicatedEvalResult to be trivial; only changes to the metadata state (splits, merges, rebalances, leases, log truncation, ...) of the Replica or certain special commands must sideline information here based on which all Replicas must take action.

func (*ReplicatedEvalResult) Descriptor

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

func (*ReplicatedEvalResult) Marshal

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

func (*ReplicatedEvalResult) MarshalTo

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

func (*ReplicatedEvalResult) ProtoMessage

func (*ReplicatedEvalResult) ProtoMessage()

func (*ReplicatedEvalResult) Reset

func (m *ReplicatedEvalResult) Reset()

func (*ReplicatedEvalResult) Size

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

func (*ReplicatedEvalResult) String

func (m *ReplicatedEvalResult) String() string

func (*ReplicatedEvalResult) Unmarshal

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

type Split

type Split struct {
	cockroach_roachpb1.SplitTrigger `protobuf:"bytes,1,opt,name=trigger,embedded=trigger" json:"trigger"`
	// RHSDelta holds the statistics for what was written to what is now the
	// right-hand side of the split during the batch which executed it.
	// The on-disk state of the right-hand side is already correct, but the
	// Store must learn about this delta to update its counters appropriately.
	RHSDelta cockroach_storage_engine_enginepb.MVCCStats `protobuf:"bytes,2,opt,name=rhs_delta,json=rhsDelta" json:"rhs_delta"`
}

Split is emitted when a Replica commits a split trigger. It signals that the Replica has prepared the on-disk state for both the left and right hand sides of the split, and that the left hand side Replica should be updated as well as the right hand side created.

func (*Split) Descriptor

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

func (*Split) Marshal

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

func (*Split) MarshalTo

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

func (*Split) ProtoMessage

func (*Split) ProtoMessage()

func (*Split) Reset

func (m *Split) Reset()

func (*Split) Size

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

func (*Split) String

func (m *Split) String() string

func (*Split) Unmarshal

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

type WriteBatch

type WriteBatch struct {
	Data []byte `protobuf:"bytes,1,opt,name=data" json:"data,omitempty"`
}

WriteBatch is the serialized representation of a RocksDB write batch. A wrapper message is used so that the absence of the field can be distinguished from a zero-length batch, and so structs containing pointers to it can be compared with the == operator (we rely on this in storage.EvalResult)

func (*WriteBatch) Descriptor

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

func (*WriteBatch) Marshal

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

func (*WriteBatch) MarshalTo

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

func (*WriteBatch) ProtoMessage

func (*WriteBatch) ProtoMessage()

func (*WriteBatch) Reset

func (m *WriteBatch) Reset()

func (*WriteBatch) Size

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

func (*WriteBatch) String

func (m *WriteBatch) String() string

func (*WriteBatch) Unmarshal

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL