[ 
https://issues.apache.org/jira/browse/IGNITE-28015?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Roman Puchkovskiy updated IGNITE-28015:
---------------------------------------
    Description: 
When making a call through a KV API, it is possible to get an exception saying 
that the primary replica has changed, like this:

{noformat}
org.apache.ignite.lang.IgniteException: IGN-CMN-65535 The primary replica has 
changed [expectedLeaseholderName=ihpt_t_3344, 
currentLeaseholderName=ihpt_t_3344, 
expectedLeaseholderId=5e4b1cc5-53c6-4609-8246-b0d6b048e0ca, 
currentLeaseholderId=5e4b1cc5-53c6-4609-8246-b0d6b048e0ca, 
expectedEnlistmentConsistencyToken=116135913863446542, 
currentEnlistmentConsistencyToken=116135915175739407, 
replicationGroupId=20_part_1]
 TraceId:a4107cb9
        at 
java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:732)
        at 
org.apache.ignite.internal.util.ExceptionUtils$1.copy(ExceptionUtils.java:971)
        at 
org.apache.ignite.internal.util.ExceptionUtils$ExceptionFactory.createCopy(ExceptionUtils.java:905)
        at 
org.apache.ignite.internal.util.ExceptionUtils.copyExceptionWithCause(ExceptionUtils.java:688)
        at 
org.apache.ignite.internal.util.ViewUtils.copyExceptionWithCauseIfPossible(ViewUtils.java:91)
        at 
org.apache.ignite.internal.util.ViewUtils.ensurePublicException(ViewUtils.java:71)
        at org.apache.ignite.internal.util.ViewUtils.sync(ViewUtils.java:54)
        at 
org.apache.ignite.internal.table.KeyValueViewImpl.remove(KeyValueViewImpl.java:380)
        at 
org.apache.ignite.internal.table.PublicApiThreadingKeyValueView.lambda$remove$22(PublicApiThreadingKeyValueView.java:167)
        at 
org.apache.ignite.internal.thread.PublicApiThreading.executeWithRole(PublicApiThreading.java:144)
        at 
org.apache.ignite.internal.thread.PublicApiThreading.execUserSyncOperation(PublicApiThreading.java:102)
        at 
org.apache.ignite.internal.table.PublicApiThreadingViewBase.executeSyncOp(PublicApiThreadingViewBase.java:107)
        at 
org.apache.ignite.internal.table.PublicApiThreadingKeyValueView.remove(PublicApiThreadingKeyValueView.java:167)
        at 
org.apache.ignite.internal.restart.RestartProofKeyValueView.lambda$remove$22(RestartProofKeyValueView.java:171)
        at 
org.apache.ignite.internal.restart.RestartProofApiObject.lambda$attached$0(RestartProofApiObject.java:46)
        at 
org.apache.ignite.internal.restart.IgniteAttachmentLock.attached(IgniteAttachmentLock.java:59)
        at 
org.apache.ignite.internal.restart.RestartProofApiObject.attached(RestartProofApiObject.java:46)
        at 
org.apache.ignite.internal.restart.RestartProofKeyValueView.remove(RestartProofKeyValueView.java:171)
        at org.apache.ignite.table.KeyValueView.remove(KeyValueView.java:586)
        at 
org.apache.ignite.internal.runner.app.ItHugePutsTest.test(ItHugePutsTest.java:60)
        at java.base/java.lang.reflect.Method.invoke(Method.java:569)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
Caused by: org.apache.ignite.lang.IgniteException: IGN-CMN-65535 The primary 
replica has changed [expectedLeaseholderName=ihpt_t_3344, 
currentLeaseholderName=ihpt_t_3344, 
expectedLeaseholderId=5e4b1cc5-53c6-4609-8246-b0d6b048e0ca, 
currentLeaseholderId=5e4b1cc5-53c6-4609-8246-b0d6b048e0ca, 
expectedEnlistmentConsistencyToken=116135913863446542, 
currentEnlistmentConsistencyToken=116135915175739407, 
replicationGroupId=20_part_1] TraceId:a4107cb9
        at 
org.apache.ignite.internal.lang.IgniteExceptionMapperUtil.lambda$mapToPublicException$2(IgniteExceptionMapperUtil.java:88)
        at 
org.apache.ignite.internal.lang.IgniteExceptionMapperUtil.mapCheckingResultIsPublic(IgniteExceptionMapperUtil.java:141)
        at 
org.apache.ignite.internal.lang.IgniteExceptionMapperUtil.mapToPublicException(IgniteExceptionMapperUtil.java:137)
        at 
org.apache.ignite.internal.lang.IgniteExceptionMapperUtil.mapToPublicException(IgniteExceptionMapperUtil.java:88)
        at 
org.apache.ignite.internal.lang.IgniteExceptionMapperUtil.lambda$convertToPublicFuture$3(IgniteExceptionMapperUtil.java:178)
        at 
java.base/java.util.concurrent.CompletableFuture.uniHandle(CompletableFuture.java:934)
        at 
java.base/java.util.concurrent.CompletableFuture$UniHandle.tryFire$$$capture(CompletableFuture.java:911)
        at 
java.base/java.util.concurrent.CompletableFuture$UniHandle.tryFire(CompletableFuture.java)
        at --- Async.Stack.Trace --- (captured by IntelliJ IDEA debugger)
        at 
java.base/java.util.concurrent.CompletableFuture$UniHandle.<init>(CompletableFuture.java:904)
        at 
java.base/java.util.concurrent.CompletableFuture.uniHandleStage(CompletableFuture.java:948)
        at 
java.base/java.util.concurrent.CompletableFuture.handle(CompletableFuture.java:2340)
        at 
org.apache.ignite.internal.lang.IgniteExceptionMapperUtil.convertToPublicFuture(IgniteExceptionMapperUtil.java:176)
        at 
org.apache.ignite.internal.table.AbstractTableView.doOperation(AbstractTableView.java:112)
        at 
org.apache.ignite.internal.table.KeyValueViewImpl.removeAsync(KeyValueViewImpl.java:394)
        at 
org.apache.ignite.internal.table.KeyValueViewImpl.remove(KeyValueViewImpl.java:380)
        at 
