Details
Description
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
// 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; } }
Exception:
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
Attachments
Issue Links
- causes
-
IGNITE-14661 Broken validation of parts of compound PK
- Resolved
- is caused by
-
IGNITE-13075 NPE on request JDBC metadata
- Resolved
- links to