Documentation ¶
Index ¶
- func GetDiskByPath(disks []Disk, dataPath string) string
- func GetDisksByPaths(disks []Disk, dataPaths []string) map[string]string
- func IsClickhouseShadow(path string) bool
- func TablePathEncode(str string) string
- type BackupTables
- type ClickHouse
- func (ch *ClickHouse) AttachPartitions(table metadata.TableMetadata, disks []Disk) error
- func (ch *ClickHouse) Chown(filename string) error
- func (ch *ClickHouse) CleanShadow(name string) error
- func (ch *ClickHouse) Close()
- func (ch *ClickHouse) Connect() error
- func (ch *ClickHouse) CopyData(backupName string, backupTable metadata.TableMetadata, disks []Disk, ...) error
- func (ch *ClickHouse) CreateDatabase(database string) error
- func (ch *ClickHouse) CreateDatabaseFromQuery(query string) error
- func (ch *ClickHouse) CreateDatabaseWithEngine(database string, engine string) error
- func (ch *ClickHouse) CreateTable(table Table, query string, dropTable bool) error
- func (ch *ClickHouse) FreezeTable(table *Table, name string) error
- func (ch *ClickHouse) FreezeTableOldWay(table *Table, name string) error
- func (ch *ClickHouse) GetAccessManagementPath(disks []Disk) (string, error)
- func (ch *ClickHouse) GetBackupTablesLegacy(backupName string) ([]metadata.TableMetadata, error)
- func (ch *ClickHouse) GetConn() *sqlx.DB
- func (ch *ClickHouse) GetDatabases() ([]Database, error)
- func (ch *ClickHouse) GetDefaultPath() (string, error)
- func (ch *ClickHouse) GetDisks() ([]Disk, error)
- func (ch *ClickHouse) GetPartitions(database, table string) (map[string][]metadata.Part, error)
- func (ch *ClickHouse) GetTables(tablePattern string) ([]Table, error)
- func (ch *ClickHouse) GetVersion() (int, error)
- func (ch *ClickHouse) GetVersionDescribe() string
- func (ch *ClickHouse) IsAtomic(database string) (bool, error)
- func (ch *ClickHouse) LogQuery(query string) string
- func (ch *ClickHouse) Mkdir(name string) error
- func (ch *ClickHouse) MkdirAll(path string) error
- func (ch *ClickHouse) Query(query string, args ...interface{}) (sql.Result, error)
- func (ch *ClickHouse) Queryx(query string, args ...interface{}) (*sqlx.Rows, error)
- func (ch *ClickHouse) Select(dest interface{}, query string, args ...interface{}) error
- func (ch *ClickHouse) ShowCreateTable(database, name string) string
- type Database
- type Disk
- type IsSystemTablesFieldPresent
- type PartDiff
- type Table
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetDiskByPath ¶ added in v1.0.0
func GetDisksByPaths ¶ added in v1.0.0
func IsClickhouseShadow ¶
func TablePathEncode ¶
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) 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) GetAccessManagementPath ¶ added in v1.0.14
func (ch *ClickHouse) GetAccessManagementPath(disks []Disk) (string, error)
GetAccessManagementPath @todo think about how to properly extract access_management_path from /etc/clickhouse-server/
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 ¶
GetPartitions - return slice of all partitions for a table
func (*ClickHouse) GetTables ¶
func (ch *ClickHouse) GetTables(tablePattern string) ([]Table, error)
GetTables - return slice of all tables suitable for backup, MySQL and PostgreSQL database engine shall be skipped
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 IsSystemTablesFieldPresent ¶ added in v1.2.1
type IsSystemTablesFieldPresent struct { IsDataPathPresent int `db:"is_data_path_present"` IsDataPathsPresent int `db:"is_data_paths_present"` IsUUIDPresent int `db:"is_uuid_present"` IsCreateTableQueryPresent int `db:"is_create_table_query_present"` IsTotalBytesPresent int `db:"is_total_bytes_present"` }
IsSystemTablesFieldPresent - ClickHouse `system.tables` varius field flags
type PartDiff ¶
type PartDiff struct { BTable metadata.TableMetadata PartitionsAdd []metadata.Part PartitionsRemove []metadata.Part }
PartDiff - Data part discrepancies infos
type Table ¶
type Table struct { // common fields for all `clickhouse-server` versions Database string `db:"database"` Name string `db:"name"` Engine string `db:"engine"` // fields depends on `clickhouse-server` version DataPath string `db:"data_path,omitempty"` // For legacy support DataPaths []string `db:"data_paths,omitempty"` UUID string `db:"uuid,omitempty"` CreateTableQuery string `db:"create_table_query,omitempty"` TotalBytes sql.NullInt64 `db:"total_bytes,omitempty"` Skip bool }
Table - ClickHouse table struct