org.apache.ignite.internal.table.PublicApiThreadingKeyValueView.lambda$remove$22(PublicApiThreadingKeyValueView.java:167)
        at 
org.apache.ignite.internal.thread.PublicApiThreading.executeWithRole(PublicApiThreading.java:144)
        at 
org.apache.ignite.internal.thread.PublicApiThreading.execUserSyncOperation(PublicApiThreading.java:102)
        at 
org.apache.ignite.internal.table.PublicApiThreadingViewBase.executeSyncOp(PublicApiThreadingViewBase.java:107)
        at 
org.apache.ignite.internal.table.PublicApiThreadingKeyValueView.remove(PublicApiThreadingKeyValueView.java:167)
        at 
org.apache.ignite.internal.restart.RestartProofKeyValueView.lambda$remove$22(RestartProofKeyValueView.java:171)
        at 
org.apache.ignite.internal.restart.RestartProofApiObject.lambda$attached$0(RestartProofApiObject.java:46)
        at 
org.apache.ignite.internal.restart.IgniteAttachmentLock.attached(IgniteAttachmentLock.java:59)
        at 
org.apache.ignite.internal.restart.RestartProofApiObject.attached(RestartProofApiObject.java:46)
        at 
org.apache.ignite.internal.restart.RestartProofKeyValueView.remove(RestartProofKeyValueView.java:171)
        at org.apache.ignite.table.KeyValueView.remove(KeyValueView.java:586)
        at 
org.apache.ignite.internal.runner.app.ItHugePutsTest.test(ItHugePutsTest.java:60)
        at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at 
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:569)
        at 
org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:786)
        at 
org.junit.platform.commons.support.ReflectionSupport.invokeMethod(ReflectionSupport.java:514)
        at 
org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
        at 
org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
        at 
org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:161)
        at 
org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:152)
        at 
org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:91)
        at 
org.junit.jupiter.engine.execution.InterceptingExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(InterceptingExecutableInvoker.java:112)
        at 
org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.lambda$invoke$0(InterceptingExecutableInvoker.java:94)
        at 
org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
        at 
org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
        at 
org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
        at 
org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
        at 
org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:93)
        at 
org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:87)
        at 
org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$4(TestMethodTestDescriptor.java:221)
        at 
org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
        at 
org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:217)
        at 
org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:159)
        at 
org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:70)
        at 
org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:157)
        at 
org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
        at 
org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:147)
        at 
org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
        at 
org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:145)
        at 
org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
        at 
org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:144)
        at 
org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:101)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
        at 
org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
        at 
org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:161)
        at 
org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
        at 
org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:147)
        at 
org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
        at 
org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:145)
        at 
org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
        at 
org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:144)
        at 
org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:101)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
        at 
org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
        at 
org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:161)
        at 
org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
        at 
org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:147)
        at 
org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
        at 
org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:145)
        at 
org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
        at 
org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:144)
        at 
org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:101)
        at 
org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)
        at 
org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
        at 
org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54)
        at 
org.junit.platform.launcher.core.EngineExecutionOrchestrator.executeEngine(EngineExecutionOrchestrator.java:230)
        at 
org.junit.platform.launcher.core.EngineExecutionOrchestrator.failOrExecuteEngine(EngineExecutionOrchestrator.java:204)
        at 
org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:172)
        at 
org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:101)
        at 
org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:64)
        at 
org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:150)
        at 
org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:63)
        at 
org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:109)
        at 
org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:91)
        at 
org.junit.platform.launcher.core.DelegatingLauncher.execute(DelegatingLauncher.java:47)
        at 
org.junit.platform.launcher.core.InterceptingLauncher.lambda$execute$1(InterceptingLauncher.java:39)
        at 
org.junit.platform.launcher.core.ClasspathAlignmentCheckingLauncherInterceptor.intercept(ClasspathAlignmentCheckingLauncherInterceptor.java:25)
        at 
org.junit.platform.launcher.core.InterceptingLauncher.execute(InterceptingLauncher.java:38)
        at 
org.junit.platform.launcher.core.DelegatingLauncher.execute(DelegatingLauncher.java:47)
        at 
org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:66)
        at 
com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:66)
        at 
com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)
        at 
com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)
        at 
com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)
        at 
com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:237)
        at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)
Caused by: 
org.apache.ignite.internal.replicator.exception.PrimaryReplicaMissException: 
IGN-REP-6 The primary replica has changed [expectedLeaseholderName=ihpt_t_3344, 
currentLeaseholderName=ihpt_t_3344, 
expectedLeaseholderId=5e4b1cc5-53c6-4609-8246-b0d6b048e0ca, 
currentLeaseholderId=5e4b1cc5-53c6-4609-8246-b0d6b048e0ca, 
expectedEnlistmentConsistencyToken=116135913863446542, 
currentEnlistmentConsistencyToken=116135915175739407, 
replicationGroupId=20_part_1] TraceId:a4107cb9
        at 
org.apache.ignite.internal.partition.replicator.ReplicaPrimacyEngine.validateReplicaPrimacy(ReplicaPrimacyEngine.java:139)
        at 
org.apache.ignite.internal.partition.replicator.ReplicaPrimacyEngine.lambda$ensureReplicaIsPrimary$0(ReplicaPrimacyEngine.java:94)
        at 
java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire$$$capture(CompletableFuture.java:646)
        at 
java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java)
        at --- Async.Stack.Trace --- (captured by IntelliJ IDEA debugger)
        at 
java.base/java.util.concurrent.CompletableFuture$UniApply.<init>(CompletableFuture.java:625)
        at 
java.base/java.util.concurrent.CompletableFuture.uniApplyStage(CompletableFuture.java:664)
        at 
java.base/java.util.concurrent.CompletableFuture.thenApply(CompletableFuture.java:2168)
        at 
org.apache.ignite.internal.partition.replicator.ReplicaPrimacyEngine.ensureReplicaIsPrimary(ReplicaPrimacyEngine.java:110)
        at 
org.apache.ignite.internal.partition.replicator.ReplicaPrimacyEngine.validatePrimacy(ReplicaPrimacyEngine.java:78)
        at 
org.apache.ignite.internal.partition.replicator.ZonePartitionReplicaListener.invoke(ZonePartitionReplicaListener.java:213)
        at 
