In order to avoid a race condition in the ASR firmware, we reduce the
likelyhood of BDI ids beeing reused soon after they have been deleted.
We do that by randomly picking a seconddot1q id (which is later set as
BDI id) from all free seconddot1q ids. Hence, BDI id reuse probability
is 1/len(free_seconddot1qs).
The former implementations went by numeric order and just selected the
next available id thus having a much larger risk of reuse.
In this PR we also move the fetch of the available seconddot1qs into the
database transaction, removing the possibilty of another thread then
executing a dirty read.
In order to avoid a race condition in the ASR firmware, we reduce the likelyhood of BDI ids beeing reused soon after they have been deleted. We do that by randomly picking a seconddot1q id (which is later set as BDI id) from all free seconddot1q ids. Hence, BDI id reuse probability is 1/len(free_seconddot1qs).
The former implementations went by numeric order and just selected the next available id thus having a much larger risk of reuse.
In this PR we also move the fetch of the available seconddot1qs into the database transaction, removing the possibilty of another thread then executing a dirty read.