
Unable to delete connectors and adapters within UNIFYBroker
It appears there may be an issue with my current environment.
I have a set of connectors and adapters I am trying to delete due to them no longer being in use. Their entities have been cleared for quite some time (a few months at least) and I am simply trying to delete them.
I am able to delete the connectors and adapters just fine within the interface, however upon restarting the UnifyBroker service, the service will fail to start back up. Giving the following error in the event logs:
Service cannot be started. Unify.Framework.UnifyServiceStartException: The DELETE statement conflicted with the REFERENCE constraint "FK_Entity_ObjectClass". The conflict occurred in database "Unify.IdentityBroker", table "dbo.Entity", column 'ObjectClassId'.
The statement has been terminated. ---> System.Data.SqlClient.SqlException: The DELETE statement conflicted with the REFERENCE constraint "FK_Entity_ObjectClass". The conflict occurred in database "Unify.IdentityBroker", table "dbo.Entity", column 'ObjectClassId'.
The statement has been terminated.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Bo...
I have tried this twice, so far and both ended with the same result. The first time I suspected maybe I didn't wait long enough before clearing the entities, deleting the configuration components and then restarting. However this second time the entities were cleared months ago, and when deleting the connectors/adapters I waited several hours before restarting the UnifyBroker service. So it would appear the DB has some sort of data issue preventing the deletion.
The connectors in question are just PowerShell connectors and the adapter have no transformations.
Version 5.3.2
Customer support service by UserEcho
Morning Hayden,
In this case, it appears like there's still some entity records referencing that ObjectClass, but potentially under a different partition id? When the UNIFYBroker service attempts to start, it tries to clear out any partitions that have been removed manually, which will also cascade to the Entity and ObjectClass tables.
I can recreate the issue by manually updating an entity in the database to reference an ObjectClass unrelated to its Partition, and then remove the original partition from configuration.
To investigate further, you can get the ID of the adapter you're trying to remove and run the following query:
Use the [ObjectClassId] from this response in the following query:
This will give you any entities that might be referencing the same object class, but for a different partition.
It's unclear under which circumstances this might happen, but could be related to config migration or a strange state where the service has been restarted while entities are still being cleared and cascades haven't finished.
If the entities returned from the second query reference a valid adapter ID, we might have to investigate further to see how to update them to point at their correctly owned object class. If they are just 'floating' (not owned by a currently valid partition) they should be safe to delete, which will then allow the system to clean up the object class and partition correctly.