Compare commits
2 Commits
ab12c29244
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| de47f41fc3 | |||
| bbbc824916 |
+18
-1
@@ -577,7 +577,24 @@ function Print-BackupSummary {
|
||||
Write-Host " Point-in-Time Range: $(([datetime]$firstLog.BackupStartDate).ToString([System.Globalization.CultureInfo]::CurrentCulture)) to $(([datetime]$lastLog.BackupFinishDate).ToString([System.Globalization.CultureInfo]::CurrentCulture))"
|
||||
Write-Host " LSN Range: $($firstLog.FirstLSN) - $($lastLog.LastLSN)"
|
||||
|
||||
# Check for gaps
|
||||
# Check that the first LOG connects to the most recent FULL (or DIFF if one exists).
|
||||
$baseLastLsn = $null
|
||||
$baseLabel = $null
|
||||
if ($Headers.ContainsKey('DIFF') -and $Headers['DIFF'].Count -gt 0) {
|
||||
$latestDiff = @($Headers['DIFF'] | Sort-Object { $_.Key })[-1]
|
||||
$dh = @($latestDiff.Header)[0]
|
||||
if ($dh) { $baseLastLsn = $dh.LastLSN; $baseLabel = "DIFF $($latestDiff.Key)" }
|
||||
}
|
||||
if (-not $baseLastLsn -and $Headers.ContainsKey('FULL') -and $Headers['FULL'].Count -gt 0) {
|
||||
$latestFull = @($Headers['FULL'] | Sort-Object { $_.Key })[-1]
|
||||
$fh = @($latestFull.Header)[0]
|
||||
if ($fh) { $baseLastLsn = $fh.LastLSN; $baseLabel = "FULL $($latestFull.Key)" }
|
||||
}
|
||||
if ($baseLastLsn -and [decimal]$firstLog.FirstLSN -gt [decimal]$baseLastLsn) {
|
||||
Write-Host " *** LSN GAP: first LOG (LSN $($firstLog.FirstLSN)) does not connect to $baseLabel (ends LSN $baseLastLsn) — point-in-time restore will fail ***"
|
||||
}
|
||||
|
||||
# Check for gaps within the LOG sequence
|
||||
$gaps = @()
|
||||
for ($i = 1; $i -lt $logItems.Count; $i++) {
|
||||
$prevHeader = @($logItems[$i-1].Header)[0]
|
||||
|
||||
+2
-2
@@ -532,7 +532,7 @@ function Get-BackupType($directoryParam) {
|
||||
$reason = if ($isFullBackupOverdue) { "overdue" } else { "scheduled" }
|
||||
return @{ Type = "FULL"; CleanupTime = 168; Reason = $reason }
|
||||
} else {
|
||||
return @{ Type = "LOG"; CleanupTime = 24; Reason = "full already taken today" }
|
||||
return @{ Type = "LOG"; CleanupTime = 48; Reason = "full already taken today" }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -563,7 +563,7 @@ function Get-BackupType($directoryParam) {
|
||||
}
|
||||
return @{ Type = "DIFF"; CleanupTime = 168; Reason = "differential scheduled" }
|
||||
} else {
|
||||
return @{ Type = "LOG"; CleanupTime = 24; Reason = "diff already taken today" }
|
||||
return @{ Type = "LOG"; CleanupTime = 48; Reason = "diff already taken today" }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user