org.apache.ignite.internal.replicator.ZonePartitionReplicaImpl.processRequest(ZonePartitionReplicaImpl.java:75)
        at 
org.apache.ignite.internal.replicator.ReplicaManager.handleReplicaRequest(ReplicaManager.java:407)
        at 
org.apache.ignite.internal.replicator.ReplicaManager.onReplicaMessageReceived(ReplicaManager.java:340)
        at 
org.apache.ignite.internal.network.DefaultMessagingService.sendToSelf(DefaultMessagingService.java:479)
        at 
org.apache.ignite.internal.network.DefaultMessagingService.invoke0(DefaultMessagingService.java:373)
        at 
org.apache.ignite.internal.network.DefaultMessagingService.invoke(DefaultMessagingService.java:286)
        at 
org.apache.ignite.internal.network.wrapper.JumpToExecutorByConsistentIdAfterSend.invoke(JumpToExecutorByConsistentIdAfterSend.java:108)
        at 
org.apache.ignite.internal.network.MessagingService.invoke(MessagingService.java:241)
        at 
org.apache.ignite.internal.replicator.ReplicaService.sendToReplicaRaw(ReplicaService.java:152)
        at 
org.apache.ignite.internal.replicator.ReplicaService.invokeRaw(ReplicaService.java:358)
        at 
org.apache.ignite.internal.table.distributed.storage.InternalTableImpl.trackingInvoke(InternalTableImpl.java:649)
        at 
org.apache.ignite.internal.table.distributed.storage.InternalTableImpl.lambda$enlistAndInvoke$7(InternalTableImpl.java:618)
        at 
java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire$$$capture(CompletableFuture.java:1150)
        at 
java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java)
        at --- Async.Stack.Trace --- (captured by IntelliJ IDEA debugger)
        at 
java.base/java.util.concurrent.CompletableFuture$UniCompose.<init>(CompletableFuture.java:1129)
        at 
java.base/java.util.concurrent.CompletableFuture.uniComposeStage(CompletableFuture.java:1173)
        at 
java.base/java.util.concurrent.CompletableFuture.thenCompose(CompletableFuture.java:2309)
        at 
org.apache.ignite.internal.table.distributed.storage.InternalTableImpl.enlistAndInvoke(InternalTableImpl.java:617)
        at 
org.apache.ignite.internal.table.distributed.storage.InternalTableImpl.enlistInTx(InternalTableImpl.java:368)
        at 
org.apache.ignite.internal.table.distributed.storage.InternalTableImpl.enlistInTx(InternalTableImpl.java:313)
        at 
org.apache.ignite.internal.table.distributed.storage.InternalTableImpl.delete(InternalTableImpl.java:1432)
        at 
org.apache.ignite.internal.table.KeyValueViewImpl.lambda$removeAsync$19(KeyValueViewImpl.java:397)
        at 
org.apache.ignite.internal.table.AbstractTableView.lambda$withSchemaSync$1(AbstractTableView.java:147)
        at 
java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire$$$capture(CompletableFuture.java:1150)
        at 
java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java)
        at --- Async.Stack.Trace --- (captured by IntelliJ IDEA debugger)
        at 
java.base/java.util.concurrent.CompletableFuture$UniCompose.<init>(CompletableFuture.java:1129)
        at 
java.base/java.util.concurrent.CompletableFuture.uniComposeStage(CompletableFuture.java:1173)
        at 
java.base/java.util.concurrent.CompletableFuture.thenCompose(CompletableFuture.java:2309)
        at 
org.apache.ignite.internal.table.AbstractTableView.withSchemaSync(AbstractTableView.java:147)
        at 
org.apache.ignite.internal.table.AbstractTableView.withSchemaSync(AbstractTableView.java:134)
        ... 91 more
{noformat}

But it seems that such exceptions should be handled internally and they should 
never reach the user code.

Also, the exception has the 'undefined' error code which should not happen.

  was:
When making a call through a KV API, it is possible to get an exception saying 
that the primary replica has changed, like this:


{noformat}
org.apache.ignite.lang.IgniteException: IGN-CMN-65535 The primary replica has 
changed [expectedLeaseholderName=ihpt_t_3344, 
currentLeaseholderName=ihpt_t_3344, 
expectedLeaseholderId=5e4b1cc5-53c6-4609-8246-b0d6b048e0ca, 
currentLeaseholderId=5e4b1cc5-53c6-4609-8246-b0d6b048e0ca, 
expectedEnlistmentConsistencyToken=116135913863446542, 
currentEnlistmentConsistencyToken=116135915175739407, 
replicationGroupId=20_part_1]
 TraceId:a4107cb9
        at 
java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:732)
        at 
org.apache.ignite.internal.util.ExceptionUtils$1.copy(ExceptionUtils.java:971)
        at 
org.apache.ignite.internal.util.ExceptionUtils$ExceptionFactory.createCopy(ExceptionUtils.java:905)
        at 
org.apache.ignite.internal.util.ExceptionUtils.copyExceptionWithCause(ExceptionUtils.java:688)
        at 
org.apache.ignite.internal.util.ViewUtils.copyExceptionWithCauseIfPossible(ViewUtils.java:91)
        at 
org.apache.ignite.internal.util.ViewUtils.ensurePublicException(ViewUtils.java:71)
        at org.apache.ignite.internal.util.ViewUtils.sync(ViewUtils.java:54)
        at 
org.apache.ignite.internal.table.KeyValueViewImpl.remove(KeyValueViewImpl.java:380)
        at 
org.apache.ignite.internal.table.PublicApiThreadingKeyValueView.lambda$remove$22(PublicApiThreadingKeyValueView.java:167)
        at 
org.apache.ignite.internal.thread.PublicApiThreading.executeWithRole(PublicApiThreading.java:144)
        at 
org.apache.ignite.internal.thread.PublicApiThreading.execUserSyncOperation(PublicApiThreading.java:102)
        at 
org.apache.ignite.internal.table.PublicApiThreadingViewBase.executeSyncOp(PublicApiThreadingViewBase.java:107)
        at 
org.apache.ignite.internal.table.PublicApiThreadingKeyValueView.remove(PublicApiThreadingKeyValueView.java:167)
        at 
org.apache.ignite.internal.restart.RestartProofKeyValueView.lambda$remove$22(RestartProofKeyValueView.java:171)
        at 
