clickhouse

package
v1.0.11 Latest Latest
Warning

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

Go to latest
Published: May 27, 2021 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDiskByPath added in v1.0.0

func GetDiskByPath(disks []Disk, dataPath string) string

func GetDisksByPaths added in v1.0.0

func GetDisksByPaths(disks []Disk, dataPaths []string) map[string]string

func IsClickhouseShadow

func IsClickhouseShadow(path string) bool

func TablePathEncode

func TablePathEncode(str string) string

Types

type BackupTables

type BackupTables []metadata.TableMetadata

BackupTables - slice of BackupTable

func (BackupTables) Sort

func (bt BackupTables) Sort()

Sort - sorting BackupTables slice orderly by name

type ClickHouse

type ClickHouse struct {
	Config *config.ClickHouseConfig
	// contains filtered or unexported fields
}

ClickHouse - provide

func (*ClickHouse) AttachPartitions

func (ch *ClickHouse) AttachPartitions(table metadata.TableMetadata, disks []Disk) error

AttachPartitions - execute ATTACH command for specific table

func (*ClickHouse) Chown

func (ch *ClickHouse) Chown(filename string) error

Chown - set permission on file to clickhouse user This is necessary that the ClickHouse will be able to read parts files on restore

func (*ClickHouse) CleanShadow added in v1.0.0

func (ch *ClickHouse) CleanShadow(name string) error

func (*ClickHouse) Close

func (ch *ClickHouse) Close()

Close - closing connection to ClickHouse

func (*ClickHouse) Connect

func (ch *ClickHouse) Connect() error

Connect - establish connection to ClickHouse

func (*ClickHouse) CopyData

func (ch *ClickHouse) CopyData(backupName string, backupTable metadata.TableMetadata, disks []Disk, tableDataPaths []string) error

CopyData - copy partitions for specific table to detached folder

func (*ClickHouse) CreateDatabase

func (ch *ClickHouse) CreateDatabase(database string) error

CreateDatabase - create ClickHouse database

func (*ClickHouse) CreateDatabaseFromQuery added in v1.0.0

func (ch *ClickHouse) CreateDatabaseFromQuery(query string) error

func (*ClickHouse) CreateDatabaseWithEngine added in v1.0.0

func (ch *ClickHouse) CreateDatabaseWithEngine(database string, engine string) error

func (*ClickHouse) CreateTable

func (ch *ClickHouse) CreateTable(table Table, query string, dropTable bool) error

CreateTable - create ClickHouse table

func (*ClickHouse) FreezeTable

func (ch *ClickHouse) FreezeTable(table *Table, name string) error

FreezeTable - freeze all partitions for table This way available for ClickHouse since v19.1

func (*ClickHouse) FreezeTableOldWay

func (ch *ClickHouse) FreezeTableOldWay(table *Table, name string) error

FreezeTableOldWay - freeze all partitions in table one by one This way using for ClickHouse below v19.1

func (*ClickHouse) GetBackupTablesLegacy added in v1.0.0

func (ch *ClickHouse) GetBackupTablesLegacy(backupName string) ([]metadata.TableMetadata, error)

GetBackupTablesLegacy - return list of backups of tables that can be restored

func (*ClickHouse) GetConn

func (ch *ClickHouse) GetConn() *sqlx.DB

GetConn - return current connection

func (*ClickHouse) GetDatabases added in v1.0.0

func (ch *ClickHouse) GetDatabases() ([]Database, error)

GetDatabases - return slice of all non system databases for backup

func (*ClickHouse) GetDefaultPath added in v1.0.0

func (ch *ClickHouse) GetDefaultPath() (string, error)

func (*ClickHouse) GetDisks added in v1.0.0

func (ch *ClickHouse) GetDisks() ([]Disk, error)

GetDisks - return data from system.disks table

func (*ClickHouse) GetPartitions

func (ch *ClickHouse) GetPartitions(database, table string) (map[string][]metadata.Part, error)

GetPartitions - return slice of all partitions for a table

func (*ClickHouse) GetTables

func (ch *ClickHouse) GetTables() ([]Table, error)

GetTables - return slice of all tables suitable for backup

func (*ClickHouse) GetVersion

func (ch *ClickHouse) GetVersion() (int, error)

GetVersion - returned ClickHouse version in number format Example value: 19001005

func (*ClickHouse) GetVersionDescribe added in v1.0.0

func (ch *ClickHouse) GetVersionDescribe() string

func (*ClickHouse) IsAtomic added in v1.0.0

func (ch *ClickHouse) IsAtomic(database string) (bool, error)

func (*ClickHouse) LogQuery added in v1.0.0

func (ch *ClickHouse) LogQuery(query string) string

func (*ClickHouse) Mkdir added in v1.0.0

func (ch *ClickHouse) Mkdir(name string) error

func (*ClickHouse) MkdirAll added in v1.0.0

func (ch *ClickHouse) MkdirAll(path string) error

func (*ClickHouse) Query added in v1.0.0

func (ch *ClickHouse) Query(query string, args ...interface{}) (sql.Result, error)

func (*ClickHouse) Queryx added in v1.0.0

func (ch *ClickHouse) Queryx(query string, args ...interface{}) (*sqlx.Rows, error)

func (*ClickHouse) Select added in v1.0.0

func (ch *ClickHouse) Select(dest interface{}, query string, args ...interface{}) error

func (*ClickHouse) ShowCreateTable added in v1.0.0

func (ch *ClickHouse) ShowCreateTable(database, name string) string

type Database added in v1.0.0

type Database struct {
	Name   string `db:"name"`
	Engine string `db:"engine"`
	Query  string `db:"query"`
}

Database - Clickhouse system.databases struct

type Disk added in v1.0.0

type Disk struct {
	Name string `db:"name"`
	Path string `db:"path"`
	Type string `db:"type"`
}

type PartDiff

type PartDiff struct {
	BTable           metadata.TableMetadata
	PartitionsAdd    []metadata.Part
	PartitionsRemove []metadata.Part
}

PartDiff - Data part discrepancies infos

type Table

type Table struct {
	Database             string   `db:"database"`
	Name                 string   `db:"name"`
	DataPath             string   `db:"data_path"` // For legacy support
	DataPaths            []string `db:"data_paths"`
	MetadataPath         string   `db:"metadata_path"`
	Engine               string   `db:"engine"`
	UUID                 string   `db:"uuid,omitempty"`
	StoragePolicy        string   `db:"storage_policy"`
	CreateTableQuery     string   `db:"create_table_query"`
	Skip                 bool
	TotalBytes           sql.NullInt64 `db:"total_bytes,omitempty"`
	DependencesTable     []string      `db:"dependencies_table"`
	DependenciesDatabase []string      `db:"dependencies_database"`
}

Table - ClickHouse table struct

Jump to

Keyboard shortcuts

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