ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrey Mashenkov <andrey.mashen...@gmail.com>
Subject Re: Ignite/Cassandra failing to use supplied value for where clause
Date Thu, 09 Nov 2017 13:42:30 GMT
I can't reproduce the issue.
Is it possible you try to get value for key with 'null' id field?

On Fri, Nov 3, 2017 at 5:28 AM, Kenan Dalley <kenan.dalley@gm.com> wrote:

> Hi Andrey,
>
> I tried taking pieces from your example and I still couldn't make it work.
> First, I removed the annotations out of the POJOs and physically mapped the
> information in the persistence settings. Still got the error with "my_id".
> Second, I tried adding the QueryEntity xml config you had. Again, still got
> the null error with "my_id". Below, I'm going to post the bare-minimum that
> I'm trying to get to work without any extra coding and see if anyone can
> duplicate, or fix, what I'm doing.
>
>
> Also, I noticed that you're putting data into the cache and then pulling
> it out. I am specifically trying not to do that. I'm trying to get Ignite
> to pull data from C* into the cache directly with a cache-miss (basically,
> the cache is empty when trying to get the data). I cannot assume that the
> data is already there.
>
> ================================= Error
>
> [21:41:05] Ignite node stopped OK [uptime=00:00:02:833]
> Exception in thread "main" javax.cache.integration.CacheLoaderException: class org.apache.ignite.IgniteException:
Failed to execute Cassandra CQL statement: select "column_1", "column_2", "column_3", "column_4",
"column_5", "column_6", "column_7", "column_8", "column_9" from "dev_qlty"."test1" where "my_id"=?;
> 	at org.apache.ignite.internal.processors.cache.store.GridCacheStoreManagerAdapter.loadFromStore(GridCacheStoreManagerAdapter.java:327)
> 	at org.apache.ignite.internal.processors.cache.store.GridCacheStoreManagerAdapter.load(GridCacheStoreManagerAdapter.java:282)
> 	at org.apache.ignite.internal.processors.cache.store.GridCacheStoreManagerAdapter.loadAllFromStore(GridCacheStoreManagerAdapter.java:418)
> 	at org.apache.ignite.internal.processors.cache.store.GridCacheStoreManagerAdapter.loadAll(GridCacheStoreManagerAdapter.java:384)
> 	at org.apache.ignite.internal.processors.cache.GridCacheAdapter$15.call(GridCacheAdapter.java:2024)
> 	at org.apache.ignite.internal.processors.cache.GridCacheAdapter$15.call(GridCacheAdapter.java:2022)
> 	at org.apache.ignite.internal.util.IgniteUtils.wrapThreadLoader(IgniteUtils.java:6608)
> 	at org.apache.ignite.internal.processors.closure.GridClosureProcessor$2.body(GridClosureProcessor.java:959)
> 	at org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:110)
> 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
> 	at java.lang.Thread.run(Thread.java:745)
> Caused by: class org.apache.ignite.IgniteException: Failed to execute Cassandra CQL statement:
select "column_1", "column_2", "column_3", "column_4", "column_5", "column_6", "column_7",
"column_8", "column_9" from "dev_qlty"."test1" where "my_id"=?;
> 	at org.apache.ignite.cache.store.cassandra.session.CassandraSessionImpl.execute(CassandraSessionImpl.java:185)
> 	at org.apache.ignite.cache.store.cassandra.CassandraCacheStore.load(CassandraCacheStore.java:189)
> 	at org.apache.ignite.internal.processors.cache.CacheStoreBalancingWrapper.load(CacheStoreBalancingWrapper.java:98)
> 	at org.apache.ignite.internal.processors.cache.store.GridCacheStoreManagerAdapter.loadFromStore(GridCacheStoreManagerAdapter.java:316)
> 	... 11 more
> Caused by: class org.apache.ignite.IgniteException: Failed to execute Cassandra CQL statement:
select "column_1", "column_2", "column_3", "column_4", "column_5", "column_6", "column_7",
"column_8", "column_9" from "dev_qlty"."test1" where "my_id"=?;
> 	at org.apache.ignite.cache.store.cassandra.session.CassandraSessionImpl.execute(CassandraSessionImpl.java:167)
> 	... 14 more
> Caused by: com.datastax.driver.core.exceptions.InvalidQueryException: Invalid null value
in condition for column my_id
> 	at com.datastax.driver.core.exceptions.InvalidQueryException.copy(InvalidQueryException.java:50)
> 	at com.datastax.driver.core.DriverThrowables.propagateCause(DriverThrowables.java:37)
> 	at com.datastax.driver.core.DefaultResultSetFuture.getUninterruptibly(DefaultResultSetFuture.java:245)
> 	at com.datastax.driver.core.AbstractSession.execute(AbstractSession.java:63)
> 	at org.apache.ignite.cache.store.cassandra.session.CassandraSessionImpl.execute(CassandraSessionImpl.java:144)
> 	... 14 more
> Caused by: com.datastax.driver.core.exceptions.InvalidQueryException: Invalid null value
in condition for column my_id
> 	at com.datastax.driver.core.Responses$Error.asException(Responses.java:136)
> 	at com.datastax.driver.core.DefaultResultSetFuture.onSet(DefaultResultSetFuture.java:179)
> 	at com.datastax.driver.core.RequestHandler.setFinalResult(RequestHandler.java:184)
> 	at com.datastax.driver.core.RequestHandler.access$2500(RequestHandler.java:43)
> 	at com.datastax.driver.core.RequestHandler$SpeculativeExecution.setFinalResult(RequestHandler.java:798)
> 	at com.datastax.driver.core.RequestHandler$SpeculativeExecution.onSet(RequestHandler.java:617)
> 	at com.datastax.driver.core.Connection$Dispatcher.channelRead0(Connection.java:1005)
> 	at com.datastax.driver.core.Connection$Dispatcher.channelRead0(Connection.java:928)
> 	at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)
> 	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:318)
> 	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:304)
> 	at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:266)
> 	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:318)
> 	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:304)
> 	at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)
> 	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:318)
> 	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:304)
> 	at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:276)
> 	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:263)
> 	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:318)
> 	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:304)
> 	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:846)
> 	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:131)
> 	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511)
> 	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468)
> 	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382)
> 	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354)
> 	at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:112)
> 	... 1 more
>
> ================================= Application.java
>
>
> public class Application {
>     public static void main(String... args) {
>         System.out.println(">>> Cassandra cache store Test1 example started.");
>         try (Ignite ignite = Ignition.start("cassandra-ignite.xml")) {
>             try (IgniteCache<Test1Key, Test1> cache = ignite.cache(Test1.class.getSimpleName()))
{
>                 Test1Key test1Key = new Test1Key("test123");
>                 final Test1 value3 = cache.get(test1Key);
>                 System.out.println(
>                         String.format(">>> Read from C* (get).  Key: [%s], Value:
[%s]", test1Key, value3));
>             }
>             System.out.println(StringUtils.EMPTY);
>         }
>     }
> }
>
> Test1.java
>
> package com.gm.test_cassandra.model;
>
> import java.util.Date;
>
> public class Test1 {
>
>     public Test1() {
>     }
>
>     /*
>         column_1 text,
>         column_2 timestamp,
>         column_3 text,
>         column_4 timestamp,
>         column_5 text,
>         column_6 text,
>         column_7 int,
>         column_8 text,
>         column_9 text
>     */
>     //    @QuerySqlField(name = "column_1")
>     private transient String column1;
>
>     //    @QuerySqlField(name = "column_2")
>     private transient Date column2;
>
>     //    @QuerySqlField(name = "column_3")
>     private transient String column3;
>
>     //    @QuerySqlField(name = "column_4")
>     private transient Date column4;
>
>     //    @QuerySqlField(name = "column_5")
>     private transient String column5;
>
>     //    @QuerySqlField(name = "column_6")
>     private transient String column6;
>
>     //    @QuerySqlField(name = "column_7")
>     private transient int column7;
>
>     //    @QuerySqlField(name = "column_8")
>     private transient String column8;
>
>     //    @QuerySqlField(name = "column_9")
>     private transient String column9;
>
>     public String getColumn1() {
>         return column1;
>     }
>
>     public void setColumn1(String column1) {
>         this.column1 = column1;
>     }
>
>     public Date getColumn2() {
>         return column2;
>     }
>
>     public void setColumn2(Date column2) {
>         this.column2 = column2;
>     }
>
>     public String getColumn3() {
>         return column3;
>     }
>
>     public void setColumn3(String column3) {
>         this.column3 = column3;
>     }
>
>     public Date getColumn4() {
>         return column4;
>     }
>
>     public void setColumn4(Date column4) {
>         this.column4 = column4;
>     }
>
>     public String getColumn5() {
>         return column5;
>     }
>
>     public void setColumn5(String column5) {
>         this.column5 = column5;
>     }
>
>     public String getColumn6() {
>         return column6;
>     }
>
>     public void setColumn6(String column6) {
>         this.column6 = column6;
>     }
>
>     public int getColumn7() {
>         return column7;
>     }
>
>     public void setColumn7(int column7) {
>         this.column7 = column7;
>     }
>
>     public String getColumn8() {
>         return column8;
>     }
>
>     public void setColumn8(String column8) {
>         this.column8 = column8;
>     }
>
>     public String getColumn9() {
>         return column9;
>     }
>
>     public void setColumn9(String column9) {
>         this.column9 = column9;
>     }
>
>     @Override
>     public String toString() {
>         final StringBuilder sb = new StringBuilder();
>         sb.append("{");
>         sb.append(Test1.class.getSimpleName() + ": {");
>         sb.append("column1: ");
>         sb.append(this.column1);
>         sb.append(", column2: ");
>         sb.append(this.column2);
>         sb.append(", column3: ");
>         sb.append(this.column3);
>         sb.append(", column4: ");
>         sb.append(this.column4);
>         sb.append(", column5: ");
>         sb.append(this.column5);
>         sb.append(", column6: ");
>         sb.append(this.column6);
>         sb.append(", column7: ");
>         sb.append(this.column7);
>         sb.append(", column8: ");
>         sb.append(this.column8);
>         sb.append(", column9: ");
>         sb.append(this.column9);
>         sb.append("}}");
>         return sb.toString();
>     }
> }
>
> Test1Key.java
>
> package com.gm.test_cassandra.model;
>
> public class Test1Key {
>
>     public Test1Key() {
>     }
>
>     //Partition Key
>     //    @QuerySqlField(index = true, name = "my_id")
>     private transient String myId;
>
>     public Test1Key(final String myId) {
>         this.myId = myId;
>     }
>
>     public String getMyId() {
>         return myId;
>     }
>
>     public void setMyId(final String myId) {
>         this.myId = myId;
>     }
>
>     @Override
>     public String toString() {
>         final StringBuilder sb = new StringBuilder();
>         sb.append("{");
>         sb.append(Test1Key.class.getSimpleName() + ": {");
>         sb.append("myId: ");
>         sb.append(this.myId);
>         sb.append("}}");
>         return sb.toString();
>     }
> }
>
> ignite.xml
>
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <!--
>   Licensed to the Apache Software Foundation (ASF) under one or more
>   contributor license agreements.  See the NOTICE file distributed with
>   this work for additional information regarding copyright ownership.
>   The ASF licenses this file to You under the Apache License, Version 2.0
>   (the "License"); you may not use this file except in compliance with
>   the License.  You may obtain a copy of the License at
>
>        http://www.apache.org/licenses/LICENSE-2.0
>
>   Unless required by applicable law or agreed to in writing, software
>   distributed under the License is distributed on an "AS IS" BASIS,
>   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
>   See the License for the specific language governing permissions and
>   limitations under the License.
> -->
>
> <!--
>     Ignite configuration with all defaults and enabled p2p deployment and enabled events.
> -->
> <beans xmlns="http://www.springframework.org/schema/beans"
>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>        xsi:schemaLocation="
>         http://www.springframework.org/schema/beans
>         http://www.springframework.org/schema/beans/spring-beans.xsd">
>
>     <!-- Cassandra connection settings -->
>     <import resource="classpath:cassandra-connection-settings.xml" />
>
>     <bean id="test1Cache_persistence_settings" class="org.apache.ignite.cache.store.cassandra.persistence.KeyValuePersistenceSettings">
>         <constructor-arg type="org.springframework.core.io.Resource" value="classpath:test1-cassandra-persistence-settings.xml"
/>
>     </bean>
>
>     <bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
>         <!-- Set to true to enable distributed class loading for examples, default
is false. -->
>         <property name="peerClassLoadingEnabled" value="true"/>
>
>         <!-- Explicitly configure TCP discovery SPI to provide list of initial nodes.
-->
>         <property name="discoverySpi">
>             <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
>                 <property name="ipFinder">
>                     <!--
>                         Ignite provides several options for automatic discovery that
can be used
>                         instead os static IP based discovery. For information on all
options refer
>                         to our documentation: http://apacheignite.readme.io/docs/cluster-config
>                     -->
>                     <!-- Uncomment static IP finder to enable static-based discovery
of initial nodes. -->
>                     <!--<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">-->
>                     <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
>                         <property name="addresses">
>                             <list>
>                                 <!-- In distributed environment, replace with actual
host IP address. -->
>                                 <value>127.0.0.1:47500..47509<
> /value>
>                             </list>
>                         </property>
>                     </bean>
>                 </property>
>             </bean>
>         </property>
>         <property name="cacheConfiguration">
>             <list>
>                 <bean class="org.apache.ignite.configuration.CacheConfiguration">
>                     <property name="name" value="Test1" />
>                     <property name="readThrough" value="true" />
>                     <property name="writeThrough" value="true" />
>                     <!-- <property name="writeBehindEnabled" value="true" />
-->
>                     <property name="cacheStoreFactory">
>                         <bean class="org.apache.ignite.cache.store.cassandra.CassandraCacheStoreFactory">
>                             <!-- Datasource configuration bean which is responsible
for Cassandra connection details -->
>                             <property name="dataSourceBean" value="cassandraDataSource"
/>
>                             <!-- Persistent settings bean which is responsible for
the details of how objects will be persisted to Cassandra -->
>                             <property name="persistenceSettingsBean" value="test1Cache_persistence_settings"
/>
>                         </bean>
>                     </property>
>                     <property name="queryEntities">
>                         <list>
>                             <bean class="org.apache.ignite.cache.QueryEntity">
>                                 <property name="keyType" value="com.gm.test_cassandra.model.Test1Key"/>
>                                 <property name="valueType" value="com.gm.test_cassandra.model.Test1"/>
>                                 <property name="fields">
>                                     <map>
>                                         <entry key="column1" value="java.lang.String"/>
>                                         <entry key="column2" value="java.util.Date"/>
>                                         <entry key="column3" value="java.lang.String"/>
>                                         <entry key="column4" value="java.util.Date"/>
>                                         <entry key="column5" value="java.lang.String"/>
>                                         <entry key="column6" value="java.lang.String"/>
>                                         <entry key="column7" value="java.lang.Integer"/>
>                                         <entry key="column8" value="java.lang.String"/>
>                                         <entry key="column9" value="java.lang.String"/>
>                                     </map>
>                                 </property>
>                             </bean>
>                         </list>
>                     </property>
>                 </bean>
>             </list>
>         </property>
>     </bean>
> </beans>
>
> test1-cassandra-persistence-settings.xml
>
> <persistence keyspace="dev_qlty" table="keyspace" ttl="2592000">
>     <keyPersistence class="com.gm.test_cassandra.model.Test1Key" strategy="POJO">
>         <partitionKey>
>             <field name="myId" column="my_id" />
>         </partitionKey>
>     </keyPersistence>
>     <valuePersistence class="com.gm.test_cassandra.model.Test1" strategy="POJO">
>         <field name="column1" column="column_1" />
>         <field name="column2" column="column_2" />
>         <field name="column3" column="column_3" />
>         <field name="column4" column="column_4" />
>         <field name="column5" column="column_5" />
>         <field name="column6" column="column_6" />
>         <field name="column7" column="column_7" />
>         <field name="column8" column="column_8" />
>         <field name="column9" column="column_9" />
>     </valuePersistence>
> </persistence>
>
> cassandra-connection-settings.xml
>
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>        xmlns:util="http://www.springframework.org/schema/util"
>        xsi:schemaLocation="
>         http://www.springframework.org/schema/beans
>         http://www.springframework.org/schema/beans/spring-beans.xsd
>         http://www.springframework.org/schema/util
>         http://www.springframework.org/schema/util/spring-util.xsd">
>
>     <bean id="loadBalancingPolicy" class="com.datastax.driver.core.policies.TokenAwarePolicy">
>         <constructor-arg type="com.datastax.driver.core.policies.LoadBalancingPolicy">
>             <bean class="com.datastax.driver.core.policies.RoundRobinPolicy"/>
>         </constructor-arg>
>     </bean>
>
>     <util:list id="contactPoints" value-type="java.lang.String">
>         <value>server-name</value>
>     </util:list>
>
>     <bean id="cassandraDataSource" class="org.apache.ignite.cache.store.cassandra.datasource.DataSource">
>         <property name="contactPoints" ref="contactPoints"/>
>         <property name="user" value="keyspace"/>
>         <property name="password" value="keyspace_pw"/>
>         <property name="readConsistency" value="ONE"/>
>         <property name="writeConsistency" value="ONE"/>
>         <property name="loadBalancingPolicy" ref="loadBalancingPolicy"/>
>     </bean>
> </beans>
>
>
> ------------------------------
> Sent from the Apache Ignite Users mailing list archive
> <http://apache-ignite-users.70518.x6.nabble.com/> at Nabble.com.
>



-- 
Best regards,
Andrey V. Mashenkov

Mime
View raw message