Skip to content

Conversation

@nasc17
Copy link
Member

@nasc17 nasc17 commented Nov 26, 2025

Related command
az postgres flexible-server update
az postgres flexible-server update/fabric-mirroring

Description
Starting with Ignite, Fabric mirroring shall be supported on PG17+ servers with HA setup as well.

Testing Guide
Manual

az postgres flexible-server fabric-mirroring start -g nascrunner25 -s nasc-new-ha-919 --database-names postgres --yes
Enabling system assigned managed identity on the server.
Updating necessary server parameters.
{
"allowedValues": ".*",
"dataType": "String",
"defaultValue": "",
"description": "Specifies the list of databases for which to enable mirroring.",
"documentationLink": "https://go.microsoft.com/fwlink/?linkid=2285682",
"id": "/subscriptions/ac0271d6-426b-4b0d-b88d-0d0e4bd693ae/resourceGroups/nascrunner25/providers/Microsoft.DBforPostgreSQL/flexibleServers/nasc-new-ha-919/configurations/azure.mirror_databases",
"isConfigPendingRestart": false,
"isDynamicConfig": true,
"isReadOnly": false,
"name": "azure.mirror_databases",
"resourceGroup": "nascrunner25",
"source": "user-override",
"systemData": null,
"type": "Microsoft.DBforPostgreSQL/flexibleServers/configurations",
"unit": null,
"value": "postgres"
}

History Notes
[RDBMS] az postgres flexible-server update/fabric-mirroring: Allow high availability enabled servers to start fabric mirroring if PG version 17+

@nasc17 nasc17 requested a review from evelyn-ys as a code owner November 26, 2025 20:04
Copilot AI review requested due to automatic review settings November 26, 2025 20:04
@nasc17 nasc17 requested a review from calvinhzy as a code owner November 26, 2025 20:04
@azure-client-tools-bot-prd
Copy link

azure-client-tools-bot-prd bot commented Nov 26, 2025

