Hi all-- I have a SQL 2008 (sp1) DB that has 400+ subscribers using merge replication to SQL CE on embedded Windows devices.
I cleaned up several hundred thousand records in a filtered table (none of which should be getting replicated to the devices), removed ~100 unused data partitions, then ran sp_mergemetadataretentioncleanup, restarted SQL, updated all indexes (including msmerge indexes) and noticed that many of the remote devices had very long sync times. I thought perhaps that recreating all the snapshots might help.
Subscription expiration is currently set to 3 days, and I have stopped all other jobs that connect to this DB.
I attempted to recreate the initial subscription, but received timeouts:
Error messages:
<dir>Message: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
Command Text: exec sp_MSmakegeneration
Parameters:
Stack: at Microsoft.SqlServer.Replication.AgentCore.ReMapSqlException(SqlException e, SqlCommand command)
at Microsoft.SqlServer.Replication.AgentCore.AgentExecuteNonQuery(SqlCommand command, Int32 queryTimeout)
at Microsoft.SqlServer.Replication.AgentCore.ExecuteDiscardResults(CommandSetupDelegate commandSetupDelegate, Int32 queryTimeout)
at Microsoft.SqlServer.Replication.Snapshot.MergeSnapshotProvider.DoRegularMergeSnapshotPreparations()
at Microsoft.SqlServer.Replication.Snapshot.MergeSnapshotProvider.DoPreArticleFilesGenerationProcessing()
at Microsoft.SqlServer.Replication.Snapshot.SqlServerSnapshotProvider.GenerateSnapshot()
at Microsoft.SqlServer.Replication.SnapshotGenerationAgent.InternalRun()
at Microsoft.SqlServer.Replication.AgentCore.Run() (Source: MSSQLServer, Error number: -2)
Get help: http://help/-2
Server SDFSQL01\SQL2008, Level 11, State 0, Procedure , Line 0
Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. (Source: MSSQLServer, Error number: -2)
Get help: http://help/-2
As a result of this, I turned up the querytimeout to 3600 seconds, but it still failed-- last update before timeout
[0%] The process is running and is waiting for a response from the server.
Using sp_whoisactive, I was seeing that the process ran the following two things repeatedly:
query--
update top (@median_changes_per_gen) dbo.MSmerge_tombstone with (rowlock)
set generation = @target_gen
where generation = @gen and tablenick = @art_nick
update ppm set generation = @target_gen
from dbo.MSmerge_past_partition_mappings ppm inner join dbo.MSmerge_tombstone ts
on ppm.tablenick = ts.tablenick
and ppm.rowguid = ts.rowguid
and ts.generation = @target_gen
and ppm.generation = @gen
and ppm.tablenick = @art_nick
and ts.tablenick = @art_nick
Obviously, with this many data partitions, I would rather not have to recreate DBs on all devices. Any suggestions would be GREATLY appreciated.query--