Hi Juergen,
On 11/01/2023 08:59, Juergen Gross wrote:
... to make sure domain_nbentry_add() is not returning a negative
value. Then it would not work.
A good example imagine you have a transaction removing nodes from tree
but not adding any. Then the "ret" would be negative.
Meanwhile the nodes are also removed outside of the transaction. So
the sum of "d->nbentry + ret" would be negative resulting to a failure
here.
Thanks for catching this.
I think the correct way to handle this is to return max(d->nbentry +
ret, 0) in
domain_nbentry_add(). The value might be imprecise, but always >= 0 and
never
wrong outside of a transaction collision.
I am bit confused with your proposal. If the return value is imprecise,
then what's the point of returning max(...) instead of simply 0?
Cheers,
--
Julien Grall