You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Pavel Tupitsyn (Jira)" <ji...@apache.org> on 2021/01/25 14:40:00 UTC

[jira] [Comment Edited] (IGNITE-13957) GridQueryProcessor.validateKeyAndValue attempts to deserialize key and value when QueryEntity.fields is not set

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

Pavel Tupitsyn edited comment on IGNITE-13957 at 1/25/21, 2:39 PM:
-------------------------------------------------------------------

[~korlov] please review. I've restored the logic that existed before IGNITE-13075.


was (Author: ptupitsyn):
[~korlov] please review.

> GridQueryProcessor.validateKeyAndValue attempts to deserialize key and value when QueryEntity.fields is not set
> ---------------------------------------------------------------------------------------------------------------
>
>                 Key: IGNITE-13957
>                 URL: https://issues.apache.org/jira/browse/IGNITE-13957
>             Project: Ignite
>          Issue Type: Bug
>          Components: sql
>    Affects Versions: 2.9, 2.9.1
>            Reporter: Pavel Tupitsyn
>            Assignee: Pavel Tupitsyn
>            Priority: Major
>             Fix For: 2.10
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> {{GridQueryProcessor.validateKeyAndValue}} attempts to deserialize cache key and value on {{put}} when {{QueryEntity.fields}} is not set, and fails when corresponding classes can't be found.
> * The bug was introduced in 2.9
> * There is no problem when some query entity fields are defined
> Reproducer in .NET (TODO: add both .NET and Java tests for this)
> {code}
> // CacheQueriesCodeConfigurationTest
>         /// <summary>
>         /// Tests query entity validation when no <see cref="QuerySqlFieldAttribute"/> has been set.
>         /// </summary>
>         [Test]
>         public void TestMissingQueryAttributes()
>         {
>             using (var ignite = Ignition.Start(TestUtils.GetTestConfiguration()))
>             {
>                 var cfg = new CacheConfiguration(
>                     TestUtils.TestName,
>                     new QueryEntity(typeof(string), typeof(MissingAttributesTest)));
>                 var cache = ignite.GetOrCreateCache<string, MissingAttributesTest>(cfg);
>                 cache["1"] = new MissingAttributesTest {Foo = "Bar"};
>             }
>         }
>         /// <summary>
>         /// Class without any <see cref="QuerySqlFieldAttribute"/> attributes.
>         /// </summary>
>         private class MissingAttributesTest
>         {
>             /** */
>             public string Foo { get; set; }
>         }
> {code}
> Exception:
> {code}
> Apache.Ignite.Core.Cache.CacheException : class org.apache.ignite.IgniteCheckedException: Failed to resolve .NET class 'Apache.Ignite.Core.Tests.Cache.Query.CacheQueriesCodeConfigurationTest+MissingAttributesTest' in Java [platformId=0, typeId=1242226865].
>   ----> Apache.Ignite.Core.Common.IgniteException : Failed to resolve .NET class 'Apache.Ignite.Core.Tests.Cache.Query.CacheQueriesCodeConfigurationTest+MissingAttributesTest' in Java [platformId=0, typeId=1242226865].
>   ----> Apache.Ignite.Core.Common.JavaException : javax.cache.CacheException: class org.apache.ignite.IgniteCheckedException: Failed to resolve .NET class 'Apache.Ignite.Core.Tests.Cache.Query.CacheQueriesCodeConfigurationTest+MissingAttributesTest' in Java [platformId=0, typeId=1242226865].
> 	at org.apache.ignite.internal.processors.cache.GridCacheUtils.convertToCacheException(GridCacheUtils.java:1263)
> 	at org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.cacheException(IgniteCacheProxyImpl.java:2083)
> 	at org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.put(IgniteCacheProxyImpl.java:1319)
> 	at org.apache.ignite.internal.processors.cache.GatewayProtectedCacheProxy.put(GatewayProtectedCacheProxy.java:856)
> 	at org.apache.ignite.internal.processors.platform.cache.PlatformCache.processInStreamOutLong(PlatformCache.java:840)
> 	at org.apache.ignite.internal.processors.platform.PlatformTargetProxyImpl.inStreamOutLong(PlatformTargetProxyImpl.java:67)
> Caused by: class org.apache.ignite.IgniteCheckedException: Failed to resolve .NET class 'Apache.Ignite.Core.Tests.Cache.Query.CacheQueriesCodeConfigurationTest+MissingAttributesTest' in Java [platformId=0, typeId=1242226865].
> 	at org.apache.ignite.internal.util.IgniteUtils.cast(IgniteUtils.java:7587)
> 	at org.apache.ignite.internal.processors.cache.GridCacheContext.validateKeyAndValue(GridCacheContext.java:1916)
> 	at org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateFuture.mapSingleUpdate(GridNearAtomicSingleUpdateFuture.java:555)
> 	at org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateFuture.map(GridNearAtomicSingleUpdateFuture.java:457)
> 	at org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateFuture.mapOnTopology(GridNearAtomicSingleUpdateFuture.java:446)
> 	at org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicAbstractUpdateFuture.map(GridNearAtomicAbstractUpdateFuture.java:255)
> 	at org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache.update0(GridDhtAtomicCache.java:1169)
> 	at org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache.put0(GridDhtAtomicCache.java:634)
> 	at org.apache.ignite.internal.processors.cache.GridCacheAdapter.put(GridCacheAdapter.java:2596)
> 	at org.apache.ignite.internal.processors.cache.GridCacheAdapter.put(GridCacheAdapter.java:2575)
> 	at org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.put(IgniteCacheProxyImpl.java:1316)
> 	... 3 more
> Caused by: class org.apache.ignite.binary.BinaryInvalidTypeException: Failed to resolve .NET class 'Apache.Ignite.Core.Tests.Cache.Query.CacheQueriesCodeConfigurationTest+MissingAttributesTest' in Java [platformId=0, typeId=1242226865].
> 	at org.apache.ignite.internal.binary.BinaryContext.descriptorForTypeId(BinaryContext.java:717)
> 	at org.apache.ignite.internal.binary.BinaryReaderExImpl.deserialize0(BinaryReaderExImpl.java:1762)
> 	at org.apache.ignite.internal.binary.BinaryReaderExImpl.deserialize(BinaryReaderExImpl.java:1721)
> 	at org.apache.ignite.internal.binary.BinaryObjectImpl.deserializeValue(BinaryObjectImpl.java:820)
> 	at org.apache.ignite.internal.binary.BinaryObjectImpl.value(BinaryObjectImpl.java:150)
> 	at org.apache.ignite.internal.binary.BinaryObjectImpl.value(BinaryObjectImpl.java:139)
> 	at org.apache.ignite.internal.processors.query.QueryTypeDescriptorImpl.validateProps(QueryTypeDescriptorImpl.java:613)
> 	at org.apache.ignite.internal.processors.query.QueryTypeDescriptorImpl.validateKeyAndValue(QueryTypeDescriptorImpl.java:587)
> 	at org.apache.ignite.internal.processors.query.GridQueryProcessor.validateKeyAndValue(GridQueryProcessor.java:3582)
> 	at org.apache.ignite.internal.processors.cache.GridCacheContext.validateKeyAndValue(GridCacheContext.java:1913)
> 	... 12 more
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)