Are you losing your xDB data?

If you are on Sitecore 9.0 to 9.1.1, and you have no patches, then I am afraid that you are losing data. Here is how you can find out if you are losing data.

Are you losing your xDB data?

If you are on Sitecore 9.0 to 9.1.1, and you have no patches, then I am afraid that you are losing data. Here is how you can find out if you are losing data.

In you Sitecore logs, you should see this error

ERROR General error when submitting contact. Exception: Sitecore.XConnect.Operations.FacetOperationException Message: Operation #0, AlreadyExists, <ContactId>, Classification Source: Sitecore.Xdb.Common.Web

In your xConnect logs, you should see this error.

2020-01-28 00:01:34.128 -05:00 [Error] Sitecore.XConnect.Operations.SetFacetOperation`1[Sitecore.XConnect.Facet]: Sitecore.XConnect.Operations.FacetOperationException: Operation #0, AlreadyExists, Contact {e7bda76f-857d-0000-0000-05a15ad3ace7}, Classification
2020-01-28 00:01:34.128 -05:00 [Error] ["XdbContextLoggingPlugin"] XdbContext Batch Execution Exception
Sitecore.XConnect.Operations.FacetOperationException: Operation #0, AlreadyExists, Contact {e7bda76f-857d-0000-0000-05a15ad3ace7}, Classification

These errors are a known issue in Sitecore. You need to install this patch

Error when saving a contact to xDB - Sitecore Knowledge Base
The following error can occur in Sitecore XP log files while saving a contact to xDB: ERROR General error when submitting contact. Exception: Sitecore.XConnect.Operations.FacetOperationException Message: Operation #0, AlreadyExists, &lt;ContactId&gt;

BUT, you can still experience these errors even with this patch install. If you have this content delivery setup:

  1. More than one CD server
  2. A load balancer
  3. Have shared session state and private session state both inProc. Meaning not in Redis, Mongo or SQL

The reason for this is that if you have more than one CD server, behind a load balancer. Whenever the client switches from one server to another (via the load balancer or switching devices) the session is lost. What is also lost is the reference to the contact. So the new session tries to save the contact and the error is generated.

The way to resolve this, is to move shared and private session to Redis, SQL or Mongo.

Redis

Private - https://doc.sitecore.com/developers/91/platform-administration-and-architecture/en/walkthrough--configuring-a-private-session-state-database-using-the-redis-provider.html

Shared - https://doc.sitecore.com/developers/91/platform-administration-and-architecture/en/walkthrough--configuring-a-shared-session-state-database-using-the-redis-provider.html

MsSQL

NOTE, this will not work in Azure SQL. SQL session scripts require the temp database. Azure SQL does not have a temp database.

Private - https://doc.sitecore.com/developers/91/platform-administration-and-architecture/en/walkthrough--configuring-a-private-session-state-database-using-the-sql-provider.html

Shared - https://doc.sitecore.com/developers/91/platform-administration-and-architecture/en/walkthrough--configuring-a-shared-session-state-database-using-the-sql-provider.html

Mongo

Private - https://doc.sitecore.com/developers/91/platform-administration-and-architecture/en/walkthrough--configuring-a-private-session-state-database-using-the-mongodb-provider.html

Shared - https://doc.sitecore.com/developers/91/platform-administration-and-architecture/en/walkthrough--configuring-a-shared-session-state-database-using-the-mongodb-provider.html