Documentation ¶
Index ¶
- func IsClickhouseShadow(path string) bool
- func TablePathEncode(str string) string
- type BackupPartition
- type BackupTable
- type BackupTables
- type ClickHouse
- func (ch *ClickHouse) ApplyPartitionsChanges(table PartDiff) error
- func (ch *ClickHouse) AttachPartitions(table BackupTable) error
- func (ch *ClickHouse) Chown(filename string) error
- func (ch *ClickHouse) Close() error
- func (ch *ClickHouse) ComputePartitionsDelta(restoreTables []BackupTable, liveTables []Table) ([]PartDiff, error)
- func (ch *ClickHouse) Connect() error
- func (ch *ClickHouse) CopyData(table BackupTable) error
- func (ch *ClickHouse) CopyDataDiff(diff PartDiff) error
- func (ch *ClickHouse) CreateDatabase(database string) error
- func (ch *ClickHouse) CreateTable(table Table, query string, dropTable bool) error
- func (ch *ClickHouse) FreezeTable(table Table) error
- func (ch *ClickHouse) FreezeTableOldWay(table Table) error
- func (ch *ClickHouse) GetBackupTables(backupName string) (map[string]BackupTable, error)
- func (ch *ClickHouse) GetConn() *sqlx.DB
- func (ch *ClickHouse) GetDataPath() (string, error)
- func (ch *ClickHouse) GetPartitions(table Table) ([]Partition, error)
- func (ch *ClickHouse) GetTables() ([]Table, error)
- func (ch *ClickHouse) GetVersion() (int, error)
- type PartDiff
- type Partition
- type Table
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsClickhouseShadow ¶
func TablePathEncode ¶
Types ¶
type BackupPartition ¶
type BackupPartition struct { Partition string `json:"Partition"` Name string `json:"Name"` Path string `json:"Path"` HashOfAllFiles string `json:"hash_of_all_files"` HashOfUncompressedFiles string `json:"hash_of_uncompressed_files"` UncompressedHashOfCompressedFiles string `json:"uncompressed_hash_of_compressed_files"` Active uint8 `json:"active"` }
BackupPartition - struct representing Clickhouse partition
type BackupTable ¶
type BackupTable struct { Database string Name string Partitions []BackupPartition }
BackupTable - struct to store additional information on partitions
type BackupTables ¶
type BackupTables []BackupTable
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) ApplyPartitionsChanges ¶
func (ch *ClickHouse) ApplyPartitionsChanges(table PartDiff) error
ApplyPartitionsChanges - add/remove partitions to/from the live table
func (*ClickHouse) AttachPartitions ¶
func (ch *ClickHouse) AttachPartitions(table BackupTable) 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) Close ¶
func (ch *ClickHouse) Close() error
Close - closing connection to ClickHouse
func (*ClickHouse) ComputePartitionsDelta ¶
func (ch *ClickHouse) ComputePartitionsDelta(restoreTables []BackupTable, liveTables []Table) ([]PartDiff, error)
ComputePartitionsDelta - computes the data partitions to be added and removed between live and backup tables
func (*ClickHouse) Connect ¶
func (ch *ClickHouse) Connect() error
Connect - establish connection to ClickHouse
func (*ClickHouse) CopyData ¶
func (ch *ClickHouse) CopyData(table BackupTable) error
CopyData - copy partitions for specific table to detached folder
func (*ClickHouse) CopyDataDiff ¶
func (ch *ClickHouse) CopyDataDiff(diff PartDiff) error
CopyDataDiff - copy only partitions that will be attached to "detached" folder
func (*ClickHouse) CreateDatabase ¶
func (ch *ClickHouse) CreateDatabase(database string) error
CreateDatabase - create ClickHouse database
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) error
FreezeTable - freeze all partitions for table This way available for ClickHouse sience v19.1
func (*ClickHouse) FreezeTableOldWay ¶
func (ch *ClickHouse) FreezeTableOldWay(table Table) error
FreezeTableOldWay - freeze all partitions in table one by one This way using for ClickHouse below v19.1
func (*ClickHouse) GetBackupTables ¶
func (ch *ClickHouse) GetBackupTables(backupName string) (map[string]BackupTable, error)
GetBackupTables - 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) GetDataPath ¶
func (ch *ClickHouse) GetDataPath() (string, error)
GetDataPath - return ClickHouse data_path
func (*ClickHouse) GetPartitions ¶
func (ch *ClickHouse) GetPartitions(table Table) ([]Partition, 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
type PartDiff ¶
type PartDiff struct { BTable BackupTable PartitionsAdd []Partition PartitionsRemove []Partition }
PartDiff - Data part discrepancies infos
type Partition ¶
type Partition struct { Partition string `db:"partition"` Name string `db:"name"` Path string `db:"path"` HashOfAllFiles string `db:"hash_of_all_files"` HashOfUncompressedFiles string `db:"hash_of_uncompressed_files"` UncompressedHashOfCompressedFiles string `db:"uncompressed_hash_of_compressed_files"` Active uint8 `db:"active"` }
Partition - partition info from system.parts