org.apache.ignite.internal.restart.RestartProofApiObject.lambda$attached$0(RestartProofApiObject.java:46)
        at 
org.apache.ignite.internal.restart.IgniteAttachmentLock.attached(IgniteAttachmentLock.java:59)
        at 
org.apache.ignite.internal.restart.RestartProofApiObject.attached(RestartProofApiObject.java:46)
        at 
org.apache.ignite.internal.restart.RestartProofKeyValueView.remove(RestartProofKeyValueView.java:171)
        at org.apache.ignite.table.KeyValueView.remove(KeyValueView.java:586)
        at 
org.apache.ignite.internal.runner.app.ItHugePutsTest.test(ItHugePutsTest.java:60)
        at java.base/java.lang.reflect.Method.invoke(Method.java:569)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
Caused by: org.apache.ignite.lang.IgniteException: IGN-CMN-65535 The primary 
replica has changed [expectedLeaseholderName=ihpt_t_3344, 
currentLeaseholderName=ihpt_t_3344, 
expectedLeaseholderId=5e4b1cc5-53c6-4609-8246-b0d6b048e0ca, 
currentLeaseholderId=5e4b1cc5-53c6-4609-8246-b0d6b048e0ca, 
expectedEnlistmentConsistencyToken=116135913863446542, 
currentEnlistmentConsistencyToken=116135915175739407, 
replicationGroupId=20_part_1] TraceId:a4107cb9
        at 
org.apache.ignite.internal.lang.IgniteExceptionMapperUtil.lambda$mapToPublicException$2(IgniteExceptionMapperUtil.java:88)
        at 
org.apache.ignite.internal.lang.IgniteExceptionMapperUtil.mapCheckingResultIsPublic(IgniteExceptionMapperUtil.java:141)
        at 
org.apache.ignite.internal.lang.IgniteExceptionMapperUtil.mapToPublicException(IgniteExceptionMapperUtil.java:137)
        at 
org.apache.ignite.internal.lang.IgniteExceptionMapperUtil.mapToPublicException(IgniteExceptionMapperUtil.java:88)
        at 
org.apache.ignite.internal.lang.IgniteExceptionMapperUtil.lambda$convertToPublicFuture$3(IgniteExceptionMapperUtil.java:178)
        at 
java.base/java.util.concurrent.CompletableFuture.uniHandle(CompletableFuture.java:934)
        at 
java.base/java.util.concurrent.CompletableFuture$UniHandle.tryFire$$$capture(CompletableFuture.java:911)
        at 
java.base/java.util.concurrent.CompletableFuture$UniHandle.tryFire(CompletableFuture.java)
        at --- Async.Stack.Trace --- (captured by IntelliJ IDEA debugger)
        at 
java.base/java.util.concurrent.CompletableFuture$UniHandle.<init>(CompletableFuture.java:904)
        at 
java.base/java.util.concurrent.CompletableFuture.uniHandleStage(CompletableFuture.java:948)
        at 
java.base/java.util.concurrent.CompletableFuture.handle(CompletableFuture.java:2340)
        at 
org.apache.ignite.internal.lang.IgniteExceptionMapperUtil.convertToPublicFuture(IgniteExceptionMapperUtil.java:176)
        at 
org.apache.ignite.internal.table.AbstractTableView.doOperation(AbstractTableView.java:112)
        at 
org.apache.ignite.internal.table.KeyValueViewImpl.removeAsync(KeyValueViewImpl.java:394)
        at 
org.apache.ignite.internal.table.KeyValueViewImpl.remove(KeyValueViewImpl.java:380)
        at 
org.apache.ignite.internal.table.PublicApiThreadingKeyValueView.lambda$remove$22(PublicApiThreadingKeyValueView.java:167)
        at 
org.apache.ignite.internal.thread.PublicApiThreading.executeWithRole(PublicApiThreading.java:144)
        at 
org.apache.ignite.internal.thread.PublicApiThreading.execUserSyncOperation(PublicApiThreading.java:102)
        at 
org.apache.ignite.internal.table.PublicApiThreadingViewBase.executeSyncOp(PublicApiThreadingViewBase.java:107)
        at 
org.apache.ignite.internal.table.PublicApiThreadingKeyValueView.remove(PublicApiThreadingKeyValueView.java:167)
        at 
org.apache.ignite.internal.restart.RestartProofKeyValueView.lambda$remove$22(RestartProofKeyValueView.java:171)
        at 
org.apache.ignite.internal.restart.RestartProofApiObject.lambda$attached$0(RestartProofApiObject.java:46)
        at 
org.apache.ignite.internal.restart.IgniteAttachmentLock.attached(IgniteAttachmentLock.java:59)
        at 
org.apache.ignite.internal.restart.RestartProofApiObject.attached(RestartProofApiObject.java:46)
        at 
org.apache.ignite.internal.restart.RestartProofKeyValueView.remove(RestartProofKeyValueView.java:171)
        at org.apache.ignite.table.KeyValueView.remove(KeyValueView.java:586)
        at 
org.apache.ignite.internal.runner.app.ItHugePutsTest.test(ItHugePutsTest.java:60)
        at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at 
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:569)
        at 
org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:786)
        at 
org.junit.platform.commons.support.ReflectionSupport.invokeMethod(ReflectionSupport.java:514)
        at 
org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
        at 
org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
        at 
org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:161)
        at 
org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:152)
        at 
org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:91)
        at 
org.junit.jupiter.engine.execution.InterceptingExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(InterceptingExecutableInvoker.java:112)
        at 
org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.lambda$invoke$0(InterceptingExecutableInvoker.java:94)
        at 
org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
        at 
org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
        at 
org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
        at 
org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
        at 
org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:93)
        at 
org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:87)
        at 
org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$4(TestMethodTestDescriptor.java:221)
        at 
org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
        at 
org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:217)
        at 
org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:159)
        at 
org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:70)
        at 
org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:157)
        at 
org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
        at 
org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:147)
        at 
org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
        at 
org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:145)
        at 
org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
        at 
org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:144)
        at 
org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:101)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
        at 
org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
        at 
org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:161)
        at 
org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
        at 
org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:147)
        at 
org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
        at 
org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:145)
        at 