️✔️AzureCLI-FullTest
️✔️acr
️✔️latest
️✔️3.12
️✔️3.13
️✔️acs
️✔️latest
️✔️3.12
️✔️3.13
️✔️advisor
️✔️latest
️✔️3.12
️✔️3.13
️✔️ams
️✔️latest
️✔️3.12
️✔️3.13
️✔️apim
️✔️latest
️✔️3.12
️✔️3.13
️✔️appconfig
️✔️latest
️✔️3.12
️✔️3.13
️✔️appservice
️✔️latest
️✔️3.12
️✔️3.13
️✔️aro
️✔️latest
️✔️3.12
️✔️3.13
️✔️backup
️✔️latest
️✔️3.12
️✔️3.13
️✔️batch
️✔️latest
️✔️3.12
️✔️3.13
️✔️batchai
️✔️latest
️✔️3.12
️✔️3.13
️✔️billing
️✔️latest
️✔️3.12
️✔️3.13
️✔️botservice
️✔️latest
️✔️3.12
️✔️3.13
️✔️cdn
️✔️latest
️✔️3.12
️✔️3.13
️✔️cloud
️✔️latest
️✔️3.12
️✔️3.13
️✔️cognitiveservices
️✔️latest
️✔️3.12
️✔️3.13
️✔️compute_recommender
️✔️latest
️✔️3.12
️✔️3.13
️✔️computefleet
️✔️latest
️✔️3.12
️✔️3.13
️✔️config
️✔️latest
️✔️3.12
️✔️3.13
️✔️configure
️✔️latest
️✔️3.12
️✔️3.13
️✔️consumption
️✔️latest
️✔️3.12
️✔️3.13
️✔️container
️✔️latest
️✔️3.12
️✔️3.13
️✔️containerapp
️✔️latest
️✔️3.12
️✔️3.13
️✔️core
️✔️latest
️✔️3.12
️✔️3.13
️✔️cosmosdb
️✔️latest
️✔️3.12
️✔️3.13
️✔️databoxedge
️✔️latest
️✔️3.12
️✔️3.13
️✔️dls
️✔️latest
️✔️3.12
️✔️3.13
️✔️dms
️✔️latest
️✔️3.12
️✔️3.13
️✔️eventgrid
️✔️latest
️✔️3.12
️✔️3.13
️✔️eventhubs
️✔️latest
️✔️3.12
️✔️3.13
️✔️feedback
️✔️latest
️✔️3.12
️✔️3.13
️✔️find
️✔️latest
️✔️3.12
️✔️3.13
️✔️hdinsight
️✔️latest
️✔️3.12
️✔️3.13
️✔️identity
️✔️latest
️✔️3.12
️✔️3.13
️✔️iot
️✔️latest
️✔️3.12
️✔️3.13
️✔️keyvault
️✔️latest
️✔️3.12
️✔️3.13
️✔️lab
️✔️latest
️✔️3.12
️✔️3.13
️✔️managedservices
️✔️latest
️✔️3.12
️✔️3.13
️✔️maps
️✔️latest
️✔️3.12
️✔️3.13
️✔️marketplaceordering
️✔️latest
️✔️3.12
️✔️3.13
️✔️monitor
️✔️latest
️✔️3.12
️✔️3.13
️✔️mysql
️✔️latest
️✔️3.12
️✔️3.13
️✔️netappfiles
️✔️latest
️✔️3.12
️✔️3.13
️✔️network
️✔️latest
️✔️3.12
️✔️3.13
️✔️policyinsights
️✔️latest
️✔️3.12
️✔️3.13
️✔️privatedns
️✔️latest
️✔️3.12
️✔️3.13
️✔️profile
️✔️latest
️✔️3.12
️✔️3.13
️✔️rdbms
️✔️latest
️✔️3.12
️✔️3.13
️✔️redis
️✔️latest
️✔️3.12
️✔️3.13
️✔️relay
️✔️latest
️✔️3.12
️✔️3.13
️✔️resource
️✔️latest
️✔️3.12
️✔️3.13
️✔️role
️✔️latest
️✔️3.12
️✔️3.13
️✔️search
️✔️latest
️✔️3.12
️✔️3.13
️✔️security
️✔️latest
️✔️3.12
️✔️3.13
️✔️servicebus
️✔️latest
️✔️3.12
️✔️3.13
️✔️serviceconnector
️✔️latest
️✔️3.12
️✔️3.13
️✔️servicefabric
️✔️latest
️✔️3.12
️✔️3.13
️✔️signalr
️✔️latest
️✔️3.12
️✔️3.13
️✔️sql
️✔️latest
️✔️3.12
️✔️3.13
️✔️sqlvm
️✔️latest
️✔️3.12
️✔️3.13
️✔️storage
️✔️latest
️✔️3.12
️✔️3.13
️✔️synapse
️✔️latest
️✔️3.12
️✔️3.13
️✔️telemetry
️✔️latest
️✔️3.12
️✔️3.13
️✔️util
️✔️latest
️✔️3.12
️✔️3.13
️✔️vm
️✔️latest
️✔️3.12
️✔️3.13

@yonzhan
Copy link
Collaborator

yonzhan commented Nov 26, 2025

Thank you for your contribution! We will review the pull request and get back to you soon.

@azure-client-tools-bot-prd
Copy link

azure-client-tools-bot-prd bot commented Nov 26, 2025

️✔️AzureCLI-BreakingChangeTest
️✔️Non Breaking Changes

@github-actions
Copy link

The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR.

Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions).
After that please run the following commands to enable git hooks:

pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>

Copilot finished reviewing on behalf of nasc17 November 26, 2025 20:06
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to enable fabric mirroring on PostgreSQL version 17+ servers with high availability (HA) enabled, lifting the previous restriction where HA and fabric mirroring were mutually exclusive.

  • Updated version checks in flexible_server_update_custom_func to skip fabric mirroring validation for PG 17+
  • Modified fabric mirroring start, stop, and update-databases functions to allow operations on HA-enabled servers for PG 17+
  • Updated comments to reflect Ignite 2025 support for fabric mirroring with HA on PG 17

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

server = flexible_servers_client.get(resource_group_name, server_name)

if server.high_availability.mode != "Disabled":
if server.high_availability.mode != "Disabled" and server.version not in ["17", "18"]:
Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same logic error as in the other fabric mirroring functions. The condition server.version not in ["17"] will incorrectly block database updates for all versions except 17 when HA is enabled.

Use the same fix as recommended for lines 1588 and 1618:

if server.high_availability.mode != "Disabled" and int(server.version) < 17:
Suggested change
if server.high_availability.mode != "Disabled" and server.version not in ["17", "18"]:
if server.high_availability.mode != "Disabled" and int(server.version) < 17:

Copilot uses AI. Check for mistakes.

