You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cassandra.apache.org by Jim Xu <ji...@gmail.com> on 2013/12/04 03:33:57 UTC

lightweight transaction timeout

Hi all,

I use two threads to test lightweight transaction. Each thread execute
"insert into test_table(column1,column2) values (i, thread_id) if not
exists" N times, and "i" is in the range of 0~N. If N is a small number,
it is ok,some row are inserted by thread 1 and other rows are inserted
by thread 2; if N is a big number, I will get
TimedoutException(acknowledged_by:1, paxos_in_progress:true) and have
the following two different results:

1) only one thread throws the exception, and this thread successfully
inserts the value;
2) both the two threads throw the exception, and no value is inserted
into the table.

I except that some rows in test_table are inserted by thread 1 and others
inserted by thread 2. If one thread inserts a row which has be in the
table,
the row will not be modified and the thread will continue to insert the
next row.

I think that is lightweight transaction's function, but why I get the
exception and how to avoid it.
I try to enlarge cas_contention_timeout_in_ms in cassandra.yaml, but it
does not work.

my cassandra version is 2.0.3, and the cluster has two nodes with
keypsace's replication_factor is 2.

Best Regards
Jim Xu

Re: lightweight transaction timeout

Posted by "J. Ryan Earl" <os...@jryanearl.us>.
Actually I may be wrong...  But I would still try with 3-nodes.


On Wed, Dec 4, 2013 at 11:04 PM, J. Ryan Earl <os...@jryanearl.us> wrote:

> You're using only 2 nodes, Paxos requires a minimum of 3 nodes to
> establish a quorum.  Cassandra should likely disallow lightweight
> transactions entirely in a 2-node scenario.
>
>
> On Tue, Dec 3, 2013 at 8:33 PM, Jim Xu <ji...@gmail.com> wrote:
>
>> Hi all,
>>
>> I use two threads to test lightweight transaction. Each thread execute
>> "insert into test_table(column1,column2) values (i, thread_id) if not
>> exists" N times, and "i" is in the range of 0~N. If N is a small number,
>> it is ok,some row are inserted by thread 1 and other rows are inserted
>> by thread 2; if N is a big number, I will get
>> TimedoutException(acknowledged_by:1, paxos_in_progress:true) and have
>> the following two different results:
>>
>> 1) only one thread throws the exception, and this thread successfully
>> inserts the value;
>> 2) both the two threads throw the exception, and no value is inserted
>> into the table.
>>
>> I except that some rows in test_table are inserted by thread 1 and others
>> inserted by thread 2. If one thread inserts a row which has be in the
>> table,
>> the row will not be modified and the thread will continue to insert the
>> next row.
>>
>> I think that is lightweight transaction's function, but why I get the
>> exception and how to avoid it.
>> I try to enlarge cas_contention_timeout_in_ms in cassandra.yaml, but it
>> does not work.
>>
>> my cassandra version is 2.0.3, and the cluster has two nodes with
>> keypsace's replication_factor is 2.
>>
>> Best Regards
>> Jim Xu
>>
>
>

Re: lightweight transaction timeout

Posted by "J. Ryan Earl" <os...@jryanearl.us>.
You're using only 2 nodes, Paxos requires a minimum of 3 nodes to establish
a quorum.  Cassandra should likely disallow lightweight transactions
entirely in a 2-node scenario.


On Tue, Dec 3, 2013 at 8:33 PM, Jim Xu <ji...@gmail.com> wrote:

> Hi all,
>
> I use two threads to test lightweight transaction. Each thread execute
> "insert into test_table(column1,column2) values (i, thread_id) if not
> exists" N times, and "i" is in the range of 0~N. If N is a small number,
> it is ok,some row are inserted by thread 1 and other rows are inserted
> by thread 2; if N is a big number, I will get
> TimedoutException(acknowledged_by:1, paxos_in_progress:true) and have
> the following two different results:
>
> 1) only one thread throws the exception, and this thread successfully
> inserts the value;
> 2) both the two threads throw the exception, and no value is inserted
> into the table.
>
> I except that some rows in test_table are inserted by thread 1 and others
> inserted by thread 2. If one thread inserts a row which has be in the
> table,
> the row will not be modified and the thread will continue to insert the
> next row.
>
> I think that is lightweight transaction's function, but why I get the
> exception and how to avoid it.
> I try to enlarge cas_contention_timeout_in_ms in cassandra.yaml, but it
> does not work.
>
> my cassandra version is 2.0.3, and the cluster has two nodes with
> keypsace's replication_factor is 2.
>
> Best Regards
> Jim Xu
>

Re: lightweight transaction timeout

Posted by Jonathan Ellis <jb...@gmail.com>.
Does turning tracing on shed any light?

On Tue, Dec 3, 2013 at 8:33 PM, Jim Xu <ji...@gmail.com> wrote:
> Hi all,
>
> I use two threads to test lightweight transaction. Each thread execute
> "insert into test_table(column1,column2) values (i, thread_id) if not
> exists" N times, and "i" is in the range of 0~N. If N is a small number,
> it is ok,some row are inserted by thread 1 and other rows are inserted
> by thread 2; if N is a big number, I will get
> TimedoutException(acknowledged_by:1, paxos_in_progress:true) and have
> the following two different results:
>
> 1) only one thread throws the exception, and this thread successfully
> inserts the value;
> 2) both the two threads throw the exception, and no value is inserted
> into the table.
>
> I except that some rows in test_table are inserted by thread 1 and others
> inserted by thread 2. If one thread inserts a row which has be in the
> table,
> the row will not be modified and the thread will continue to insert the
> next row.
>
> I think that is lightweight transaction's function, but why I get the
> exception and how to avoid it.
> I try to enlarge cas_contention_timeout_in_ms in cassandra.yaml, but it
> does not work.
>
> my cassandra version is 2.0.3, and the cluster has two nodes with
> keypsace's replication_factor is 2.
>
> Best Regards
> Jim Xu



-- 
Jonathan Ellis
Project Chair, Apache Cassandra
co-founder, http://www.datastax.com
@spyced