You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Upasana Sharma <02...@gmail.com> on 2019/07/08 07:00:49 UTC
Cassandra LWT Writes inconsistent
Hi,
I am using an LWT Insert transaction similar to:
INSERT INTO table1 (code, id, subpart) VALUES (:code, :id, :subpart) IF NOT
EXISTS
With
readConsistency="LOCAL_SERIAL"
writeConsistency="LOCAL_QUORUM"
Cassandra Driver: 3.6.0
Cassandra Version: Cassandra 3.11.2
The problem is that I am getting* [applied] false* on the *first write* to
cassandra.
I have set retry policy as writeTimes = 0, so no retries are attempted.
My application logs for reference:
c-7967981443032352 - [INFO ] 2019-06-18T19:46:16.276Z [pool-15-thread-5]
CreateService - SubPartition 104
c-7967981443032352 - [INFO ] 2019-06-18T19:46:16.805Z
[pool-15-thread-5] *Repository
- Row[false, A, 1, 104]*
c-7967981443032352 - [INFO ] 2019-06-18T19:46:16.805Z [pool-15-thread-5]
CreateService - SubPartition 104 CodeNumber 75191
*DuplicateCodeGenerated A*
This is causing my count of writes to tables to differ from required
100000, to 100001, writing extra codes.
Please guide here.
--
Regards,
Upasana Sharma
Re: Cassandra LWT Writes inconsistent
Posted by Upasana Sharma <02...@gmail.com>.
Thanks Hiro & Jeff
Jeff,
My LWT(Insert if not exists) query is executed in parallel by 6 threads,
with a possibility of collision.
So, all threads may request to write same data on Cassandra tables.
What would you suggest here ?
Hiro,
i am using Datastax Mapper & Accessor for this.
Something similar to this :
https://docs.datastax.com/en/developer/java-driver/3.6/manual/object_mapper/creating/
Do you have a suggestion , how can i verify that my code is actually
setting query consistency?
Thank you for your response.
On Tue, Jul 9, 2019 at 5:30 PM Hiroyuki Yamada <mo...@gmail.com> wrote:
> Do you also set SERIAL CONSISTENCY properly ?
>
> https://docs.datastax.com/en/archived/cql/3.3/cql/cql_reference/cqlshSerialConsistency.html
>
> Hiro
>
> On Tue, Jul 9, 2019 at 2:25 PM Jeff Jirsa <jj...@gmail.com> wrote:
> >
> > If applied is false it’s not the first write, the value already exists.
> You’ve likely got a concurrency issue app side or you don’t understand the
> concurrent queries you’re issuing to the db
> >
> > On Jul 8, 2019, at 10:08 PM, raman gugnani <ra...@gmail.com>
> wrote:
> >
> > Hi Team,
> >
> > Can anyone help on the same.
> >
> > Cassnadra driver says write is not done but eventually write has been
> done.
> >
> > On Mon, 8 Jul 2019 at 12:31, Upasana Sharma <02...@gmail.com>
> wrote:
> >>
> >>
> >> Hi,
> >>
> >> I am using an LWT Insert transaction similar to:
> >>
> >> INSERT INTO table1 (code, id, subpart) VALUES (:code, :id, :subpart) IF
> NOT EXISTS
> >>
> >> With
> >> readConsistency="LOCAL_SERIAL"
> >> writeConsistency="LOCAL_QUORUM"
> >>
> >> Cassandra Driver: 3.6.0
> >> Cassandra Version: Cassandra 3.11.2
> >>
> >>
> >> The problem is that I am getting [applied] false on the first write to
> cassandra.
> >>
> >> I have set retry policy as writeTimes = 0, so no retries are attempted.
> >>
> >> My application logs for reference:
> >>
> >> c-7967981443032352 - [INFO ] 2019-06-18T19:46:16.276Z
> [pool-15-thread-5] CreateService - SubPartition 104
> >> c-7967981443032352 - [INFO ] 2019-06-18T19:46:16.805Z
> [pool-15-thread-5] Repository - Row[false, A, 1, 104]
> >> c-7967981443032352 - [INFO ] 2019-06-18T19:46:16.805Z
> [pool-15-thread-5] CreateService - SubPartition 104 CodeNumber 75191
> DuplicateCodeGenerated A
> >>
> >> This is causing my count of writes to tables to differ from required
> 100000, to 100001, writing extra codes.
> >>
> >> Please guide here.
> >>
> >> --
> >> Regards,
> >> Upasana Sharma
> >
> >
> >
> > --
> > Raman Gugnani
> >
> > 8588892293
> > Principal Engineer
> > ixigo.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@cassandra.apache.org
> For additional commands, e-mail: user-help@cassandra.apache.org
>
>
--
Regards,
Upasana Sharma
Re: Cassandra LWT Writes inconsistent
Posted by Hiroyuki Yamada <mo...@gmail.com>.
Do you also set SERIAL CONSISTENCY properly ?
https://docs.datastax.com/en/archived/cql/3.3/cql/cql_reference/cqlshSerialConsistency.html
Hiro
On Tue, Jul 9, 2019 at 2:25 PM Jeff Jirsa <jj...@gmail.com> wrote:
>
> If applied is false it’s not the first write, the value already exists. You’ve likely got a concurrency issue app side or you don’t understand the concurrent queries you’re issuing to the db
>
> On Jul 8, 2019, at 10:08 PM, raman gugnani <ra...@gmail.com> wrote:
>
> Hi Team,
>
> Can anyone help on the same.
>
> Cassnadra driver says write is not done but eventually write has been done.
>
> On Mon, 8 Jul 2019 at 12:31, Upasana Sharma <02...@gmail.com> wrote:
>>
>>
>> Hi,
>>
>> I am using an LWT Insert transaction similar to:
>>
>> INSERT INTO table1 (code, id, subpart) VALUES (:code, :id, :subpart) IF NOT EXISTS
>>
>> With
>> readConsistency="LOCAL_SERIAL"
>> writeConsistency="LOCAL_QUORUM"
>>
>> Cassandra Driver: 3.6.0
>> Cassandra Version: Cassandra 3.11.2
>>
>>
>> The problem is that I am getting [applied] false on the first write to cassandra.
>>
>> I have set retry policy as writeTimes = 0, so no retries are attempted.
>>
>> My application logs for reference:
>>
>> c-7967981443032352 - [INFO ] 2019-06-18T19:46:16.276Z [pool-15-thread-5] CreateService - SubPartition 104
>> c-7967981443032352 - [INFO ] 2019-06-18T19:46:16.805Z [pool-15-thread-5] Repository - Row[false, A, 1, 104]
>> c-7967981443032352 - [INFO ] 2019-06-18T19:46:16.805Z [pool-15-thread-5] CreateService - SubPartition 104 CodeNumber 75191 DuplicateCodeGenerated A
>>
>> This is causing my count of writes to tables to differ from required 100000, to 100001, writing extra codes.
>>
>> Please guide here.
>>
>> --
>> Regards,
>> Upasana Sharma
>
>
>
> --
> Raman Gugnani
>
> 8588892293
> Principal Engineer
> ixigo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@cassandra.apache.org
For additional commands, e-mail: user-help@cassandra.apache.org
Re: Cassandra LWT Writes inconsistent
Posted by Jeff Jirsa <jj...@gmail.com>.
If applied is false it’s not the first write, the value already exists. You’ve likely got a concurrency issue app side or you don’t understand the concurrent queries you’re issuing to the db
> On Jul 8, 2019, at 10:08 PM, raman gugnani <ra...@gmail.com> wrote:
>
> Hi Team,
>
> Can anyone help on the same.
>
> Cassnadra driver says write is not done but eventually write has been done.
>
>> On Mon, 8 Jul 2019 at 12:31, Upasana Sharma <02...@gmail.com> wrote:
>>
>> Hi,
>>
>> I am using an LWT Insert transaction similar to:
>>
>> INSERT INTO table1 (code, id, subpart) VALUES (:code, :id, :subpart) IF NOT EXISTS
>>
>> With
>> readConsistency="LOCAL_SERIAL"
>> writeConsistency="LOCAL_QUORUM"
>>
>> Cassandra Driver: 3.6.0
>> Cassandra Version: Cassandra 3.11.2
>>
>>
>> The problem is that I am getting [applied] false on the first write to cassandra.
>>
>> I have set retry policy as writeTimes = 0, so no retries are attempted.
>>
>> My application logs for reference:
>>
>> c-7967981443032352 - [INFO ] 2019-06-18T19:46:16.276Z [pool-15-thread-5] CreateService - SubPartition 104
>> c-7967981443032352 - [INFO ] 2019-06-18T19:46:16.805Z [pool-15-thread-5] Repository - Row[false, A, 1, 104]
>> c-7967981443032352 - [INFO ] 2019-06-18T19:46:16.805Z [pool-15-thread-5] CreateService - SubPartition 104 CodeNumber 75191 DuplicateCodeGenerated A
>>
>> This is causing my count of writes to tables to differ from required 100000, to 100001, writing extra codes.
>>
>> Please guide here.
>>
>> --
>> Regards,
>> Upasana Sharma
>
>
> --
> Raman Gugnani
>
> 8588892293
> Principal Engineer
> ixigo.com
Re: Cassandra LWT Writes inconsistent
Posted by raman gugnani <ra...@gmail.com>.
Hi Team,
Can anyone help on the same.
Cassnadra driver says write is not done but eventually write has been done.
On Mon, 8 Jul 2019 at 12:31, Upasana Sharma <02...@gmail.com> wrote:
>
> Hi,
>
> I am using an LWT Insert transaction similar to:
>
> INSERT INTO table1 (code, id, subpart) VALUES (:code, :id, :subpart) IF
> NOT EXISTS
>
> With
> readConsistency="LOCAL_SERIAL"
> writeConsistency="LOCAL_QUORUM"
>
> Cassandra Driver: 3.6.0
> Cassandra Version: Cassandra 3.11.2
>
>
> The problem is that I am getting* [applied] false* on the *first write* to
> cassandra.
>
> I have set retry policy as writeTimes = 0, so no retries are attempted.
>
> My application logs for reference:
>
> c-7967981443032352 - [INFO ] 2019-06-18T19:46:16.276Z [pool-15-thread-5]
> CreateService - SubPartition 104
> c-7967981443032352 - [INFO ] 2019-06-18T19:46:16.805Z [pool-15-thread-5] *Repository
> - Row[false, A, 1, 104]*
> c-7967981443032352 - [INFO ] 2019-06-18T19:46:16.805Z [pool-15-thread-5]
> CreateService - SubPartition 104 CodeNumber 75191
> *DuplicateCodeGenerated A*
>
> This is causing my count of writes to tables to differ from required
> 100000, to 100001, writing extra codes.
>
> Please guide here.
>
> --
> Regards,
> Upasana Sharma
>
--
Raman Gugnani
8588892293
Principal Engineer
*ixigo.com <http://ixigo.com>*