cockroach: github.com/cockroachdb/cockroach/pkg/config Index | Files

package config

import "github.com/cockroachdb/cockroach/pkg/config"

Index

Package Files

keys.go system.go system.pb.go testutil.go zone.go zone.pb.go zone_yaml.go

Constants

const (
    DefaultZoneName    = "default"
    LivenessZoneName   = "liveness"
    MetaZoneName       = "meta"
    SystemZoneName     = "system"
    TimeseriesZoneName = "timeseries"
)

Several ranges outside of the SQL keyspace are given special names so they can be targeted by zone configs.

Variables

var (
    // ZoneConfigHook is a function used to lookup a zone config given a table
    // or database ID.
    // This is also used by testing to simplify fake configs.
    ZoneConfigHook zoneConfigHook

    // SplitAtIDHook is a function that is used to check if a given
    // descriptor comes from a database or a table view.
    SplitAtIDHook func(uint32, *SystemConfig) bool
)
var (
    ErrInvalidLengthSystem = fmt.Errorf("proto: negative length found during unmarshaling")
    ErrIntOverflowSystem   = fmt.Errorf("proto: integer overflow")
)
var (
    ErrInvalidLengthZone = fmt.Errorf("proto: negative length found during unmarshaling")
    ErrIntOverflowZone   = fmt.Errorf("proto: integer overflow")
)
var Constraint_Type_name = map[int32]string{
    0:  "DEPRECATED_POSITIVE",
    1:  "REQUIRED",
    2:  "PROHIBITED",
}
var Constraint_Type_value = map[string]int32{
    "DEPRECATED_POSITIVE": 0,
    "REQUIRED":            1,
    "PROHIBITED":          2,
}
var NamedZones = map[string]uint32{
    DefaultZoneName:    keys.RootNamespaceID,
    LivenessZoneName:   keys.LivenessRangesID,
    MetaZoneName:       keys.MetaRangesID,
    SystemZoneName:     keys.SystemRangesID,
    TimeseriesZoneName: keys.TimeseriesRangesID,
}

NamedZones maps named zones to their pseudo-table ID that can be used to install an entry into the system.zones table.

var NamedZonesByID = func() map[uint32]string {
    out := map[uint32]string{}
    for name, id := range NamedZones {
        out[id] = name
    }
    return out
}()

NamedZonesByID is the inverse of NamedZones: it maps pseudo-table IDs to their zone names.

func DecodeKeyIntoZoneIDAndSuffix Uses

func DecodeKeyIntoZoneIDAndSuffix(key roachpb.RKey) (id uint32, keySuffix []byte)

DecodeKeyIntoZoneIDAndSuffix figures out the zone that the key belongs to.

func DecodeObjectID Uses

func DecodeObjectID(key roachpb.RKey) (uint32, []byte, bool)

DecodeObjectID decodes the object ID from the front of key. It returns the decoded object ID, the remainder of the key, and whether the result is valid (i.e., whether the key was within the structured key space).

func MakeZoneKey Uses

func MakeZoneKey(id uint32) roachpb.Key

MakeZoneKey returns the key for id's entry in the system.zones table.

func MakeZoneKeyPrefix Uses

func MakeZoneKeyPrefix(id uint32) roachpb.Key

MakeZoneKeyPrefix returns the key prefix for id's row in the system.zones table.

func ResolveZoneSpecifier Uses

func ResolveZoneSpecifier(
    zs *tree.ZoneSpecifier, resolveName func(parentID uint32, name string) (id uint32, err error),
) (uint32, error)

ResolveZoneSpecifier converts a zone specifier to the ID of most specific zone whose config applies.

func StaticSplits Uses

func StaticSplits() []roachpb.RKey

StaticSplits are predefined split points in the system keyspace. Corresponding ranges are created at cluster bootstrap time.

