Skip to content

Commit

Permalink
sources/storage.h: remove watchdog's query to lag_query
Browse files Browse the repository at this point in the history
To keep things simplier

Signed-off-by: rkhapov <[email protected]>
  • Loading branch information
rkhapov committed Jan 28, 2025
1 parent 1f6d25f commit ae57f54
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion sources/config_reader.c
Original file line number Diff line number Diff line change
Expand Up @@ -1696,7 +1696,7 @@ static int od_config_reader_rule_settings(od_config_reader_t *reader,
return NOT_OK_RESPONSE;
}
if (!od_config_reader_string(reader,
&watchdog->query)) {
&watchdog->lag_query)) {
return NOT_OK_RESPONSE;
}
continue;
Expand Down
4 changes: 2 additions & 2 deletions sources/rules.c
Original file line number Diff line number Diff line change
Expand Up @@ -1760,10 +1760,10 @@ void od_rules_print(od_rules_t *rules, od_logger_t *logger)
" tls_protocols %s",
storage->tls_opts->tls_protocols);
if (storage->watchdog) {
if (storage->watchdog->query)
if (storage->watchdog->lag_query)
od_log(logger, "storage", NULL, NULL,
" watchdog query %s",
storage->watchdog->query);
storage->watchdog->lag_query);
if (storage->watchdog->interval)
od_log(logger, "storage", NULL, NULL,
" watchdog interval %d",
Expand Down
7 changes: 4 additions & 3 deletions sources/storage.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ od_storage_watchdog_t *od_storage_watchdog_allocate(od_global_t *global)
memset(watchdog, 0, sizeof(od_storage_watchdog_t));
watchdog->global = global;
watchdog->online = 1;
watchdog->lag_query = NULL;
od_atomic_u64_set(&watchdog->finished, 0ULL);
pthread_mutex_init(&watchdog->mu, NULL);

Expand Down Expand Up @@ -59,8 +60,8 @@ int od_storage_watchdog_free(od_storage_watchdog_t *watchdog)
return NOT_OK_RESPONSE;
}

if (watchdog->query) {
free(watchdog->query);
if (watchdog->lag_query) {
free(watchdog->lag_query);
}

pthread_mutex_destroy(&watchdog->mu);
Expand Down Expand Up @@ -404,7 +405,7 @@ od_storage_watchdog_do_polling_step(od_storage_watchdog_t *watchdog)
server = watchdog_client->server;

machine_msg_t *msg;
msg = od_query_do(server, "watchdog", watchdog->query, NULL);
msg = od_query_do(server, "watchdog", watchdog->lag_query, NULL);
if (msg == NULL) {
od_error(&instance->logger, "watchdog", watchdog_client, server,
"receive msg failed, closing backend connection");
Expand Down
2 changes: 1 addition & 1 deletion sources/storage.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ struct od_storage_watchdog {
char *storage_user;
char *storage_db;

char *query;
char *lag_query;
int interval;

/* soft shutdown on reload */
Expand Down

0 comments on commit ae57f54

Please sign in to comment.