PooledOptimizer generates duplicate ids when several JVMs initialize optimizer and sequence value is the initial value
Description
Hello,
I have overlapping ids with PooledOptimizer when :
the sequence value is the initial value (1 in the following example)
several JVMs initialize its optimizer for the first time (hiValue = null) in the same time
In this context, we may have JVMs that generate duplicate ids. Here the explanation :
There are two ways to fix that :
Don't call nextval() again, but intialize optimizer values like this -> hiValue = value. The next generate() will necessarily request a new fresh range of ids (nextval)
Call another time nextval (like the function generate() currently do), but we need to check that the new value generated from the sequence is the one we expected (i.e. there is no gap due to an external nextval).
In the PR, I chose the first solution : simpliest to implement and to understand. I can implement solution 2 if needed
Hello,
I have overlapping ids with PooledOptimizer when :
the sequence value is the initial value (1 in the following example)
several JVMs initialize its optimizer for the first time (hiValue = null) in the same time
In this context, we may have JVMs that generate duplicate ids. Here the explanation :
There are two ways to fix that :
Don't call nextval() again, but intialize optimizer values like this -> hiValue = value. The next generate() will necessarily request a new fresh range of ids (nextval)
Call another time nextval (like the function generate() currently do), but we need to check that the new value generated from the sequence is the one we expected (i.e. there is no gap due to an external nextval).
In the PR, I chose the first solution : simpliest to implement and to understand. I can implement solution 2 if needed
Regards,