How to store Binary Object in Cassandra Backup Store

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to store Binary Object in Cassandra Backup Store

fatih
This post was updated on .
Hi

I am working with BinaryObjects and i wanted to use Cassandra as a backup store. However i could not manage. Could please explain how i can achieve this.  

Persistence configuration i use is as below

<persistence keyspace=“triggers” table=“eventstreaming”><keyPersistence class=“java.lang.String” strategy=“PRIMITIVE”/><strategy=“BLOB”/></persistence>


The error I get is as below

2017-05-19 16:07:12,497 [dockerjava-netty-3-4] INFO  ignite@localhost - STDERR: [14:07:12,493][SEVERE][flusher-0-#27%null%][CassandraCacheStore] Failed to process 1 of 1 elements, during BULK_WRITE operation with Cassandra
2017-05-19 16:07:12,497 [dockerjava-netty-3-4] INFO  ignite@localhost - STDERR: class org.apache.ignite.IgniteException: Failed to execute Cassandra BULK_WRITE operation
2017-05-19 16:07:12,497 [dockerjava-netty-3-4] INFO  ignite@localhost - STDERR: at org.apache.ignite.cache.store.cassandra.session.CassandraSessionImpl.execute(CassandraSessionImpl.java:262)
2017-05-19 16:07:12,497 [dockerjava-netty-3-4] INFO  ignite@localhost - STDERR: at org.apache.ignite.cache.store.cassandra.CassandraCacheStore.writeAll(CassandraCacheStore.java:332)
2017-05-19 16:07:12,497 [dockerjava-netty-3-4] INFO  ignite@localhost - STDERR: at org.apache.ignite.internal.processors.cache.store.GridCacheWriteBehindStore.updateStore(GridCacheWriteBehindStore.java:685)
2017-05-19 16:07:12,498 [dockerjava-netty-3-4] INFO  ignite@localhost - STDERR: at org.apache.ignite.internal.processors.cache.store.GridCacheWriteBehindStore.applyBatch(GridCacheWriteBehindStore.java:618)
2017-05-19 16:07:12,498 [dockerjava-netty-3-4] INFO  ignite@localhost - STDERR: at org.apache.ignite.internal.processors.cache.store.GridCacheWriteBehindStore.access$1700(GridCacheWriteBehindStore.java:69)
2017-05-19 16:07:12,498 [dockerjava-netty-3-4] INFO  ignite@localhost - STDERR: at org.apache.ignite.internal.processors.cache.store.GridCacheWriteBehindStore$Flusher.flushCache(GridCacheWriteBehindStore.java:850)
2017-05-19 16:07:12,498 [dockerjava-netty-3-4] INFO  ignite@localhost - STDERR: at org.apache.ignite.internal.processors.cache.store.GridCacheWriteBehindStore$Flusher.body(GridCacheWriteBehindStore.java:754)
2017-05-19 16:07:12,498 [dockerjava-netty-3-4] INFO  ignite@localhost - STDERR: at org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:110)
2017-05-19 16:07:12,498 [dockerjava-netty-3-4] INFO  ignite@localhost - STDERR: at java.lang.Thread.run(Thread.java:745)
2017-05-19 16:07:12,498 [dockerjava-netty-3-4] INFO  ignite@localhost - STDERR: Caused by: java.lang.IllegalArgumentException: Couldn't deserialize instance of class 'org.apache.ignite.internal.binary.BinaryObjectImpl' using PRIMITIVE strategy. Please use BLOB strategy for this case.
2017-05-19 16:07:12,498 [dockerjava-netty-3-4] INFO  ignite@localhost - STDERR: at org.apache.ignite.cache.store.cassandra.persistence.PersistenceController.bindValues(PersistenceController.java:431)
2017-05-19 16:07:12,498 [dockerjava-netty-3-4] INFO  ignite@localhost - STDERR: at org.apache.ignite.cache.store.cassandra.persistence.PersistenceController.bindKeyValue(PersistenceController.java:203)
2017-05-19 16:07:12,498 [dockerjava-netty-3-4] INFO  ignite@localhost - STDERR: at org.apache.ignite.cache.store.cassandra.CassandraCacheStore$4.bindStatement(CassandraCacheStore.java:346)
2017-05-19 16:07:12,498 [dockerjava-netty-3-4] INFO  ignite@localhost - STDERR: at org.apache.ignite.cache.store.cassandra.CassandraCacheStore$4.bindStatement(CassandraCacheStore.java:332)
2017-05-19 16:07:12,498 [dockerjava-netty-3-4] INFO  ignite@localhost - STDERR: at org.apache.ignite.cache.store.cassandra.session.CassandraSessionImpl.execute(CassandraSessionImpl.java:226)
2017-05-19 16:07:12,498 [dockerjava-netty-3-4] INFO  ignite@localhost - STDERR: ... 8 more

Reply | Threaded
Open this post in threaded view
|

Re: How to store Binary Object in Cassandra Backup Store

irudyak
You are using invalid persistence descriptor. It should be something like:

<persistence keyspace="my_keyspace" table="my_table">
        <keyPersistence class="java.lang.String" strategy="PRIMITIVE"/>
        <valuePersistence class="org.mycompany.MyValueClass" strategy="BLOB"/>
</persistence>


You can find more details about persistence descriptor configuration here: https://apacheignite-mix.readme.io/docs/base-concepts#section-persistencesettingsbean