Ejemplo n.º 1
0
 /// <summary>
 /// After one of the BPServiceActors registers successfully with the
 /// NN, it calls this function to verify that the NN it connected to
 /// is consistent with other NNs serving the block-pool.
 /// </summary>
 /// <exception cref="System.IO.IOException"/>
 internal virtual void RegistrationSucceeded(BPServiceActor bpServiceActor, DatanodeRegistration
                                             reg)
 {
     WriteLock();
     try
     {
         if (bpRegistration != null)
         {
             CheckNSEquality(bpRegistration.GetStorageInfo().GetNamespaceID(), reg.GetStorageInfo
                                 ().GetNamespaceID(), "namespace ID");
             CheckNSEquality(bpRegistration.GetStorageInfo().GetClusterID(), reg.GetStorageInfo
                                 ().GetClusterID(), "cluster ID");
         }
         bpRegistration = reg;
         dn.BpRegistrationSucceeded(bpRegistration, GetBlockPoolId());
         // Add the initial block token secret keys to the DN's secret manager.
         if (dn.isBlockTokenEnabled)
         {
             dn.blockPoolTokenSecretManager.AddKeys(GetBlockPoolId(), reg.GetExportedKeys());
         }
     }
     finally
     {
         WriteUnlock();
     }
 }