keyspace

package
v1.1.0-beta.0...-96bdeae Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package keyspace provides utilities for keyspace for nextgen TiDB.

Keyspace are used to isolate data and operations, allowing for multi-tenancy in next generation TiDB. Each keyspace represents a logical cluster on top of the underlying physical cluster.

There are two types of keyspace: user keyspace and reserved internal keyspace, currently, only SYSTEM keyspace is reserved for internal use.

SYSTEM keyspace is reserved for system-level services and data, currently, only the DXF service uses this keyspace. As user keyspace depends on SYSTEM keyspace, we need to make sure SYSTEM keyspace exist before user keyspace start serving any user traffic. So for the deployment of nextgen cluster, we need to:

  • Deploy PD/TiKV and other components, wait them to be ready to serve TiDB access.
  • Deploy SYSTEM keyspace, wait it fully bootstrapped.
  • Deploy other user keyspace, they can be deployed concurrently.

During upgrade, we also need to follow above order, i.e. We need to upgrade the SYSTEM keyspace first, then user keyspace.

Note: serverless also use keyspace, and have the special NULL and DEFAULT keyspace, while nextgen hasn't.

Index

Constants

View Source
const (
	// System is the keyspace name for SYSTEM keyspace.
	// see doc.go for more detail.
	System = "SYSTEM"
)

Variables

CodecV1 represents api v1 codec.

Functions

func GetKeyspaceNameBySettings

func GetKeyspaceNameBySettings() (keyspaceName string)

GetKeyspaceNameBySettings is used to get Keyspace name setting.

func GetKeyspaceNameBytesBySettings

func GetKeyspaceNameBytesBySettings() []byte

GetKeyspaceNameBytesBySettings is used to get keyspace name setting as a byte slice.

func IsKeyspaceNameEmpty

func IsKeyspaceNameEmpty(keyspaceName string) bool

IsKeyspaceNameEmpty is used to determine whether keyspaceName is set.

func MakeKeyspaceEtcdNamespace

func MakeKeyspaceEtcdNamespace(c tikv.Codec) string

MakeKeyspaceEtcdNamespace return the keyspace prefix path for etcd namespace

func MakeKeyspaceEtcdNamespaceSlash

func MakeKeyspaceEtcdNamespaceSlash(c tikv.Codec) string

MakeKeyspaceEtcdNamespaceSlash return the keyspace prefix path for etcd namespace, and end with a slash.

func WrapZapcoreWithKeyspace

func WrapZapcoreWithKeyspace() zap.Option

WrapZapcoreWithKeyspace is used to wrap zapcore.Core.

Types

This section is empty.

Jump to

Keyboard shortcuts

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