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

package copysets

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

Package copysets provides an implementation of copysets presented in https://web.stanford.edu/~skatti/pubs/usenix13-copysets.pdf.

Stores are divided into sets of nodes of size replication factor (for each replication factor) and ranges reside within a single copyset in steady state. This significantly reduces the probability of data loss in large clusters since as long as a quorum of nodes are alive within each copyset, there is no loss of data.

Index

Package Files

copysets.go copysets.pb.go doc.go

Variables

var (
    ErrInvalidLengthCopysets = fmt.Errorf("proto: negative length found during unmarshaling")
    ErrIntOverflowCopysets   = fmt.Errorf("proto: integer overflow")
)
var CopysetStrategy_name = map[int32]string{
    0:  "MAXIMIZE_DIVERSITY",
    1:  "MINIMIZE_MOVEMENT",
}
var CopysetStrategy_value = map[string]int32{
    "MAXIMIZE_DIVERSITY": 0,
    "MINIMIZE_MOVEMENT":  1,
}

type AllCopysets Uses

type AllCopysets struct {
    // Map from replication factors to copysets.
    ByRf map[int32]Copysets `protobuf:"bytes,1,rep,name=by_rf,json=byRf,proto3" json:"by_rf" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
    // Strategy used for store-copyset allocation.
    Strategy CopysetStrategy `protobuf:"varint,2,opt,name=strategy,proto3,enum=cockroach.storage.copysets.CopysetStrategy" json:"strategy,omitempty"`
}

AllCopysets contains the map between replication factor to its copysets.

func (*AllCopysets) Descriptor Uses

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

func (*AllCopysets) Marshal Uses

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

func (*AllCopysets) MarshalTo Uses

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

func (*AllCopysets) ProtoMessage Uses

func (*AllCopysets) ProtoMessage()

func (*AllCopysets) Reset Uses

func (m *AllCopysets) Reset()

func (*AllCopysets) Size Uses

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

func (*AllCopysets) String Uses

func (m *AllCopysets) String() string

func (*AllCopysets) Unmarshal Uses

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

func (*AllCopysets) XXX_DiscardUnknown Uses

func (m *AllCopysets) XXX_DiscardUnknown()

func (*AllCopysets) XXX_Marshal Uses

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

func (*AllCopysets) XXX_Merge Uses

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

func (*AllCopysets) XXX_Size Uses

func (m *AllCopysets) XXX_Size() int

func (*AllCopysets) XXX_Unmarshal Uses

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

type Copyset Uses

type Copyset struct {
    // Map of StoreIDs.
    Ids map[github_com_cockroachdb_cockroach_pkg_roachpb.StoreID]bool `protobuf:"bytes,1,rep,name=ids,proto3,castkey=github.com/cockroachdb/cockroach/pkg/roachpb.StoreID" json:"ids,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
}

Copyset contains the set of stores belonging to the same copyset.

func (*Copyset) Descriptor Uses

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

func (*Copyset) Marshal Uses

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

func (*Copyset) MarshalTo Uses

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

func (*Copyset) ProtoMessage Uses

func (*Copyset) ProtoMessage()

func (*Copyset) Reset Uses

func (m *Copyset) Reset()

func (*Copyset) Size Uses

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

func (*Copyset) String Uses

func (m *Copyset) String() string

func (*Copyset) Unmarshal Uses

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

func (*Copyset) XXX_DiscardUnknown Uses

func (m *Copyset) XXX_DiscardUnknown()

func (*Copyset) XXX_Marshal Uses

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

func (*Copyset) XXX_Merge Uses

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

func (*Copyset) XXX_Size Uses

func (m *Copyset) XXX_Size() int

func (*Copyset) XXX_Unmarshal Uses

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

type CopysetID Uses

type CopysetID int32

CopysetID is a custom type for a cockroach copyset ID. Copyset is a group of stores where a range should be contained within if copyset based rebalancing is enabled.

type CopysetStrategy Uses

type CopysetStrategy int32

CopysetStrategy has the set of supported copyset-store allocation strategies.

const (
    // MAXIMIZE_DIVERSITY is a strategy which tries to maximize locality diversity
    // when creating copysets from a store list.
    CopysetStrategy_MAXIMIZE_DIVERSITY CopysetStrategy = 0
    // MINIMIZE_MOVEMENT is a strategy which tries to minimize changes to
    // existing copysets when generating new copysets on store list changes.
    // It does not guarantee optimal locality diversity but tries to avoid
    // stores with same localities within copysets.
    CopysetStrategy_MINIMIZE_MOVEMENT CopysetStrategy = 1
)

func (CopysetStrategy) EnumDescriptor Uses

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

func (CopysetStrategy) String Uses

func (x CopysetStrategy) String() string

type Copysets Uses

type Copysets struct {
    // Map from CopysetID to a Copyset (set of stores in the copyset).
    Sets map[CopysetID]Copyset `protobuf:"bytes,1,rep,name=sets,proto3,castkey=CopysetID" json:"sets" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
    // Replication factor of copy sets.
    ReplicationFactor int32 `protobuf:"varint,2,opt,name=replication_factor,json=replicationFactor,proto3" json:"replication_factor,omitempty"`
}

Copysets contains copysets for a particular replication factor. If copysets based rebalancing is enabled, the replicas of a range will be contained within a copy set. Each store belongs to a single copyset. Copyset based rebalancing significantly improves failure tolerance.

func (*Copysets) Descriptor Uses

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

func (*Copysets) Marshal Uses

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

func (*Copysets) MarshalTo Uses

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

func (*Copysets) ProtoMessage Uses

func (*Copysets) ProtoMessage()

func (*Copysets) Reset Uses

func (m *Copysets) Reset()

func (*Copysets) Size Uses

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

func (*Copysets) String Uses

func (m *Copysets) String() string

func (*Copysets) Unmarshal Uses

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

func (*Copysets) XXX_DiscardUnknown Uses

func (m *Copysets) XXX_DiscardUnknown()

func (*Copysets) XXX_Marshal Uses

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

func (*Copysets) XXX_Merge Uses

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

func (*Copysets) XXX_Size Uses

func (m *Copysets) XXX_Size() int

func (*Copysets) XXX_Unmarshal Uses

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

type Maintainer Uses

type Maintainer struct {
}

Maintainer maintains and assigns copysets to stores. TODO(hassan): implement Maintainer.

type Reader Uses

type Reader interface {
    // contains filtered or unexported methods
}

Reader is used to read copysets in the cluster.

Package copysets imports 7 packages (graph). Updated 2019-07-23. Refresh now. Tools for package owners.