diff --git a/clickhouse.go b/clickhouse.go index 7a471b9a..7b4ca245 100644 --- a/clickhouse.go +++ b/clickhouse.go @@ -255,14 +255,14 @@ func (ch *ClickHouse) CopyData(table BackupTable) error { return nil } -func convertPartition(deatachedTableFoler string, depricatedCreation bool) string { +func convertPartition(deatachedTableFoler string, deprecatedCreation bool) string { // TODO: rewrite this magic begin := strings.Split(deatachedTableFoler, "_")[0] if begin == "all" { // ENGINE = MergeTree ORDER BY id return "tuple()" } - if depricatedCreation { + if deprecatedCreation { // Deprecated Method for Creating a Table // ENGINE = MergeTree(Date, (TimeStamp, Log), 8192) return begin[:6] @@ -273,9 +273,9 @@ func convertPartition(deatachedTableFoler string, depricatedCreation bool) strin } // AttachPatritions - execute ATTACH command for specific table -func (ch *ClickHouse) AttachPatritions(table BackupTable, depricatedCreation bool) error { +func (ch *ClickHouse) AttachPatritions(table BackupTable, deprecatedCreation bool) error { // TODO: need tests - partitionName := convertPartition(table.Partitions[0].Name, depricatedCreation) + partitionName := convertPartition(table.Partitions[0].Name, deprecatedCreation) if ch.DryRun { log.Printf("ATTACH partition '%s' for %s.%s increment %d ...skip dry-run", partitionName, table.Database, table.Name, table.Increment) return nil diff --git a/config.go b/config.go index b2add7e1..9be23fd5 100644 --- a/config.go +++ b/config.go @@ -55,13 +55,15 @@ func LoadConfig(configLocation string) (*Config, error) { return config, validateConfig(config) } -func validateConfig (config *Config) error { +func validateConfig(config *Config) error { switch config.S3.OverwriteStrategy { - case + case "skip", "etag", - "always": break - default: return fmt.Errorf("unknown s3.overwrite_strategy it can be 'skip', 'etag', 'always'") + "always": + break + default: + return fmt.Errorf("unknown s3.overwrite_strategy it can be 'skip', 'etag', 'always'") } return nil } @@ -82,9 +84,9 @@ func defaultConfig() *Config { Port: 9000, }, S3: S3Config{ - Region: "us-east-1", - DisableSSL: false, - ACL: "private", + Region: "us-east-1", + DisableSSL: false, + ACL: "private", OverwriteStrategy: "always", }, } diff --git a/main.go b/main.go index 8624a9d9..44ebc98c 100644 --- a/main.go +++ b/main.go @@ -100,9 +100,9 @@ func main() { Hidden: false, }, cli.BoolFlag{ - Name: "depricated, d", + Name: "deprecated, d", Hidden: false, - Usage: "Set this flag if Table was created of deprecated method: ENGINE = MergeTree(Date, (TimeStamp, Log), 8192)", + Usage: "Set this flag if Table was created of deprecated method: ENGINE = MergeTree(Date, (TimeStamp, Log), 8192)", }, ), }, @@ -211,7 +211,7 @@ func freeze(config Config, args []string, dryRun bool) error { return nil } -func restore(config Config, args []string, dryRun bool, increments []int, depricatedCreation bool) error { +func restore(config Config, args []string, dryRun bool, increments []int, deprecatedCreation bool) error { ch := &ClickHouse{ DryRun: dryRun, Config: &config.ClickHouse, @@ -236,7 +236,7 @@ func restore(config Config, args []string, dryRun bool, increments []int, depric if err := ch.CopyData(table); err != nil { return fmt.Errorf("can't restore %s.%s increment %d with %v", table.Database, table.Name, table.Increment, err) } - if err := ch.AttachPatritions(table, depricatedCreation); err != nil { + if err := ch.AttachPatritions(table, deprecatedCreation); err != nil { return fmt.Errorf("can't attach partitions for table %s.%s with %v", table.Database, table.Name, err) } } diff --git a/s3.go b/s3.go index a46e7cf0..dbe238eb 100644 --- a/s3.go +++ b/s3.go @@ -259,6 +259,7 @@ func (s *S3) newSyncFolderIterator(localPath, dstPath string) (*SyncFolderIterat if existFile.size == info.Size() { switch s.Config.OverwriteStrategy { case "skip": + skipFilesCount++ return nil case "etag": if existFile.etag == GetEtag(filePath) {