You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@trafodion.apache.org by "Lijian (Q)" <ji...@huawei.com> on 2015/09/17 03:47:18 UTC

答复: Question about commit conflict check

Thanks Oliver, thanks Ming.

I've miss the RPC call and make a wrong understand. After reading your explain, I've understood the conflict check.

As trafodion is a distributed system, it has c++/java code, and has a lot of processes, debug on it is difficult, do we have a good debugging tools? 
How we debug the DTM which contains c++ and java code and RPC call other processes of hbase?

Thanks.

-----邮件原件-----
发件人: Oliver Bucaojit [mailto:oliver.bucaojit@esgyn.com] 
发送时间: 2015年9月16日 23:30
收件人: dev@trafodion.incubator.apache.org
抄送: Nieyuanyuan
主题: Re: Question about commit conflict check

Hi,

Ming is correct that the changes are made to the same region and so the conflict is detected on the region.

The HBase regions (server-side) hold the transactional state such as DML modifications, other transactions to check, committed transaction states.
During the transaction, the client-side TM will send the DML data through and RPC call to the server and so the row changed is then held in-memory on the server node, based on where the region is located.  Rows that are in the same range are held in the same region for a simple example  region1 can hold rows with keys in the range null to 500 and region2 would hold rows with keys in the range of 501 to 1000.

To give a little more detail on the flow using your example:
tx1 is run on node1 client, it updates a row on region1 - region1 is located on HBase server node1
tx2 is run on node2 client, it updates row on region1 - sends that row change to region1 located on HBase node1
tx1 commits the change to region1 node1, this adds the transaction state to our committed list (also located on the region):
commitedTransactionsBySequenceNumber
tx2 wants to commit.  So in phase 1 prepare phase, prepare call goes to region 1 node1 and it goes through the the committed transaction list on the region and that is where it finds the conflict
tx2 aborts transaction

So in other words, each HBase region only needs to know about the rows updated within the region, and each of the modified regions goes through this conflict check.  If at least one region finds a conflict, then the entire transaction gets aborted.

-Oliver


On Wed, Sep 16, 2015 at 3:34 AM, Lijian (Q) <ji...@huawei.com> wrote:

> Hi, Hans, Narendra,
>
>        I’m reading source code of trafodion’s DTM and get confused 
> about commit conflict check.
>
>        When a transaction want to commit, it need to check update 
> conflict first. If there’s update row conflict with other running 
> transactions that started before the commit time, the transaction will abort.
> This work is done by TrxTransactionState.hasconflict, and all the 
> running transactions get from the set transactionsToCheck in
> TrxTransactionState.java。
>
> My question is how we can get all running transactions when 
> transactions may be execute in different node? To my opinion, the 
> transactionsToCheck just include the running transactions in one node, not all nodes.
>
> For Example:
> tx1 run on node1 and tx1 update a row in region1.
> tx2 run on node2 and tx2 update the same row in region1.
> tx1 commit first.
> tx2 want  to commit, and he check row conflict and get running 
> transactions from set transactionsToCheck, but tx1 is not in the set 
> transactionsToCheck in node1’s TM, It’s in the set transactionsToCheck 
> in node2’s TM. How can tx2 get the row conflict?
>
>
> Thanks.
>


On Wed, Sep 16, 2015 at 6:35 AM, Liu, Ming (Ming) <mi...@esgyn.cn> wrote:

> Hi,
>
> Please don't ask question to specific people, otherwise, others will 
> ignore your question :-) Each row can only belong to one region. Check 
> conflict in region not TM.
>
> Thanks,
> Ming
>
> -----邮件原件-----
> 发件人: Lijian (Q) [mailto:jianli.li@huawei.com]
> 发送时间: 2015年9月16日 18:35
> 收件人: dev <de...@trafodion.incubator.apache.org>
> 抄送: Nieyuanyuan <ni...@huawei.com>
> 主题: Question about commit conflict check
>
> Hi, Hans, Narendra,
>
>        I’m reading source code of trafodion’s DTM and get confused 
> about commit conflict check.
>
>        When a transaction want to commit, it need to check update 
> conflict first. If there’s update row conflict with other running 
> transactions that started before the commit time, the transaction will abort.
> This work is done by TrxTransactionState.hasconflict, and all the 
> running transactions get from the set transactionsToCheck in
> TrxTransactionState.java。
>
> My question is how we can get all running transactions when 
> transactions may be execute in different node? To my opinion, the 
> transactionsToCheck just include the running transactions in one node, not all nodes.
>
> For Example:
> tx1 run on node1 and tx1 update a row in region1.
> tx2 run on node2 and tx2 update the same row in region1.
> tx1 commit first.
> tx2 want  to commit, and he check row conflict and get running 
> transactions from set transactionsToCheck, but tx1 is not in the set 
> transactionsToCheck in node1’s TM, It’s in the set transactionsToCheck 
> in node2’s TM. How can tx2 get the row conflict?
>
>
> Thanks.
>