You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Rafael Troilo <ra...@uni-heidelberg.de> on 2017/01/30 15:49:37 UTC

Datastreamer ignores Persitent Store

Hello everybody,

the DataStreamer ignores the underlying store. Do I miss something?

Here is my test code:

// CacheConfiguration
public static CacheConfiguration<Integer, String> getCacheConfig() {
         CacheJdbcBlobStoreFactory<Integer, String> blobStore = new 
CacheJdbcBlobStoreFactory<>();
         blobStore.setUser("sa");
         blobStore.setConnectionUrl("jdbc:h2:./test");

         CacheConfiguration<Integer, String> cfg = new 
CacheConfiguration<>("test_cache");
         cfg.setCacheStoreFactory(blobStore);
         cfg.setReadThrough(true);
         cfg.setWriteThrough(true);
         cfg.setWriteBehindEnabled(true);
         return cfg;
}

// first write to store, then read from it
public void test(){
         try (Ignite ignite = Ignition.start()) {
             IgniteCache<Integer, String> cache = 
ignite.getOrCreateCache(getCacheConfig());
             IgniteDataStreamer<Integer, String> streamer = 
ignite.dataStreamer(cache.getName());
             streamer.skipStore(false);

             cache.put(1, "put");
             streamer.addData(4, "stream");
             streamer.flush();

             System.out.println("Write to Store:");
             System.out.println("1: "+ cache.get(1));
             System.out.println("4: "+ cache.get(4));

         }
         try (Ignite ignite = Ignition.start()) {
             IgniteCache<Integer, String> cache = 
ignite.getOrCreateCache(getCacheConfig());
             cache.loadCache(null);

             System.out.println("Read from Store:");
             System.out.println("1: "+ cache.get(1));
             System.out.println("4: "+ cache.get(4));
         }
}


The Result is:

Write to Store:
1: put
4: stream

Read from Store:
1: put
4: null


Thank you.

Best,
Rafael



-- 
Rafael Troilo, Dipl.-Inform. (FH)
    GIScience Research Group
   
    Heidelberg Institute for Geoinformation Technology

    rafael.troilo@uni-heidelberg.de
    http://giscience.uni-hd.de
    http://www.geog.uni-heidelberg.de/gis/heigit.html
   
    Berliner Str. 45 (Mathematikon), D-69120 Heidelberg, Germany
    fon: +49(0)6221 / 54 / 19704


Re: Datastreamer ignores Persitent Store

Posted by vkulichenko <va...@gmail.com>.
Rafael,

Basically allowOverwrite=false is intended for initial data loading. For
this task write-through doesn't make sense.

-Val



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Datastreamer-ignores-Persitent-Store-tp10312p10348.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Datastreamer ignores Persitent Store

Posted by Rafael Troilo <ra...@uni-heidelberg.de>.
Hi Val,

thank you!

Perfekt, with allowOverwrite it works!

But why do I need the overwrite flag. Is this an intended behavior?
Because the cache was empty before, so nothing gets overwritten.

But for me it is fine to use allowOverwrite.

Cheer,
Rafael



On 01/31/2017 12:27 AM, vkulichenko wrote:
> Hi Rafael,
>
> Please try to set allowOverwrite flag before streaming:
>
> streamer.allowOverwrite(true);
>
> -Val
>
>
>
> --
> View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Datastreamer-ignores-Persitent-Store-tp10312p10323.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.

-- 
Rafael Troilo, Dipl.-Inform. (FH)
    GIScience Research Group
   
    Heidelberg Institute for Geoinformation Technology

    rafael.troilo@uni-heidelberg.de
    http://giscience.uni-hd.de
    http://www.geog.uni-heidelberg.de/gis/heigit.html
   
    Berliner Str. 45 (Mathematikon), D-69120 Heidelberg, Germany
    fon: +49(0)6221 / 54 / 19704


Re: Datastreamer ignores Persitent Store

Posted by vkulichenko <va...@gmail.com>.
Hi Rafael,

Please try to set allowOverwrite flag before streaming:

streamer.allowOverwrite(true);

-Val



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Datastreamer-ignores-Persitent-Store-tp10312p10323.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.