Example #1
0
 internal DatanodeStorageInfo(DatanodeDescriptor dn, DatanodeStorage s)
 {
     // The ID of the last full block report which updated this storage.
     this.dn          = dn;
     this.storageID   = s.GetStorageID();
     this.storageType = s.GetStorageType();
     this.state       = s.GetState();
 }
Example #2
0
 public virtual void UpdateFromStorage(DatanodeStorage storage)
 {
     state       = storage.GetState();
     storageType = storage.GetStorageType();
 }
Example #3
0
 internal virtual void Compare(DatanodeStorage dns1, DatanodeStorage dns2)
 {
     Assert.AssertThat(dns2.GetStorageID(), CoreMatchers.Is(dns1.GetStorageID()));
     Assert.AssertThat(dns2.GetState(), CoreMatchers.Is(dns1.GetState()));
     Assert.AssertThat(dns2.GetStorageType(), CoreMatchers.Is(dns1.GetStorageType()));
 }
 internal virtual DatanodeStorageInfo UpdateStorage(DatanodeStorage s)
 {
     lock (storageMap)
     {
         DatanodeStorageInfo storage = storageMap[s.GetStorageID()];
         if (storage == null)
         {
             Log.Info("Adding new storage ID " + s.GetStorageID() + " for DN " + GetXferAddr()
                      );
             storage = new DatanodeStorageInfo(this, s);
             storageMap[s.GetStorageID()] = storage;
         }
         else
         {
             if (storage.GetState() != s.GetState() || storage.GetStorageType() != s.GetStorageType
                     ())
             {
                 // For backwards compatibility, make sure that the type and
                 // state are updated. Some reports from older datanodes do
                 // not include these fields so we may have assumed defaults.
                 storage.UpdateFromStorage(s);
                 storageMap[storage.GetStorageID()] = storage;
             }
         }
         return(storage);
     }
 }