Tuesday, November 1, 2016

Today we continue to review the mechanics of Active Directory replication:
We are referring to intrasite replication for the most often use cases of Active directory domain name-context item changes. Such AD replication takes place between DCs in pull operations, not pushes. AD controls and manages the transmission of AD Data with replication metadata. The first item of replication metadata is the USN which is the update sequence number that denotes a version at the local DC.The other DCs keep track of these USN for each other.  To tell apart a replicating change from the originating change, another item of the metadata called the high watermark vector is used. In order to prevent the entire database from being sent over the wire on every change, the high watermark is used to notify only the incremental changes. However this is not all. If a DC has a change that it needs to replicate and if the only things to go on were the USN and the high water mark, then that DC would contact another DC to replicate the same change back that it already replicated which would create an endless cycle of replication and chew up progressively more and more bandwidth. To combat this, we need the up-to-dateness vector also called the UTDV. This is used for propagation dampening and it is used for every DC in the domain. The UTDV table keeps track of not only the highest USN that each DC has received from its partners but also the highest USN it has received from other DCs replicating the a given NC. The replicated change therefore includes the following:
the GUID of the DC that is replicating the change
the USN from the DC that is replicating the change
the GUID of the DC that originated the change
the USN from the DC that originated the change.
Sometimes you wonder why Active Directory can't be a database.
#codingexercise
Given a string, determine the minimum number of cuts needed to partition a string.
int minSplit(String val)
{
int n = val.Length;
if (n == 0) return 0;
var C = new int[n,n];
var P = new int[n,n];
for (int i = 0; i < n; i++)
{
P[i,i] = true;
C[i,i] = 0;
}
for (int L = 2; L <= n; L++)
{
 int j = i + L - 1;
if (L == 2)
   P[i,j] = (val[i] == val[j]);
else
   P[i,j] = (val[i] == val[j]) && P[i+1, j-1];

if (P[i,j] == true)
     C[i,j] = 0;
else
{
     C[i,j] = INT_MAX;
     for (int k = i; k < j-1; k++)
      C[i,j] = min(C[i,j], C[i,k] + C[k+1, j] + 1);
}
}
return C[0,n-1];
}

No comments:

Post a Comment