ignite-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Igor Rudyak (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (IGNITE-4205) CassandraCacheStore should start IgniteThread threads in loadCache() method
Date Sat, 10 Dec 2016 19:08:58 GMT

    [ https://issues.apache.org/jira/browse/IGNITE-4205?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15738308#comment-15738308
] 

Igor Rudyak edited comment on IGNITE-4205 at 12/10/16 7:08 PM:
---------------------------------------------------------------

Valentin, could you please clarify this *"When an object is saved, it's passed to the store
as an instance of BinaryObject"*?

I did this:

*IgniteCache myCache = ignite.cache("mycache").withKeepBinary();*
*myCache.put(1L, new MyObject());*

But on *CacheStore* side, inside *write(final Cache.Entry<? extends K, ? extends V>
entry)* method I still have *MyObject* instance inside the *entry* object instead of expected
*BinaryObject*.

Should I construct *BinaryObject* manually? Looks like I can do this using *BinaryObjectBuilder*,
but the idea itself looks rather awkwardly. If I am correct, the main idea of binary objects
is to use them for read only operations on different clients (*Java*, *.Net* and etc.) which
provides kind of *"platform independent"* serialization. While for write operations I can
use my custom Java class instances and they will be automatically converted to *BinaryObjects*
right?

Configuration for *mycache* looks like this:

<bean class="org.apache.ignite.configuration.CacheConfiguration">
        <property name="name" value="mycache"/>
        <property name="readThrough" value="true"/>
        <property name="writeThrough" value="true"/>
        <property name="storeKeepBinary" value="true"/>
        <property name="cacheStoreFactory">
                <bean class="org.apache.ignite.cache.store.cassandra.CassandraCacheStoreFactory">
                        <property name="dataSourceBean" value="cassandraAdminDataSource"/>
                        <property name="persistenceSettingsBean" value="cache2_persistence_settings"/>
                </bean>
        </property>
</bean>



was (Author: irudyak):
Valentin, could you please clarify this *"When an object is saved, it's passed to the store
as an instance of BinaryObject"*?

I did this:

*IgniteCache myCache = ignite.cache("mycache").withKeepBinary();*
*myCache.put(1L, new MyObject());*

But on *CacheStore* side, inside *write(final Cache.Entry<? extends K, ? extends V>
entry)* method I still have *MyObject* instance inside the *entry* object instead of expected
*BinaryObject*.

Should I construct *BinaryObject* manually? Looks like I can do this using *BinaryObjectBuilder*,
but the idea itself looks rather awkwardly. If I am correct, the main idea of binary objects
is to use them for read only operations on different clients (*Java*, *.Net* and etc.) which
provides kind of *"platform independent"* serialization. While for write operations I can
use my custom Java class instances and they will be automatically converted to *BinaryObjects*
right?

Configuration for *mycache* looks like this:

<bean class="org.apache.ignite.configuration.CacheConfiguration">
	<property name="name" value="mycache"/>
	<property name="readThrough" value="true"/>
	<property name="writeThrough" value="true"/>
	<property name="storeKeepBinary" value="true"/>
	<property name="cacheStoreFactory">
		<bean class="org.apache.ignite.cache.store.cassandra.CassandraCacheStoreFactory">
			<property name="dataSourceBean" value="cassandraAdminDataSource"/>
			<property name="persistenceSettingsBean" value="cache2_persistence_settings"/>
		</bean>
	</property>
</bean>


> CassandraCacheStore should start IgniteThread threads in loadCache() method
> ---------------------------------------------------------------------------
>
>                 Key: IGNITE-4205
>                 URL: https://issues.apache.org/jira/browse/IGNITE-4205
>             Project: Ignite
>          Issue Type: Bug
>          Components: cache
>    Affects Versions: 1.7
>            Reporter: Valentin Kulichenko
>            Assignee: Igor Rudyak
>
> {{CassandraCacheStore.loadCache()}} method starts a generic thread pool for parallel
data load. Threads in this thread pool can't deserialize Ignite internal objects (e.g. {{IgniteKernal}})
which can cause unexpected behavior. Here is one of the scenarios:
> * There is column in Cassandra which stores an object as BLOB using {{JavaSerializer}}.
> * {{CacheConfiguration.storeKeepBinary}} is {{true}}.
> * When an object is saved, it's passed to the store as an instance of {{BinaryObject}}
which is converted to a byte array and saved in Cassandra.
> * When the same object is loaded in {{loadCache}}, the store takes the byte array and
tries to convert it to {{BinaryObject}}. But it can't because this implies calling {{IgnitionEx.localIgnite()}}
from non-Ignite thread.
> To fix this we need to provide a thread factory that will create instances of {{IgniteThread}}
and use it in the pool that loads the data.
> Most likely the same issue exists in {{CacheAbstractJdbcStore}}.
> And in general, any threads created by Ignite internals should be {{IgniteThread}}-s.
This should be revisited.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message