From fd3c3324983cfa88fcccc1e74fe1a472260caf38 Mon Sep 17 00:00:00 2001 From: YenchangChan Date: Tue, 2 Apr 2024 18:36:21 +0800 Subject: [PATCH] fix: set alter_sync = 0 when add columns on cluster --- output/clickhouse.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/output/clickhouse.go b/output/clickhouse.go index 76998994..d7cdb889 100644 --- a/output/clickhouse.go +++ b/output/clickhouse.go @@ -581,7 +581,7 @@ func (c *ClickHouse) ChangeSchema(newKeys *sync.Map) (err error) { } alterTable := func(tbl, col string) error { - query := fmt.Sprintf("ALTER TABLE `%s`.`%s` %s %s;", c.dbName, tbl, onCluster, col) + query := fmt.Sprintf("ALTER TABLE `%s`.`%s` %s %s SETTINGS alter_sync = 0;", c.dbName, tbl, onCluster, col) util.Logger.Info(fmt.Sprintf("executing sql=> %s", query), zap.String("task", taskCfg.Name)) return conn.Exec(query) }