Skip to content

Commit 930424c

Browse files
committed
add creation integration tables for POST /restart and kill -SIGHUP reaction, fix #1195
Signed-off-by: Slach <[email protected]>
1 parent cbfac26 commit 930424c

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

ChangeLog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# v2.6.33
2+
BUG FIXES
3+
- add creation integration tables for `POST /restart` and `kill -SIGHUP` reaction, fix [1195](https://github.com/Altinity/clickhouse-backup/issues/1195)
4+
15
# v2.6.32
26
IMPROVEMENTS
37
- add `--format` for `list` command which support json, yaml, csv, tsv, fix [1192](https://github.com/Altinity/clickhouse-backup/issues/1192), thanks @minguyen9988

pkg/server/server.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,6 @@ func Run(cliCtx *cli.Context, cliApp *cli.App, configPath string, clickhouseBack
9191
metrics: metrics.NewAPIMetrics(),
9292
stop: make(chan struct{}),
9393
}
94-
if cfg.API.CreateIntegrationTables {
95-
if err := api.CreateIntegrationTables(); err != nil {
96-
log.Error().Err(err).Send()
97-
}
98-
}
9994
api.metrics.RegisterMetrics()
10095

10196
log.Info().Msgf("Starting API server %s on %s", api.cliApp.Version, api.config.API.ListenAddr)
@@ -127,14 +122,14 @@ func Run(cliCtx *cli.Context, cliApp *cli.App, configPath string, clickhouseBack
127122
for {
128123
select {
129124
case <-api.restart:
130-
if err := api.Restart(); err != nil {
131-
log.Error().Msgf("Failed to restarting API server: %v", err)
125+
if restartErr := api.Restart(); restartErr != nil {
126+
log.Error().Msgf("Failed to restarting API server: %v", restartErr)
132127
continue
133128
}
134129
log.Info().Msgf("Reloaded by HTTP")
135130
case <-sighup:
136-
if err := api.Restart(); err != nil {
137-
log.Error().Msgf("Failed to restarting API server: %v", err)
131+
if restartErr := api.Restart(); restartErr != nil {
132+
log.Error().Msgf("Failed to restarting API server: %v", restartErr)
138133
continue
139134
}
140135
log.Info().Msg("Reloaded by SIGHUP")
@@ -171,6 +166,11 @@ func (api *APIServer) Restart() error {
171166
if err != nil {
172167
return err
173168
}
169+
if api.config.API.CreateIntegrationTables {
170+
if createErr := api.CreateIntegrationTables(); createErr != nil {
171+
log.Error().Err(createErr).Send()
172+
}
173+
}
174174
status.Current.CancelAll("canceled via API /restart")
175175
if api.server != nil {
176176
_ = api.server.Close()

0 commit comments

Comments
 (0)