Details
-
Bug
-
Resolution: Done
-
Major
-
fuse-7.6-GA
-
None
-
QE Approved
-
%
-
fuse-7.7-build5
-
-
-
Fuse Standalone
Description
The CU would like to use the JdbcAggregationRepository (camel-sql) in a distributed environment (multiple independent threads or multiple JVMs).
The assumption here is that the JdbcAggregationRepository with optimistic locking enabled would prevent any race condition from occurring, because synchronization should happen at the database level. In practice it doesn't seem to work: when running more than one thread we have silently dropped exchanges.
The JdbcAggregationRepository optimistic locking implementation seems to cover only the race condition that happens when two aggregators are trying to insert into the aggregation table for the same correlationId (pk). Instead, it does not cover the race when more than one Camel aggregator tries to update a row in the "aggregation" table for the same correlationId (lost updates problem).
The javadoc for OptimisticLockingAggregationRepository.add says that the implementation should store a version identifier, but this is not the case with JdbcAggregationRepository implementation.