Andy Mallon looks at a wrinkle Availability Groups adds to replication:
This has always worked super, and has been a go-to query for me for years. But when looking at a SQL Server 2017 distributor with the distribution database in an Availability Group, that wasn’t working. All the publications had a
publisher_id
of 1, but insys.servers
,server_id
1 was some random linked server, and definitely not the publisher. But replication was working great. Maybe replication was set up on the other AG replica, andserver_id
1 came from there.Nope. On the other replica, it was the same story.
Server_id
1 was a random linked server, and nothing to do with replication at all, let alone the publisher. But replication was working perfectly. A teammate fooling around with it in dev confirmed that if he updated thepublisher_id
to match theserver_id
we thought it should join to, replication stopped working. So, thatpublisher_id
of 1 was correct. Or special. But also definitely different than what I’ve seen in prior versions of SQL Server.
Read on to see what Andy learned.