Tomasz Wałaszek via dev <[email protected]> writes:
> Currently, the transaction history keeps a fixed number of transactions,
> hardcoded to 100. On a busy system this may cover only a short period
> of time, so a client that disconnects has a high chance of not finding
> its last transaction in the history, which leads to a download of the
> whole database.
>
> This patch replaces the fixed number of transactions with a time based
> limit. Transactions are removed from the history once they are older
> than the limit, regardless of how many of them are in the history. The
> limit defaults to 60 seconds and can be changed with a new database
> configuration option 'transaction-history-time-limit' for clustered and
> relay databases. The value is in seconds.
>
> The limit on the number of atoms, which prevents the transaction history
> from growing larger than the database itself, still applies.
>
> Reported-at:
> https://mail.openvswitch.org/pipermail/ovs-dev/2026-April/431593.html
> Signed-off-by: Tomasz Wałaszek <[email protected]>
> ---
[ ... ]
> @@ -1725,3 +1734,11 @@ ovsdb_txn_history_destroy(struct ovsdb *db)
> db->n_txn_history = 0;
> db->n_txn_history_atoms = 0;
> }
> +
> +void
> +ovsdb_txn_history_update(struct ovsdb *db, long long int
> txn_history_time_max)
> +{
> + ovs_assert(txn_history_time_max >= 0);
> + db->txn_history_time_max = txn_history_time_max;
> + ovsdb_txn_history_run(db);
An AI generated this comment, and it looked relevant to a human reviewer
so it is forwarded here.
Concern (defensive): `ovsdb_txn_history_init()` does not initialize
`txn_history_time_max`; it relies on `xzalloc` in `ovsdb_create()`
leaving it 0 and on callers calling `ovsdb_txn_history_update()`. Today
every path that enables history goes through ovsdb-server's
`open_db()`/`database_update_config()` (verified: relay.c:310 re-enable
keeps the already-set value, `ovsdb_replace()` only destroys nodes), so
there is no live bug. But a 0 value means "expire everything older than
this millisecond", i.e., history collapses to one entry — a future
caller of `ovsdb_txn_history_init(db, true)` that forgets the update
call would get silently degenerate behavior. Setting a sane default in
`init()` (or documenting the dependency) would be safer. Low severity.
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev