Skip to content

Add MSSQLServer status.disasterRecovery for DC-DR - #1795

Open
tamalsaha wants to merge 1 commit into
masterfrom
dc-dr-mssql
Open

tamalsaha wants to merge 1 commit into
masterfrom
dc-dr-mssql

Conversation

@tamalsaha

Copy link
Copy Markdown
Member

What

Adds the cross data center (DC-DR) status surface to the distributed MSSQLServer object, the foundational apimachinery piece for KubeDB MSSQL DC-DR (dc-dr/mssqlserver/common.md). It mirrors the Postgres DC-DR status shape and adds the Distributed Availability Group (DAG) specific telemetry that MSSQL needs.

Types added (apis/kubedb/v1alpha2/mssqlserver_types.go)

  • MSSQLServerStatus.disasterRecovery *MSSQLServerDisasterRecoveryStatus
  • MSSQLServerDRPhase (Steady, FailingOver, FailingBack, Degraded)
  • MSSQLServerDisasterRecoveryStatus: activeDC, phase, dataCenters[], lastTransitionTime
  • MSSQLServerDCStatus: per Member DC view, clusterName, role, agPrimary, dagRole, writable, synchronizationHealth, redoQueueBytes, logSendQueueBytes, lastHardenedLSN, healthy

The cross-DC decision is owned by the dr-controlplane primary-DC Lease, which drives the underlying DAG role; this status reflects it on the single distributed MSSQLServer object. The DAG-specific fields (synchronizationHealth, redoQueueBytes, logSendQueueBytes, lastHardenedLSN) are sourced from sys.dm_hadr_database_replica_states and back the lag guard and the LSN-equality switchover gate.

zz_generated.deepcopy.go is updated by hand to match.

Staging

This is step 1 of the staging order in dc-dr/mssqlserver/common.md: apimachinery merges and releases first, then the mssqlserver operator and mssql-coordinator bump to it.

Follow-up

CRD and openapi regeneration is a mechanical follow-up step (matches the Postgres DC-DR PR, which also deferred regen to a separate mechanical pass).

Test plan

  • go build ./apis/kubedb/...
  • go vet ./apis/kubedb/v1alpha2/
  • gofmt clean

Add the cross data center (DC-DR) status surface to the distributed
MSSQLServer object, mirroring the Postgres DC-DR status shape and adding
the Distributed Availability Group (DAG) specific telemetry.

status.disasterRecovery carries the active DC, the DR phase, and a per
data center view (each Member DC's AG primary, DAG role, writability, DAG
synchronization health, redo and log-send queue bytes, and last hardened
LSN) so the single distributed MSSQLServer object reflects the per-DC
state owned by the dr-controlplane primary-DC Lease.

CRD and openapi regeneration is a follow-up mechanical step.

Signed-off-by: Tamal Saha <tamal@appscode.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant