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 :

  1. 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)

  2. 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,

Attachments

2

Activity

Show:
Fixed

Details

Assignee

Reporter

Labels

Components

Fix versions

Affects versions

Priority

Created March 11, 2022 at 9:17 PM
Updated March 31, 2022 at 5:22 PM
Resolved March 18, 2022 at 9:27 AM