mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-01-09 23:39:55 +00:00
BUG/MINOR: counters: make the sc-inc-gpc0 and sc-set-gpt0 touch the table
These two actions don't touch the table so the entry will expire and the values will not be pushed to other peers. Also in the case of gpc0, the gpc0_rate counter must be updated. The issue was reported by Ruoshan Huang. This fix needs to be backported to 1.6.
This commit is contained in:
parent
49008c157e
commit
79c1e912bb
@ -1316,7 +1316,6 @@ static int sample_conv_table_trackers(const struct arg *arg_p, struct sample *sm
|
|||||||
static enum act_return action_inc_gpc0(struct act_rule *rule, struct proxy *px,
|
static enum act_return action_inc_gpc0(struct act_rule *rule, struct proxy *px,
|
||||||
struct session *sess, struct stream *s, int flags)
|
struct session *sess, struct stream *s, int flags)
|
||||||
{
|
{
|
||||||
void *ptr;
|
|
||||||
struct stksess *ts;
|
struct stksess *ts;
|
||||||
struct stkctr *stkctr;
|
struct stkctr *stkctr;
|
||||||
|
|
||||||
@ -1325,16 +1324,25 @@ static enum act_return action_inc_gpc0(struct act_rule *rule, struct proxy *px,
|
|||||||
stkctr = &s->stkctr[rule->arg.gpc.sc];
|
stkctr = &s->stkctr[rule->arg.gpc.sc];
|
||||||
else
|
else
|
||||||
stkctr = &sess->stkctr[rule->arg.gpc.sc];
|
stkctr = &sess->stkctr[rule->arg.gpc.sc];
|
||||||
|
|
||||||
ts = stkctr_entry(stkctr);
|
ts = stkctr_entry(stkctr);
|
||||||
if (!ts)
|
if (ts) {
|
||||||
return ACT_RET_CONT;
|
void *ptr1, *ptr2;
|
||||||
|
|
||||||
/* Store the sample in the required sc, and ignore errors. */
|
/* First, update gpc0_rate if it's tracked. Second, update its gpc0 if tracked. */
|
||||||
ptr = stktable_data_ptr(stkctr->table, ts, STKTABLE_DT_GPC0);
|
ptr1 = stktable_data_ptr(stkctr->table, ts, STKTABLE_DT_GPC0_RATE);
|
||||||
if (!ptr)
|
if (ptr1)
|
||||||
return ACT_RET_CONT;
|
update_freq_ctr_period(&stktable_data_cast(ptr1, gpc0_rate),
|
||||||
|
stkctr->table->data_arg[STKTABLE_DT_GPC0_RATE].u, 1);
|
||||||
|
|
||||||
stktable_data_cast(ptr, gpc0)++;
|
ptr2 = stktable_data_ptr(stkctr->table, ts, STKTABLE_DT_GPC0);
|
||||||
|
if (ptr2)
|
||||||
|
stktable_data_cast(ptr2, gpc0)++;
|
||||||
|
|
||||||
|
/* If data was modified, we need to touch to re-schedule sync */
|
||||||
|
if (ptr1 || ptr2)
|
||||||
|
stktable_touch(stkctr->table, ts, 1);
|
||||||
|
}
|
||||||
return ACT_RET_CONT;
|
return ACT_RET_CONT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1394,14 +1402,18 @@ static enum act_return action_set_gpt0(struct act_rule *rule, struct proxy *px,
|
|||||||
stkctr = &s->stkctr[rule->arg.gpt.sc];
|
stkctr = &s->stkctr[rule->arg.gpt.sc];
|
||||||
else
|
else
|
||||||
stkctr = &sess->stkctr[rule->arg.gpt.sc];
|
stkctr = &sess->stkctr[rule->arg.gpt.sc];
|
||||||
|
|
||||||
ts = stkctr_entry(stkctr);
|
ts = stkctr_entry(stkctr);
|
||||||
if (!ts)
|
if (!ts)
|
||||||
return ACT_RET_CONT;
|
return ACT_RET_CONT;
|
||||||
|
|
||||||
/* Store the sample in the required sc, and ignore errors. */
|
/* Store the sample in the required sc, and ignore errors. */
|
||||||
ptr = stktable_data_ptr(stkctr->table, ts, STKTABLE_DT_GPT0);
|
ptr = stktable_data_ptr(stkctr->table, ts, STKTABLE_DT_GPT0);
|
||||||
if (ptr)
|
if (ptr) {
|
||||||
stktable_data_cast(ptr, gpt0) = rule->arg.gpt.value;
|
stktable_data_cast(ptr, gpt0) = rule->arg.gpt.value;
|
||||||
|
stktable_touch(stkctr->table, ts, 1);
|
||||||
|
}
|
||||||
|
|
||||||
return ACT_RET_CONT;
|
return ACT_RET_CONT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user