0
Fixed

Foreign key constraint violation when attempting delta import into FIM

Matthew Clark 13 years ago updated by anonymous 9 years ago 7

In order to attempt 3.1.8 of the regression test, I did the following:

  • CSV connector with 2 entries
  • Full import into FIM
  • Added new user, updated existing user, deleted old user
  • Change detection shows 3 changes in adapter statistics, entries present in the changes table
  • Delta import into FIM to confirm changes

The following error was thrown:

The extensible extension returned an unsupported error.
The stack trace is:

"System.ServiceModel.FaultException`1System.ServiceModel.ExceptionDetail: The INSERT statement conflicted with the FOREIGN KEY constraint "FK_ObjectClass_Partition". The conflict occurred in database "Unify.IdentityBroker", table "dbo.Partition", column 'PartitionId'.
The statement has been terminated. (Fault Detail is equal to An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:
System.Data.SqlClient.SqlException: The INSERT statement conflicted with the FOREIGN KEY constraint "FK_ObjectClass_Partition". The conflict occurred in database "Unify.IdentityBroker", table "dbo.Partition", column 'PartitionId'.
The statement has been terminated.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
at System.Data.SqlClient.SqlDataReader.get_MetaData()
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(...).Forefront Identity Manager 4.0.3594.2"

Subsequent delta imports also throw this error, so fortunately the changes are not being cleared following the error of the first attempt.

Attached extensibility directory.

SQL Server 2008 R2 is being used, and the database was created by the installer, build from 18/05/12 8:55am.

Was there an error logged by IdB?

Delta imports have begun working in this environment, will need to investigate logging and configuration further. A service restart was performed in the interim and may have had an effect.

Updating description - 3.1.8 not 3.2.8

Stack trace from Identity Broker logs:

Adapter request to get entity from adapter space failed.
Adapter request to get attribute changes from adapter space 44ae3fa8-a017-4ae5-9e76-dccfd5bb3f7c failed with reason The INSERT statement conflicted with the FOREIGN KEY constraint "FK_ObjectClass_Partition". The conflict occurred in database "Unify.IdentityBroker", table "dbo.Partition", column 'PartitionId'.
The statement has been terminated.. Duration: 00:00:00.2500000
Error details:
System.Data.SqlClient.SqlException (0x80131904): The INSERT statement conflicted with the FOREIGN KEY constraint "FK_ObjectClass_Partition". The conflict occurred in database "Unify.IdentityBroker", table "dbo.Partition", column 'PartitionId'.
The statement has been terminated.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
at System.Data.SqlClient.SqlDataReader.get_MetaData()
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.Linq.SqlClient.SqlProvider.Execute(Expression query, QueryInfo queryInfo, IObjectReaderFactory factory, Object[] parentArgs, Object[] userArgs, ICompiledSubQuery[] subQueries, Object lastResult)
at System.Data.Linq.SqlClient.SqlProvider.ExecuteAll(Expression query, QueryInfo[] queryInfos, IObjectReaderFactory factory, Object[] userArguments, ICompiledSubQuery[] subQueries)
at System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression query)
at System.Data.Linq.ChangeDirector.StandardChangeDirector.DynamicInsert(TrackedObject item)
at System.Data.Linq.ChangeDirector.StandardChangeDirector.Insert(TrackedObject item)
at System.Data.Linq.ChangeProcessor.SubmitChanges(ConflictMode failureMode)
at System.Data.Linq.DataContext.SubmitChanges(ConflictMode failureMode)
at Unify.Product.IdentityBroker.Repository.EntityLinqQueryConverterUtilitiesBase`3.GetObjectClass(String objectClass, Guid partitionId, EntityDataContext sourceContext)
at Unify.Product.IdentityBroker.Repository.AdapterEntityContext.SetEntityRowDetails(__EntityInsertRow row, IAdapterEntity entity, EntityDataContext sourceContext, IEntityCollectionKeyUtility`1 keyUtility)
at Unify.Product.IdentityBroker.Repository.KnownEntityContextBase`3.InsertItems(HashSet`1 addedItems, EntityDataContext sourceContext, SqlConnection connection)
at Unify.Framework.Data.LinqContextConversionBase`4.SubmitChanges()
at Unify.Product.IdentityBroker.Adapter.ProcessAttributeChangePage(IEnumerable`1 pageOfChangedIds)
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at System.Linq.Enumerable.<SelectManyIterator>d__14`2.MoveNext()
at Unify.Framework.Collections.EnumerableExtensions.<ActionOnLast>d__17`1.MoveNext()
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at Unify.Framework.Collections.ActionOnExceptionEnumerator`1.MoveNext()
at Unify.Framework.Collections.EnumerableExtensions.<ActionOnLast>d__17`1.MoveNext()
at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
at System.Linq.Enumerable.ToArrayTSource(IEnumerable`1 source)
at Unify.Framework.Notification.NotificationEnumerableExtensions.NotifyT(IEnumerable`1 source, IEnumerableTaskNotificationFactory notificationFactory, INotificationMessageService messageService, IUnifyBranding branding)
at Unify.Product.IdentityBroker.AdapterNotifierDecoratorBase`1.GetAttributeChanges()
at Unify.Product.IdentityBroker.LDIFAdapterBase.ImportChanges(Guid adapterId)
at Unify.Product.IdentityBroker.LDIFAdapterServiceHostDecoratorBase.ImportChanges(Guid adapterId)
at SyncInvokeImportChanges(Object , Object[] , Object[] )
at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)
at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet

Matthew, can you please check this again during your next round of testing?

Thanks.

Tony and I have been working with deltas for a little while now and haven't seen this again. Issue closed.