Hi,

I am using Oracle database. I want to use write behind approach to update
the tables when the cache associated with that table is updated.

1. If I do colocate computing in my distributed transaction will it also
commit/rollback the data from oracle table?

2. I want to start multiple ignite nodes. When nodes starts it will load
all the configured caches. All the nodes will have the same cache
configuration, I meant all node will start loading the same caches at
startup in partiotioned cache mode.

Does ignite executes the cache loader/CacheStore code (which fetches the
data from oracle tables) on the node which starts first and then
distributes it to other nodes in a cluster or all the nodes in a cluster
executes the data  loader code and just loads the cache with the data which
is appropriate to the  node?

Thanks,
Prasad


On Feb 8, 2018 7:54 PM, "Ilya Lantukh" <ilant...@gridgain.com> wrote:

Hi Phasad,

Your approach is incorrect, and function that you passed into
ignite.compute().affinityRun(...) will be executed outside of transaction
scope. If you want to execute your code on the affinity node to modify
value in cache, you should use IgniteCache.invoke(...) method - it will be
a part of transaction.

Hope this helps.

On Thu, Feb 8, 2018 at 5:14 PM, Prasad Bhalerao <
prasadbhalerao1...@gmail.com> wrote:

> Hi,
>
> Does ignite support distributed transaction in case of collocate
> computation?
>
> I started two ignite nodes and then pushed the data to cache using
> following code. Please check code as given below.  In this code I am
> rolling back the transaction at the end of compute affinity run. But after
> doing rollback the values in the map are not getting restored to previous
> version.
>
> Can anyone please help? Am I doing something wrong?
>
>
> *public static void *main(String[] args) *throws *Exception {
>     Ignition.*setClientMode*(*true*);
>
>     *try*( Ignite ignite = Ignition.*start*(*"ignite-configuration.xml"*)){
>             IgniteCache<Integer, String> cache = 
> ignite.getOrCreateCache(*"ipcache1"*);
>
>         *for *(*int *i = 0; i < 10; i++)
>             cache.put(i, Integer.*toString*(i));
>
>         *for *(*int *i = 0; i < 10; i++)
>             System.*out*.println(*"Got [key=" *+ i + *", val=" *+ 
> cache.get(i) + *']'*);
>
>         System.*out*.println(*"Node Started"*);
>
>         *final *IgniteCache<Integer, String> cache1 = 
> ignite.cache(*"ipcache1"*);
>         IgniteTransactions transactions = ignite.transactions();
>         *Transaction tx = transactions.txStart(TransactionConcurrency.*
> *OPTIMISTIC,
>                 TransactionIsolation.SERIALIZABLE**);*
>
>         *for *(*int *i = 0; i < 10; i++) {
>             *int *key = i;
>
>
>        ignite.compute().affinityRun(*"ipcache1"*, key,
>                     () -> {
>                             System.*out*.println(*"Co-located using 
> affinityRun [key= " *+ key + *", value=" *+ cache1.localPeek(key) + *']'*);
>
>                         String s = cache1.get(key);
>                         s = s+*"#Modified"*;
>                         cache1.put(key,s);
>                     }
>             );
>         }
>         *tx.rollback();*
>         System.*out*.println(*"RolledBack..."*);
>         *for *(*int *i = 0; i < 10; i++)
>             System.*out*.println(*"Got [key=" *+ i + *", val=" *+ 
> cache.get(i) + *']'*);
>     }
>
> }
>
>
>
> Thanks,
> Prasad
>



-- 
Best regards,
Ilya

Reply via email to