BUG/MINOR: vars: don't store the variable twice with set-var-fmt

In 2.5, commit 9a621ae76d ("MEDIUM: vars: add a new "set-var-fmt" action")
introduced the set-var-fmt action. However the storage (by then
sample_store_stream() now var_set()) was added for this specific
branch without any return, leaving the sample copied again over the
variable via the final call, meaning that the variable name is looked
up twice and for proc scope, the lock is taken twice for each call to
set-var-fmt.

This patch removes the first call. Tests show that proc operations
now jump from 1.1M to 1.67M/s on a 64-core CPU (lower lock contention),
while other scopes only observe a modest improvement with few vars
(10 goes from 43.3M to 44M/s). This could be backported.
This commit is contained in:
Willy Tarreau 2026-04-30 08:48:35 +02:00
parent 2b30330cdc
commit 37b1f15d85

View File

@ -1050,7 +1050,6 @@ static enum act_return action_store(struct act_rule *rule, struct proxy *px,
smp_set_owner(&smp, px, sess, s, 0);
smp.data.type = SMP_T_STR;
smp.data.u.str = *fmtstr;
var_set(&rule->arg.vars.desc, &smp, rule->arg.vars.conditions);
}
else {
/* an expression is used */