Skip to content

Commit

Permalink
[pgexporter#94] pgexporter_pg_settings metrics across servers are not…
Browse files Browse the repository at this point in the history
… grouped properly
  • Loading branch information
resyfer committed Aug 9, 2023
1 parent 2b51755 commit 292c465
Showing 1 changed file with 29 additions and 18 deletions.
47 changes: 29 additions & 18 deletions src/libpgexporter/queries.c
Original file line number Diff line number Diff line change
Expand Up @@ -449,37 +449,48 @@ pgexporter_merge_queries(struct query* q1, struct query* q2, int sort)
last = ct1;
ct1 = ct1->next;
}

last->next = ct2;
}
else
{
while (ct1 != NULL)

if (ct1 != NULL)
{
if (ct2 != NULL && !strcmp(ct1->data[0], ct2->data[0]))
while (ct1 != NULL && ct2 != NULL)
{
while (ct1->next != NULL && !strcmp(ct1->next->data[0], ct2->data[0]))

tmp1 = ct1;

if (strcmp(tmp1->data[0], ct2->data[0]))
{
while (tmp1 != NULL && tmp1->next != NULL && strcmp(tmp1->next->data[0], ct2->data[0]))
{
tmp1 = tmp1->next;
}
}
while (tmp1 != NULL && tmp1->next != NULL && !strcmp(tmp1->next->data[0], ct2->data[0]))
{
tmp1 = tmp1->next;
}

if (tmp1 == NULL)
{
ct1 = ct1->next;
continue;
}

tmp1 = ct1->next;
tmp2 = ct2->next;

ct1->next = ct2;
ct2->next = tmp1;
ct2->next = tmp1->next;
tmp1->next = ct2;
ct2 = tmp2;
}

last = ct1;
ct1 = ct1->next;
}
}

while (ct2 != NULL)
{
last->next = ct2;

last = last->next;
ct2 = ct2->next;
else
{
ct1 = ct2;
ct2 = NULL;
}
}

q2->tuples = NULL;
Expand Down

0 comments on commit 292c465

Please sign in to comment.