提交 b0a68ad6 编写于 作者: N Nadeem Ghani 提交者: Jacob Champion

Change the order in which gpsmon sends packets to gpmmon

Before this commit, gpmmon expected to see QLOG packets before QUERYSEG packets.
Out of order packets were quietly dropped. This behavior was causing
intermittent test failure with the message: No segments for CPU skew
calculation.

This commit change the order of packet sends on gpsmon to fix these failures.
Signed-off-by: NJacob Champion <pchampion@pivotal.io>
上级 e97e8b1a
...@@ -711,44 +711,47 @@ static void gx_gettcpcmd(SOCKET sock, short event, void* arg) ...@@ -711,44 +711,47 @@ static void gx_gettcpcmd(SOCKET sock, short event, void* arg)
int count = 0; int count = 0;
apr_hash_t* query_cpu_table = NULL; apr_hash_t* query_cpu_table = NULL;
for (hi = apr_hash_first(0, querysegtab); hi; hi = apr_hash_next(hi)) for (hi = apr_hash_first(0, segtab); hi; hi = apr_hash_next(hi))
{ {
void* vptr; void* vptr;
apr_hash_this(hi, 0, 0, &vptr); apr_hash_this(hi, 0, 0, &vptr);
ppkt = vptr; ppkt = vptr;
if (ppkt->header.pkttype != GPMON_PKTTYPE_QUERYSEG) if (ppkt->header.pkttype != GPMON_PKTTYPE_SEGINFO)
continue; continue;
/* fill in hostname */
strncpy(ppkt->u.seginfo.hostname, gx.hostname, sizeof(ppkt->u.seginfo.hostname) - 1);
ppkt->u.seginfo.hostname[sizeof(ppkt->u.seginfo.hostname) - 1] = 0;
TR2(("sending magic %x, pkttype %d\n", ppkt->header.magic, ppkt->header.pkttype)); TR2(("sending magic %x, pkttype %d\n", ppkt->header.magic, ppkt->header.pkttype));
send_smon_to_mon_pkt(sock, ppkt); send_smon_to_mon_pkt(sock, ppkt);
count++; count++;
} }
for (hi = apr_hash_first(0, segtab); hi; hi = apr_hash_next(hi)) for (hi = apr_hash_first(0, qdtab); hi; hi = apr_hash_next(hi))
{ {
void* vptr; void* vptr;
apr_hash_this(hi, 0, 0, &vptr); apr_hash_this(hi, 0, 0, &vptr);
ppkt = vptr; ppkt = vptr;
if (ppkt->header.pkttype != GPMON_PKTTYPE_SEGINFO) if (ppkt->header.pkttype != GPMON_PKTTYPE_QLOG)
continue; continue;
/* fill in hostname */
strncpy(ppkt->u.seginfo.hostname, gx.hostname, sizeof(ppkt->u.seginfo.hostname) - 1);
ppkt->u.seginfo.hostname[sizeof(ppkt->u.seginfo.hostname) - 1] = 0;
TR2(("sending magic %x, pkttype %d\n", ppkt->header.magic, ppkt->header.pkttype)); TR2(("sending magic %x, pkttype %d\n", ppkt->header.magic, ppkt->header.pkttype));
send_smon_to_mon_pkt(sock, ppkt); send_smon_to_mon_pkt(sock, ppkt);
count++; count++;
} }
/*
for (hi = apr_hash_first(0, qdtab); hi; hi = apr_hash_next(hi)) * QUERYSEG packets must be sent after QLOG packets so that gpmmon can
* correctly populate its query_seginfo_hash.
*/
for (hi = apr_hash_first(0, querysegtab); hi; hi = apr_hash_next(hi))
{ {
void* vptr; void* vptr;
apr_hash_this(hi, 0, 0, &vptr); apr_hash_this(hi, 0, 0, &vptr);
ppkt = vptr; ppkt = vptr;
if (ppkt->header.pkttype != GPMON_PKTTYPE_QLOG) if (ppkt->header.pkttype != GPMON_PKTTYPE_QUERYSEG)
continue; continue;
TR2(("sending magic %x, pkttype %d\n", ppkt->header.magic, ppkt->header.pkttype)); TR2(("sending magic %x, pkttype %d\n", ppkt->header.magic, ppkt->header.pkttype));
send_smon_to_mon_pkt(sock, ppkt); send_smon_to_mon_pkt(sock, ppkt);
count++; count++;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册