sharding

package
v0.0.0-...-d253ebd Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2021 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConfigDB = "config"

	SettingsCol   = "settings"
	ShardCol      = "shards"
	ChunkCol      = "chunks"
	CollectionCol = "collections"

	HashedShard = "hashed"
	RangedShard = "ranged"

	ConfigShardLogInterval = 3 // s
)

Variables

This section is empty.

Functions

func GetBalancerStatusByUrl

func GetBalancerStatusByUrl(csUrl string) (bool, error)

get balancer status from config server

func GetColShardType

func GetColShardType(session *mgo.Session, namespace string) ([]string, string, error)

input given namespace, return all keys and shard type(range or hashed)

func GetDDLNamespace

func GetDDLNamespace(log *oplog.PartialLog) string

func IsSharding

func IsSharding(session *mgo.Session) bool

func TestSharding

func TestSharding(t *testing.T)

Types

type ChunkRange

type ChunkRange struct {
	// the minimum/maximum of the chunk range of multiple columns shard key has multiple values
	Mins []interface{}
	Maxs []interface{}
}

type DBChunkMap

type DBChunkMap map[string]*ShardCollection

type ShardCollection

type ShardCollection struct {
	Chunks []*ChunkRange
	// shard key may have multiple columns, for example {a:1, b:1, c:1}
	Keys      []string
	ShardType string
}

type ShardCollectionSpec

type ShardCollectionSpec struct {
	Ns     string
	Key    bson.D
	Unique bool
}

func GetShardCollectionSpec

func GetShardCollectionSpec(session *mgo.Session, log *oplog.PartialLog) *ShardCollectionSpec

type ShardingChunkMap

type ShardingChunkMap map[string]map[string]*ShardCollection

{replset: {namespace: []ChunkRange} }

func GetChunkMapByUrl

func GetChunkMapByUrl(csUrl string) (ShardingChunkMap, error)

Jump to

Keyboard shortcuts

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