K2 Five upgrade fails with "An item with the same key has already been added"
KBS100252
PRODUCTIssue
When upgrading from 4.7 to K2 5.3, if duplicate attributes LogLevel=Error;LogSize=0;LogLevel=Error;LogSize=0; are detected in the [RoleInit] column for the K2 SecurityLabel:
The upgrade would fail with the following error:
16:52:31:>> MigrateDatabase.Execute: Logged Error: Failed: System.ArgumentException: An item with the same key has already been added.
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at SourceCode.Sync.Storage.Sql.SyncEngineContext.GetADUMProviderInstances(XElement roleInit)
at SourceCode.Sync.Storage.Sql.SyncEngineContext.GetRoleInitProviderInstances(String roleInitValue, Boolean& adumInstancesExist)
at SourceCode.Sync.Storage.Sql.SyncEngineContext.GetRoleInitProvider(IProviderType legacyProviderType, IProviderType adProviderType, String providerName, String roleInitValue)
at SourceCode.Sync.Storage.Sql.SyncEngineContext.SeedExistingProviders()
at SourceCode.Sync.Storage.Sql.SyncEngineContext.DatabaseMigrate()
at SourceCode.Install.Package.Actions.Database.Migrations.MigrateDatabase.<>c.b__3_0(String connectionString)
at SourceCode.Install.Package.Actions.IsolatedExecution.AppDomainDelegate.Execute[T,TResult](T parameter, Func`2 func)
at SourceCode.Install.Package.Actions.IsolatedExecution.Execute[T,TResult](T parameter, Func`2 func, String privateBinPath, Boolean enableLogging)
at SourceCode.Install.Package.Actions.Database.Migrations.MigrateDatabase.ExecuteMigrateSyncEngine(String dbConnectionString)
at SourceCode.Install.Package.Actions.Database.Migrations.MigrateDatabase.Execute(Target target)
16:52:31:>> Log.WriteUnindent: Finish MigrateDatabase for 'SyncEngine'. Successful: False
16:52:31:>> Target.Execute: !Completed: SyncEngine, Success: False
16:52:31:>> ActionGroup.Execute: Logged Error: Target failed to execute: SyncEngine
Symptoms
Although you can update the K2 Security Label, and remove the duplicate "LogLevel=Error;LogSize=0;" entry from the [RoleInit] column and then successfully re-"Configure" K2 Five. The installation of the 5.3 New Identity Service Opt-in would be successful. However, performing the initial sync results in an error:
0 Execute 'RunSyncJob' Error : The Provider Instance with Name or ID 'DENALLIX' was not found.
The applicable entries were not seeded into the [SyncEngine] tables resulting in the error.
Resolution
1. If a 4.7 K2 database backup and 4.7 K2 server VM snapshot exists prior to the upgrade:
- Revert to the 4.7 snapshot
- Restore the 4.7 K2 database backup
- Remove the duplicate LogLevel=Error;LogSize=0; entry
- Re-perform the upgrade
2. If a 4.7 VM snapshot does not exist
- Uninstall K2 Five
- Restore the 4.7 K2 database backup
- Remove the duplicate LogLevel=Error;LogSize=0; entry
- Re-install 4.7
- Re-perform the upgrade
3. If neither exists, logging a Support ticket may be necessary.