How to configure H2 indexing spi?

classic Classic list List threaded Threaded
5 messages Options
Romain Gilles Romain Gilles
Reply | Threaded
Open this post in threaded view
|

How to configure H2 indexing spi?

Hi all,

I'm trying to migrate from gridgain 6 to ignite 1.

I use to configure my H2 indexing as follow:


GridH2IndexingSpi gridH2IndexingSpi = new GridH2IndexingSpi();
gridH2IndexingSpi.setDefaultIndexPrimitiveKey(true);
gridH2IndexingSpi.setDefaultEscapeAll(true);
configuration.setIndexingSpi(gridH2IndexingSpi);

But Event after added the indexing jar into my maven project I was not able to find the corresponding implementation of the GridH2IndexingSpi.


<dependency>
    <groupId>org.apache.ignite</groupId>
    <artifactId>ignite-indexing</artifactId>
</dependency>


Could you please help me. I'm really interesting in the EscapeAll option.


Thanks in advance,


Romain.

"Misys" is the trade name of the Misys group of companies. This email and any attachments have been scanned for known viruses using multiple scanners. This email message is intended for the named recipient only. It may be privileged and/or confidential. If you are not the named recipient of this email please notify us immediately and do not copy it or use it for any purpose, nor disclose its contents to any other person. This email does not constitute the commencement of legal relations between you and Misys. Please refer to the executed contract between you and the relevant member of the Misys group for the identity of the contracting party with which you are dealing.
Romain Gilles Romain Gilles
Reply | Threaded
Open this post in threaded view
|

Re: How to configure H2 indexing spi?

This post was updated on .
So I found the solution for the gridH2IndexingSpi.setDefaultEscapeAll(true) at least. This option has move to the CacheConfiguration class: cacheConfiguration.setSqlEscapeAll(true)

Not yet found the option for gridH2IndexingSpi.setDefaultIndexPrimitiveKey(true) but work in progress...

Regards,

Romain.
alexey.goncharuk alexey.goncharuk
Reply | Threaded
Open this post in threaded view
|

Re: How to configure H2 indexing spi?

Romain,

In Ignite H2 indexing became the default mechanism, thus there is no H2 IndexingSPI anymore. Even though there is a way to set an indexing SPI, it is intended for other query implementations. 

Former H2 indexing SPI properties were moved to cache configuration and CacheTypeMetadata. As for the setDefaultIndexPrimitiveKey property, you simply need to include your key-value type pair into CacheConfiguration.setIndexedTypes like this:

cacheCfg.setIndexedTypes(Integer.class, MyValue.class)

Hope this helps!

2015-05-20 14:11 GMT-07:00 Romain Gilles <[hidden email]>:
So I found the solution for the gridH2IndexingSpi.setDefaultEscapeAll(true)
at least. This option has move to the CacheConfiguration object.

Not yet found the option for
gridH2IndexingSpi.setDefaultIndexPrimitiveKey(true) but work in progress...

Regards,

Romain.



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/How-to-configure-H2-indexing-spi-tp349p350.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Romain Gilles Romain Gilles
Reply | Threaded
Open this post in threaded view
|

Re: How to configure H2 indexing spi?

This post was updated on .
Hi,
First thank you for the clarification. Secondly, when do you need to index the key. For example if I do a cache.get(myKey) do you use the indexing part for that?
In my case keys are just opaque identifiers where only their hash and equals are important / relevant.

Regards,

Romain
Sergi Vladykin Sergi Vladykin
Reply | Threaded
Open this post in threaded view
|

Re: How to configure H2 indexing spi?

Romian,


First thank you for the clarification. Secondly, when do you need to index
the key.

Please read carefully javadoc for CacheConfiguration.setIndexedTypes method. It is not just an array of indexed types, it is a array of key-value type pairs. This pair is needed to construct SQL table correctly (Ignite allows you to expose SQL fields for key as well as for value).
 
For example if I do a cache.get(myKey) do you use the indexing part
for that?

Operation cache.get(key) has nothing to do with indexes.
 
In my case key are just opaque identifier where only its has and its equals
are important / relevant.
 
Since indexes are sorted data structures and key is always indexed it is preferable to implement Comparable for key as well.
The same for any other indexed fields.
 
Sergi


Regards,

Romain



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/How-to-configure-H2-indexing-spi-tp349p358.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.