Skip to content

Commit

Permalink
mk-sql: correct sql script to get backups in "clustered" setup
Browse files Browse the repository at this point in the history
SUP-21423
SUP-20138

Change-Id: Ia035be14cbfa5d22023612e0a5e4b7645c390c52
  • Loading branch information
s-kipnis committed Jan 2, 2025
1 parent 2ec6399 commit bcd5e0f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/host/mk-sql/src/ms_sql/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1727,7 +1727,7 @@ fn to_backup_entry(
.get_value_by_name("is_primary_replica")
.trim()
.to_string();
if replica_id.is_empty() || is_primary_replica == "True" {
if replica_id.is_empty() || is_primary_replica == "True" || is_primary_replica == "1" {
format!(
"{}{sep}{}{sep}{}+00:00{sep}{}\n",
instance_name,
Expand Down Expand Up @@ -1769,7 +1769,7 @@ fn to_backup_entry_odbc(
.get_value_by_name(row, "is_primary_replica")
.trim()
.to_string();
if replica_id.is_empty() || is_primary_replica == "True" {
if replica_id.is_empty() || is_primary_replica == "True" || is_primary_replica == "1" {
format!(
"{}{sep}{}{sep}{}+00:00{sep}{}\n",
instance_name,
Expand Down
4 changes: 2 additions & 2 deletions packages/host/mk-sql/src/ms_sql/sqls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,8 @@ BEGIN
(CASE WHEN time_zone IS NOT NULL AND time_zone <> 127 THEN 60 * 15 * time_zone ELSE 0 END)), ''19700101''), 120)
AS last_backup_date,
cast(b.type as nvarchar(max)) as type,
cast(b.machine_name as nvarchar(max)),
isnull(rep.is_primary_replica,0) as is_primary_replica,
cast(b.machine_name as nvarchar(max)) as machine_name,
isnull(convert(nvarchar(40), rep.is_primary_replica), '''') as is_primary_replica,
rep.is_local,
isnull(convert(nvarchar(40), rep.replica_id), '''') AS replica_id,
cast(db.name as nvarchar(max)) AS database_name
Expand Down

0 comments on commit bcd5e0f

Please sign in to comment.