You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by zhaogxd <zh...@gmail.com> on 2016/09/22 04:25:33 UTC

Cannot query on a cache using Cassandra as a persistent store

Hi,

I am in the process of trying out the Ignite Cassandra integration feature.
I was able to setup a Java project to launch an ignite node using the
configuration files presented in the Cassandra Integration- Example page (
https://apacheignite.readme.io/docs/examples
<https://apacheignite.readme.io/docs/examples>  ) with a little changes
specific to my environment. One of my caches is configured as following in
order to try POJO persistence strategy:

                
                <bean
class="org.apache.ignite.configuration.CacheConfiguration">
                    <property name="name" value="cache3"/>
                    <property name="readThrough" value="true"/>
                    <property name="writeThrough" value="true"/>
		    <property name="indexedTypes" value="java.lang.Long,
org.apache.ignite.tests.pojos.Person"/>
                    <property name="cacheStoreFactory">
                        <bean
class="org.apache.ignite.cache.store.cassandra.CassandraCacheStoreFactory">
                            <property name="dataSourceBean"
value="cassandraAdminDataSource"/>
                            <property name="persistenceSettingsBean"
value="cache3_persistence_settings"/>
                        </bean>
                    </property>
                </bean>

Noted that I have indexedTypes defined in order to run query against this
cache with following codes:

			IgniteCache<Long, Person> cache3 = ignite.cache("cache3");			

			SimpleDateFormat ft = new SimpleDateFormat ("yyyy-MM-dd"); 			
			Person p1 = new Person(1, "Tom", "Zhang", 30, false, 170, 150,
ft.parse("1970-12-01"), Arrays.asList("123", "234", "456"));
			Person p2 = new Person(2, "Frank", "Lee", 35, false, 170, 150,
ft.parse("1978-12-01"), Arrays.asList("123", "234", "456"));
			Person p3 = new Person(3, "Bob", "Liu", 40, false, 170, 150,
ft.parse("1976-12-01"), Arrays.asList("123", "234", "456"));

			cache3.put((long)1, p1);
			cache3.put((long)2, p2);
			cache3.put((long)3, p3);
			
			//All persons with age greater than 30
			//=======================================
			SqlQuery<Long, Person> qry1 =
					new SqlQuery<>(Person.class, "select * from Person where age > ?");
		
			qry1.setArgs(30);
			List<Entry&lt;Long, Person>> res1 = cache3.query(qry1).getAll();
		
			ExamplesUtils.printQueryResults(res1);


Then, I got following exceptions:

Exception in thread "main" javax.cache.CacheException: Failed to parse
query: SELECT "cache3".Person._key, "cache3".Person._val from Person where
age > ?
	at
org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.queryTwoStep(IgniteH2Indexing.java:1137)
	at
org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.queryTwoStep(IgniteH2Indexing.java:1043)
	at
org.apache.ignite.internal.processors.query.GridQueryProcessor$3.applyx(GridQueryProcessor.java:758)
	at
org.apache.ignite.internal.processors.query.GridQueryProcessor$3.applyx(GridQueryProcessor.java:756)
	at
org.apache.ignite.internal.util.lang.IgniteOutClosureX.apply(IgniteOutClosureX.java:36)
	at
org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuery(GridQueryProcessor.java:1666)
	at
org.apache.ignite.internal.processors.query.GridQueryProcessor.queryTwoStep(GridQueryProcessor.java:756)
	at
org.apache.ignite.internal.processors.cache.IgniteCacheProxy.query(IgniteCacheProxy.java:687)
	at com.sumumind.ignite_test.igniteCassandra.main(igniteCassandra.java:86)
Caused by: org.h2.jdbc.JdbcSQLException: Column "AGE" not found; SQL
statement:
SELECT "cache3".Person._key, "cache3".Person._val from Person where age > ?
[42122-191]
	at org.h2.message.DbException.getJdbcSQLException(DbException.java:345)
	at org.h2.message.DbException.get(DbException.java:179)
	at org.h2.message.DbException.get(DbException.java:155)
	at org.h2.expression.ExpressionColumn.optimize(ExpressionColumn.java:147)
	at org.h2.expression.Comparison.optimize(Comparison.java:178)
	at org.h2.command.dml.Select.prepare(Select.java:855)
	at org.h2.command.Parser.prepareCommand(Parser.java:257)
	at org.h2.engine.Session.prepareLocal(Session.java:560)
	at org.h2.engine.Session.prepareCommand(Session.java:501)
	at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1188)
	at org.h2.jdbc.JdbcPreparedStatement.<init>(JdbcPreparedStatement.java:73)
	at org.h2.jdbc.JdbcConnection.prepareStatement(JdbcConnection.java:276)
	at
org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.prepareStatement(IgniteH2Indexing.java:406)
	at
org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.queryTwoStep(IgniteH2Indexing.java:1121)
	... 8 more

My question is how to make the cache3 or Person table queryable? Did I do
anything wrong in either the configuration or Java code?

Thanks!

Guang





--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Cannot-query-on-a-cache-using-Cassandra-as-a-persistent-store-tp7870.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Cannot query on a cache using Cassandra as a persistent store

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

First of all I would check logs on all nodes for any exception or assertion.
Is there anything suspicious?

-Val



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Cannot-query-on-a-cache-using-Cassandra-as-a-persistent-store-tp7870p8093.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Cannot query on a cache using Cassandra as a persistent store

Posted by zhaogxd <zh...@gmail.com>.
Hi Igor,

It is good to know that a cache can be created dynamically through the code,
so I started to try it out using  a simple approach:
1) Copied file
org/apache/ignite/tests/persistence/pojo/persistence-settings-3.xml to
persistence-settings-4.xml
2) Assigned a new Cassandra table name in persistence-settings-4.xml
3) Started an Ignite server node from a Window 10 cmd dialog
4) Ran following code to create a new cache called 'cache5':

	public static void main(String[] args) throws ParseException {
		//Start an ignite client node
		Ignition.setClientMode(true);		
		try (Ignite ignite =
Ignition.start("examples/config/cassandra/example-cassandra.xml")) {
			
            //Create a new cache in Java
			CacheConfiguration<PersonId, Person> pcfg = new
CacheConfiguration<>("cache5");
						
			pcfg.setIndexedTypes(PersonId.class, Person.class);
			pcfg.setReadThrough(true);
			pcfg.setWriteThrough(true);

//			DataSource cAdminDataSource = new DataSource();
//			cAdminDataSource.setCredentials(new CassandraAdminCredentials()); 
//		
cAdminDataSource.setContactPoints(CassandraHelper.getContactPointsArray());
//			cAdminDataSource.setReadConsistency("ONE");
//			cAdminDataSource.setWriteConsistency("ONE");
			File kvpsf = new
File("C:\\mySoft\\apache-ignite-fabric-1.7.0-bin\\examples\\config\\cassandra\\persistence\\pojo\\persistence-settings-4.xml");
			KeyValuePersistenceSettings kvps = new
KeyValuePersistenceSettings(kvpsf);
			
			CassandraCacheStoreFactory<PersonId, Person> ccsf = new
CassandraCacheStoreFactory<>();
			//ccsf.setDataSource(cAdminDataSource); //Don't work!?
			ccsf.setDataSourceBean("cassandraAdminDataSource");
			ccsf.setPersistenceSettings(kvps);
			pcfg.setCacheStoreFactory(ccsf);
			
			IgniteCache<PersonId, Person> cache5 = ignite.getOrCreateCache(pcfg);

            System.out.println("Cache5 size:" + cache5.size());

			SimpleDateFormat ft = new SimpleDateFormat ("yyyy-MM-dd"); 			
			Person p1 = new Person(1, "Tom", "Zhang", 30, false, 170, 150,
ft.parse("1970-12-01"), Arrays.asList("123", "234", "456"));
			Person p2 = new Person(2, "Frank", "Lee", 35, false, 170, 150,
ft.parse("1978-12-01"), Arrays.asList("123", "234", "456"));
			Person p3 = new Person(3, "Bob", "Liu", 40, false, 170, 150,
ft.parse("1976-12-01"), Arrays.asList("123", "234", "456"));

			Person p4 = new Person(4, "Tom", "Lee", 45, false, 170, 150,
ft.parse("1970-12-01"), Arrays.asList("123", "234", "456"));
			Person p5 = new Person(5, "Frank", "Wang", 40, false, 170, 150,
ft.parse("1978-12-01"), Arrays.asList("123", "234", "456"));
			Person p6 = new Person(6, "Bob", "Lu", 42, false, 170, 150,
ft.parse("1976-12-01"), Arrays.asList("123", "234", "456"));
			
			PersonId pid1 = new PersonId("Facebook", "Dev", 1);
			PersonId pid2 = new PersonId("Facebook", "Dev", 2);
			PersonId pid3 = new PersonId("Facebook", "AAG", 3);

			PersonId pid4 = new PersonId("Google", "Dev", 4);
			PersonId pid5 = new PersonId("Google", "Dev", 5);
			PersonId pid6 = new PersonId("Google", "AAG", 6);
			
            System.out.println("Populate some data into cache5...");
            
			cache5.put(pid1, p1);
			cache5.put(pid2, p2);
			cache5.put(pid3, p3);
			
			cache5.put(pid4, p4);
			cache5.put(pid5, p5);
			cache5.put(pid6, p6);
			

            System.out.println("Cache5 size:" + cache5.size());
		}			
		System.out.println("Finished!");
	}

