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

Danut Radoaica commented on IGNITE-18347:
-----------------------------------------

unfortunately I wasn't able to reproduce locally or in the develop env (also in 
AKS), this are the unit test and the helper class:
{code:c#}
        [TestMethod]
        public void TestCacheFactoryPutThenGetAllPrintableChars()
        {
            IgniteClientConfiguration igniteClientConfiguration = 
CacheFactory.GetIgniteClientConfiguration();
            IIgniteClient igniteClient = 
CacheFactory.ConnectAsClient(igniteClientConfiguration);
            string cacheName = "LiveChatConversationAllPrintableChars";
            ICacheClient<Guid, LiveChatConversation> cacheClient = 
CacheFactory.GetOrCreateCacheClient<Guid, LiveChatConversation>(igniteClient, 
cacheName, configuration =>
                configuration.QueryEntities = new List<QueryEntity>()
                {
                    new QueryEntity(typeof(Guid), typeof(LiveChatConversation))
                    {
                        Fields = new List<QueryField>()
                        {
                            new QueryField("Id", typeof(Guid))
                        },
                        Indexes = new List<QueryIndex>()
                        {
                            new QueryIndex("Id")
                        }
                    }
                }).WithExpiryPolicy(new ExpiryPolicy(TimeSpan.FromDays(1), 
TimeSpan.FromDays(1), TimeSpan.FromDays(1)));
            // see: https://web.itu.edu.tr/~sgunduz/courses/mikroisl/ascii.html
            for (int i = char.MinValue; i <= char.MaxValue; i++)
            {
                char c = Convert.ToChar(i);
                if (!char.IsControl(c))
                {
                    Guid id = Guid.NewGuid();
                    LiveChatConversation liveChatConversation = new() { Id = 
id, HelpdeskSubject = $"{c}" };
                    cacheClient.Put(liveChatConversation.Id, 
liveChatConversation);
                    liveChatConversation = 
cacheClient.Get(liveChatConversation.Id);
                    Assert.IsNotNull(liveChatConversation);
                }
            }

            igniteClient.DestroyCache(cacheName);
        }
{code}
{code:c#}
    public static class CacheFactory
    {
        public static IgniteClientConfiguration 
GetIgniteClientConfiguration(string endpoint = "127.0.0.1",
            string userName = null, string password = null, bool useSsl = false,
            string certificatePath = null, string certificatePassword = null)
        {
            IgniteClientConfiguration igniteClientConfiguration = new()
            {
                Endpoints = new[] { endpoint },
                RetryPolicy = new ClientRetryReadPolicy(),
                RetryLimit = 5,
                SocketTimeout = TimeSpan.FromSeconds(30),
                EnablePartitionAwareness = true,
                EnableHeartbeats = true,
                // Enable trace logging to observe discovery process.
                Logger = new ConsoleLogger { MinLevel = LogLevel.Trace }
            };
            if (!string.IsNullOrWhiteSpace(userName))
            {
                igniteClientConfiguration.UserName = userName;
            }

            if (!string.IsNullOrWhiteSpace(password))
            {
                igniteClientConfiguration.Password = password;
            }

            if (useSsl)
            {
                igniteClientConfiguration.SslStreamFactory = new 
SslStreamFactory
                {
                    CertificatePath = certificatePath,
                    CertificatePassword = certificatePassword,
                    CheckCertificateRevocation = true,
                    SkipServerCertificateValidation = true,
                    SslProtocols = SslProtocols.Tls12
                };
            }

            return igniteClientConfiguration;
        }

        public static IIgnite ConnectAsClient(IgniteConfiguration 
igniteConfiguration)
        {
            Ignition.ClientMode = true;
            return Ignition.Start(igniteConfiguration);
        }

        public static IIgniteClient ConnectAsClient(IgniteClientConfiguration 
igniteClientConfiguration)
        {
            return Ignition.StartClient(igniteClientConfiguration);
        }

        public static ICache<TKey, TData> GetOrCreateCache<TKey, TData>(IIgnite 
ignite, string cacheName,
            Action<CacheConfiguration> extendConfigurationAction = null)
        {
            CacheConfiguration cacheCfg = new()
            {
                Name = cacheName,
                CacheMode = CacheMode.Partitioned,
                GroupName = typeof(TData).FullNameWithoutAssemblyInfo(),
                QueryEntities = new[] { new QueryEntity { KeyType = 
typeof(TKey), ValueType = typeof(TData) } },
                Backups = 1,
                PlatformCacheConfiguration = new PlatformCacheConfiguration
                {
                    KeyTypeName = typeof(TKey).FullNameWithoutAssemblyInfo(),
                    ValueTypeName = typeof(TData).FullNameWithoutAssemblyInfo()
                }
            };
            extendConfigurationAction?.Invoke(cacheCfg);
            ICache<TKey, TData> cache = ignite.GetOrCreateCache<TKey, 
TData>(cacheCfg);
            return cache;
        }

        public static ICacheClient<TKey, TData> GetOrCreateCacheClient<TKey, 
TData>(IIgniteClient ignite,
            string cacheName, Action<CacheClientConfiguration> 
extendConfigurationAction = null)
        {
            CacheClientConfiguration cacheCfg =
                new(
                    new CacheConfiguration
                    {
                        PlatformCacheConfiguration = new 
PlatformCacheConfiguration
                        {
                            KeyTypeName = 
typeof(TKey).FullNameWithoutAssemblyInfo(),
                            ValueTypeName = 
typeof(TData).FullNameWithoutAssemblyInfo()
                        }
                    }, true)
                {
                    Name = cacheName,
                    CacheMode = CacheMode.Partitioned,
                    GroupName = typeof(TData).FullNameWithoutAssemblyInfo(),
                    QueryEntities = new[] { new QueryEntity { KeyType = 
typeof(TKey), ValueType = typeof(TData) } },
                    Backups = 1
                };
            extendConfigurationAction?.Invoke(cacheCfg);
            return ignite.GetOrCreateCache<TKey, TData>(cacheCfg);
        }
    }
{code}

> .NET: B+Tree is corrupted when string value has emoticons
> ---------------------------------------------------------
>
>                 Key: IGNITE-18347
>                 URL: https://issues.apache.org/jira/browse/IGNITE-18347
>             Project: Ignite
>          Issue Type: Bug
>          Components: platforms
>    Affects Versions: 2.14
>         Environment: Apache Ignite: v2.14.0
> JDK: v1.11
> .NET Core: v6.0
> Azure Kubernetes Service (AKS)
> StorageClass: (provisioner: disk.csi.azure.com, skuname: Premium_ZRS)
>            Reporter: Danut Radoaica
>            Priority: Major
>
> exception: "JVM will be halted immediately due to the failure: 
> [failureCtx=FailureContext [type=CRITICAL_ERROR, err=class 
> o.a.i.i.processors.cache.persistence.tree.CorruptedTreeException: B+Tree is 
> corrupted [groupId=-1229361758, pageIds=[1129924291198982], 
> groupName=Druid.DataAccess.DbEntities.LiveChatConversation, msg=Runtime 
> failure on search row: SearchRow [key=KeyCacheObjectImpl [part=937, 
> val=6194b7bf-64a0-4b00-87eb-2660ecc3536a, hasValBytes=true], hash=1847364021, 
> cacheId=-998779923]]]]"
> dto:        
>         [Table("LiveChatConversation")]
>         private class LiveChatConversation
>         {
>             [Column]
>             [Key]
>             public Guid Id \{ get; set; }
>             [Column]
>             [MaxLength(255)]
>             public string HelpdeskSubject \{ get; set; }
>         }
> HelpdeskSubject string value: "💋💋💋💋💋💋💋💋💋"



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to