You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2021/02/09 01:46:53 UTC

[GitHub] [ignite] Nikita-tech-writer opened a new pull request #8777: IGNITE-14144 Document C++ thin client transactions

Nikita-tech-writer opened a new pull request #8777:
URL: https://github.com/apache/ignite/pull/8777


   Thank you for submitting the pull request to the Apache Ignite.
   
   In order to streamline the review of the contribution 
   we ask you to ensure the following steps have been taken:
   
   ### The Contribution Checklist
   - [ ] There is a single JIRA ticket related to the pull request. 
   - [ ] The web-link to the pull request is attached to the JIRA ticket.
   - [ ] The JIRA ticket has the _Patch Available_ state.
   - [ ] The pull request body describes changes that have been made. 
   The description explains _WHAT_ and _WHY_ was made instead of _HOW_.
   - [ ] The pull request title is treated as the final commit message. 
   The following pattern must be used: `IGNITE-XXXX Change summary` where `XXXX` - number of JIRA issue.
   - [ ] A reviewer has been mentioned through the JIRA comments 
   (see [the Maintainers list](https://cwiki.apache.org/confluence/display/IGNITE/How+to+Contribute#HowtoContribute-ReviewProcessandMaintainers)) 
   - [ ] The pull request has been checked by the Teamcity Bot and 
   the `green visa` attached to the JIRA ticket (see [TC.Bot: Check PR](https://mtcga.gridgain.com/prs.html))
   
   ### Notes
   - [How to Contribute](https://cwiki.apache.org/confluence/display/IGNITE/How+to+Contribute)
   - [Coding abbreviation rules](https://cwiki.apache.org/confluence/display/IGNITE/Abbreviation+Rules)
   - [Coding Guidelines](https://cwiki.apache.org/confluence/display/IGNITE/Coding+Guidelines)
   - [Apache Ignite Teamcity Bot](https://cwiki.apache.org/confluence/display/IGNITE/Apache+Ignite+Teamcity+Bot)
   
   If you need any help, please email dev@ignite.apache.org or ask anу advice on http://asf.slack.com _#ignite_ channel.
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] zstan commented on pull request #8777: IGNITE-14144 Document C++ thin client transactions

Posted by GitBox <gi...@apache.org>.
zstan commented on pull request #8777:
URL: https://github.com/apache/ignite/pull/8777#issuecomment-776747166


   and what about :  transactions.withLabel(label) , we are talking previously ? 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] Nikita-tech-writer commented on pull request #8777: IGNITE-14144 Document C++ thin client transactions

Posted by GitBox <gi...@apache.org>.
Nikita-tech-writer commented on pull request #8777:
URL: https://github.com/apache/ignite/pull/8777#issuecomment-787971713


   @Mmuzaf Hi Maxim! Could you please cherry-pick this improvement to the 2.10 documentation?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] Nikita-tech-writer commented on pull request #8777: IGNITE-14144 Document C++ thin client transactions

Posted by GitBox <gi...@apache.org>.
Nikita-tech-writer commented on pull request #8777:
URL: https://github.com/apache/ignite/pull/8777#issuecomment-775592773


   @zstan Please take a look at the PR.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] zstan commented on pull request #8777: IGNITE-14144 Document C++ thin client transactions

Posted by GitBox <gi...@apache.org>.
zstan commented on pull request #8777:
URL: https://github.com/apache/ignite/pull/8777#issuecomment-788604576


   @Nikita-tech-writer the one question: why do we have container reference changes here ? thanks !


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] Nikita-tech-writer commented on pull request #8777: IGNITE-14144 Document C++ thin client transactions

Posted by GitBox <gi...@apache.org>.
Nikita-tech-writer commented on pull request #8777:
URL: https://github.com/apache/ignite/pull/8777#issuecomment-787863591


   I've added a paragraph on transactions with labels.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] zstan commented on a change in pull request #8777: IGNITE-14144 Document C++ thin client transactions

Posted by GitBox <gi...@apache.org>.
zstan commented on a change in pull request #8777:
URL: https://github.com/apache/ignite/pull/8777#discussion_r572921841



##########
File path: docs/_docs/thin-clients/cpp-thin-client.adoc
##########
@@ -115,3 +115,32 @@ Configure link:security/authentication[authentication on the cluster side] and p
 include::code-snippets/cpp/src/thin_authentication.cpp[tag=thin-authentication,indent=0]
 ----
 
+=== Executing Transactions
+
+The C++ thin client supports the transactional API. You can execute distributed transactions in various configuration
+modes by selecting required isolation levels and concurrency modes.

Review comment:
       doubled "modes" seems excessive here.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] Nikita-tech-writer commented on pull request #8777: IGNITE-14144 Document C++ thin client transactions

Posted by GitBox <gi...@apache.org>.
Nikita-tech-writer commented on pull request #8777:
URL: https://github.com/apache/ignite/pull/8777#issuecomment-776190933


   @zstan I've added more examples and aligned the topic with the similar one (thin client trasnactions) in java thin client. Please see the latest changes in the PR.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] Nikita-tech-writer commented on a change in pull request #8777: IGNITE-14144 Document C++ thin client transactions

Posted by GitBox <gi...@apache.org>.
Nikita-tech-writer commented on a change in pull request #8777:
URL: https://github.com/apache/ignite/pull/8777#discussion_r586237205



##########
File path: docs/_docs/thin-clients/cpp-thin-client.adoc
##########
@@ -115,3 +115,75 @@ Configure link:security/authentication[authentication on the cluster side] and p
 include::code-snippets/cpp/src/thin_authentication.cpp[tag=thin-authentication,indent=0]
 ----
 
+=== Transactions
+
+
+Client transactions are supported for caches with `AtomicityMode.TRANSACTIONAL` mode.
+
+
+==== Executing Transactions
+
+
+To start a transaction, obtain the `ClientTransactions` object from `IgniteClient`.
+`ClientTransactions` has a number of `txStart(...)` methods, each of which starts a new transaction and returns an object (`ClientTransaction`) that represents the transaction.
+Use this object to commit or rollback the transaction.
+
+
+[source, cpp]
+----
+cache::CacheClient<int, int> cache = client.GetCache<int, int>("my_transactional_cache");
+
+transactions::ClientTransactions transactions = client.ClientTransactions();
+
+transactions::ClientTransaction tx = transactions.TxStart();
+
+cache.Put(2, 20);
+
+tx.Commit();
+----
+
+
+==== Transaction Configuration
+
+
+Client transactions can have different concurrency modes, isolation levels, and execution timeout, which can be set for all transactions or on a per transaction basis.
+
+You can specify the concurrency mode, isolation level, and timeout when starting an individual transaction. In this case, the provided values override the default settings.
+
+
+[source, cpp]
+----
+transactions::ClientTransactions transactions = client.ClientTransactions();
+
+const uint32_t TX_TIMEOUT = 200;
+
+transactions::ClientTransaction tx = transactions.TxStart(TransactionConcurrency::OPTIMISTIC, TransactionIsolation::SERIALIZABLE, TX_TIMEOUT);
+
+cache.Put(1, 20);
+
+tx.Commit();
+----
+
+You can also perform transactions with labels:
+
+[source, cpp]
+----
+transactions::ClientTransaction tx = transactions.withLabel(label).TxStart();
+
+transactions::ClientTransaction tx = transactions.withLabel(label).TxStart(TransactionConcurrency::OPTIMISTIC, TransactionIsolation::SERIALIZABLE, TX_TIMEOUT);
+----
+
+=== Init Container
+To use an init container, add the appropriate definitions.
+
+For example:
+----
+...
+init_container_image: busybox

Review comment:
       It must have happened by mistake. Thanks for noticing!




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] Mmuzaf merged pull request #8777: IGNITE-14144 Document C++ thin client transactions

Posted by GitBox <gi...@apache.org>.
Mmuzaf merged pull request #8777:
URL: https://github.com/apache/ignite/pull/8777


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] Nikita-tech-writer commented on pull request #8777: IGNITE-14144 Document C++ thin client transactions

