0
初めてリモートキャッシュサーバを起動すると、出力が得られますが、2回目のクエリでは動作しませんが、クライアントノードでキャッシュサイズを取得しています。私はcache.iterator()
経由でデータを取得することはできますが、SQLを経由せずにキャッシュクエリ経由で取得することも、テキストクエリ経由でスキャンすることもできません。キャッシュクエリが動作しない
コード: -
List<Cache.Entry<PersonKey, Person>> as = cache.query(new SqlQuery<PersonKey, Person>(Person.class, sql).
setArgs("Manish")).getAll();
System.out.println("data " + as);
System.out.println("size " + cache.size());
Iterator<Cache.Entry<PersonKey, Person>> abc = cache.iterator();
while (abc.hasNext()) {
Cache.Entry<PersonKey, Person> data = abc.next();
System.out.println("data " + data);
}
for (Cache.Entry<PersonKey, Person> e : as) {
System.out.println(e.getValue().toString());
}
SqlFieldsQuery qry = new SqlFieldsQuery("select firstname, lastname from Person where firstname='Manish'");
try (FieldsQueryCursor<List<?>> cursor = cache.query(qry)) {
for (List<?> row : cursor) {
System.out.println("firstname:" + row.get(0) + ", lastname:" + row.get(1));
}
}
私のキャッシュの設定: -
<import resource="classpath:cassandra/connection-settings.xml" />
<!-- Persistence settings for 'cache1' -->
<bean id="cache1_persistence_settings" class="org.apache.ignite.cache.store.cassandra.persistence.KeyValuePersistenceSettings">
<constructor-arg type="org.springframework.core.io.Resource" value="classpath:persistence/primitive/persistence-settings-1.xml" />
</bean>
<!-- Ignite configuration -->
<bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
<property name="cacheConfiguration">
<list>
<!-- Configuring persistence for "cache1" cache -->
<bean class="org.apache.ignite.configuration.CacheConfiguration">
<property name="name" value="cache1"/>
<property name="readThrough" value="false"/>
<property name="writeThrough" value="true"/>
<property name="writeBehindEnabled" value="true"/>
<property name="writeBehindFlushSize" value="2"/>
<!-- <property name="atomicityMode" value="TRANSACTIONAL"/>
<property name="backups" value="1"/>-->
<property name="cacheStoreFactory">
<bean class="org.apache.ignite.cache.store.cassandra.CassandraCacheStoreFactory">
<property name="dataSourceBean" value="cassandraAdminDataSource" />
<property name="persistenceSettingsBean" value="cache1_persistence_settings"/>
</bean>
</property>
<property name="queryEntities">
<list>
<bean class="org.apache.ignite.cache.QueryEntity">
<property name="keyType" value="com.manish.igniteexample.PersonKey"/>
<property name="valueType" value="com.manish.igniteexample.Person"/>
<property name="fields">
<map>
<entry key="firstname" value="java.lang.String"/>
<entry key="lastname" value="java.lang.String"/>
<entry key="age" value="java.lang.Integer"/>
<entry key="married" value="java.lang.Boolean"/>
<entry key="birthDate" value="java.util.Date"/>
<entry key="phone" value="java.lang.Integer"/>
</map>
</property>
<property name="indexes">
<list>
<bean class="org.apache.ignite.cache.QueryIndex">
<constructor-arg value="firstname"/>
</bean>
<bean class="org.apache.ignite.cache.QueryIndex">
<constructor-arg value="lastname"/>
</bean>
</list>
</property>
</bean>
</list>
</property>
</bean>
</list>
</property>
<property name="clientMode" value="false"/>
と私の出力プログラムをPIC
first time executionに示されるように、Second time execution
インデックスを無効にすると再生されますか? – Denis
Igniteログに-DIGNITE_QUIET = falseシステムプロパティを指定できますか? – alexfedotov
また、「firstname = 'Manish'」の条件がないと動作しますか? – Denis