Re: Transactions and IgniteQueue
/** * Commits this transaction by initiating {@code two-phase-commit} process. * * @throws IgniteException If commit failed. * @throws TransactionTimeoutException If transaction is timed out. * @throws TransactionRollbackException If transaction is automatically rolled back. * @throws TransactionOptimisticException If transaction concurrency is {@link TransactionConcurrency#OPTIMISTIC} * and commit is optimistically failed. * @throws TransactionHeuristicException If transaction has entered an unknown state. */ @IgniteAsyncSupported public void commit() throws IgniteException; 2017-11-03 17:36 GMT+03:00 Evgenii Zhuravlev: > Yes, you could see it in the javadoc for Transaction class: > > > 2017-11-03 14:43 GMT+03:00 arunkjn : > >> Thanks Evgenii. >> >> If I get a TransactionOptimisticException during the transaction will it >> be >> thrown at the time of tx.commit() ? >> >> >> >> -- >> Sent from: http://apache-ignite-users.70518.x6.nabble.com/ >> > >
Re: Transactions and IgniteQueue
Yes, you could see it in the javadoc for Transaction class: 2017-11-03 14:43 GMT+03:00 arunkjn: > Thanks Evgenii. > > If I get a TransactionOptimisticException during the transaction will it be > thrown at the time of tx.commit() ? > > > > -- > Sent from: http://apache-ignite-users.70518.x6.nabble.com/ >
Re: Transactions and IgniteQueue
Thanks Evgenii. If I get a TransactionOptimisticException during the transaction will it be thrown at the time of tx.commit() ? -- Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Re: Transactions and IgniteQueue
Hi Arun, As for now, IgniteTransaction works only for caches. You can find information about it in documentation: https://apacheignite.readme.io/docs/transactions#section-ignitetransactions Evgenii 2017-11-03 12:43 GMT+03:00 arunkjn: > Hi, > > I am using an optimistic transaction with serializable isolation level on a > transactional cache as follows- > > while (true){ > try(Transaction tx = > ignite.transactions().txStart(TransactionConcurrency.OPTIMISTIC, > TransactionIsolation.SERIALIZABLE)){ > > // update all keys of workflow run state corresponding > to this event > flowRunStateIds.stream().forEach(flowRunStateId -> { > FlowRunState state = > workflowRunStateIgniteCache.get(flowRunStateId); > try { > state.getFlowRunEvents().put(event); > } catch (InterruptedException e) { > e.printStackTrace(); > } > workflowRunStateIgniteCache.put(flowRunStateId, > state); > }); > > updatedFlows.stream().forEach(workflowFlow -> > updatedFlowsIgniteQueue.put(workflowFlow)); > > tx.commit(); > break; > } > catch (TransactionOptimisticException e){ > // todo: emit a monitoring metric TRANSACTIONS_FAILED > here > System.out.println("Transaction failed. Retrying..."); > } > } > > Inside the transaction I am updating the cache values and also updating an > IgniteQueue updatedFlowsIgniteQueue. If the transaction fails at the time > of > commit, the transactional cache will not be updated. Is the same also true > for IgniteQueue? Also, will my queue be locked during the duration of the > transaction? > > Thanks, > Arun > > > > -- > Sent from: http://apache-ignite-users.70518.x6.nabble.com/ >
Transactions and IgniteQueue
Hi, I am using an optimistic transaction with serializable isolation level on a transactional cache as follows- while (true){ try(Transaction tx = ignite.transactions().txStart(TransactionConcurrency.OPTIMISTIC, TransactionIsolation.SERIALIZABLE)){ // update all keys of workflow run state corresponding to this event flowRunStateIds.stream().forEach(flowRunStateId -> { FlowRunState state = workflowRunStateIgniteCache.get(flowRunStateId); try { state.getFlowRunEvents().put(event); } catch (InterruptedException e) { e.printStackTrace(); } workflowRunStateIgniteCache.put(flowRunStateId, state); }); updatedFlows.stream().forEach(workflowFlow -> updatedFlowsIgniteQueue.put(workflowFlow)); tx.commit(); break; } catch (TransactionOptimisticException e){ // todo: emit a monitoring metric TRANSACTIONS_FAILED here System.out.println("Transaction failed. Retrying..."); } } Inside the transaction I am updating the cache values and also updating an IgniteQueue updatedFlowsIgniteQueue. If the transaction fails at the time of commit, the transactional cache will not be updated. Is the same also true for IgniteQueue? Also, will my queue be locked during the duration of the transaction? Thanks, Arun -- Sent from: http://apache-ignite-users.70518.x6.nabble.com/