Documentation ¶
Overview ¶
Package enginepb is a generated protocol buffer package.
It is generated from these files:
cockroach/storage/engine/enginepb/mvcc.proto
It has these top-level messages:
TxnMeta MVCCMetadata MVCCStats
Index ¶
- Variables
- type IsolationType
- type MVCCMetadata
- func (*MVCCMetadata) Descriptor() ([]byte, []int)
- func (meta MVCCMetadata) IsInline() bool
- func (m *MVCCMetadata) Marshal() (data []byte, err error)
- func (m *MVCCMetadata) MarshalTo(data []byte) (int, error)
- func (*MVCCMetadata) ProtoMessage()
- func (m *MVCCMetadata) Reset()
- func (m *MVCCMetadata) Size() (n int)
- func (m *MVCCMetadata) String() string
- func (m *MVCCMetadata) Unmarshal(data []byte) error
- type MVCCStats
- func (ms *MVCCStats) Add(oms MVCCStats)
- func (ms *MVCCStats) AgeTo(nowNanos int64)
- func (ms MVCCStats) AvgIntentAge(nowNanos int64) float64
- func (*MVCCStats) Descriptor() ([]byte, []int)
- func (ms MVCCStats) GCByteAge(nowNanos int64) int64
- func (ms MVCCStats) GCBytes() int64
- func (m *MVCCStats) Marshal() (data []byte, err error)
- func (m *MVCCStats) MarshalTo(data []byte) (int, error)
- func (*MVCCStats) ProtoMessage()
- func (m *MVCCStats) Reset()
- func (m *MVCCStats) Size() (n int)
- func (m *MVCCStats) String() string
- func (ms *MVCCStats) Subtract(oms MVCCStats)
- func (ms MVCCStats) Total() int64
- func (m *MVCCStats) Unmarshal(data []byte) error
- type TxnMeta
- func (*TxnMeta) Descriptor() ([]byte, []int)
- func (m *TxnMeta) Marshal() (data []byte, err error)
- func (m *TxnMeta) MarshalTo(data []byte) (int, error)
- func (*TxnMeta) ProtoMessage()
- func (m *TxnMeta) Reset()
- func (m *TxnMeta) Size() (n int)
- func (m *TxnMeta) String() string
- func (m *TxnMeta) Unmarshal(data []byte) error
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidLengthMvcc = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowMvcc = fmt.Errorf("proto: integer overflow") )
var IsolationType_name = map[int32]string{
0: "SERIALIZABLE",
1: "SNAPSHOT",
}
var IsolationType_value = map[string]int32{
"SERIALIZABLE": 0,
"SNAPSHOT": 1,
}
Functions ¶
This section is empty.
Types ¶
type IsolationType ¶
type IsolationType int32
TODO(tschottdorf): Should not live in enginepb (but can't live in roachpb either).
const ( SERIALIZABLE IsolationType = 0 SNAPSHOT IsolationType = 1 )
func (IsolationType) Enum ¶
func (x IsolationType) Enum() *IsolationType
func (IsolationType) EnumDescriptor ¶
func (IsolationType) EnumDescriptor() ([]byte, []int)
func (IsolationType) String ¶
func (x IsolationType) String() string
func (*IsolationType) UnmarshalJSON ¶
func (x *IsolationType) UnmarshalJSON(data []byte) error
type MVCCMetadata ¶
type MVCCMetadata struct { Txn *TxnMeta `protobuf:"bytes,1,opt,name=txn" json:"txn,omitempty"` // The timestamp of the most recent versioned value if this is a // value that may have multiple versions. For values which may have // only one version, the data is stored inline (via raw_bytes), and // timestamp is set to zero. Timestamp cockroach_util_hlc.Timestamp `protobuf:"bytes,2,opt,name=timestamp" json:"timestamp"` // Is the most recent value a deletion tombstone? Deleted bool `protobuf:"varint,3,opt,name=deleted" json:"deleted"` // The size in bytes of the most recent encoded key. KeyBytes int64 `protobuf:"varint,4,opt,name=key_bytes,json=keyBytes" json:"key_bytes"` // The size in bytes of the most recent versioned value. ValBytes int64 `protobuf:"varint,5,opt,name=val_bytes,json=valBytes" json:"val_bytes"` // Inline value, used for non-versioned values with zero // timestamp. This provides an efficient short circuit of the normal // MVCC metadata sentinel and subsequent version rows. If timestamp // == (0, 0), then there is only a single MVCC metadata row with // value inlined, and with empty timestamp, key_bytes, and // val_bytes. RawBytes []byte `protobuf:"bytes,6,opt,name=raw_bytes,json=rawBytes" json:"raw_bytes,omitempty"` // This provides a measure of protection against replays caused by // Raft duplicating merge commands. MergeTimestamp *cockroach_util_hlc.Timestamp `protobuf:"bytes,7,opt,name=merge_timestamp,json=mergeTimestamp" json:"merge_timestamp,omitempty"` }
MVCCMetadata holds MVCC metadata for a key. Used by storage/engine/mvcc.go.
func NewPopulatedMVCCMetadata ¶
func NewPopulatedMVCCMetadata(r randyMvcc, easy bool) *MVCCMetadata
func (*MVCCMetadata) Descriptor ¶
func (*MVCCMetadata) Descriptor() ([]byte, []int)
func (MVCCMetadata) IsInline ¶
func (meta MVCCMetadata) IsInline() bool
IsInline returns true if the value is inlined in the metadata.
func (*MVCCMetadata) Marshal ¶
func (m *MVCCMetadata) Marshal() (data []byte, err error)
func (*MVCCMetadata) ProtoMessage ¶
func (*MVCCMetadata) ProtoMessage()
func (*MVCCMetadata) Reset ¶
func (m *MVCCMetadata) Reset()
func (*MVCCMetadata) Size ¶
func (m *MVCCMetadata) Size() (n int)
func (*MVCCMetadata) String ¶
func (m *MVCCMetadata) String() string
func (*MVCCMetadata) Unmarshal ¶
func (m *MVCCMetadata) Unmarshal(data []byte) error
type MVCCStats ¶
type MVCCStats struct { // last_update_nanos is a timestamp at which the ages were last // updated. See the comment on MVCCStats. LastUpdateNanos int64 `protobuf:"fixed64,1,opt,name=last_update_nanos,json=lastUpdateNanos" json:"last_update_nanos"` // intent_age is the cumulative age of the tracked intents. // See the comment on MVCCStats. IntentAge int64 `protobuf:"fixed64,2,opt,name=intent_age,json=intentAge" json:"intent_age"` // gc_bytes_age is the cumulative age of the non-live data (i.e. // data included in key_bytes and val_bytes, but not live_bytes). // See the comment on MVCCStats. GCBytesAge int64 `protobuf:"fixed64,3,opt,name=gc_bytes_age,json=gcBytesAge" json:"gc_bytes_age"` // live_bytes is the number of bytes stored in keys and values which can in // principle be read by means of a Scan or Get, including intents but not // deletion tombstones (or their intents). Note that the size of the meta kv // pair (which could be explicit or implicit) is included in this. // Only the meta kv pair counts for the actual length of the encoded key // (regular pairs only count the timestamp suffix). LiveBytes int64 `protobuf:"fixed64,4,opt,name=live_bytes,json=liveBytes" json:"live_bytes"` // live_count is the number of meta keys tracked under live_bytes. LiveCount int64 `protobuf:"fixed64,5,opt,name=live_count,json=liveCount" json:"live_count"` // key_bytes is the number of bytes stored in all non-system // keys, including live, meta, old, and deleted keys. // Only meta keys really account for the "full" key; value // keys only for the timestamp suffix. KeyBytes int64 `protobuf:"fixed64,6,opt,name=key_bytes,json=keyBytes" json:"key_bytes"` // key_count is the number of meta keys tracked under key_bytes. KeyCount int64 `protobuf:"fixed64,7,opt,name=key_count,json=keyCount" json:"key_count"` // value_bytes is the number of bytes in all non-system version // values, including meta values. ValBytes int64 `protobuf:"fixed64,8,opt,name=val_bytes,json=valBytes" json:"val_bytes"` // val_count is the number of meta values tracked under val_bytes. ValCount int64 `protobuf:"fixed64,9,opt,name=val_count,json=valCount" json:"val_count"` // intent_bytes is the number of bytes in intent key-value // pairs (without their meta keys). IntentBytes int64 `protobuf:"fixed64,10,opt,name=intent_bytes,json=intentBytes" json:"intent_bytes"` // intent_count is the number of keys tracked under intent_bytes. // It is equal to the number of meta keys in the system with // a non-empty Transaction proto. IntentCount int64 `protobuf:"fixed64,11,opt,name=intent_count,json=intentCount" json:"intent_count"` // sys_bytes is the number of bytes stored in system-local kv-pairs. // This tracks the same quantity as (key_bytes + val_bytes), but // for system-local metadata keys (which aren't counted in either // key_bytes or val_bytes). Each of the keys falling into this group // is documented in keys/constants.go under the localPrefix constant // and is prefixed by either LocalRangeIDPrefix or LocalRangePrefix. SysBytes int64 `protobuf:"fixed64,12,opt,name=sys_bytes,json=sysBytes" json:"sys_bytes"` // sys_count is the number of meta keys tracked under sys_bytes. SysCount int64 `protobuf:"fixed64,13,opt,name=sys_count,json=sysCount" json:"sys_count"` }
MVCCStats tracks byte and instance counts for various groups of keys, values, or key-value pairs; see the field comments for details.
It also tracks two cumulative ages, namely that of intents and non-live (i.e. GC-able) bytes. This computation is intrinsically linked to last_update_nanos and is easy to get wrong. Updates happen only once every full second, as measured by last_update_nanos/1e9. That is, forward updates don't change last_update_nanos until an update at a timestamp which, truncated to the second, is ahead of last_update_nanos/1e9. Then, that difference in seconds times the base quantity (excluding the currently running update) is added to the age. It gets more complicated when data is accounted for with a timestamp behind last_update_nanos. In this case, if more than a second has passed (computed via truncation above), the ages have to be adjusted to account for this late addition. This isn't hard: add the new data's base quantity times the (truncated) number of seconds behind. Important to keep in mind with those computations is that (x/1e9 - y/1e9) does not equal (x-y)/1e9 in most cases.
Note that this struct must be kept at a fixed size by using fixed-size encodings for all fields and by making all fields non-nullable. This is so that it can predict its own impact on the size of the system-local kv-pairs.
func NewPopulatedMVCCStats ¶
func (*MVCCStats) Add ¶
Add adds values from oms to ms. The ages will be moved forward to the larger of the LastUpdateNano timestamps involved.
func (*MVCCStats) AgeTo ¶
AgeTo encapsulates the complexity of computing the increment in age quantities contained in MVCCStats. Two MVCCStats structs only add and subtract meaningfully if their LastUpdateNanos matches, so aging them to the max of their LastUpdateNanos is a prerequisite. If nowNanos is behind ms.LastUpdateNanos, this method is a noop.
func (MVCCStats) AvgIntentAge ¶
AvgIntentAge returns the average age of outstanding intents, based on current wall time specified via nowNanos.
func (*MVCCStats) Descriptor ¶
func (MVCCStats) GCByteAge ¶
GCByteAge returns the total age of outstanding gc'able bytes, based on current wall time specified via nowNanos. nowNanos is ignored if it's a past timestamp as seen by rs.LastUpdateNanos.
func (MVCCStats) GCBytes ¶
GCBytes is a convenience function which returns the number of gc bytes, that is the key and value bytes excluding the live bytes.
func (*MVCCStats) ProtoMessage ¶
func (*MVCCStats) ProtoMessage()
func (*MVCCStats) Subtract ¶
Subtract removes oms from ms. The ages will be moved forward to the larger of the LastUpdateNano timestamps involved.
type TxnMeta ¶
type TxnMeta struct { // id is a unique UUID value which identifies the transaction. ID *github_com_cockroachdb_cockroach_util_uuid.UUID `protobuf:"bytes,1,opt,name=id,customtype=github.com/cockroachdb/cockroach/util/uuid.UUID" json:"id,omitempty"` Isolation IsolationType `protobuf:"varint,2,opt,name=isolation,enum=cockroach.storage.engine.enginepb.IsolationType" json:"isolation"` // key is the key which anchors the transaction. This is typically // the first key read or written during the transaction and determines which // range in the cluster will hold the transaction record. Key []byte `protobuf:"bytes,3,opt,name=key" json:"key,omitempty"` // Incremented on txn retry. Epoch uint32 `protobuf:"varint,4,opt,name=epoch" json:"epoch"` // The proposed timestamp for the transaction. This starts as // the current wall time on the txn coordinator. Timestamp cockroach_util_hlc.Timestamp `protobuf:"bytes,5,opt,name=timestamp" json:"timestamp"` Priority int32 `protobuf:"varint,6,opt,name=priority" json:"priority"` // A one-indexed sequence number which is increased on each batch // sent as part of the transaction. Used to prevent replay and // out-of-order application protection (by means of a transaction // retry). Sequence int32 `protobuf:"varint,7,opt,name=sequence" json:"sequence"` // A zero-indexed sequence number indicating the index of a // command within a batch. This disambiguate Raft replays of a batch // from multiple commands in a batch which modify the same key. BatchIndex int32 `protobuf:"varint,8,opt,name=batch_index,json=batchIndex" json:"batch_index"` }
TxnMeta is the metadata of a Transaction record.
func NewPopulatedTxnMeta ¶
func (*TxnMeta) Descriptor ¶
func (*TxnMeta) ProtoMessage ¶
func (*TxnMeta) ProtoMessage()