org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
        at 
org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:144)
        at 
org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:101)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
        at 
org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
        at 
org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:161)
        at 
org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
        at 
org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:147)
        at 
org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
        at 
org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:145)
        at 
org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
        at 
org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:144)
        at 
org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:101)
        at 
org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)
        at 
org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
        at 
org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54)
        at 
org.junit.platform.launcher.core.EngineExecutionOrchestrator.executeEngine(EngineExecutionOrchestrator.java:230)
        at 
org.junit.platform.launcher.core.EngineExecutionOrchestrator.failOrExecuteEngine(EngineExecutionOrchestrator.java:204)
        at 
org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:172)
        at 
org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:101)
        at 
org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:64)
        at 
org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:150)
        at 
org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:63)
        at 
org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:109)
        at 
org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:91)
        at 
org.junit.platform.launcher.core.DelegatingLauncher.execute(DelegatingLauncher.java:47)
        at 
org.junit.platform.launcher.core.InterceptingLauncher.lambda$execute$1(InterceptingLauncher.java:39)
        at 
org.junit.platform.launcher.core.ClasspathAlignmentCheckingLauncherInterceptor.intercept(ClasspathAlignmentCheckingLauncherInterceptor.java:25)
        at 
org.junit.platform.launcher.core.InterceptingLauncher.execute(InterceptingLauncher.java:38)
        at 
org.junit.platform.launcher.core.DelegatingLauncher.execute(DelegatingLauncher.java:47)
        at 
org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:66)
        at 
com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:66)
        at 
com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)
        at 
com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)
        at 
com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)
        at 
com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:237)
        at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)
Caused by: 
org.apache.ignite.internal.replicator.exception.PrimaryReplicaMissException: 
IGN-REP-6 The primary replica has changed [expectedLeaseholderName=ihpt_t_3344, 
currentLeaseholderName=ihpt_t_3344, 
expectedLeaseholderId=5e4b1cc5-53c6-4609-8246-b0d6b048e0ca, 
currentLeaseholderId=5e4b1cc5-53c6-4609-8246-b0d6b048e0ca, 
expectedEnlistmentConsistencyToken=116135913863446542, 
currentEnlistmentConsistencyToken=116135915175739407, 
replicationGroupId=20_part_1] TraceId:a4107cb9
        at 
org.apache.ignite.internal.partition.replicator.ReplicaPrimacyEngine.validateReplicaPrimacy(ReplicaPrimacyEngine.java:139)
        at 
org.apache.ignite.internal.partition.replicator.ReplicaPrimacyEngine.lambda$ensureReplicaIsPrimary$0(ReplicaPrimacyEngine.java:94)
        at 
java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire$$$capture(CompletableFuture.java:646)
        at 
java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java)
        at --- Async.Stack.Trace --- (captured by IntelliJ IDEA debugger)
        at 
java.base/java.util.concurrent.CompletableFuture$UniApply.<init>(CompletableFuture.java:625)
        at 
java.base/java.util.concurrent.CompletableFuture.uniApplyStage(CompletableFuture.java:664)
        at 
java.base/java.util.concurrent.CompletableFuture.thenApply(CompletableFuture.java:2168)
        at 
org.apache.ignite.internal.partition.replicator.ReplicaPrimacyEngine.ensureReplicaIsPrimary(ReplicaPrimacyEngine.java:110)
        at 
org.apache.ignite.internal.partition.replicator.ReplicaPrimacyEngine.validatePrimacy(ReplicaPrimacyEngine.java:78)
        at 
org.apache.ignite.internal.partition.replicator.ZonePartitionReplicaListener.invoke(ZonePartitionReplicaListener.java:213)
        at 
org.apache.ignite.internal.replicator.ZonePartitionReplicaImpl.processRequest(ZonePartitionReplicaImpl.java:75)
        at 
org.apache.ignite.internal.replicator.ReplicaManager.handleReplicaRequest(ReplicaManager.java:407)
        at 
org.apache.ignite.internal.replicator.ReplicaManager.onReplicaMessageReceived(ReplicaManager.java:340)
        at 
org.apache.ignite.internal.network.DefaultMessagingService.sendToSelf(DefaultMessagingService.java:479)
        at 
org.apache.ignite.internal.network.DefaultMessagingService.invoke0(DefaultMessagingService.java:373)
        at 
org.apache.ignite.internal.network.DefaultMessagingService.invoke(DefaultMessagingService.java:286)
        at 
org.apache.ignite.internal.network.wrapper.JumpToExecutorByConsistentIdAfterSend.invoke(JumpToExecutorByConsistentIdAfterSend.java:108)
        at 
org.apache.ignite.internal.network.MessagingService.invoke(MessagingService.java:241)
        at 
org.apache.ignite.internal.replicator.ReplicaService.sendToReplicaRaw(ReplicaService.java:152)
        at 
org.apache.ignite.internal.replicator.ReplicaService.invokeRaw(ReplicaService.java:358)
        at 
org.apache.ignite.internal.table.distributed.storage.InternalTableImpl.trackingInvoke(InternalTableImpl.java:649)
        at 
org.apache.ignite.internal.table.distributed.storage.InternalTableImpl.lambda$enlistAndInvoke$7(InternalTableImpl.java:618)
        at 
java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire$$$capture(CompletableFuture.java:1150)
        at 
java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java)
        at --- Async.Stack.Trace --- (captured by IntelliJ IDEA debugger)
        at 
java.base/java.util.concurrent.CompletableFuture$UniCompose.<init>(CompletableFuture.java:1129)
        at 
java.base/java.util.concurrent.CompletableFuture.uniComposeStage(CompletableFuture.java:1173)
        at 
java.base/java.util.concurrent.CompletableFuture.thenCompose(CompletableFuture.java:2309)
        at 
org.apache.ignite.internal.table.distributed.storage.InternalTableImpl.enlistAndInvoke(InternalTableImpl.java:617)
        at 
org.apache.ignite.internal.table.distributed.storage.InternalTableImpl.enlistInTx(InternalTableImpl.java:368)
        at 
org.apache.ignite.internal.table.distributed.storage.InternalTableImpl.enlistInTx(InternalTableImpl.java:313)
        at 
