You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by siva <si...@bizruntime.com> on 2020/01/12 16:56:23 UTC
write behind is not triggering for created table through query
Hi,
I am using .Net Core for client and Server Ignite v2.7.6.
*Create Cache and configuration*:
-----------------------------------
where cache name is 32 bit guid(e.g:"C091E548-B45A-49B4-B8EC-2CB5E27C7AF6")
*i have created table from sqlline on cache*
after that ,did *insert statement*:
insert into Person(id,name) values(1,"Ram");
where some of table and indexes created at the time of cache configuration.
*persist store*
C:\server\storage\node00-e03ee70f-0903-41db-beb7-190ead503597
where i found two folder for the cache,name as
1.cache-C091E548-B45A-49B4-B8EC-2CB5E27C7AF6
2.cache-SQL_C091E548-B45A-49B4-B8EC-2CB5E27C7AF6_PERSON
recorded inserted successfully in cache,
but write behind is not called/triggering...any configuration/implementation
needed?
--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Re: write behind is not triggering for created table through query
Posted by Ilya Kasnacheev <il...@gmail.com>.
Hello!
You should not specify key_type in this case.
Can you show code of your cache store / factory?
Regards,
--
Ilya Kasnacheev
вт, 14 янв. 2020 г. в 19:18, siva <si...@bizruntime.com>:
> Hi,
> yes,type of key is string.
> String cacheName="C091E548-B45A-49B4-B8EC-2CB5E27C7AF6";
> cacheCfg = new CacheConfiguration(cacheName)
> {
> Name = cacheName,
> CacheStoreFactory = new
> TenantCacheStoreFactory(_logger,
> connectionString),
> KeepBinaryInStore = false, // Cache store works with
> deserialized data.
> ReadThrough = true,
> WriteThrough = true,
> WriteBehindEnabled = true,
> QueryEntities = queryList,
> WriteBehindFlushThreadCount = 2,
> CacheMode = CacheMode.Partitioned,
> Backups = 0,
> DataRegionName = "IgniteDataRegion",
> EvictionPolicy = new LruEvictionPolicy
> {
> MaxSize = 100000
> }
> };
>
> Table Create query:
> ---------------------------------
> CREATE TABLE IF NOT EXISTS
> "C091E548-B45A-49B4-B8EC-2CB5E27C7AF6".EntitiesPulsarTest(EntityId
> varchar,EntityType varchar,EntityInfoJson varchar,TenantName
> varchar,TenantId varchar,Fabric varchar,EntityName varchar,SequenceNumber
> Double,PRIMARY KEY(EntityId)) WITH
> "template=CacheConfigurationTemplate,backups=0";
>
>
>
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>
Re: write behind is not triggering for created table through query
Posted by siva <si...@bizruntime.com>.
Hi,
yes,type of key is string.
String cacheName="C091E548-B45A-49B4-B8EC-2CB5E27C7AF6";
cacheCfg = new CacheConfiguration(cacheName)
{
Name = cacheName,
CacheStoreFactory = new TenantCacheStoreFactory(_logger,
connectionString),
KeepBinaryInStore = false, // Cache store works with
deserialized data.
ReadThrough = true,
WriteThrough = true,
WriteBehindEnabled = true,
QueryEntities = queryList,
WriteBehindFlushThreadCount = 2,
CacheMode = CacheMode.Partitioned,
Backups = 0,
DataRegionName = "IgniteDataRegion",
EvictionPolicy = new LruEvictionPolicy
{
MaxSize = 100000
}
};
Table Create query:
---------------------------------
CREATE TABLE IF NOT EXISTS
"C091E548-B45A-49B4-B8EC-2CB5E27C7AF6".EntitiesPulsarTest(EntityId
varchar,EntityType varchar,EntityInfoJson varchar,TenantName
varchar,TenantId varchar,Fabric varchar,EntityName varchar,SequenceNumber
Double,PRIMARY KEY(EntityId)) WITH
"template=CacheConfigurationTemplate,backups=0";
--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Re: write behind is not triggering for created table through query
Posted by Ilya Kasnacheev <il...@gmail.com>.
Hello!
Can you show complete cache configuration (template)?
I imagine it's possible that your cache ends up having primitive type as
key, yet you try to use it as binary object in cache store.
Regards,
--
Ilya Kasnacheev
пн, 13 янв. 2020 г. в 15:10, siva <si...@bizruntime.com>:
> Hi,
> Thanks for reply...write behind triggering now.but getting exception in
> writeAll() method.
>
> I have one query on insert what will be the key and value for writeAll()
> method,if i defined or not in create query commond key_type and
> value_type?.is this key_type and value_type needed.?
>
> but in case of cache.putAsync(key,tableModel); working properly.
>
> WriteAll(IEnumerable<KeyValuePair<string, ICustomCacheStore>> entries){
> List<KeyValuePair<string, ICustomCacheStore>> entityList =
> entries.ToList();//on sql insert error
> foreach (var recordEntry in entityList)
> {
> ....
> ....
> }
> }
>
> *create and insert query*:
> --------------
> CREATE TABLE IF NOT EXISTS
> "C091E548-B45A-49B4-B8EC-2CB5E27C7AF6".EntitiesPulsarTest(EntityId
> varchar,EntityType varchar,EntityInfoJson varchar,TenantName
> varchar,TenantId varchar,Fabric varchar,EntityName varchar,SequenceNumber
> Double,PRIMARY KEY(EntityId)) WITH
>
> "template=CacheConfigurationTemplate,backups=0,key_type=TableName,value_type=EntitiesPulsarTest";
>
>
> INSERT INTO
>
> "C091E548-B45A-49B4-B8EC-2CB5E27C7AF6".EntitiesPulsarTest(EntityId,EntityInfoJson,EntityName,EntityType,Fabric,SequenceNumber,TenantId,TenantName)
> VALUES ('0-pulsar', '{}', 'Testing Topic0 Name', 'testpulsarType',
> 'pulsarFabric', 0.0, 'pulsar-123-tenantid', 'pulsar-tenantName');
>
> Exception:
> Apache.Ignite.Core.Binary.BinaryObjectException: Invalid header on
> deserialization [pos=136, hdr=0]
> at Apache.Ignite.Core.Impl.Binary.BinaryReader.TryDeserialize[T](T& res,
> Type typeOverride)
> at Apache.Ignite.Core.Impl.Binary.BinaryReader.Deserialize[T](Type
> typeOverride)
> at
>
> Apache.Ignite.Core.Impl.Cache.Store.CacheStoreInternal`2.<ReadPairs>d__14.MoveNext()
> at System.Collections.Generic.List`1.AddEnumerable(IEnumerable`1
> enumerable)
> at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
> at
> IgnitePersistenceApp.CacheStore.TenantCacheStore.WriteAll(IEnumerable`1
> entries)
>
> anything i have to change in create or insert query?
>
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>
Re: write behind is not triggering for created table through query
Posted by siva <si...@bizruntime.com>.
Hi,
Thanks for reply...write behind triggering now.but getting exception in
writeAll() method.
I have one query on insert what will be the key and value for writeAll()
method,if i defined or not in create query commond key_type and
value_type?.is this key_type and value_type needed.?
but in case of cache.putAsync(key,tableModel); working properly.
WriteAll(IEnumerable<KeyValuePair<string, ICustomCacheStore>> entries){
List<KeyValuePair<string, ICustomCacheStore>> entityList =
entries.ToList();//on sql insert error
foreach (var recordEntry in entityList)
{
....
....
}
}
*create and insert query*:
--------------
CREATE TABLE IF NOT EXISTS
"C091E548-B45A-49B4-B8EC-2CB5E27C7AF6".EntitiesPulsarTest(EntityId
varchar,EntityType varchar,EntityInfoJson varchar,TenantName
varchar,TenantId varchar,Fabric varchar,EntityName varchar,SequenceNumber
Double,PRIMARY KEY(EntityId)) WITH
"template=CacheConfigurationTemplate,backups=0,key_type=TableName,value_type=EntitiesPulsarTest";
INSERT INTO
"C091E548-B45A-49B4-B8EC-2CB5E27C7AF6".EntitiesPulsarTest(EntityId,EntityInfoJson,EntityName,EntityType,Fabric,SequenceNumber,TenantId,TenantName)
VALUES ('0-pulsar', '{}', 'Testing Topic0 Name', 'testpulsarType',
'pulsarFabric', 0.0, 'pulsar-123-tenantid', 'pulsar-tenantName');
Exception:
Apache.Ignite.Core.Binary.BinaryObjectException: Invalid header on
deserialization [pos=136, hdr=0]
at Apache.Ignite.Core.Impl.Binary.BinaryReader.TryDeserialize[T](T& res,
Type typeOverride)
at Apache.Ignite.Core.Impl.Binary.BinaryReader.Deserialize[T](Type
typeOverride)
at
Apache.Ignite.Core.Impl.Cache.Store.CacheStoreInternal`2.<ReadPairs>d__14.MoveNext()
at System.Collections.Generic.List`1.AddEnumerable(IEnumerable`1
enumerable)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at
IgnitePersistenceApp.CacheStore.TenantCacheStore.WriteAll(IEnumerable`1
entries)
anything i have to change in create or insert query?
--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Re: write behind is not triggering for created table through query
Posted by Ilya Kasnacheev <il...@gmail.com>.
Hello!
You need to employ cache configuration templates to add Write Behind to
cache configured via SQL:
https://apacheignite.readme.io/docs/cache-template
In your case, you created two caches: one is empty but with write behind,
other is with SQL-inserted data but without Write Behind.
Regards,
--
Ilya Kasnacheev
вс, 12 янв. 2020 г. в 19:56, siva <si...@bizruntime.com>:
> Hi,
> I am using .Net Core for client and Server Ignite v2.7.6.
>
> *Create Cache and configuration*:
> -----------------------------------
>
>
>
> where cache name is 32 bit guid(e.g:"C091E548-B45A-49B4-B8EC-2CB5E27C7AF6")
>
> *i have created table from sqlline on cache*
>
>
> after that ,did *insert statement*:
> insert into Person(id,name) values(1,"Ram");
>
> where some of table and indexes created at the time of cache configuration.
>
> *persist store*
> C:\server\storage\node00-e03ee70f-0903-41db-beb7-190ead503597
> where i found two folder for the cache,name as
> 1.cache-C091E548-B45A-49B4-B8EC-2CB5E27C7AF6
> 2.cache-SQL_C091E548-B45A-49B4-B8EC-2CB5E27C7AF6_PERSON
>
> recorded inserted successfully in cache,
> but write behind is not called/triggering...any
> configuration/implementation
> needed?
>
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>