[ 
https://issues.apache.org/jira/browse/CAMEL-27712?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claus Ibsen updated CAMEL-27712:
--------------------------------
    Fix Version/s: 4.25.0
                       (was: 4.24.0)

> camel-state-store: put reads the previous value with a separate, non-atomic 
> get
> -------------------------------------------------------------------------------
>
>                 Key: CAMEL-27712
>                 URL: https://issues.apache.org/jira/browse/CAMEL-27712
>             Project: Camel
>          Issue Type: Bug
>            Reporter: Claus Ibsen
>            Priority: Minor
>             Fix For: 4.25.0
>
>
> Found while improving the option descriptions of camel-state-store for 
> CAMEL-23832 (commit 
> https://github.com/apache/camel/commit/2fc5b2f19664c686514a3407971196abaadfc3cf).
> These are separate problems of the component; the descriptions commit only 
> documents the current behavior.
> h4. 1. The put operation reads the previous value with a separate get, which 
> is not atomic
> {{StateStoreProducer.process()}} handles {{put}} by calling 
> {{backend.get(key)}} and then {{backend.put(key, value, ttl)}}, and sets the 
> result of the get as the body. The comment says that 
> {{KeyValueRepository.put()}} is void, but it returns the previous value (it 
> has done so since the SPI was added).
> When two exchanges put the same key at the same time, both can get the same 
> old value as the body, so the body does not tell which value was replaced. On 
> a remote backend each put also costs two round trips.
> Use the return value of {{backend.put(key, value, ttl)}} as the body and 
> remove the extra get and the outdated comment.
> _Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to