james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Charles <e...@apache.org>
Subject Re: [PATCH] Fix CassandraModSeqProvider
Date Sun, 01 Mar 2015 07:41:07 GMT
Can you attach the patch on a jira for review ? (if not yet done)

On 12/17/2014 07:05 PM, Benoit Tellier wrote:
>
> Hi,
>
> I found in the current Cassandra implementation a possible data race
> during modseq generation. It is located in james-mailbox project and in
> cassandra subproject.
>
> The previous implementation, relying on Cassandra counters, first
> increments the modseq for the current mailbox in a first request to
> Cassandra, and in a second time is reading the new modseq value, using a
> second request.
>
> If two mails for the same mailbox are received on different servers at
> the same time, it is possible that both server proceed to the first
> operation in the same time, setting ModSeq value from n to n+2. During
> the second operation, they will return both the n+2 value, and both
> mails will have the same modseq.
>
>
>
> To solve the bug, I used Cassandra's lightweight tansactions :
>  - I created a table dedicated to modseq storage ( I needed a separated
> table as in unit tests modseq operations are used with non initialised
> mailbox )
>  - We ensure that an entry exist for this mailbox
>  - We read and update the value ( in two operations ) until our
> modification is applied ( using Cassandra lightweight transactions )
>  - I added a max retry parameter so that we can't dead lock. Upon
> failure ( too many tries ), we throw a mailbox exception.
>
>
>
> You will find the corresponding patch as an attachment to this current
> e-mail,
>
> Sincerly yours,
>
> Benoit Tellier
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
> For additional commands, e-mail: server-dev-help@james.apache.org

-- 
Eric Charles

Datalayer <http://datalayer.io>
Turn Big Data into Business Value
eric@datalayer.io +32 478 555.750


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message