none
Replica with the specified key was not found RRS feed

  • Question

  • Every so often I get into a situation where this error occurs on an initial sync. I am Syncing SQL Server 2008 to SQL CE 3.5 Sp2. I am batching for performance reasons. I am not sure what all other information is needed to find out what is wrong but here is the full error:

    Error Msg: An unexpected error occurred when applying batch file D:\Documents and Settings\mattc\Local Settings\Temp\WebSync_e7fb85cd268646ea95c8548472432752\8be18514-0b41-4a19-a49b-50c9aa321ce2.batch. See the inner exception for more details.


    Inner Exception: Replica with the specified key was not found.

     

    Stack Trace:  at Microsoft.Synchronization.Data.DbSyncBatchConsumer.ApplyBatches(DbSyncScopeMetadata scopeMetadata, DbSyncSession syncSession, SyncSessionStatistics sessionStatistics)    

    at Microsoft.Synchronization.Data.RelationalSyncProvider.ProcessChangeBatch(ConflictResolutionPolicy resolutionPolicy, ChangeBatch sourceChanges, Object changeDataRetriever, SyncCallbacks syncCallbacks, SyncSessionStatistics sessionStatistics)    

    at Microsoft.Synchronization.KnowledgeProviderProxy.ProcessChangeBatch(CONFLICT_RESOLUTION_POLICY resolutionPolicy, ISyncChangeBatch pSourceChangeManager, Object pUnkDataRetriever, ISyncCallback pCallback, _SYNC_SESSION_STATISTICS& pSyncSessionStatistics)    

    at

    Microsoft.Synchronization.CoreInterop.ISyncSession.Start(CONFLICT_RESOLUTION_POLICY resolutionPolicy, _SYNC_SESSION_STATISTICS& pSyncSessionStatistics)    

    at

    Microsoft.Synchronization.KnowledgeSyncOrchestrator.DoOneWaySyncHelper(SyncIdFormatGroup sourceIdFormats, SyncIdFormatGroup destinationIdFormats, KnowledgeSyncProviderConfigurat

    ion destinationConfiguration, SyncCallbacks DestinationCallbacks, ISyncProvider sourceProxy, ISyncProvider destinationProxy, ChangeDataAdapter callbackChangeDataAdapter, SyncDataConverter conflictDataConverter, Int32& changesApplied, Int32& changesFailed)    

    at

    Microsoft.Synchronization.KnowledgeSyncOrchestrator.DoOneWayKnowledgeSync(SyncDataConverter sourceConverter, SyncDataConverter destinationConverter, SyncProvider sourceProvider, SyncProvider destinationProvider, Int32& changesApplied, Int32& changesFailed)    

    at

    Microsoft.Synchronization.KnowledgeSyncOrchestrator.Synchronize()    

    at

    Microsoft.Synchronization.SyncOrchestrator.Synchronize()    

    at

    GDFieldSystem.SynchronizationHelper.SynchronizeProviders(KnowledgeSyncProvider localProvider, KnowledgeSyncProvider remoteProvider, String ScopeName, SyncDirectionOrder direction, String url) in D:\Development\GDFieldSystem\GDFieldSystem\UtilityClasses\SynchronizationHelper.vb:line 42

     

    Stack Trace From Inner Exception: at Microsoft.Synchronization.SyncServices.ThrowExceptionForHR(Int32 hr)    

    at

    Microsoft.Synchronization.ReplicaKeyMap.LookupReplicaId(UInt32 replicaKey)    

    at

    Microsoft.Synchronization.Data.SyncRowMetadata..ctor(DataRow row, Boolean isTombstone, DbSyncAdapter adapter, SyncKnowledge fromKnowledge, SyncKnowledge toKnowledge, Boolean isLocal)    

    at Microsoft.Synchronization.Data.RelationalSyncProvider.ApplyChangesInternal(DbSyncScopeMetadata scopeMetadata, IDbTransaction transaction, FailedDeleteDelegate_type failedDeleteDelegate, DataSet dataSet, ChangeApplicationType applyType)    

    at

    Microsoft.Synchronization.Data.RelationalSyncProvider.ApplyChanges(DbSyncScopeMetadata scopeMetadata, IDbTransaction applyTransaction, DataSet dataSet, DbSyncSession DbSyncSession, Boolean commitTransaction, FailedDeleteDelegate_type failedDeleteDelegate, String batchFileName, ChangeApplicationAction& action)    

    at Microsoft.Synchronization.Data.RelationalSyncProvider.SingleTransactionApplyChangesAdapter.Apply(DataSet data

    Set, Boolean commitTransaction, FailedDeleteDelegate_type failedDeleteDelegate, String batchFileName, ChangeApplicationAction& action)    

    at

    Microsoft.Synchronization.Data.DbSyncBatchConsumer.ApplyBatches(DbSyncScopeMetadata scopeMetadata, DbSyncSession syncSession, SyncSessionStatistics sessionStatistics)

     

    Thursday, January 20, 2011 7:32 PM

Answers

  • Hi Rache,

    On the initial sync you need to make sure that server scopes are not provisioned concurrently, otherwise you may run into issues. Subsequent syncs can be concurrent.

    Thanks,

    Minh.

    Wednesday, February 9, 2011 10:46 PM

All replies

  • Would help to learn bit more about the situation: When you say on the "error occurs on an initial sync", do you imply:

    - you never see this error for any replica that has been in sync before ie you see this error only for new replicas ?

    - once the error has occurred, do any subsequent syncs succeed ?

    Thanks,

    Sameer

    Thursday, January 20, 2011 11:50 PM
  • It's been to long since I've replied but they have me bouncing off several projects at the moment.

    I am saying that it's an Initial Sync. I just created the database and no schema or sync info has been applied.

    I am running multiple syncs at once (eventually will be 5 at once) and if any one of them fails I stop the threading for each of them and report any errors.

     

    Thursday, February 3, 2011 4:04 PM
  • are you initial sync the SqlCe DB at the same time ? if so, this is not a supported scneario and it could run into various of issues here.

    thanks

    Yunwen


    This posting is provided "AS IS" with no warranties, and confers no rights.
    Thursday, February 3, 2011 10:59 PM
    Moderator
  • Well I have three scopes currently. What I do on an intial sync is run the first one say "Lookup" and once the Db and the tracking tables are created I start up the other two.  90% of the time this seems to work just fine but every once in a while it will throw this error at me.
    Friday, February 4, 2011 2:49 PM
  • Hi Rache,

    On the initial sync you need to make sure that server scopes are not provisioned concurrently, otherwise you may run into issues. Subsequent syncs can be concurrent.

    Thanks,

    Minh.

    Wednesday, February 9, 2011 10:46 PM
  • This is NOT true.  Some of my customer get this very often.  There may be a bug in the scopeid validation.
    Wednesday, March 7, 2012 12:44 AM