# PG 11 and 12 will never receive fabric mirroring support. Skip this check for servers of these versions
if high_availability.lower() != "disabled" and str(instance.version) not in ["11", "12"]:
# PG 11 and 12 will never receive fabric mirroring support. Ignite 2025 Fabric mirroring supported on 17. Skip this check for servers of these versions
Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment is misleading. It states "Ignite 2025 Fabric mirroring supported on 17" but the logic skips the check for version 17, which is the opposite of what the comment suggests. The comment should clarify that the check is being skipped for versions where fabric mirroring + HA is supported (17+).

Suggested change
# PG 11 and 12 will never receive fabric mirroring support. Ignite 2025 Fabric mirroring supported on 17. Skip this check for servers of these versions
# Skip this check for versions where fabric mirroring and high availability are supported together (17 and above),
# and for PG 11 and 12, which will never receive fabric mirroring support. For all other versions, prevent enabling HA when fabric mirroring is active.

Copilot uses AI. Check for mistakes.
Comment on lines +473 to +474
# PG 11 and 12 will never receive fabric mirroring support. Ignite 2025 Fabric mirroring supported on 17. Skip this check for servers of these versions
if high_availability.lower() != "disabled" and str(instance.version) not in ["11", "12", "17", "18"]:
Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic here is inverted. The condition str(instance.version) not in ["11", "12", "17"] means that for version 17, the fabric mirroring check will be skipped. This allows HA to be enabled without checking if fabric mirroring is active, which could lead to an invalid state.

The correct logic should be: if the version is 17 or higher, allow both HA and fabric mirroring to coexist. For versions 13-16, prevent enabling HA if fabric mirroring is active.

Consider changing to:

# PG 11 and 12 will never receive fabric mirroring support. Ignite 2025: Fabric mirroring supported with HA on 17+
if high_availability.lower() != "disabled" and str(instance.version) in ["13", "14", "15", "16"]:
Suggested change
# PG 11 and 12 will never receive fabric mirroring support. Ignite 2025 Fabric mirroring supported on 17. Skip this check for servers of these versions
if high_availability.lower() != "disabled" and str(instance.version) not in ["11", "12", "17", "18"]:
# PG 11 and 12 will never receive fabric mirroring support. Ignite 2025: Fabric mirroring supported with HA on 17+
if high_availability.lower() != "disabled" and str(instance.version) in ["13", "14", "15", "16"]:

Copilot uses AI. Check for mistakes.
server = flexible_servers_client.get(resource_group_name, server_name)

if server.high_availability.mode != "Disabled":
if server.high_availability.mode != "Disabled" and server.version not in ["17", "18"]:
Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic is incorrect. The condition server.version not in ["17"] means:

  • For version 17: condition is False, error is NOT raised ✓ (correct)
  • For versions 11-16: condition is True, error IS raised ✗ (incorrect for intended behavior)

This prevents fabric mirroring on all non-17 versions with HA, including future versions like 18, 19, etc.

The correct approach should check if the version is less than 17:

if server.high_availability.mode != "Disabled" and int(server.version) < 17:

Alternatively, if you want to be explicit about supported versions:

if server.high_availability.mode != "Disabled" and server.version in ["11", "12", "13", "14", "15", "16"]:
Suggested change
if server.high_availability.mode != "Disabled" and server.version not in ["17", "18"]:
if server.high_availability.mode != "Disabled" and int(server.version) < 17:

Copilot uses AI. Check for mistakes.
server = flexible_servers_client.get(resource_group_name, server_name)

if server.high_availability.mode != "Disabled":
if server.high_availability.mode != "Disabled" and server.version not in ["17", "18"]:
Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same logic error as in flexible_server_fabric_mirroring_start. The condition server.version not in ["17"] will block fabric mirroring stop operations for all versions except 17 when HA is enabled, including future versions.

Use the same fix as recommended for line 1588:

if server.high_availability.mode != "Disabled" and int(server.version) < 17:
Suggested change
if server.high_availability.mode != "Disabled" and server.version not in ["17", "18"]:
if server.high_availability.mode != "Disabled" and int(server.version) < 17:

Copilot uses AI. Check for mistakes.
@nasc17 nasc17 requested a review from mattboentoro November 26, 2025 21:07
@evelyn-ys
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@evelyn-ys evelyn-ys merged commit 7f1ccf6 into Azure:dev Dec 3, 2025
48 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Auto-Assign Auto assign by bot

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants