Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id D31AC200D34 for ; Fri, 3 Nov 2017 11:40:56 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id D1AC9160BE9; Fri, 3 Nov 2017 10:40:56 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id F1804160BFC for ; Fri, 3 Nov 2017 11:40:55 +0100 (CET) Received: (qmail 23297 invoked by uid 500); 3 Nov 2017 10:40:54 -0000 Mailing-List: contact user-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@ignite.apache.org Delivered-To: mailing list user@ignite.apache.org Received: (qmail 23287 invoked by uid 99); 3 Nov 2017 10:40:54 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 03 Nov 2017 10:40:54 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 18FD51808C8 for ; Fri, 3 Nov 2017 10:40:54 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.379 X-Spam-Level: ** X-Spam-Status: No, score=2.379 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SORBS_SPAM=0.5, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id 4Up_QI9kFrPe for ; Fri, 3 Nov 2017 10:40:52 +0000 (UTC) Received: from mail-qk0-f180.google.com (mail-qk0-f180.google.com [209.85.220.180]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id A7D6860F5B for ; Fri, 3 Nov 2017 10:40:51 +0000 (UTC) Received: by mail-qk0-f180.google.com with SMTP id y23so2606406qkb.10 for ; Fri, 03 Nov 2017 03:40:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=zcHiywsGLcPs12SwCsh6TwpyO+yXrT3fi9BNBJtEB4I=; b=FfqZZIdR/b0D2CrCGlf5yOs+fsPjGf4rPc17oPTi1juzKdGYy1uQ+9U0v2d0bRK0S3 dv32jQal+HXsoCFowu5QGHkLcHhso5klCN8ptXhx1EdyKIOU5XBwHxnw9f3fA5qL4co9 avKHuuze+l1M4/2dNcqfdyFy9p3SaI3jo85cdAoPaXVj5wWJs5VWTRnc1WiOy0qz5qci NMU3fZvJF1qYAHEuWhkOhr0FT6YFX1I6f0M/iBNUeKZZE57Moz+rShsBqd2M5A3HKdAe nE3xmCwvedwZMUuFjy/XkxEgsRYRd/BIlaCaEA7Yb7me8UuiGz8X9cw4EC405me5mZxo 9EAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=zcHiywsGLcPs12SwCsh6TwpyO+yXrT3fi9BNBJtEB4I=; b=azOe2KMz032AHK0fUPq4gmOZjoEoMgEcSzE5zCm4oEjj3LlgoSxo6CMbt12/SBAHrS Z9LwZKkpobwgS9GgQ+akokhOj+tPm7HgaJCjlOARskNozkt0UVJz0ExYD6aXT+Zwu4gQ cWUSZ/3926ARxsKOX3GeHkHTyCXhQJCfGTb/fKlekAvLvNXiG8hw8kUiRMaIOF2hSKI6 lFpWklwdQswxxiGhJnkoXf00Yf/1Uluz+axyjpWyR4UorNA70c8R/YjB2aUtOs8PKRUs W3SXwS5tDVD1f7fewdpfk6bP3BSzcB4DrADXlICTEpHN47VtGenYkJ9qdWi5zxMBN4av CEGg== X-Gm-Message-State: AMCzsaUi/YyZ1NNsG47BlizNP/NEo9HBvSiV3I+ZiyWj9vtwxyZzjpAl D24YndlMbVX6hQJetP8DSWHysyJ5OpFCKhSWwUL6Ig== X-Google-Smtp-Source: ABhQp+T5UsADBXZ8jqRTkOgid0nvb+12PTtzzg5ULpKrBX22/fie0zuy6pmSvFstC6ccZ40QX0zQBow0NM8dSr9HRk4= X-Received: by 10.55.24.170 with SMTP id 42mr8597625qky.220.1509705644642; Fri, 03 Nov 2017 03:40:44 -0700 (PDT) MIME-Version: 1.0 Received: by 10.200.9.23 with HTTP; Fri, 3 Nov 2017 03:40:44 -0700 (PDT) In-Reply-To: <1509702187097-0.post@n6.nabble.com> References: <1509702187097-0.post@n6.nabble.com> From: Evgenii Zhuravlev Date: Fri, 3 Nov 2017 13:40:44 +0300 Message-ID: Subject: Re: Transactions and IgniteQueue To: user@ignite.apache.org Content-Type: multipart/alternative; boundary="001a11440fbcaa15c6055d11bca7" archived-at: Fri, 03 Nov 2017 10:40:57 -0000 --001a11440fbcaa15c6055d11bca7 Content-Type: text/plain; charset="UTF-8" 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/ > --001a11440fbcaa15c6055d11bca7 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Arun,

As for now, IgniteTransaction = works only for caches. You can find information about it in documentation:= =C2=A0https://apacheignite.readme.io/docs/transactions#section= -ignitetransactions

Evgenii

2017-11-03 12:43 GMT+03:= 00 arunkjn <arunkjn@gmail.com>:
Hi,

I am using an optimistic transaction with serializable isolation level on a=
transactional cache as follows-

while (true){
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 try(Transaction tx = =3D
ignite.transactions().txStart(TransactionConcurrency.OPTIMISTIC,<= br> TransactionIsolation.SERIALIZABLE)){

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 // up= date all keys of workflow run state corresponding
to this event
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 flowR= unStateIds.stream().forEach(flowRunStateId -> {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 FlowRunState state =3D
workflowRunStateIgniteCache.get(flowRunStateId);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 try {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 state.getFlowRunEvents().put(event);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 } catch (InterruptedException e) {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 e.printStackTrace();
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 }
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 workflowRunStateIgniteCache.put(flowRunStateId,
state);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 });
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 updat= edFlows.stream().forEach(workflowFlow ->
updatedFlowsIgniteQueue.put(workflowFlow));

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 tx.co= mmit();
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 break= ;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 catch (Transac= tionOptimisticException e){
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 // to= do: emit a monitoring metric TRANSACTIONS_FAILED
here
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Syste= m.out.println("Transaction failed. Retrying...");
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }

Inside the transaction I am updating the cache values and also updating an<= br> IgniteQueue updatedFlowsIgniteQueue. If the transaction fails at the time o= f
commit, the transactional cache will not be updated. Is the same also true<= br> 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/

--001a11440fbcaa15c6055d11bca7--