Keycloak was working just fine, but suddenly the users can not create accounts and this warning was appears on the Keycloak logs
Could not create user: org.keycloak.models.ModelException: jakarta.persistence.OptimisticLockException: Unexpected row count: -1; expected: 1; statement executed: insert into USER_ENTITY (CREATED_TIMESTAMP,EMAIL,EMAIL_CONSTRAINT,EMAIL_VERIFIED,ENABLED,FEDERATION_LINK,FIRST_NAME,LAST_NAME,NOT_BEFORE,REALM_ID,SERVICE_ACCOUNT_CLIENT_LINK,USERNAME,ID) values (?,?,?,?,?,?,?,?,?,?,?,?,?)
We are using SQL Server 2019 for Keycloak, I just failover the database to run on the secondary node then Keycloak start to work.
what does it mean (Unexpected row count: -1; expected: 1;)and why it happened?
is it normal to send values as (?)?
how to make sure it is not happening again?
I restarted the keycloak cluster but it did not work.
if its a transaction held the records, why it is happening?
create the user by Application via API to DB.
no trigger has been configured on the DB.