Can you attach the patch on a jira for review ? (if not yet done)

On 12/17/2014 07:19 PM, Benoit Tellier wrote:
> Hi,
>
> I found a possible data race on uid generation, in Cassandra's
> james-mailbox subproject.
>
> The problem appears when nextUid is called for the first time ( the last
> generated uid is equal to 0 ).
>
> The previous code was performing a select on the last uid value.
>  - If this value is null, it updates it without checking it.
>  - If the value is not null, it updates the value, with a lightweight
> transaction.
>
>
>
> I solved the issue by :
>  - creating the uid value if the uid is equal to 0. If we can perform
> this operation, no one can do, and we can use 1 as next value for uid.
> If we fail, someone did that, and we have to update the last uid value
> using lightweight transactions ( as if last uid was not null ).
>  - I also added a max retry parameter : if we try too update the value
> of the uid too many times, a Mailbox exception will be thrown.
>
> You will find the corresponding patch as an attachment.
>
> Sincerly yours,
>
> Benoit Tellier

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to