There are two reasons for a static split. First, spans that are critical to cluster stability, like the node liveness span, are split into their own ranges to ease debugging (see #17297). Second, spans in the system keyspace that can be targeted by zone configs, like the meta span and the timeseries span, are split off into their own ranges because zone configs cannot apply to fractions of a range.

Note that these are not the only splits created at cluster bootstrap; splits between various system tables are also created.

func StoreMatchesConstraint Uses

func StoreMatchesConstraint(store roachpb.StoreDescriptor, c Constraint) bool

StoreMatchesConstraint returns whether a store's attributes or node's locality match the constraint's spec. It notably ignores whether the constraint is required, prohibited, positive, or otherwise. Also see StoreSatisfiesConstraint().

func StoreSatisfiesConstraint Uses

func StoreSatisfiesConstraint(store roachpb.StoreDescriptor, constraint Constraint) bool

StoreSatisfiesConstraint checks whether a store satisfies the given constraint. If the constraint is of the PROHIBITED type, satisfying it means the store not matching the constraint's spec.

func TestingSetZoneConfig Uses

func TestingSetZoneConfig(id uint32, zone ZoneConfig)

TestingSetZoneConfig sets the zone config entry for object 'id' in the testing map.

func TestingSetupZoneConfigHook Uses

func TestingSetupZoneConfigHook(stopper *stop.Stopper)

TestingSetupZoneConfigHook initializes the zone config hook to 'testingZoneConfigHook' which uses 'testingZoneConfig'. Settings go back to their previous values when the stopper runs our closer.

func ZoneSpecifierFromID Uses

func ZoneSpecifierFromID(
    id uint32, resolveID func(id uint32) (parentID uint32, name string, err error),
) (tree.ZoneSpecifier, error)

ZoneSpecifierFromID creates a tree.ZoneSpecifier for the zone with the given ID.

type Constraint Uses

type Constraint struct {
    Type Constraint_Type `protobuf:"varint,1,opt,name=type,enum=cockroach.config.Constraint_Type" json:"type"`
    // Key is only set if this is a constraint on locality.
    Key string `protobuf:"bytes,2,opt,name=key" json:"key"`
    // Value to constrain to.
    Value string `protobuf:"bytes,3,opt,name=value" json:"value"`
}

Constraint constrains the stores a replica can be stored on.

func NewPopulatedConstraint Uses

func NewPopulatedConstraint(r randyZone, easy bool) *Constraint

func (*Constraint) Descriptor Uses

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

func (*Constraint) Equal Uses

func (this *Constraint) Equal(that interface{}) bool

func (*Constraint) FromString Uses

func (c *Constraint) FromString(short string) error

FromString populates the constraint from the constraint shorthand notation.

func (*Constraint) GetKey Uses

func (c *Constraint) GetKey() string

GetKey is part of the cat.Constraint interface.

func (*Constraint) GetValue Uses

func (c *Constraint) GetValue() string

GetValue is part of the cat.Constraint interface.

func (*Constraint) IsRequired Uses

func (c *Constraint) IsRequired() bool

IsRequired is part of the cat.Constraint interface.

func (*Constraint) Marshal Uses

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

func (*Constraint) MarshalTo Uses

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

func (*Constraint) ProtoMessage Uses

func (*Constraint) ProtoMessage()

func (*Constraint) Reset Uses

func (m *Constraint) Reset()

func (*Constraint) Size Uses

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

func (Constraint) String Uses

func (c Constraint) String() string

func (*Constraint) Unmarshal Uses

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

func (*Constraint) XXX_DiscardUnknown Uses

func (m *Constraint) XXX_DiscardUnknown()

func (*Constraint) XXX_Marshal Uses

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

func (*Constraint) XXX_Merge Uses

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

func (*Constraint) XXX_Size Uses

func (m *Constraint) XXX_Size() int

func (*Constraint) XXX_Unmarshal Uses

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

type Constraint_Type Uses

type Constraint_Type int32
const (
    // DEPRECATED_POSITIVE has no effect on a replica's placement.
    Constraint_DEPRECATED_POSITIVE Constraint_Type = 0
    // REQUIRED ensures all replicas are placed on stores that match the
    // constraint. Replication will fail if there aren't any such stores.
    Constraint_REQUIRED Constraint_Type = 1
    // PROHIBITED will prevent replicas from having this key, value.
    Constraint_PROHIBITED Constraint_Type = 2
)

func (Constraint_Type) Enum Uses

func (x Constraint_Type) Enum() *Constraint_Type

func (Constraint_Type) EnumDescriptor Uses

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

func (Constraint_Type) String Uses

func (x Constraint_Type) String() string

func (*Constraint_Type) UnmarshalJSON Uses

func (x *Constraint_Type) UnmarshalJSON(data []byte) error

type Constraints Uses

type Constraints struct {
    // The number of replicas that should abide by the constraints. If left
    // unspecified (i.e. set to 0), the constraints will be assumed to apply
    // to all replicas of the range.
    // As of v2.0, only REQUIRED constraints are allowed when num_replicas is
    // set to a non-zero value.
    NumReplicas int32        `protobuf:"varint,7,opt,name=num_replicas,json=numReplicas" json:"num_replicas"`
    Constraints []Constraint `protobuf:"bytes,6,rep,name=constraints" json:"constraints"`
}

Constraints is a collection of constraints.

func NewPopulatedConstraints Uses

func NewPopulatedConstraints(r randyZone, easy bool) *Constraints

func (*Constraints) Constraint Uses

func (c *Constraints) Constraint(i int) cat.Constraint

Constraint is part of the cat.ReplicaConstraints interface.

func (*Constraints) ConstraintCount Uses

func (c *Constraints) ConstraintCount() int

ConstraintCount is part of the cat.ReplicaConstraints interface.

func (*Constraints) Descriptor Uses

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

func (*Constraints) Equal Uses

func (this *Constraints) Equal(that interface{}) bool

func (*Constraints) Marshal Uses

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

func (*Constraints) MarshalTo Uses

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

func (Constraints) MarshalYAML Uses

func (c Constraints) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler.

func (*Constraints) ProtoMessage Uses

func (*Constraints) ProtoMessage()

func (*Constraints) ReplicaCount Uses

func (c *Constraints) ReplicaCount() int32

ReplicaCount is part of the cat.ReplicaConstraints interface.

func (*Constraints) Reset Uses

func (m *Constraints) Reset()

func (*Constraints) Size Uses

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

func (*Constraints) String Uses

func (m *Constraints) String() string

func (*Constraints) Unmarshal Uses

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

func (*Constraints) UnmarshalYAML Uses

func (c *Constraints) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yaml.Marshaler.

func (*Constraints) XXX_DiscardUnknown Uses

func (m *Constraints) XXX_DiscardUnknown()

func (*Constraints) XXX_Marshal Uses

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

func (*Constraints) XXX_Merge Uses

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

func (*Constraints) XXX_Size Uses

func (m *Constraints) XXX_Size() int

func (*Constraints) XXX_Unmarshal Uses

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

type ConstraintsList Uses

type ConstraintsList struct {
    Constraints []Constraints
    Inherited   bool
}

ConstraintsList is an alias for a slice of Constraints that can be properly marshaled to/from YAML.

func (ConstraintsList) MarshalYAML Uses

func (c ConstraintsList) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler.

We use two different formats here, dependent on whether per-replica constraints are being used in ConstraintsList: 1. A legacy format when there are 0 or 1 Constraints and NumReplicas is

zero:
[c1, c2, c3]

2. A per-replica format when NumReplicas is non-zero:

{"c1,c2,c3": numReplicas1, "c4,c5": numReplicas2}

func (*ConstraintsList) UnmarshalYAML Uses

func (c *ConstraintsList) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yaml.Unmarshaler.

type GCPolicy Uses

type GCPolicy struct {
    // TTLSeconds specifies the maximum age of a value before it's
    // garbage collected. Only older versions of values are garbage
    // collected. Specifying <=0 mean older versions are never GC'd.
    TTLSeconds int32 `protobuf:"varint,1,opt,name=ttl_seconds,json=ttlSeconds" json:"ttl_seconds"`
}

GCPolicy defines garbage collection policies which apply to MVCC values within a zone.

TODO(spencer): flesh this out to include maximum number of values

as well as whether there's an intersection between max values
and TTL or a union.

func NewPopulatedGCPolicy Uses

func NewPopulatedGCPolicy(r randyZone, easy bool) *GCPolicy

func (*GCPolicy) Descriptor Uses

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

func (*GCPolicy) Equal Uses

func (this *GCPolicy) Equal(that interface{}) bool

func (*GCPolicy) Marshal Uses

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

func (*GCPolicy) MarshalTo Uses

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

func (*GCPolicy) ProtoMessage Uses

func (*GCPolicy) ProtoMessage()

func (*GCPolicy) Reset Uses

func (m *GCPolicy) Reset()

func (*GCPolicy) Size Uses

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

func (*GCPolicy) String Uses

func (m *GCPolicy) String() string

func (*GCPolicy) Unmarshal Uses

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

func (*GCPolicy) XXX_DiscardUnknown Uses

func (m *GCPolicy) XXX_DiscardUnknown()

func (*GCPolicy) XXX_Marshal Uses

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

func (*GCPolicy) XXX_Merge Uses

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

func (*GCPolicy) XXX_Size Uses

func (m *GCPolicy) XXX_Size() int

func (*GCPolicy) XXX_Unmarshal Uses

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

type LeasePreference Uses

type LeasePreference struct {
    Constraints []Constraint `protobuf:"bytes,1,rep,name=constraints" json:"constraints" yaml:"constraints,flow"`
}

LeasePreference specifies a preference about where range leases should be located.

func NewPopulatedLeasePreference Uses

func NewPopulatedLeasePreference(r randyZone, easy bool) *LeasePreference

func (*LeasePreference) Constraint Uses

func (l *LeasePreference) Constraint(i int) cat.Constraint

Constraint is part of the cat.LeasePreference interface.

func (*LeasePreference) ConstraintCount Uses

func (l *LeasePreference) ConstraintCount() int

ConstraintCount is part of the cat.LeasePreference interface.

func (*LeasePreference) Descriptor Uses

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

func (*LeasePreference) Equal Uses

func (this *LeasePreference) Equal(that interface{}) bool

func (*LeasePreference) Marshal Uses

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

func (*LeasePreference) MarshalTo Uses

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

func (LeasePreference) MarshalYAML Uses

func (l LeasePreference) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler.

func (*LeasePreference) ProtoMessage Uses

func (*LeasePreference) ProtoMessage()

func (*LeasePreference) Reset Uses

func (m *LeasePreference) Reset()

func (*LeasePreference) Size Uses

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

func (*LeasePreference) String Uses

func (m *LeasePreference) String() string

func (*LeasePreference) Unmarshal Uses

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

func (*LeasePreference) UnmarshalYAML Uses

func (l *LeasePreference) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yaml.Unmarshaler.

func (*LeasePreference) XXX_DiscardUnknown Uses

func (m *LeasePreference) XXX_DiscardUnknown()

func (*LeasePreference) XXX_Marshal Uses

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

func (*LeasePreference) XXX_Merge Uses

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

func (*LeasePreference) XXX_Size Uses

func (m *LeasePreference) XXX_Size() int

func (*LeasePreference) XXX_Unmarshal Uses

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

type Subzone Uses

type Subzone struct {
    // IndexID is the ID of the SQL table index that the subzone represents.
    // Always set.
    IndexID uint32 `protobuf:"varint,1,opt,name=index_id,json=indexId" json:"index_id"`
    // PartitionName is the partition of the SQL table index that the subzone
    // represents. It is empty when the subzone represents the entire index.
    PartitionName string `protobuf:"bytes,2,opt,name=partition_name,json=partitionName" json:"partition_name"`
    // Config stores the ZoneConfig that applies to this Subzone. It never
    // contains nested subzones.
    Config ZoneConfig `protobuf:"bytes,3,opt,name=config" json:"config"`
}

func NewPopulatedSubzone Uses

func NewPopulatedSubzone(r randyZone, easy bool) *Subzone

func (*Subzone) Descriptor Uses

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

func (*Subzone) Equal Uses

func (this *Subzone) Equal(that interface{}) bool

func (*Subzone) Marshal Uses

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

func (*Subzone) MarshalTo Uses

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

func (*Subzone) ProtoMessage Uses

func (*Subzone) ProtoMessage()

func (*Subzone) Reset Uses

func (m *Subzone) Reset()

func (*Subzone) Size Uses

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

func (*Subzone) String Uses

func (m *Subzone) String() string

func (*Subzone) Unmarshal Uses

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

func (*Subzone) XXX_DiscardUnknown Uses

func (m *Subzone) XXX_DiscardUnknown()

func (*Subzone) XXX_Marshal Uses

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

func (*Subzone) XXX_Merge Uses

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

func (*Subzone) XXX_Size Uses

func (m *Subzone) XXX_Size() int

func (*Subzone) XXX_Unmarshal Uses

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

type SubzoneSpan Uses

type SubzoneSpan struct {
    // Key stores a key suffix that represents the inclusive lower bound for this
    // span. The SQL table prefix, like /Table/51/, is omitted.
    //
    // Both Key and EndKey, below, are cast to roachpb.Key for convenience, but
    // there's no technical restriction that prevents switching them to []byte or
    // another type that communicates their missing prefix.
    Key github_com_cockroachdb_cockroach_pkg_roachpb.Key `protobuf:"bytes,1,opt,name=key,casttype=github.com/cockroachdb/cockroach/pkg/roachpb.Key" json:"key,omitempty"`
    // EndKey stores a key suffix that represents the exclusive upper bound for
    // this span. Like with Key, the SQL table prefix is omitted. If EndKey is
    // empty, it is assumed to be Key.PrefixEnd().
    EndKey github_com_cockroachdb_cockroach_pkg_roachpb.Key `protobuf:"bytes,2,opt,name=end_key,json=endKey,casttype=github.com/cockroachdb/cockroach/pkg/roachpb.Key" json:"end_key,omitempty"`
    // SubzoneIndex is the slice index of the Subzone this span belongs to in the
    // parent ZoneConfig's Subzones field.
    SubzoneIndex int32 `protobuf:"varint,3,opt,name=subzone_index,json=subzoneIndex" json:"subzone_index"`
}

func NewPopulatedSubzoneSpan Uses

func NewPopulatedSubzoneSpan(r randyZone, easy bool) *SubzoneSpan

func (*SubzoneSpan) Descriptor Uses

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

func (*SubzoneSpan) Equal Uses

func (this *SubzoneSpan) Equal(that interface{}) bool

func (*SubzoneSpan) Marshal Uses

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

func (*SubzoneSpan) MarshalTo Uses

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

func (*SubzoneSpan) ProtoMessage Uses

func (*SubzoneSpan) ProtoMessage()

func (*SubzoneSpan) Reset Uses

func (m *SubzoneSpan) Reset()

func (*SubzoneSpan) Size Uses

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

func (*SubzoneSpan) String Uses

func (m *SubzoneSpan) String() string

func (*SubzoneSpan) Unmarshal Uses

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

func (*SubzoneSpan) XXX_DiscardUnknown Uses

func (m *SubzoneSpan) XXX_DiscardUnknown()

func (*SubzoneSpan) XXX_Marshal Uses

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

func (*SubzoneSpan) XXX_Merge Uses

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

func (*SubzoneSpan) XXX_Size Uses

func (m *SubzoneSpan) XXX_Size() int

func (*SubzoneSpan) XXX_Unmarshal Uses

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

type SystemConfig Uses

type SystemConfig struct {
    SystemConfigEntries
    DefaultZoneConfig *ZoneConfig
    // contains filtered or unexported fields
}

SystemConfig embeds a SystemConfigEntries message which contains an entry for every system descriptor (e.g. databases, tables, zone configs). It also has a map from object ID to unmarshaled zone config for caching. The shouldSplitCache caches information about the descriptor ID, saying whether or not it should be considered for splitting at all. A database descriptor or a table view descriptor are examples of IDs that should not be considered for splits.

func NewSystemConfig Uses

func NewSystemConfig(defaultZoneConfig *ZoneConfig) *SystemConfig

NewSystemConfig returns an initialized instance of SystemConfig.

func (*SystemConfig) ComputeSplitKey Uses

func (s *SystemConfig) ComputeSplitKey(startKey, endKey roachpb.RKey) (rr roachpb.RKey)

ComputeSplitKey takes a start and end key and returns the first key at which to split the span [start, end). Returns nil if no splits are required.

Splits are required between user tables (i.e. /table/<id>), at the start of the system-config tables (i.e. /table/0), and at certain points within the system ranges that come before the system tables. The system-config range is somewhat special in that it can contain multiple SQL tables (/table/0-/table/<max-system-config-desc>) within a single range.

func (*SystemConfig) Equal Uses

func (s *SystemConfig) Equal(other *SystemConfigEntries) bool

Equal checks for equality.

It assumes that s.Values and other.Values are sorted in key order.

func (*SystemConfig) GetDesc Uses

func (s *SystemConfig) GetDesc(key roachpb.Key) *roachpb.Value

GetDesc looks for the descriptor value given a key, if a zone is created in a test without creating a Descriptor, a dummy descriptor is returned. If the key is invalid in decoding an ID, GetDesc panics.

func (*SystemConfig) GetIndex Uses

func (s *SystemConfig) GetIndex(key roachpb.Key) (int, bool)

GetIndex searches the kv list for 'key' and returns its index if found.

func (*SystemConfig) GetLargestObjectID Uses

func (s *SystemConfig) GetLargestObjectID(maxID uint32) (uint32, error)

GetLargestObjectID returns the largest object ID found in the config which is less than or equal to maxID. If maxID is 0, returns the largest ID in the config.

func (*SystemConfig) GetValue Uses

func (s *SystemConfig) GetValue(key roachpb.Key) *roachpb.Value

GetValue searches the kv list for 'key' and returns its roachpb.Value if found.

func (*SystemConfig) GetZoneConfigForKey Uses

func (s *SystemConfig) GetZoneConfigForKey(key roachpb.RKey) (*ZoneConfig, error)

GetZoneConfigForKey looks up the zone config for the object (table or database, specified by key.id). It is the caller's responsibility to ensure that the range does not need to be split.

func (*SystemConfig) GetZoneConfigForObject Uses

func (s *SystemConfig) GetZoneConfigForObject(id uint32) (*ZoneConfig, error)

GetZoneConfigForObject returns the combined zone config for the given object identifier. NOTE: any subzones from the zone placeholder will be automatically merged into the cached zone so the caller doesn't need special-case handling code.

func (*SystemConfig) NeedsSplit Uses

func (s *SystemConfig) NeedsSplit(startKey, endKey roachpb.RKey) bool

NeedsSplit returns whether the range [startKey, endKey) needs a split due to zone configs.

type SystemConfigEntries Uses

type SystemConfigEntries struct {
    Values []roachpb.KeyValue `protobuf:"bytes,1,rep,name=values" json:"values"`
}

func (*SystemConfigEntries) Descriptor Uses

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

func (*SystemConfigEntries) Marshal Uses

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

func (*SystemConfigEntries) MarshalTo Uses

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

func (*SystemConfigEntries) ProtoMessage Uses

func (*SystemConfigEntries) ProtoMessage()

func (*SystemConfigEntries) Reset Uses

func (m *SystemConfigEntries) Reset()

func (*SystemConfigEntries) Size Uses

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

func (*SystemConfigEntries) String Uses

func (m *SystemConfigEntries) String() string

func (*SystemConfigEntries) Unmarshal Uses

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

func (*SystemConfigEntries) XXX_DiscardUnknown Uses

func (m *SystemConfigEntries) XXX_DiscardUnknown()

func (*SystemConfigEntries) XXX_Marshal Uses

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

func (*SystemConfigEntries) XXX_Merge Uses

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

func (*SystemConfigEntries) XXX_Size Uses

func (m *SystemConfigEntries) XXX_Size() int

func (*SystemConfigEntries) XXX_Unmarshal Uses

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

type ZoneConfig Uses

type ZoneConfig struct {
    RangeMinBytes *int64 `protobuf:"varint,2,opt,name=range_min_bytes,json=rangeMinBytes" json:"range_min_bytes,omitempty" yaml:"range_min_bytes"`
    RangeMaxBytes *int64 `protobuf:"varint,3,opt,name=range_max_bytes,json=rangeMaxBytes" json:"range_max_bytes,omitempty" yaml:"range_max_bytes"`
    // If GC policy is not set, uses the next highest, non-null policy
    // in the zone config hierarchy, up to the default policy if necessary.
    GC  *GCPolicy `protobuf:"bytes,4,opt,name=gc" json:"gc,omitempty"`
    // NumReplicas specifies the desired number of replicas
    NumReplicas *int32 `protobuf:"varint,5,opt,name=num_replicas,json=numReplicas" json:"num_replicas,omitempty" yaml:"num_replicas"`
    // Constraints constrains which stores the replicas can be stored on. The
    // order in which the constraints are stored is arbitrary and may change.
    // https://github.com/cockroachdb/cockroach/blob/master/docs/RFCS/20160706_expressive_zone_config.md#constraint-system
    //
    // NOTE: The sum of the num_replicas fields of the Constraints must add up to
    // ZoneConfig.num_replicas, or there must be no more than a single Constraints
    // field with num_replicas set to 0.
    Constraints []Constraints `protobuf:"bytes,6,rep,name=constraints" json:"constraints" yaml:"constraints,flow"`
    // InheritedContraints specifies if the value in the Constraints field was
    // inherited from the zone's parent or specified explicitly by the user.
    InheritedConstraints bool `protobuf:"varint,10,opt,name=inherited_constraints,json=inheritedConstraints" json:"inherited_constraints"`
    // LeasePreference stores information about where the user would prefer for
    // range leases to be placed. Leases are allowed to be placed elsewhere if
    // needed, but will follow the provided preference when possible.
    //
    // More than one lease preference is allowed, but they should be ordered from
    // most preferred to lease preferred. The first preference that an existing
    // replica of a range matches will take priority.
    LeasePreferences []LeasePreference `protobuf:"bytes,9,rep,name=lease_preferences,json=leasePreferences" json:"lease_preferences" yaml:"lease_preferences,flow"`
    // InheritedLeasePreferences specifies if the value in the LeasePreferences field
    // was inherited from the zone's parent or specified explicitly by the user.
    InheritedLeasePreferences bool `protobuf:"varint,11,opt,name=inherited_lease_preferences,json=inheritedLeasePreferences" json:"inherited_lease_preferences"`
    // Subzones stores config overrides for "subzones", each of which represents
    // either a SQL table index or a partition of a SQL table index. Subzones are
    // not applicable when the zone does not represent a SQL table (i.e., when the
    // zone represents a database, a special system range, or is itself a
    // subzone.)
    Subzones []Subzone `protobuf:"bytes,8,rep,name=subzones" json:"subzones" yaml:"-"`
    // SubzoneSpans maps each key span in a subzone to the slice index of an entry
    // in SubzoneConfig. Spans are non-overlapping and sorted by start key to
    // allow binary searching. SubzoneSpans can be easily derived from a
    // TableDescriptor, but are denormalized here to make GetZoneConfigForKey
    // lookups efficient.
    SubzoneSpans []SubzoneSpan `protobuf:"bytes,7,rep,name=subzone_spans,json=subzoneSpans" json:"subzone_spans" yaml:"-"`
}

ZoneConfig holds configuration that applies to one or more ranges.

Note: when adding.removing fields here, be sure to update supportedZoneConfigOptions in the sql package, to synchronize with the code for ALTER ... CONFIGURE ZONE.

func DefaultSystemZoneConfig Uses

func DefaultSystemZoneConfig() ZoneConfig

DefaultSystemZoneConfig is the default zone configuration used when no custom config has been specified.

func DefaultSystemZoneConfigRef Uses

func DefaultSystemZoneConfigRef() *ZoneConfig

DefaultSystemZoneConfigRef is the default zone configuration used when no custom config has been specified.

func DefaultZoneConfig Uses

func DefaultZoneConfig() ZoneConfig

DefaultZoneConfig is the default zone configuration used when no custom config has been specified.

func DefaultZoneConfigRef Uses

func DefaultZoneConfigRef() *ZoneConfig

DefaultZoneConfigRef is the default zone configuration used when no custom config has been specified.

func EmptyCompleteZoneConfig Uses

func EmptyCompleteZoneConfig() *ZoneConfig

EmptyCompleteZoneConfig is the zone configuration where all fields are set but set to their respective zero values.

func NewPopulatedZoneConfig Uses

func NewPopulatedZoneConfig(r randyZone, easy bool) *ZoneConfig

func NewZoneConfig Uses

func NewZoneConfig() *ZoneConfig

NewZoneConfig is the zone configuration used when no custom config has been specified.

func (*ZoneConfig) CopyFromZone Uses

func (z *ZoneConfig) CopyFromZone(other ZoneConfig, fieldList []tree.Name)

CopyFromZone copies over the specified fields from the other zone.

func (*ZoneConfig) DeleteIndexSubzones Uses

func (z *ZoneConfig) DeleteIndexSubzones(indexID uint32)

DeleteIndexSubzones deletes all subzones that refer to the index with the specified ID. This includes subzones for partitions of the index as well as the index subzone itself.

func (*ZoneConfig) DeleteSubzone Uses

func (z *ZoneConfig) DeleteSubzone(indexID uint32, partition string) bool

DeleteSubzone removes the subzone with the specified index ID and partition. It returns whether it performed any work.

func (*ZoneConfig) DeleteTableConfig Uses

func (z *ZoneConfig) DeleteTableConfig()

DeleteTableConfig removes any configuration that applies to the table targeted by this ZoneConfig, leaving only its subzone configs, if any. After calling DeleteTableConfig, IsSubzonePlaceholder will return true.

Only table zones can have subzones, so it does not make sense to call this method on non-table ZoneConfigs.

func (*ZoneConfig) Descriptor Uses

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

func (*ZoneConfig) Equal Uses

func (this *ZoneConfig) Equal(that interface{}) bool

func (*ZoneConfig) GetSubzone Uses

func (z *ZoneConfig) GetSubzone(indexID uint32, partition string) *Subzone

GetSubzone returns the most specific Subzone that applies to the specified index ID and partition, if any exists. The partition can be left unspecified to get the Subzone for an entire index, if it exists. indexID, however, must always be provided, even when looking for a partition's Subzone.

func (ZoneConfig) GetSubzoneForKeySuffix Uses

func (z ZoneConfig) GetSubzoneForKeySuffix(keySuffix []byte) (*Subzone, int32)

GetSubzoneForKeySuffix returns the ZoneConfig for the subzone that contains keySuffix, if it exists and its position in the subzones slice.

func (*ZoneConfig) InheritFromParent Uses

func (z *ZoneConfig) InheritFromParent(parent *ZoneConfig)

InheritFromParent hydrates a zones missing fields from its parent.

func (*ZoneConfig) IsComplete Uses

func (z *ZoneConfig) IsComplete() bool

IsComplete returns whether all the fields are set.

func (*ZoneConfig) IsSubzonePlaceholder Uses

func (z *ZoneConfig) IsSubzonePlaceholder() bool

IsSubzonePlaceholder returns whether the ZoneConfig exists only to store subzones. The configuration fields (e.g., RangeMinBytes) in a subzone placeholder should be ignored; instead, the configuration from the parent ZoneConfig applies.

func (*ZoneConfig) LeasePreference Uses

func (z *ZoneConfig) LeasePreference(i int) cat.ConstraintSet

LeasePreference is part of the cat.Zone interface.

func (*ZoneConfig) LeasePreferenceCount Uses

func (z *ZoneConfig) LeasePreferenceCount() int

LeasePreferenceCount is part of the cat.Zone interface.

func (*ZoneConfig) Marshal Uses

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

func (*ZoneConfig) MarshalTo Uses

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

func (ZoneConfig) MarshalYAML Uses

func (c ZoneConfig) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler.

func (*ZoneConfig) ProtoMessage Uses

func (*ZoneConfig) ProtoMessage()

func (*ZoneConfig) ReplicaConstraints Uses

func (z *ZoneConfig) ReplicaConstraints(i int) cat.ReplicaConstraints

ReplicaConstraints is part of the cat.Zone interface.

func (*ZoneConfig) ReplicaConstraintsCount Uses

func (z *ZoneConfig) ReplicaConstraintsCount() int

ReplicaConstraintsCount is part of the cat.Zone interface.

func (*ZoneConfig) Reset Uses

func (m *ZoneConfig) Reset()

func (*ZoneConfig) SetSubzone Uses

func (z *ZoneConfig) SetSubzone(subzone Subzone)

SetSubzone installs subzone into the ZoneConfig, overwriting any existing subzone with the same IndexID and PartitionName.

func (*ZoneConfig) Size Uses

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

func (*ZoneConfig) String Uses

func (m *ZoneConfig) String() string

func (*ZoneConfig) Unmarshal Uses

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

func (*ZoneConfig) UnmarshalYAML Uses

func (c *ZoneConfig) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yaml.Unmarshaler.

func (*ZoneConfig) Validate Uses

func (z *ZoneConfig) Validate() error

Validate returns an error if the ZoneConfig specifies a known-dangerous or disallowed configuration.

func (*ZoneConfig) ValidateTandemFields Uses

func (z *ZoneConfig) ValidateTandemFields() error

ValidateTandemFields returns an error if the ZoneConfig to be written specifies a configuration that could cause problems with the introduction of cascading zone configs.

func (*ZoneConfig) XXX_DiscardUnknown Uses

func (m *ZoneConfig) XXX_DiscardUnknown()

func (*ZoneConfig) XXX_Marshal Uses

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

func (*ZoneConfig) XXX_Merge Uses

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

func (*ZoneConfig) XXX_Size Uses

func (m *ZoneConfig) XXX_Size() int

func (*ZoneConfig) XXX_Unmarshal Uses

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

Package config imports 22 packages (graph) and is imported by 48 packages. Updated 2019-09-11. Refresh now. Tools for package owners.