Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues applying partial rollback in atomic entity mutation #569

Open
novoj opened this issue May 17, 2024 · 0 comments
Open

Issues applying partial rollback in atomic entity mutation #569

novoj opened this issue May 17, 2024 · 0 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@novoj
Copy link
Collaborator

novoj commented May 17, 2024

Since we need to respect the atomicity update of the entity mutation, we try to undo the local action that happened on the transactional index that was already executed since the start of the entity mutation beginning until the problematic local mutation. Obviously, this doesn't always work, which leads to compromising the state of a particular transaction. We should add more tests that would verify as many possible scenarios as possible.

One of the problematic scenarios is represented by the following stack from production:

SEVERE: Exception while executing runnable io.grpc.internal.ServerImpl$JumpToApplicationThreadServerStreamListener$1HalfClosed@3ac174bd
io.evitadb.api.exception.UniqueValueViolationException: Unique value is already present for entity `Product` `url` key: `/elektronicky-darkovy-poukaz-500-kc` in locale `sk` (existing: 40791, new: 41233)!
        at io.evitadb.index.attribute.UniqueIndex.assertUniqueKeyIsFree(UniqueIndex.java:347)
        at io.evitadb.index.attribute.UniqueIndex.registerUniqueKeyValue(UniqueIndex.java:303)
        at io.evitadb.index.attribute.UniqueIndex.registerUniqueKeyValue(UniqueIndex.java:291)
        at io.evitadb.index.attribute.UniqueIndex.registerUniqueKey(UniqueIndex.java:145)
        at io.evitadb.index.attribute.AttributeIndex.insertUniqueAttribute(AttributeIndex.java:230)
        at io.evitadb.index.EntityIndex.insertUniqueAttribute(EntityIndex.java:101)
        at io.evitadb.index.mutation.AttributeIndexMutator.executeAttributeUpsert(AttributeIndexMutator.java:123)
        at io.evitadb.index.mutation.EntityIndexLocalMutationExecutor.updateAttributes(EntityIndexLocalMutationExecutor.java:391)
        at io.evitadb.index.mutation.EntityIndexLocalMutationExecutor.lambda$applyMutation$7(EntityIndexLocalMutationExecutor.java:249)
        at io.evitadb.index.mutation.EntityIndexLocalMutationExecutor.applyMutation(EntityIndexLocalMutationExecutor.java:258)
        at io.evitadb.core.EntityCollection.processMutations(EntityCollection.java:276)
        at io.evitadb.core.EntityCollection.lambda$applyMutations$41(EntityCollection.java:1543)
        at io.evitadb.store.entity.serializer.EntitySchemaContext.executeWithSchemaContext(EntitySchemaContext.java:90)
        at io.evitadb.core.EntityCollection.applyMutations(EntityCollection.java:1541)
        at io.evitadb.core.EntityCollection.upsertEntityInternal(EntityCollection.java:1434)
        at io.evitadb.core.EntityCollection.upsertEntity(EntityCollection.java:542)
        at io.evitadb.core.EvitaSession.lambda$upsertEntity$37(EvitaSession.java:874)
        at io.evitadb.core.EvitaSession.lambda$executeInTransactionIfPossible$58(EvitaSession.java:1386)
        at io.evitadb.core.Transaction.executeInTransactionIfProvided(Transaction.java:149)
        at io.evitadb.core.EvitaSession.executeInTransactionIfPossible(EvitaSession.java:1384)
        at io.evitadb.core.EvitaSession.upsertEntity(EvitaSession.java:872)
        at jdk.internal.reflect.GeneratedMethodAccessor58.invoke(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at io.evitadb.core.SessionRegistry$EvitaSessionProxy.lambda$invoke$0(SessionRegistry.java:198)
        at io.evitadb.core.SessionRegistry$EvitaSessionProxy.lambda$invoke$2(SessionRegistry.java:260)
        at io.evitadb.core.Transaction.executeInTransactionIfProvided(Transaction.java:149)
        at io.evitadb.core.SessionRegistry$EvitaSessionProxy.invoke(SessionRegistry.java:193)
        at jdk.proxy2/jdk.proxy2.$Proxy68.upsertEntity(Unknown Source)
        at io.evitadb.externalApi.grpc.services.EvitaSessionService.upsertEntity(EvitaSessionService.java:366)
        at io.evitadb.externalApi.grpc.generated.EvitaSessionServiceGrpc$MethodHandlers.invoke(EvitaSessionServiceGrpc.java:2217)
        at io.grpc.stub.ServerCalls$UnaryServerCallHandler$UnaryServerCallListener.onHalfClose(ServerCalls.java:182)
        at io.grpc.PartialForwardingServerCallListener.onHalfClose(PartialForwardingServerCallListener.java:35)
        at io.grpc.ForwardingServerCallListener.onHalfClose(ForwardingServerCallListener.java:23)
        at io.grpc.ForwardingServerCallListener$SimpleForwardingServerCallListener.onHalfClose(ForwardingServerCallListener.java:40)
        at io.grpc.Contexts$ContextualizedServerCallListener.onHalfClose(Contexts.java:86)
        at io.grpc.PartialForwardingServerCallListener.onHalfClose(PartialForwardingServerCallListener.java:35)
        at io.grpc.ForwardingServerCallListener.onHalfClose(ForwardingServerCallListener.java:23)
        at io.grpc.ForwardingServerCallListener$SimpleForwardingServerCallListener.onHalfClose(ForwardingServerCallListener.java:40)
        at io.evitadb.externalApi.grpc.services.interceptors.GlobalExceptionHandlerInterceptor$ExceptionHandler.onHalfClose(GlobalExceptionHandlerInterceptor.java:72)
        at io.grpc.PartialForwardingServerCallListener.onHalfClose(PartialForwardingServerCallListener.java:35)
        at io.grpc.ForwardingServerCallListener.onHalfClose(ForwardingServerCallListener.java:23)
        at io.grpc.ForwardingServerCallListener$SimpleForwardingServerCallListener.onHalfClose(ForwardingServerCallListener.java:40)
        at io.grpc.internal.ServerCallImpl$ServerStreamListenerImpl.halfClosed(ServerCallImpl.java:351)
        at io.grpc.internal.ServerImpl$JumpToApplicationThreadServerStreamListener$1HalfClosed.runInContext(ServerImpl.java:861)
        at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
        at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:133)
        at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
        at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
        at java.base/java.lang.Thread.run(Thread.java:840)
        Suppressed: io.evitadb.exception.EvitaInvalidUsageException: Facet `12` not found in index (group: `null`)!
                at io.evitadb.utils.Assert.notNull(Assert.java:54)
                at io.evitadb.index.facet.FacetReferenceIndex.removeFacet(FacetReferenceIndex.java:194)
                at io.evitadb.index.facet.FacetIndex.removeFacet(FacetIndex.java:166)
                at io.evitadb.index.EntityIndex.removeFacet(EntityIndex.java:123)
                at io.evitadb.index.mutation.ReferenceIndexMutator.lambda$addFacetToIndex$21(ReferenceIndexMutator.java:696)
                at io.evitadb.index.mutation.EntityIndexLocalMutationExecutor.rollback(EntityIndexLocalMutationExecutor.java:304)
                at io.evitadb.core.EntityCollection.processMutations(EntityCollection.java:293)
                ... 40 more
@novoj novoj added the bug Something isn't working label May 17, 2024
@novoj novoj added this to the Beta milestone May 17, 2024
@novoj novoj self-assigned this May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant