We have an issue with merge replication where we have a background process inserting rows in bulk. These inserts sometimes fail with the message that
The insert failed. It conflicted with an identity range check constraint in database ‘′, replicated table ‘’, column ‘′. If the identity column is automatically managed by replication, update the range as follows: for the Publisher, execute sp_adjustpublisheridentityrange; for the Subscriber, run the Distribution Agent or the Merge Agent.
I've done a lot of reading and tinkering with inserts of different sizes and various settings for the Publisher Range Size, Subscriber Range Size, and Range Threshold Percentage. If I set the bulk insert size to something not divisible by 10 and repeatedly insert rows, I cannot find settings that are immune to the insert error. Even if I set Range Threshold Percentage to 50 or 1 it still doesn't allow me to insert batches that are close to 1/3rd the size of the Subscriber Range Size. Should there not be some setting like 1000 rows for the subscriber range and 50% threshold that if I insert 317 rows(prime number) repeatedly it doesn't error? If I were to say, I'm not going to insert more than 5000 rows at a time, does anyone have a recommendation for what to use for the settings that would never result in the insert error?