org.apache.ignite.internal.table.distributed.storage.InternalTableImpl.delete(InternalTableImpl.java:1432)
        at 
org.apache.ignite.internal.table.KeyValueViewImpl.lambda$removeAsync$19(KeyValueViewImpl.java:397)
        at 
org.apache.ignite.internal.table.AbstractTableView.lambda$withSchemaSync$1(AbstractTableView.java:147)
        at 
java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire$$$capture(CompletableFuture.java:1150)
        at 
java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java)
        at --- Async.Stack.Trace --- (captured by IntelliJ IDEA debugger)
        at 
java.base/java.util.concurrent.CompletableFuture$UniCompose.<init>(CompletableFuture.java:1129)
        at 
java.base/java.util.concurrent.CompletableFuture.uniComposeStage(CompletableFuture.java:1173)
        at 
java.base/java.util.concurrent.CompletableFuture.thenCompose(CompletableFuture.java:2309)
        at 
org.apache.ignite.internal.table.AbstractTableView.withSchemaSync(AbstractTableView.java:147)
        at 
org.apache.ignite.internal.table.AbstractTableView.withSchemaSync(AbstractTableView.java:134)
        ... 91 more
{noformat}

But it seems that such exceptions should be handled internally and they should 
never reach the user code.


> 'The primary replica has changed' reaches the client
> ----------------------------------------------------
>
>                 Key: IGNITE-28015
>                 URL: https://issues.apache.org/jira/browse/IGNITE-28015
>             Project: Ignite
>          Issue Type: Bug
>            Reporter: Roman Puchkovskiy
>            Priority: Major
>              Labels: ignite-3
>
> When making a call through a KV API, it is possible to get an exception 
> saying that the primary replica has changed, like this:
> {noformat}
> org.apache.ignite.lang.IgniteException: IGN-CMN-65535 The primary replica has 
> changed [expectedLeaseholderName=ihpt_t_3344, 
> currentLeaseholderName=ihpt_t_3344, 
> expectedLeaseholderId=5e4b1cc5-53c6-4609-8246-b0d6b048e0ca, 
> currentLeaseholderId=5e4b1cc5-53c6-4609-8246-b0d6b048e0ca, 
> expectedEnlistmentConsistencyToken=116135913863446542, 
> currentEnlistmentConsistencyToken=116135915175739407, 
> replicationGroupId=20_part_1]
>  TraceId:a4107cb9
>       at 
> java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:732)
>       at 
> org.apache.ignite.internal.util.ExceptionUtils$1.copy(ExceptionUtils.java:971)
>       at 
> org.apache.ignite.internal.util.ExceptionUtils$ExceptionFactory.createCopy(ExceptionUtils.java:905)
>       at 
> org.apache.ignite.internal.util.ExceptionUtils.copyExceptionWithCause(ExceptionUtils.java:688)
>       at 
> org.apache.ignite.internal.util.ViewUtils.copyExceptionWithCauseIfPossible(ViewUtils.java:91)
>       at 
> org.apache.ignite.internal.util.ViewUtils.ensurePublicException(ViewUtils.java:71)
>       at org.apache.ignite.internal.util.ViewUtils.sync(ViewUtils.java:54)
>       at 
> org.apache.ignite.internal.table.KeyValueViewImpl.remove(KeyValueViewImpl.java:380)
>       at 
> org.apache.ignite.internal.table.PublicApiThreadingKeyValueView.lambda$remove$22(PublicApiThreadingKeyValueView.java:167)
>       at 
> org.apache.ignite.internal.thread.PublicApiThreading.executeWithRole(PublicApiThreading.java:144)
>       at 
> org.apache.ignite.internal.thread.PublicApiThreading.execUserSyncOperation(PublicApiThreading.java:102)
>       at 
> org.apache.ignite.internal.table.PublicApiThreadingViewBase.executeSyncOp(PublicApiThreadingViewBase.java:107)
>       at 
> org.apache.ignite.internal.table.PublicApiThreadingKeyValueView.remove(PublicApiThreadingKeyValueView.java:167)
>       at 
> org.apache.ignite.internal.restart.RestartProofKeyValueView.lambda$remove$22(RestartProofKeyValueView.java:171)
>       at 
> org.apache.ignite.internal.restart.RestartProofApiObject.lambda$attached$0(RestartProofApiObject.java:46)
>       at 
> org.apache.ignite.internal.restart.IgniteAttachmentLock.attached(IgniteAttachmentLock.java:59)
>       at 
> org.apache.ignite.internal.restart.RestartProofApiObject.attached(RestartProofApiObject.java:46)
>       at 
> org.apache.ignite.internal.restart.RestartProofKeyValueView.remove(RestartProofKeyValueView.java:171)
>       at org.apache.ignite.table.KeyValueView.remove(KeyValueView.java:586)
>       at 
> org.apache.ignite.internal.runner.app.ItHugePutsTest.test(ItHugePutsTest.java:60)
>       at java.base/java.lang.reflect.Method.invoke(Method.java:569)
>       at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
>       at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
> Caused by: org.apache.ignite.lang.IgniteException: IGN-CMN-65535 The primary 
> replica has changed [expectedLeaseholderName=ihpt_t_3344, 
> currentLeaseholderName=ihpt_t_3344, 
> expectedLeaseholderId=5e4b1cc5-53c6-4609-8246-b0d6b048e0ca, 
> currentLeaseholderId=5e4b1cc5-53c6-4609-8246-b0d6b048e0ca, 
> expectedEnlistmentConsistencyToken=116135913863446542, 
> currentEnlistmentConsistencyToken=116135915175739407, 
> replicationGroupId=20_part_1] TraceId:a4107cb9
>       at 
> org.apache.ignite.internal.lang.IgniteExceptionMapperUtil.lambda$mapToPublicException$2(IgniteExceptionMapperUtil.java:88)
>       at 
> org.apache.ignite.internal.lang.IgniteExceptionMapperUtil.mapCheckingResultIsPublic(IgniteExceptionMapperUtil.java:141)
>       at 
> org.apache.ignite.internal.lang.IgniteExceptionMapperUtil.mapToPublicException(IgniteExceptionMapperUtil.java:137)
>       at 
> org.apache.ignite.internal.lang.IgniteExceptionMapperUtil.mapToPublicException(IgniteExceptionMapperUtil.java:88)
>       at 
> org.apache.ignite.internal.lang.IgniteExceptionMapperUtil.lambda$convertToPublicFuture$3(IgniteExceptionMapperUtil.java:178)
>       at 
> java.base/java.util.concurrent.CompletableFuture.uniHandle(CompletableFuture.java:934)
>       at 
> java.base/java.util.concurrent.CompletableFuture$UniHandle.tryFire$$$capture(CompletableFuture.java:911)
>       at 
> java.base/java.util.concurrent.CompletableFuture$UniHandle.tryFire(CompletableFuture.java)
>       at --- Async.Stack.Trace --- (captured by IntelliJ IDEA debugger)
>       at 
> java.base/java.util.concurrent.CompletableFuture$UniHandle.<init>(CompletableFuture.java:904)
>       at 
> java.base/java.util.concurrent.CompletableFuture.uniHandleStage(CompletableFuture.java:948)
>       at 
> java.base/java.util.concurrent.CompletableFuture.handle(CompletableFuture.java:2340)
>       at 
> org.apache.ignite.internal.lang.IgniteExceptionMapperUtil.convertToPublicFuture(IgniteExceptionMapperUtil.java:176)
>       at 
> org.apache.ignite.internal.table.AbstractTableView.doOperation(AbstractTableView.java:112)
>       at 
> org.apache.ignite.internal.table.KeyValueViewImpl.removeAsync(KeyValueViewImpl.java:394)
>       at 
> org.apache.ignite.internal.table.KeyValueViewImpl.remove(KeyValueViewImpl.java:380)
>       at 
> org.apache.ignite.internal.table.PublicApiThreadingKeyValueView.lambda$remove$22(PublicApiThreadingKeyValueView.java:167)
>       at 
> org.apache.ignite.internal.thread.PublicApiThreading.executeWithRole(PublicApiThreading.java:144)
>       at 
> org.apache.ignite.internal.thread.PublicApiThreading.execUserSyncOperation(PublicApiThreading.java:102)
>       at 
> org.apache.ignite.internal.table.PublicApiThreadingViewBase.executeSyncOp(PublicApiThreadingViewBase.java:107)
>       at 
> org.apache.ignite.internal.table.PublicApiThreadingKeyValueView.remove(PublicApiThreadingKeyValueView.java:167)
>       at 
> org.apache.ignite.internal.restart.RestartProofKeyValueView.lambda$remove$22(RestartProofKeyValueView.java:171)
>       at 
> org.apache.ignite.internal.restart.RestartProofApiObject.lambda$attached$0(RestartProofApiObject.java:46)
>       at 
> org.apache.ignite.internal.restart.IgniteAttachmentLock.attached(IgniteAttachmentLock.java:59)
>       at 
> org.apache.ignite.internal.restart.RestartProofApiObject.attached(RestartProofApiObject.java:46)
>       at 
> org.apache.ignite.internal.restart.RestartProofKeyValueView.remove(RestartProofKeyValueView.java:171)
>       at org.apache.ignite.table.KeyValueView.remove(KeyValueView.java:586)
>       at 
> org.apache.ignite.internal.runner.app.ItHugePutsTest.test(ItHugePutsTest.java:60)
>       at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
>       at 
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>       at java.base/java.lang.reflect.Method.invoke(Method.java:569)
>       at 
> org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:786)
>       at 
> org.junit.platform.commons.support.ReflectionSupport.invokeMethod(ReflectionSupport.java:514)
>       at 
> org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
>       at 
> org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
>       at 
> org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:161)
>       at 
> org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:152)
>       at 
> org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:91)
>       at 
> org.junit.jupiter.engine.execution.InterceptingExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(InterceptingExecutableInvoker.java:112)
>       at 
> org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.lambda$invoke$0(InterceptingExecutableInvoker.java:94)
>       at 
> org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
>       at 
> org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
>       at 
> org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
>       at 
> org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
>       at 
> org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:93)
>       at 
> org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:87)
>       at 
> org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$4(TestMethodTestDescriptor.java:221)
>       at 
> org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
>       at 
> org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:217)
>       at 
> org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:159)
>       at 
> org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:70)
>       at 
> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:157)
>       at 
> org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
>       at 
> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:147)
>       at 
> org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
>       at 
> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:145)
>       at 
> org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
>       at 
> org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:144)
>       at 
> org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:101)
>       at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
>       at 
> org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
>       at 
> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:161)
>       at 
> org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
>       at 
> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:147)
>       at 
> org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
>       at 
> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:145)
>       at 
> org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
>       at 
> org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:144)
>       at 
> org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:101)
>       at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
>       at 
> org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
>       at 
> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:161)
>       at 
> org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
>       at 
> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:147)
>       at 
> org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
>       at 
> org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:145)
>       at 
> org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
>       at 
> org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:144)
>       at 
> org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:101)
>       at 
> org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)
>       at 
> org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
>       at 
> org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54)
>       at 
> org.junit.platform.launcher.core.EngineExecutionOrchestrator.executeEngine(EngineExecutionOrchestrator.java:230)
>       at 
> org.junit.platform.launcher.core.EngineExecutionOrchestrator.failOrExecuteEngine(EngineExecutionOrchestrator.java:204)
>       at 
> org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:172)
>       at 
> org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:101)
>       at 
> org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:64)
>       at 
> org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:150)
>       at 
> org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:63)
>       at 
> org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:109)
>       at 
> org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:91)
>       at 
> org.junit.platform.launcher.core.DelegatingLauncher.execute(DelegatingLauncher.java:47)
>       at 
> org.junit.platform.launcher.core.InterceptingLauncher.lambda$execute$1(InterceptingLauncher.java:39)
>       at 
> org.junit.platform.launcher.core.ClasspathAlignmentCheckingLauncherInterceptor.intercept(ClasspathAlignmentCheckingLauncherInterceptor.java:25)
>       at 
> org.junit.platform.launcher.core.InterceptingLauncher.execute(InterceptingLauncher.java:38)
>       at 
> org.junit.platform.launcher.core.DelegatingLauncher.execute(DelegatingLauncher.java:47)
>       at 
> org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:66)
>       at 
> com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:66)
>       at 
> com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)
>       at 
> com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)
>       at 
> com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)
>       at 
> com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:237)
>       at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)
> Caused by: 
> org.apache.ignite.internal.replicator.exception.PrimaryReplicaMissException: 
> IGN-REP-6 The primary replica has changed 
> [expectedLeaseholderName=ihpt_t_3344, currentLeaseholderName=ihpt_t_3344, 
> expectedLeaseholderId=5e4b1cc5-53c6-4609-8246-b0d6b048e0ca, 
> currentLeaseholderId=5e4b1cc5-53c6-4609-8246-b0d6b048e0ca, 
> expectedEnlistmentConsistencyToken=116135913863446542, 
> currentEnlistmentConsistencyToken=116135915175739407, 
> replicationGroupId=20_part_1] TraceId:a4107cb9
>       at 
> org.apache.ignite.internal.partition.replicator.ReplicaPrimacyEngine.validateReplicaPrimacy(ReplicaPrimacyEngine.java:139)
>       at 
> org.apache.ignite.internal.partition.replicator.ReplicaPrimacyEngine.lambda$ensureReplicaIsPrimary$0(ReplicaPrimacyEngine.java:94)
>       at 
> java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire$$$capture(CompletableFuture.java:646)
>       at 
> java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java)
>       at --- Async.Stack.Trace --- (captured by IntelliJ IDEA debugger)
>       at 
> java.base/java.util.concurrent.CompletableFuture$UniApply.<init>(CompletableFuture.java:625)
>       at 
> java.base/java.util.concurrent.CompletableFuture.uniApplyStage(CompletableFuture.java:664)
>       at 
> java.base/java.util.concurrent.CompletableFuture.thenApply(CompletableFuture.java:2168)
>       at 
> org.apache.ignite.internal.partition.replicator.ReplicaPrimacyEngine.ensureReplicaIsPrimary(ReplicaPrimacyEngine.java:110)
>       at 
> org.apache.ignite.internal.partition.replicator.ReplicaPrimacyEngine.validatePrimacy(ReplicaPrimacyEngine.java:78)
>       at 
> org.apache.ignite.internal.partition.replicator.ZonePartitionReplicaListener.invoke(ZonePartitionReplicaListener.java:213)
>       at 
> org.apache.ignite.internal.replicator.ZonePartitionReplicaImpl.processRequest(ZonePartitionReplicaImpl.java:75)
>       at 
> org.apache.ignite.internal.replicator.ReplicaManager.handleReplicaRequest(ReplicaManager.java:407)
>       at 
> org.apache.ignite.internal.replicator.ReplicaManager.onReplicaMessageReceived(ReplicaManager.java:340)
>       at 
> org.apache.ignite.internal.network.DefaultMessagingService.sendToSelf(DefaultMessagingService.java:479)
>       at 
> org.apache.ignite.internal.network.DefaultMessagingService.invoke0(DefaultMessagingService.java:373)
>       at 
> org.apache.ignite.internal.network.DefaultMessagingService.invoke(DefaultMessagingService.java:286)
>       at 
> org.apache.ignite.internal.network.wrapper.JumpToExecutorByConsistentIdAfterSend.invoke(JumpToExecutorByConsistentIdAfterSend.java:108)
>       at 
> org.apache.ignite.internal.network.MessagingService.invoke(MessagingService.java:241)
>       at 
> org.apache.ignite.internal.replicator.ReplicaService.sendToReplicaRaw(ReplicaService.java:152)
>       at 
> org.apache.ignite.internal.replicator.ReplicaService.invokeRaw(ReplicaService.java:358)
>       at 
> org.apache.ignite.internal.table.distributed.storage.InternalTableImpl.trackingInvoke(InternalTableImpl.java:649)
>       at 
> org.apache.ignite.internal.table.distributed.storage.InternalTableImpl.lambda$enlistAndInvoke$7(InternalTableImpl.java:618)
>       at 
> java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire$$$capture(CompletableFuture.java:1150)
>       at 
> java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java)
>       at --- Async.Stack.Trace --- (captured by IntelliJ IDEA debugger)
>       at 
> java.base/java.util.concurrent.CompletableFuture$UniCompose.<init>(CompletableFuture.java:1129)
>       at 
> java.base/java.util.concurrent.CompletableFuture.uniComposeStage(CompletableFuture.java:1173)
>       at 
> java.base/java.util.concurrent.CompletableFuture.thenCompose(CompletableFuture.java:2309)
>       at 
> org.apache.ignite.internal.table.distributed.storage.InternalTableImpl.enlistAndInvoke(InternalTableImpl.java:617)
>       at 
> org.apache.ignite.internal.table.distributed.storage.InternalTableImpl.enlistInTx(InternalTableImpl.java:368)
>       at 
> org.apache.ignite.internal.table.distributed.storage.InternalTableImpl.enlistInTx(InternalTableImpl.java:313)
>       at 
> org.apache.ignite.internal.table.distributed.storage.InternalTableImpl.delete(InternalTableImpl.java:1432)
>       at 
> org.apache.ignite.internal.table.KeyValueViewImpl.lambda$removeAsync$19(KeyValueViewImpl.java:397)
>       at 
> org.apache.ignite.internal.table.AbstractTableView.lambda$withSchemaSync$1(AbstractTableView.java:147)
>       at 
> java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire$$$capture(CompletableFuture.java:1150)
>       at 
> java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java)
>       at --- Async.Stack.Trace --- (captured by IntelliJ IDEA debugger)
>       at 
> java.base/java.util.concurrent.CompletableFuture$UniCompose.<init>(CompletableFuture.java:1129)
>       at 
> java.base/java.util.concurrent.CompletableFuture.uniComposeStage(CompletableFuture.java:1173)
>       at 
> java.base/java.util.concurrent.CompletableFuture.thenCompose(CompletableFuture.java:2309)
>       at 
> org.apache.ignite.internal.table.AbstractTableView.withSchemaSync(AbstractTableView.java:147)
>       at 
> org.apache.ignite.internal.table.AbstractTableView.withSchemaSync(AbstractTableView.java:134)
>       ... 91 more
> {noformat}
> But it seems that such exceptions should be handled internally and they 
> should never reach the user code.
> Also, the exception has the 'undefined' error code which should not happen.



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

Reply via email to