feat: add preference sorting and multi-ok DC prioritization in replication pipeline

This commit is contained in:
2026-10-21 19:01:52 +09:00
parent d69000213d
commit 0ebe04234e
2 changed files with 38 additions and 8 deletions
+11 -3
View File
@@ -1067,18 +1067,26 @@ function Navigate-ToPage {
[System.Threading.Monitor]::Exit($sync.Logs)
}
# 3. Background Sync to the other 5 DCs
# 3. Background Sync to the other 5 DCs (NetApp의 다른 OK 상태 DC들을 최우선 복제)
if ($pBgSync) {
$sync.Status = "3/5단계: 타 도메인 컨트롤러(5대) 백그라운드 복제 큐잉..."
Start-Sleep -Milliseconds 150
$allDcs = Get-ADDomainControllers -Config $cfg
$otherDcs = @($allDcs | Where-Object { $_.HostName -ne $targetDc })
foreach ($odc in $otherDcs) {
# NetApp에서 OK 상태로 감지된 추가 DC가 있다면 최우선 순위로 정렬하여 먼저 동기화
$priorityDcNames = if ($activeDcInfo.AllOkDcs) { @($activeDcInfo.AllOkDcs | Where-Object { $_ -ne $targetDc }) } else { @() }
$sortedTargetDcs = @($otherDcs | Sort-Object -Property @{
Expression = { if ($priorityDcNames -contains $_.HostName) { 0 } else { 1 } }
})
foreach ($odc in $sortedTargetDcs) {
$null = Sync-ADObjectToTargetDc -ObjectDN "CN=$pShare,OU=SecurityGroups,DC=corp,DC=local" -SourceDc $targetDc -DestinationDc $odc.HostName -Config $cfg
}
[System.Threading.Monitor]::Enter($sync.Logs)
try {
$sync.Logs.Add("[$((Get-Date).ToString('yyyy-MM-dd HH:mm:ss'))] [단계 3] 6대 DC 복제 동기화: NetApp 활성 DC($targetDc) -> 5대 DC 비동기 복제 전송 완료")
$pMsg = if ($priorityDcNames.Count -gt 0) { " (NetApp OK 후보 DC [$(($priorityDcNames) -join ', ')] 우선 복제)" } else { "" }
$sync.Logs.Add("[$((Get-Date).ToString('yyyy-MM-dd HH:mm:ss'))] [단계 3] 6대 DC 복제 동기화: NetApp 활성 DC($targetDc) -> 5대 DC 비동기 복제 전송 완료$pMsg")
} finally {
[System.Threading.Monitor]::Exit($sync.Logs)
}