MEDIUM: stick-tables: Optimize the expiration process a bit.

In process_tables_expire(), if the table we're analyzing still has
entries, and thus should be put back into the tree, do not put it in the
mt_list, to have it put back into the tree the next time the task runs.
There is no problem with putting it in the tree right away, as either
the next expiration is in the future, or we handled the maximum number
of expirations per task call and we're about to stop, anyway.

This does not need to be backported.
This commit is contained in:
Olivier Houchard 2025-11-05 19:18:21 +01:00 committed by Olivier Houchard
parent 93f994e8b1
commit 201971ec5f

View File

@ -1128,14 +1128,13 @@ struct task *process_tables_expire(struct task *task, void *context, unsigned in
HA_ATOMIC_CAS(&t->shards[shard].next_exp, &old_exp, next_exp_table); HA_ATOMIC_CAS(&t->shards[shard].next_exp, &old_exp, next_exp_table);
} }
eb32_delete(table_eb);
table_eb->key = TICK_ETERNITY;
/* /*
* If there's more entry, just put it back into the list, * Move the table to its next expiration date, if any.
* it'll go back into the tree the next time the task runs.
*/ */
eb32_delete(table_eb);
table_eb->key = next_exp_table;
if (next_exp_table != TICK_ETERNITY) if (next_exp_table != TICK_ETERNITY)
MT_LIST_TRY_APPEND(&per_bucket[shard].toadd_tables, &t->shards[shard].in_bucket_toadd); eb32_insert(&ps->tables, table_eb);
} }
table_eb = tmpnode; table_eb = tmpnode;
} }