0
Fixed

Database conflicting reference constraint on removal of adapters from config.

Ross Currie 9 years ago updated by anonymous 5 years ago 8

When you remove an adapter from the config and restart the service, the following error presents:

Service cannot be started. Unify.Framework.UnifyServerStartException: The DELETE statement conflicted with the REFERENCE constraint "FK_Container_Container". The conflict occurred in database "Unify.FIMIdentityBroker", table "dbo.Container", column 'PartitionId'.
The statement has been terminated. ---> System.Data.SqlClient.SqlException: The DELETE statement conflicted with the REFERENCE constraint "FK_Container_Container". The conflict occurred in database "Unify.FIMIdentityBroker", table "dbo.Container", column 'PartitionId'.
The statement has been terminated.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior run...

Work-around is to go into SQL Server and manually delete items from the entity and partition tables... which is pretty time-consuming

Affected Versions:
Fixed by Version:

suspect this may have to do witih composite adapters:

There's an attempt to delete a composite before the sub-adapter is deleted.

(I can reproduce this if I delete them in SQL Server in the wrong order)

Actually, sorry, it's because the dbo.Container reference isn't deleted before the composite adapter partition record.

This issue can be traced to a foreign key constraint - specifically FK_Container_Container as seen in the exception details. When a particular partition

{Adapter in this instance}

is recognized as having been removed from the configuration it is deleted with the following command:

DELETE FROM Partition WHERE PartitionId = [Id]

If there are still entries in the Container table against that particular Partition the foreign key constraint will be broken. The IdentityBroker database creation statement will be updated to ensure that a Partition deletion cascades to the Container table.

Reassigned for confirmation of completion.

Added 2.8.3 to regression test document.