It was nice that the cache5 was created and populated successfully as
expected.

Then I assumed that I need to add more data to the cache5, so I just run the
same code again with more person and personId objects added. This time, the
procedure get stuck with following warning:

/23:15:08,936  WARN [main] - Failed to wait for initial partition map
exchange. Possible reasons are: 
  ^-- Transactions in deadlock.
  ^-- Long running transactions (ignore if this is the case).
  ^-- Unreleased explicit locks./

I did some googling on this warning, and it seems there could be many reason
causing this problem. But for my case, do you think what the cause could be?
Why cannot I add data to cache5 more than once?

Besides, I was also wondering if the same configuration is required for
starting an additional ignite node successfully whether it is server node or
client node?

I also noticed that on the Windows cmd screen in which my ignite server node
was started, if I click the ctrl+c, many exception messages (see below) were
show up when my code ran into above warning, but the node seemed still
functioning:

/23:15:33,788  WARN [grid-nio-worker-1-#44%null%] - Failed to process
selector key (will close): GridSelectorNioSessionImpl [selectorIdx=1,
queueSize=0, writeBuf=java.nio.DirectByteBuffer[pos=0 lim=32768 cap=32768],
readBuf=java.nio.DirectByteBuffer[pos=0 lim=32768 cap=32768],
recovery=GridNioRecoveryDescriptor [acked=0, resendCnt=0, rcvCnt=7,
sentCnt=0, reserved=true, lastAck=7, nodeLeft=false, node=TcpDiscoveryNode
[id=371afde8-c4d5-452f-a25b-7da97d983214, addrs=[0:0:0:0:0:0:0:1, 127.0.0.1,
192.168.1.73, 192.168.188.1, 192.168.56.1,
2001:569:7222:9a00:5529:93af:1491:9f5f,
2001:569:7222:9a00:b1dd:1553:c502:2ccc],
sockAddrs=[DESKTOP-SGS5CHU.telus/192.168.1.73:0, /0:0:0:0:0:0:0:1:0,
/127.0.0.1:0, /2001:569:7222:9a00:b1dd:1553:c502:2ccc:0,
DESKTOP-SGS5CHU/192.168.188.1:0, /192.168.56.1:0,
/2001:569:7222:9a00:5529:93af:1491:9f5f:0], discPort=0, order=4, intOrder=3,
lastExchangeTime=1475216038662, loc=false, ver=1.7.0#20160801-sha1:383273e3,
isClient=true], connected=true, connectCnt=0, queueLimit=5120,
reserveCnt=1], super=GridNioSessionImpl [locAddr=/127.0.0.1:47100,
rmtAddr=/127.0.0.1:3595, createTime=1475216038938, closeTime=0,
bytesSent=35, bytesRcvd=163, sndSchedTime=1475216131853,
lastSndTime=1475216047835, lastRcvTime=1475216131853, readsPaused=false,
filterChain=FilterChain[filters=[GridNioCodecFilter
[parser=o.a.i.i.util.nio.GridDirectParser@5bd2917c, directMode=true],
GridConnectionBytesVerifyFilter], accepted=true]]
23:14:01,845  INFO [grid-timeout-worker-#41%null%] -
Metrics for local node (to disable set 'metricsLogFrequency' to 0)
    ^-- Node [id=e5b0ddf0, name=null, uptime=00:01:00:013]
    ^-- H/N/C [hosts=1, nodes=2, CPUs=8]
    ^-- CPU [cur=0.6%, avg=0.34%, GC=0%]
    ^-- Heap [used=169MB, free=82.72%, comm=981MB]
    ^-- Non heap [used=50MB, free=96.7%, comm=51MB]
    ^-- Public thread pool [active=0, idle=16, qSize=0]
    ^-- System thread pool [active=0, idle=16, qSize=0]
    ^-- Outbound messages queue [size=0]
23:30:49,771  WARN [grid-nio-worker-1-#44%null%] - Closing NIO session
because of unhandled exception [cls=class o.a.i.i.util.nio.GridNioException,
msg=An existing connection was forcibly closed by the remote host]
23:30:49,797 ERROR [exchange-worker-#57%null%] - <ignite-sys-cache> Failed
to send affinity assignment response to remote node [node=TcpDiscoveryNode
[id=371afde8-c4d5-452f-a25b-7da97d983214, addrs=[0:0:0:0:0:0:0:1, 127.0.0.1,
192.168.1.73, 192.168.188.1, 192.168.56.1,
2001:569:7222:9a00:5529:93af:1491:9f5f,
2001:569:7222:9a00:b1dd:1553:c502:2ccc],
sockAddrs=[DESKTOP-SGS5CHU.telus/192.168.1.73:0, /0:0:0:0:0:0:0:1:0,
/127.0.0.1:0, /2001:569:7222:9a00:b1dd:1553:c502:2ccc:0,
DESKTOP-SGS5CHU/192.168.188.1:0, /192.168.56.1:0,
/2001:569:7222:9a00:5529:93af:1491:9f5f:0], discPort=0, order=4, intOrder=3,
lastExchangeTime=1475216038662, loc=false, ver=1.7.0#20160801-sha1:383273e3,
isClient=true]]
class org.apache.ignite.internal.cluster.ClusterTopologyCheckedException:
Node left grid while sending message to:
371afde8-c4d5-452f-a25b-7da97d983214
        at
org.apache.ignite.internal.processors.cache.GridCacheIoManager.send(GridCacheIoManager.java:837)
        at
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPreloader$6.apply(GridDhtPreloader.java:619)
        at
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPreloader$6.apply(GridDhtPreloader.java:597)
        at
org.apache.ignite.internal.util.future.GridFutureAdapter.notifyListener(GridFutureAdapter.java:263)
        at
org.apache.ignite.internal.util.future.GridFutureAdapter.notifyListeners(GridFutureAdapter.java:251)
        at
org.apache.ignite.internal.util.future.GridFutureAdapter.onDone(GridFutureAdapter.java:381)
        at
org.apache.ignite.internal.util.future.GridFutureAdapter.onDone(GridFutureAdapter.java:347)
        at
org.apache.ignite.internal.processors.affinity.GridAffinityAssignmentCache$AffinityReadyFuture.onDone(GridAffinityAssignmentCache.java:592)
        at
org.apache.ignite.internal.processors.affinity.GridAffinityAssignmentCache$AffinityReadyFuture.onDone(GridAffinityAssignmentCache.java:573)
        at
org.apache.ignite.internal.util.future.GridFutureAdapter.onDone(GridFutureAdapter.java:324)
        at
org.apache.ignite.internal.processors.affinity.GridAffinityAssignmentCache.clientEventTopologyChange(GridAffinityAssignmentCache.java:312)
        at
org.apache.ignite.internal.processors.cache.CacheAffinitySharedManager$7.applyx(CacheAffinitySharedManager.java:634)
        at
org.apache.ignite.internal.processors.cache.CacheAffinitySharedManager$7.applyx(CacheAffinitySharedManager.java:630)
        at
org.apache.ignite.internal.util.lang.IgniteInClosureX.apply(IgniteInClosureX.java:38)
        at
org.apache.ignite.internal.processors.cache.CacheAffinitySharedManager.forAllCaches(CacheAffinitySharedManager.java:715)
        at
org.apache.ignite.internal.processors.cache.CacheAffinitySharedManager.onClientEvent(CacheAffinitySharedManager.java:630)
        at
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture.onClientNodeEvent(GridDhtPartitionsExchangeFuture.java:619)
        at
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture.init(GridDhtPartitionsExchangeFuture.java:464)
        at
org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$ExchangeWorker.body(GridCachePartitionExchangeManager.java:1440)
        at
org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:110)
        at java.lang.Thread.run(Thread.java:745)
Caused by: class org.apache.ignite.IgniteCheckedException: Failed to send
message (node may have left the grid or TCP connection cannot be established
due to firewall issues) [node=TcpDiscoveryNode
[id=371afde8-c4d5-452f-a25b-7da97d983214, addrs=[0:0:0:0:0:0:0:1, 127.0.0.1,
192.168.1.73, 192.168.188.1, 192.168.56.1,
2001:569:7222:9a00:5529:93af:1491:9f5f,
2001:569:7222:9a00:b1dd:1553:c502:2ccc],
sockAddrs=[DESKTOP-SGS5CHU.telus/192.168.1.73:0, /0:0:0:0:0:0:0:1:0,
/127.0.0.1:0, /2001:569:7222:9a00:b1dd:1553:c502:2ccc:0,
DESKTOP-SGS5CHU/192.168.188.1:0, /192.168.56.1:0,
/2001:569:7222:9a00:5529:93af:1491:9f5f:0], discPort=0, order=4, intOrder=3,
lastExchangeTime=1475216038662, loc=false, ver=1.7.0#20160801-sha1:383273e3,
isClient=true], topic=TOPIC_CACHE, msg=GridDhtAffinityAssignmentResponse
[topVer=AffinityTopologyVersion [topVer=4, minorTopVer=0],
affAssignment=null], policy=4]
        at
org.apache.ignite.internal.managers.communication.GridIoManager.send(GridIoManager.java:1309)
        at
org.apache.ignite.internal.managers.communication.GridIoManager.send(GridIoManager.java:1373)
        at
org.apache.ignite.internal.processors.cache.GridCacheIoManager.send(GridCacheIoManager.java:831)
        ... 20 more
Caused by: class org.apache.ignite.spi.IgniteSpiException: Failed to send
message to remote node: TcpDiscoveryNode
[id=371afde8-c4d5-452f-a25b-7da97d983214, addrs=[0:0:0:0:0:0:0:1, 127.0.0.1,
192.168.1.73, 192.168.188.1, 192.168.56.1,
2001:569:7222:9a00:5529:93af:1491:9f5f,
2001:569:7222:9a00:b1dd:1553:c502:2ccc],
sockAddrs=[DESKTOP-SGS5CHU.telus/192.168.1.73:0, /0:0:0:0:0:0:0:1:0,
/127.0.0.1:0, /2001:569:7222:9a00:b1dd:1553:c502:2ccc:0,
DESKTOP-SGS5CHU/192.168.188.1:0, /192.168.56.1:0,
/2001:569:7222:9a00:5529:93af:1491:9f5f:0], discPort=0, order=4, intOrder=3,
lastExchangeTime=1475216038662, loc=false, ver=1.7.0#20160801-sha1:383273e3,
isClient=true]
        at
org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi.sendMessage0(TcpCommunicationSpi.java:1996)
        at
org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi.sendMessage(TcpCommunicationSpi.java:1936)
        at
org.apache.ignite.internal.managers.communication.GridIoManager.send(GridIoManager.java:1304)
        ... 22 more
Caused by: class org.apache.ignite.IgniteCheckedException: Failed to connect
to node (is node still alive?). Make sure that each ComputeTask and cache
Transaction has a timeout set in order to prevent parties from waiting
forever in case of network issues
[nodeId=371afde8-c4d5-452f-a25b-7da97d983214, addrs=[/127.0.0.1:47101,
/0:0:0:0:0:0:0:1:47101, /192.168.56.1:47101,
/2001:569:7222:9a00:b1dd:1553:c502:2ccc:47101,
DESKTOP-SGS5CHU/192.168.188.1:47101,
/2001:569:7222:9a00:5529:93af:1491:9f5f:47101,
DESKTOP-SGS5CHU.telus/192.168.1.73:47101]]
/

Could you please explain how the server node console works?

Thanks so much!

Guang





--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Cannot-query-on-a-cache-using-Cassandra-as-a-persistent-store-tp7870p8030.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Cannot query on a cache using Cassandra as a persistent store

Posted by Igor Rudyak <ir...@gmail.com>.
Hi Guang,

If Cassandra table structure changed you should also change Ignite cache
mapping settings specified by Cassandra persistence descriptor. For this,
you need to destroy and recreate your cache or you can just create another
cache with the most actual mapping settings.

Yes you are free to create your Ignite caches dynamically through the code.

Regarding the strategy it all depends on your specific case. If for example
you are using POJO persistence strategy and changed Cassandra table schema
(added or removed some columns), for these changes to be reflected in Ignite
cache, you need:

1) Implement new java POJO class which will reflect new structure of
Cassandra table
2) Prepare new Cassandra persistence descriptor which handles all the
mappings between Ignite and Cassandra
3) Refresh cache mapping settings and reload data set into memory, either by
creating new cache or recreating the previous one



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Cannot-query-on-a-cache-using-Cassandra-as-a-persistent-store-tp7870p7950.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Cannot query on a cache using Cassandra as a persistent store

Posted by zhaogxd <zh...@gmail.com>.
Hi Igor,

The Cassandra Parallel Data Loader is really a great feature, I will
definitely give it a try when it is released.

Thinking about making schema changes in production environment, if the
underline Cassandra table structure is changed, such as adding or dropping a
column, do I have to destroy and re-create the cache associated with the
table? 

If a new table is added to Cassandra, can I create a cache dynamically
through the codes that run as a ignite client rather than shutdown the
cluster and update the configuration files?

What strategy should I use to ensure my application gets upgraded without
taking the whole cluster down or re-loading a big data set into memory?

Thanks so much!

Guang



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Cannot-query-on-a-cache-using-Cassandra-as-a-persistent-store-tp7870p7939.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Cannot query on a cache using Cassandra as a persistent store

Posted by Igor Rudyak <ir...@gmail.com>.
Hi Guang, 

You can specify your custom IgniteBiPredicate implementation if you need
some custom pre-processing for each key-value pair loaded from persistent
store.

Yes you can pass more that one query using something like that:

cache3.loadCache(null, "select * from my_table_1", "select * from my_table_2
where id=xxx and time > yyy");

According your last question where you want to query the whole Cassandra
table which doesn't fit into Cache memory - you should implement your custom
logic for this case. It's rather complicated and there are no common
solution which works for all situations. 

In the nearest future it's also will be available to download portion of
Cassandra data in parallel, by utilizing all the nodes of Ignite cluster:
https://issues.apache.org/jira/browse/IGNITE-3962



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Cannot-query-on-a-cache-using-Cassandra-as-a-persistent-store-tp7870p7931.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Cannot query on a cache using Cassandra as a persistent store

Posted by zhaogxd <zh...@gmail.com>.
Cool, it worked!

Since I am newbie, would you mind to explain the two input parameters for
loadCache method? Based on the warning (below) raised in Eclipse for this
line of code, I can see the first parameter is IgniteBiPredicate type. How
should this parameter be used? Can I pass more than one queries in the
second parameter for data retrieval? 

/"Type String[] of the last argument to method
loadCache(*IgniteBiPredicate<Long,Person>*, Object...) doesn't exactly match
the vararg parameter type. Cast to Object[] to confirm the non-varargs
invocation, or pass individual arguments of type Object for a varargs
invocation."/

Most importantly, if the data volume in a Cassandra table is too big to fit
into the memory a node has, what options are available in Ignite to still
make the whole data in the Cassandra table queryable? In that case, would
portion of the data be loaded into Cache, and extra data would be loaded
automatically from Cassandra when required by a query?

Thanks,

Guang  





--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Cannot-query-on-a-cache-using-Cassandra-as-a-persistent-store-tp7870p7929.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Cannot query on a cache using Cassandra as a persistent store

Posted by Igor Rudyak <ir...@gmail.com>.
Hi Guang,

Try this:  

*cache3.loadCache(null, new String[] {"select * from test1.pojo_test3 limit
10"});*



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Cannot-query-on-a-cache-using-Cassandra-as-a-persistent-store-tp7870p7918.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Cannot query on a cache using Cassandra as a persistent store

Posted by zhaogxd <zh...@gmail.com>.
Hi Val,

You are right! There is no @QuerySqlField on any of the fields in Person
class.

After adding this annotation to the getter of Age field, I was able to query
on the Age field. 

    /** */
    @SuppressWarnings("UnusedDeclaration")
    *@QuerySqlField (name = "age", index = true)*
    public int getAge() {
        return age;
    }

Now I come to another question, hope you can help.

Since I got some data populated into the Cassandra table from Ignite
already, I want to get the data loaded into the cache next time when I start
the ignite node without repopulating it. I tried following codes for this
purpose, then ran a query against cache3, but it always returned empty.  

	    IgniteCache<Long, Person> cache3 = ignite.cache("cache3");			
            cache3.loadCache(null); 

What is the right way to do so?

Thanks!

Guang



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Cannot-query-on-a-cache-using-Cassandra-as-a-persistent-store-tp7870p7915.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Cannot query on a cache using Cassandra as a persistent store

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

Please show the source of the Person class. Does the 'age' field has
@QuerySqlField on it?

-Val



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Cannot-query-on-a-cache-using-Cassandra-as-a-persistent-store-tp7870p7893.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.