dsccommunity / dsccommunity/SqlServerDsc
SqlAG/SqlAGReplica: Are both needed?
Nobody has claimed this yet.
- Dominant language
- PowerShell
- Stars
- 385
- Forks
- 224
- PR merge metrics
- No merged PRs in 30d
Description
Details of the scenario you tried and the problem that is occurring:
Wouldn't it be better to concatenate SqlAG and SqlAGReplica into SqlAG? I want to discuss to see if this is possible, there might be a scenario that make having two resources necessary.
When looking at issue #518 and issue #1057 I'm started to wonder if SqlAGReplica is really needed. They need the same properties, which means the same code (which could be resolved by helper functions if the resources are kept as-is). We have properties that can only be set on the primary replica, so there is a logic in SqlAGReplica to search for and connect to the primary to make those changes.
The "new SqlAG" could instead use $availabilityGroup.LocalReplicaRole to determine which role the replica is running under, and set the properties accordingly.
In the "new SqlAG" there could be a property to specify an existing replica (for example ExistingReplicaName). This new property is assigned a server instance 'ServerName\InstanceName', which is the same format that is needed for the Name parameter. This ExistingReplicaName is the same as the properties PrimaryReplicaServerName and PrimaryReplicaInstanceName in SqlAGReplica. This will be used to find the primary replica, for example to be able to add a secondary to the Availability Group.
/cc @randomnote1, @TraGicCode
The DSC configuration that is using the resource (as detailed as possible):
n/a
Version of the Operating System, SQL Server and PowerShell the DSC Target Node is running:
n/a
What module (SqlServer or SQLPS) and which version of the module the DSC Target Node is running:
n/a
Version of the DSC module you're using, or 'dev' if you're using current dev branch:
n/a
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by comparing the SqlAG and SqlAGReplica resources and reviewing issues #518 and #1057. Determine whether their overlapping properties and primary-replica behavior support one resource or require both. Done means reaching an agreed design for the resource structure and documenting the decision; the issue does not name specific files or tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- powershell, sql
- Domain
- databases
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 15/100