Skip to content

Commit

Permalink
Merge pull request #1423 from hxy7yx/v2.5-1
Browse files Browse the repository at this point in the history
Log optimization
  • Loading branch information
fengzeroz authored Jul 27, 2023
2 parents 29ae833 + 4cf7357 commit 34247aa
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/adapter/storage.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ int adapter_load_setting(const char *node, char **setting)
{
int rv = neu_persister_load_node_setting(node, (const char **) setting);
if (0 != rv) {
nlog_error("load %s setting fail", node);
nlog_warn("load %s setting fail", node);
return -1;
}

Expand Down
19 changes: 14 additions & 5 deletions src/persist/persist.c
Original file line number Diff line number Diff line change
Expand Up @@ -599,11 +599,20 @@ void neu_persister_destroy()

int neu_persister_store_node(neu_persist_node_info_t *info)
{
int rv =
execute_sql(global_db,
"INSERT INTO nodes (name, type, state, plugin_name) "
"VALUES (%Q, %i, %i, %Q)",
info->name, info->type, info->state, info->plugin_name);
int rv = 0;
if (strcmp(info->plugin_name, "Monitor") == 0) {
rv = execute_sql(
global_db,
"INSERT OR IGNORE INTO nodes (name, type, state, plugin_name) "
"VALUES (%Q, %i, %i, %Q)",
info->name, info->type, info->state, info->plugin_name);
} else {
rv =
execute_sql(global_db,
"INSERT INTO nodes (name, type, state, plugin_name) "
"VALUES (%Q, %i, %i, %Q)",
info->name, info->type, info->state, info->plugin_name);
}
if (0 == rv) {
node_count_add(1);
}
Expand Down

0 comments on commit 34247aa

Please sign in to comment.