Example #1
0
 public ReplicaUnderRecovery(ReplicaInfo replica, long recoveryId)
     : base(replica, replica.GetVolume(), replica.GetDir())
 {
     // the original replica that needs to be recovered
     // recovery id; it is also the generation stamp
     // that the replica will be bumped to after recovery
     if (replica.GetState() != HdfsServerConstants.ReplicaState.Finalized && replica.GetState
             () != HdfsServerConstants.ReplicaState.Rbw && replica.GetState() != HdfsServerConstants.ReplicaState
         .Rwr)
     {
         throw new ArgumentException("Cannot recover replica: " + replica);
     }
     this.original   = replica;
     this.recoveryId = recoveryId;
 }
Example #2
0
        /// <exception cref="System.Exception"/>
        private static ReplicaInPipeline GetReplica(DataNode datanode, string bpid, HdfsServerConstants.ReplicaState
                                                    expectedState)
        {
            ICollection <ReplicaInfo> replicas = FsDatasetTestUtil.GetReplicas(datanode.GetFSDataset
                                                                                   (), bpid);

            for (int i = 0; i < 5 && replicas.Count == 0; i++)
            {
                Log.Info("wait since replicas.size() == 0; i=" + i);
                Sharpen.Thread.Sleep(1000);
            }
            NUnit.Framework.Assert.AreEqual(1, replicas.Count);
            ReplicaInfo r = replicas.GetEnumerator().Next();

            NUnit.Framework.Assert.AreEqual(expectedState, r.GetState());
            return((ReplicaInPipeline)r);
        }
Example #3
0
 public virtual ReplicaRecoveryInfo CreateInfo()
 {
     return(new ReplicaRecoveryInfo(original.GetBlockId(), original.GetBytesOnDisk(),
                                    original.GetGenerationStamp(), original.GetState()));
 }