Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -470,8 +470,8 @@ def flexible_server_update_custom_func(cmd, client, instance,
if high_availability.lower() != "disabled" and standby_availability_zone:
high_availability_param.standby_availability_zone = standby_availability_zone

# 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.
if high_availability.lower() != "disabled" and str(instance.version) not in ["11", "12", "17", "18"]:
Comment on lines +473 to +474
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.
config_client = cf_postgres_flexible_config(cmd.cli_ctx, '_')
fabric_mirror_status = config_client.get(resource_group_name, server_name, 'azure.fabric_mirror_enabled')
if (fabric_mirror_status and fabric_mirror_status.value.lower() == 'on'):
Expand Down Expand Up @@ -1585,7 +1585,7 @@ def flexible_server_fabric_mirroring_start(cmd, client, resource_group_name, ser
flexible_servers_client = cf_postgres_flexible_servers(cmd.cli_ctx, '_')
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.
# disable fabric mirroring on HA server
raise CLIError("Fabric mirroring is not supported on servers with high availability enabled.")

Expand Down Expand Up @@ -1615,7 +1615,7 @@ def flexible_server_fabric_mirroring_stop(cmd, client, resource_group_name, serv
flexible_servers_client = cf_postgres_flexible_servers(cmd.cli_ctx, '_')
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.
# disable fabric mirroring on HA server
raise CLIError("Fabric mirroring is not supported on servers with high availability enabled.")

Expand All @@ -1637,7 +1637,7 @@ def flexible_server_fabric_mirroring_update_databases(cmd, client, resource_grou
flexible_servers_client = cf_postgres_flexible_servers(cmd.cli_ctx, '_')
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.
# disable fabric mirroring on HA server
raise CLIError("Fabric mirroring is not supported on servers with high availability enabled.")

Expand Down