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

package config

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

Index

Package Files

keys.go system.go system.pb.go testutil.go

Variables

var (
    ErrInvalidLengthSystem = fmt.Errorf("proto: negative length found during unmarshaling")
    ErrIntOverflowSystem   = fmt.Errorf("proto: integer overflow")
)
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
)

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 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 TestingSetZoneConfig Uses

func TestingSetZoneConfig(id uint32, zone zonepb.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.

type SystemConfig Uses

type SystemConfig struct {
    SystemConfigEntries
    DefaultZoneConfig *zonepb.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 *zonepb.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) (*zonepb.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) (*zonepb.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

Directories

PathSynopsis
zonepb

Package config imports 15 packages (graph) and is imported by 306 packages. Updated 2020-01-22. Refresh now. Tools for package owners.