-
Notifications
You must be signed in to change notification settings - Fork 225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SqlAGReplica: 'ReadOnlyRoutingList' is a ReadOnly property #518
Comments
I think I found the root cause. The error only appears if the config on the node changes and it's not the primary. Config for the AOAG can only be changed on a node if the node is primary (Microsoft has set this requirement). So to replicate this you would:
So I guess we could either say this is by design or the DSC resource should only connect to the Primary node when making changes. What are everyone's thoughts? |
I agree. But it looks like the resource do connect to the Primary replica. If it is not the primary replica, it connect to the primary replica. But it seems there is a problem somewhere here. https://github.com/PowerShell/SqlserverDsc/blob/dev/DSCResources/MSFT_SqlAGReplica/MSFT_SqlAGReplica.psm1#L241 But this should be easier to look into when you provided the steps to reproduce the behaviour. |
Hello guys, I am having the same problem, but not only on the secondary, but the primary too. DSC configuration: ERROR: Server: Windows 2016 |
@aalmeida89 The node that is assigned to The target node should connect to the Primary according to this code. And here it will get the replica (that is assigned to And here it will set the routing list. I wonder if it will go out to the secondary and try to update it, but it is not allowed becuase it is not running under the primary role. Is it that this setting can only be set when the replica is running under the primary role? |
So I assume the bold text above 'must be specified on a replica-by-replica basis, as needed' is meaning that this needs to be set on each replica,
And that says, to set this you must be connected to the primary replica. I suppose this means that to be able to set this, the "secondary" must (can) only be configured once it starts to run under the primary role. Can someone confirm this? |
You modify the read only routing list for each replica (including the primary replica) but only from the primary replica. It doesn't matter if that replica is primary or secondary. |
I've been testing this out. I have a secondary SEC1N1 and a primary DAC1N1 with an incorrect ReadOnlyRoutingConnectionUrl (say 'tcp://DAC1N2.lab.com:1433').
The code tries to set the correct URL. In this example I have it connect to SEC1N1 knowing from what you said above the code will redirect it to the primary DAC1N1 (but the error will happen if you directly use DAC1N1 as well). It executes the correct statement which I caught in Profiler.
It does however throw the error (only once, if you run the resource again it will detect the correct setting is in use and not touch it again).
So I've been able to reproduce it and add information but not find the source of the bug yet. |
Ok I've got it. The problem is that EVERY time the Set resource gets called, if no read only routing list has been set up, it will trigger anyway.
This is because the comparison is invalid - ReadOnlyRoutingList is a StringCollection not a string. So the comparison always fails and it tries to modify ReadOnlyRoutingList - but it can't because it's read only. The proper way to add URLs would be to call .Clear() and then .Add() each server in the list. Though this is only valid for 2012-2014. In 2016 there's a newer mechanism to allow for read only routing sets. |
- Changes to SqlAG - Updated documentation on the behavior of defaults as they only apply when creating a group. - Changes to SqlAGReplica - AvailabilityMode, BackupPriority, and FailoverMode defaults only apply when creating a replica not when making changes to an existing replica. Explicit parameters will still change existing replicas (issue #1244). - ReadOnlyRoutingList now gets updated without throwing an error on the first run (issue #518).
Details of the scenario you try and problem that is occurring:
If I change a setting on a replica (bringing it out of desired state), for example FailoverMode then I receive "'ReadOnlyRoutingList' is a ReadOnly property" when performing a consistency check.
The DSC configuration that is using the resource (as detailed as possible):
Version of the Operating System, SQL Server and PowerShell the DSC Target Node is running:
Server: Windows 2012 R2 (Update)
SQL Server: 2016 SP1 CU2
Powershell: 5.1
What module (SqlServer or SQLPS) and which version of the module the DSC Target Node is running:
SqlServer v20.0
Version of the DSC module you're using, or 'dev' if you're using current dev branch:
7.0.0.0
The text was updated successfully, but these errors were encountered: