public object Clone()
        {
            DistributionMaps maps = new DistributionMaps(_result);

            if (_hashmap != null)
            {
                maps.Hashmap = _hashmap.Clone() as ArrayList;
            }
            if (_bucketsOwnershipMap != null)
            {
                maps.BucketsOwnershipMap = _bucketsOwnershipMap.Clone() as Hashtable;
            }
            if (_specialBucketOwners != null)
            {
                maps.SpecialBucketOwners = _specialBucketOwners.Clone() as Hashtable;
            }

            return(maps);
        }
Exemple #2
0
        public object Clone()
        {
            DistributionMaps maps = new DistributionMaps(_result);

            if (_hashmap != null)
            {
                maps.Hashmap = _hashmap.Clone() as ArrayList;
            }
            if (_bucketsOwnershipMap != null)
            {
                maps.BucketsOwnershipMap = _bucketsOwnershipMap.Clone() as Hashtable;
            }
            if (_specialBucketOwners != null)
            {
                maps.SpecialBucketOwners = _specialBucketOwners.Clone() as Hashtable;
            }
            if (_orphanedBuckets != null)
            {
                maps.OrphanedBuckets = _orphanedBuckets.Clone() as Hashtable;
            }
            maps.LeavingNode = _leavingNode;

            return(maps);
        }
Exemple #3
0
        public DistributionMaps BalanceNodes(DistributionInfoData distInfo, ArrayList hashMap, Hashtable bucketStats, ArrayList members)
        {
            _hashMap = hashMap;
            _nodeBalData = new NodeBalanceData(hashMap, bucketStats, members);
            
            //Check if any other state transfer is not in progress...
            bool bAllFunctional = this.SanityCheckForAllFunctional(hashMap);            
            //Add some status saying that node balancing is not possible at the moment.
            if (!bAllFunctional)
            {
                DistributionMaps result = new DistributionMaps(BalancingResult.AlreadyInBalancing);
                return result;
            }

            //Check if really the node needs some balancing or not.
            bool bShouldBalance = this.SanityCheckForCandidateNode((Address)distInfo.AffectedNode.NodeAddress);

            if (!bShouldBalance)
            {
                DistributionMaps result = new DistributionMaps(BalancingResult.NotRequired);
                return result;
            }
                        
            ArrayList dataListForNodes = _nodeBalData.BalanceDataListForNodes;
            ArrayList candidates = FilterCandidateNodes();
            
            foreach (AddressWeightPair awPair in candidates)
            {
                BalanceDataForNode secNode = GetBalDataForNode(awPair.NodeAddress);
                BalanceTwoNodes(_primaryNode, secNode, awPair.WeightShare);
                ApplyChangesInHashMap(secNode);
            }
            ApplyChangesInHashMap(_primaryNode);
            return new DistributionMaps(_hashMap, null);           

        } //end func.
Exemple #4
0
		public virtual void Deserialize(CompactReader reader)
		{
			vid = (ViewId) reader.ReadObject();
			_members = (ArrayList) reader.ReadObject();
			_sequencerTbl = (Hashtable)reader.ReadObject();
			_mbrsSubgroupMap = (Hashtable)reader.ReadObject();

            _distributionMaps = (DistributionMaps)reader.ReadObject();

            _mirrorMapping = reader.ReadObject() as CacheNode[];
            _bridgeSourceCacheId = reader.ReadObject() as string;
            nodeGmsIds = reader.ReadObject() as Hashtable;
            _coordinatorGmsId = reader.ReadObject() as string;
		}
 public void Clustered_PublishMaps(DistributionMaps distributionMaps)
 {
     try
     {
         Function func = new Function((int)OpCodes.PublishMap, new object[] { distributionMaps }, false);
         Cluster.Broadcast(func, GroupRequest.GET_NONE, false, Priority.Critical);
     }
     catch (Exception e)
     {
         Context.NCacheLog.Error("PartitionedCache.Clustered_PublishMaps()", e.ToString());
         throw new GeneralFailureException(e.Message, e);
     }
 }
 public void PublishMaps(DistributionMaps distributionMaps)
 {
     Clustered_PublishMaps(distributionMaps);
 }
 public virtual void InstallHashMap(DistributionMaps distributionMaps, ArrayList leftMbrs) { }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="newMap"></param>
        /// <param name="newBucketsOwnershipMap"></param>
        /// <param name="leftMbrs"></param>
        public void InstallHashMap(DistributionMaps distributionMaps, ArrayList leftMbrs)
        {
            ArrayList newMap = null;
            Hashtable newBucketsOwnershipMap = null;

            _sync.AcquireWriterLock(Timeout.Infinite);
            try
            {
                if (distributionMaps == null)
                    return;

                newMap = distributionMaps.Hashmap;
                newBucketsOwnershipMap = distributionMaps.BucketsOwnershipMap;

                if (newMap == null || newBucketsOwnershipMap == null)
                    return;

                if (_installedHashMap != null)
                {
                    for (int i = 0; i < newMap.Count; i++)
                    {
                        HashMapBucket newBucket = (HashMapBucket)newMap[i];
                        int index = _installedHashMap.IndexOf(newBucket);
                        HashMapBucket oldBucket = (HashMapBucket)_installedHashMap[index];

                        if (!oldBucket.PermanentAddress.Equals(newBucket.PermanentAddress) && oldBucket.TempAddress.Equals(newBucket.TempAddress))
                        {
                            NCacheLog.Error("Install Hasmap", "BucketID: " + index.ToString() + "\toldBucket: " + oldBucket.PermanentAddress.ToString() + "\toldBucket.Temp: " + oldBucket.TempAddress.ToString() + "\tnewBucket: " + newBucket.PermanentAddress.ToString() + "\tnewBucekt.Temp: " + newBucket.TempAddress.ToString());
                        }
                        else
                        {
                            oldBucket.PermanentAddress = newBucket.PermanentAddress;
                            oldBucket.TempAddress = newBucket.TempAddress;
                            oldBucket.Status = newBucket.Status;
                        }


                    }
                }
                else
                {
                    _installedHashMap = newMap;
                }
                _bucketsOwnershipMap = newBucketsOwnershipMap;

                NotifyBucketUpdate();
            }
            finally
            {
                _sync.ReleaseWriterLock();
            }
        }
 public override void InstallHashMap(DistributionMaps distributionMaps, ArrayList leftMbrs)
 {
     _distributionMgr.InstallHashMap(distributionMaps, leftMbrs);
     
 }
        public object Clone()
        {
            DistributionMaps maps = new DistributionMaps(_result);
            if(_hashmap != null) maps.Hashmap = _hashmap.Clone() as ArrayList;
            if (_bucketsOwnershipMap != null) maps.BucketsOwnershipMap = _bucketsOwnershipMap.Clone() as Hashtable;
            if (_specialBucketOwners != null) maps.SpecialBucketOwners = _specialBucketOwners.Clone() as Hashtable;

            return maps;
        }