Posted by GitBox <gi...@apache.org>.
Nikita-tech-writer commented on pull request #8777:
URL: https://github.com/apache/ignite/pull/8777#issuecomment-789558246


   > @Nikita-tech-writer the one question: why do we have container reference changes here ? thanks !
   
   Hi @zstan! It must have happened by mistake. Thanks for noticing! The issue is resolved, I've removed it.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] zstan commented on a change in pull request #8777: IGNITE-14144 Document C++ thin client transactions

Posted by GitBox <gi...@apache.org>.
zstan commented on a change in pull request #8777:
URL: https://github.com/apache/ignite/pull/8777#discussion_r585267597



##########
File path: docs/_docs/thin-clients/cpp-thin-client.adoc
##########
@@ -115,3 +115,75 @@ Configure link:security/authentication[authentication on the cluster side] and p
 include::code-snippets/cpp/src/thin_authentication.cpp[tag=thin-authentication,indent=0]
 ----
 
+=== Transactions
+
+
+Client transactions are supported for caches with `AtomicityMode.TRANSACTIONAL` mode.
+
+
+==== Executing Transactions
+
+
+To start a transaction, obtain the `ClientTransactions` object from `IgniteClient`.
+`ClientTransactions` has a number of `txStart(...)` methods, each of which starts a new transaction and returns an object (`ClientTransaction`) that represents the transaction.
+Use this object to commit or rollback the transaction.
+
+
+[source, cpp]
+----
+cache::CacheClient<int, int> cache = client.GetCache<int, int>("my_transactional_cache");
+
+transactions::ClientTransactions transactions = client.ClientTransactions();
+
+transactions::ClientTransaction tx = transactions.TxStart();
+
+cache.Put(2, 20);
+
+tx.Commit();
+----
+
+
+==== Transaction Configuration
+
+
+Client transactions can have different concurrency modes, isolation levels, and execution timeout, which can be set for all transactions or on a per transaction basis.
+
+You can specify the concurrency mode, isolation level, and timeout when starting an individual transaction. In this case, the provided values override the default settings.
+
+
+[source, cpp]
+----
+transactions::ClientTransactions transactions = client.ClientTransactions();
+
+const uint32_t TX_TIMEOUT = 200;
+
+transactions::ClientTransaction tx = transactions.TxStart(TransactionConcurrency::OPTIMISTIC, TransactionIsolation::SERIALIZABLE, TX_TIMEOUT);
+
+cache.Put(1, 20);
+
+tx.Commit();
+----
+
+You can also perform transactions with labels:
+
+[source, cpp]
+----
+transactions::ClientTransaction tx = transactions.withLabel(label).TxStart();
+
+transactions::ClientTransaction tx = transactions.withLabel(label).TxStart(TransactionConcurrency::OPTIMISTIC, TransactionIsolation::SERIALIZABLE, TX_TIMEOUT);
+----
+
+=== Init Container
+To use an init container, add the appropriate definitions.
+
+For example:
+----
+...
+init_container_image: busybox

Review comment:
       why do we have container reference code here ?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite] Nikita-tech-writer commented on pull request #8777: IGNITE-14144 Document C++ thin client transactions

Posted by GitBox <gi...@apache.org>.
Nikita-tech-writer commented on pull request #8777:
URL: https://github.com/apache/ignite/pull/8777#issuecomment-795140038


   Hi @Mmuzaf, I do believe that this one can also be merged and cherry-picked to 2.10, if there is still a chance to do this. Thank you!


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org