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 9B71A200B5E for ; Wed, 10 Aug 2016 22:22:24 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 9A01E160A8F; Wed, 10 Aug 2016 20:22:24 +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 B90B1160AA4 for ; Wed, 10 Aug 2016 22:22:23 +0200 (CEST) Received: (qmail 68588 invoked by uid 500); 10 Aug 2016 20:22:22 -0000 Mailing-List: contact dev-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list dev@ignite.apache.org Received: (qmail 68573 invoked by uid 99); 10 Aug 2016 20:22:22 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 10 Aug 2016 20:22:22 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 3BA7BC2203 for ; Wed, 10 Aug 2016 20:22:22 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.179 X-Spam-Level: * X-Spam-Status: No, score=1.179 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_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx2-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id K1Il9FSZy-CI for ; Wed, 10 Aug 2016 20:22:21 +0000 (UTC) Received: from mail-ua0-f174.google.com (mail-ua0-f174.google.com [209.85.217.174]) by mx2-lw-us.apache.org (ASF Mail Server at mx2-lw-us.apache.org) with ESMTPS id 06C9E5F343 for ; Wed, 10 Aug 2016 20:22:21 +0000 (UTC) Received: by mail-ua0-f174.google.com with SMTP id 97so88446588uav.3 for ; Wed, 10 Aug 2016 13:22:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=mDGMUlcTmTFcI65OQ5OIpvow2PVJWc+SX3eD98jsZhs=; b=uMtaLWp8RK4DUSIeVNs0qudk3IaJBNsCkr47yEq4LogczbGSrCfJ5ZlfMV/nyi7eRU ZUSFDjSJq5nJQ6eoNNaMb9pTegL54FNASqyzeP9wCa048SJ93oFX1b7FPh0z5AVhEVRj 50KFpCWk+P9XKZBEjfxJgCBXTPO+Futj7JkwIO0et8R7aBGjbm4xaXtYB7R/paGvx1Vm sDeRyrc9GUpOOU+ybqzxl7YHjWMVZ1og4ROKHaCAvKIMA66opiTww3WI2kCrDtgH90P/ g6B71VAUTiCUoSsSab6ldE8pDBhmT7IHlMM5GOK/bYUK8c1fGs4LDwekpcjYxqkcEpe7 xHGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=mDGMUlcTmTFcI65OQ5OIpvow2PVJWc+SX3eD98jsZhs=; b=mAFg8CvFVVSdoCYzvSuO+g9e3i/3jCWJHFjU0tVmE5OiyFtXBTCR5V0vwBf0i1c3wd es+t/U1EahG4JuxV2a9gJGtfKx3ZhRpsnb2CCyZvPcom3APVdxW93FVcbDVJyiYE0lbY dolK1PkIPXiTVN81+XA7fo8XOcK/ZfmdtIARn/wwO0x+hNzn+oDKuHajv0gVy2aKWW0o He6ES1z3OqoXGsCC59LzE8hnjMyCtZyx2dqykH51cuZhdVM6Tjsy0UZ25AaXGSI5Vqtk v0Qdv1NHuvldICWL6IfGGsjjET6ej+ICEcpxNPazgC1TlZZo8uBk13DBoa+eJwYRih1R 9DSQ== X-Gm-Message-State: AEkoouudq4rLGNvR5o/nSrMtboIl98Vb/1ZCJIv9JjZ59IMSYtzQJ0JMRvragYXTpeEbm7wKJaDTbbz3e/7azA== X-Received: by 10.159.40.71 with SMTP id c65mr3118511uac.1.1470860540425; Wed, 10 Aug 2016 13:22:20 -0700 (PDT) MIME-Version: 1.0 Received: by 10.103.126.7 with HTTP; Wed, 10 Aug 2016 13:22:00 -0700 (PDT) In-Reply-To: References: From: Igor Rudyak Date: Wed, 10 Aug 2016 13:22:00 -0700 Message-ID: Subject: Re: Multi-cache transactions & persistent store To: dev@ignite.apache.org Content-Type: multipart/alternative; boundary=94eb2c047d3e06bdbe0539bd686d archived-at: Wed, 10 Aug 2016 20:22:24 -0000 --94eb2c047d3e06bdbe0539bd686d Content-Type: text/plain; charset=UTF-8 By the way Yakov. How should we handle multi-cache transactions for "write-behind" caches? For different caches (participated in transaction) we can receive several separate sessionEnd calls. Igor On Mon, Aug 1, 2016 at 1:32 AM, Yakov Zhdanov wrote: > Igor, you factory should return the same instance for all caches started > locally. This way Ignite should call sessionEnd() once. Can you please > check? > > --Yakov > > 2016-07-30 4:40 GMT+03:00 Igor Rudyak : > > > Hi guys, > > > > Playing with Ignite multi-cache transactions(transactions involving > > multiple caches) we run into the lack of proper/easy mechanism to support > > such transactions on persistent store side (while implementing particular > > *CacheStore*). > > > > The problem is there is no easy way for *CacheStore *implementation to > get > > information about caches involved in the transaction. > > > > Here are more details: > > > > When committing multi-cache transaction, Ignite produces multiple > > *sessionEnd(...)* calls (in *CacheStore *implementation) - one for each > > cache. Thus to support multi-cache transaction in persistent store, we > need > > to accumulate all the changes made to multiple caches (by > > *write/writeAll/delete/deleteAll* operations) and apply them as one > > transaction/batch to a persistent store in the final(last) *sessionEnd > > *call. > > To do this we need to know exact number of caches participating in the > > transaction. Having this number we can skip all *sessionEnd *calls except > > the last - which we will use to commit/persist all the changes we > > previously accumulated. > > > > As for now, the only way to get the number of caches participating in a > > transaction is to register *CacheStoreSessionListener *and count number > of > > caches in its "*onSessionStart*" method. Such approach doesn't look very > > elegant cause we always need to keep in mind that specifying " > > *cacheStoreFactory*" in cache configuration is not enough. In addition to > > this we also need to specify appropriate " > > *cacheStoreSessionListenerFactories*" property - otherwise it will not > work > > for multi-cache transactions. > > > > Here is an example chunk from cache configuration: > > > > * * > > * > > > class="org.apache.ignite.cache.store.cassandra. > CassandraCacheStoreFactory">* > > * * > > * > value="cache1_persistence_settings"/>* > > * * > > * * > > * * > > * * > > * * > > * * > > * * > > > > We see that, instead of specifying only one property > "*cacheStoreFactory*" > > for a cache we should always specify two properties in case we need > > multi-cache transactions support in persistent store. Conceptually it > > doesn't look good, cause users thinking about *CacheStore *implementation > > like something self-contained - once it specified in cache configuration > > everything should be smooth. But in case of multi-cache transactions > > support we always need to remember about registering some strange > > "listener". > > > > In Ignite we already have such concept as " > > *org.apache.ignite.transactions.Transaction*" which defines our > > transaction. It looks logical if it will also provide information about > > transaction boundaries (caches involved into transaction). Such approach > > can simplify persistent store implementation for multi-cache > transactions. > > > > Any thoughts? > > > > > > Igor Rudyak > > > --94eb2c047d3e06bdbe0539bd686d--