/// <summary> /// Verifies that joining node has no data integrity conflicts with other nodes of the /// cluster. /// </summary> /// <returns>True, if no data integrity conflicts found, other wise false</returns> /// <remarks>Each partitioned node can have his data affinity. Data groups other than the /// strongly affiliated groups can be loadbalanced to any of the existing node. In such a /// situaltion if a new node joins and it has strong affinity with the groups whose data /// was previously distributed evenly, then a data integrity conflict arises. To avoid such /// conflicts each joining node first varifes that no other node on the cluster has data /// of his groups. If it is so, then he has to leave the cluster.</remarks> public bool VerifyDataIntegrity() { bool integrityVarified = true; bool integrityIssue = false; try { if (Cluster.Servers.Count > 1) { if (_stats != null && _stats.LocalNode.DataAffinity != null) { DataAffinity affinity = _stats.LocalNode.DataAffinity; if (affinity.Groups != null && affinity.Groups.Count > 0) { Function fun = new Function((int)OpCodes.VerifyDataIntegrity, (object)affinity.Groups, false); RspList results = Cluster.BroadcastToServers(fun, GroupRequest.GET_ALL, false); if (results != null) { ClusterHelper.ValidateResponses(results, typeof(bool), Name); Rsp response; for (int i = 0; i < results.size(); i++) { response = (Rsp)results.elementAt(i); if (response.wasReceived()) { integrityIssue = Convert.ToBoolean(response.Value); if (integrityIssue) { Context.NCacheLog.Error("PartitionedCacheBase.Verifydataintegrity()", "data integrity issue from " + response.Sender.ToString()); integrityVarified = false; } } else { Context.NCacheLog.Error("PartitionedCacheBase.Verifydataintegrity()", "data integrity varification not received from " + response.Sender.ToString()); integrityVarified = false; break; } } } } } } } catch (Exception e) { if (Context != null) { Context.NCacheLog.Error("PartitionedCacheBase.Verifydataintegrity()", e.ToString()); } integrityVarified = false; } return(integrityVarified); }
public void Serialize(CompactWriter writer) { Address.WriteAddress(writer, _address); writer.WriteObject(_subgroupName); CacheStatistics.WriteCacheStatistics(writer, _stats); writer.Write(_status.Data); DataAffinity.WriteDataAffinity(writer, _dataAffinity); writer.WriteObject(_connectedClients); writer.Write(_isInproc); Address.WriteAddress(writer, _rendererAddress); writer.Write(_isStartedAsMirror); }
public void Deserialize(CompactReader reader) { _address = Address.ReadAddress(reader); _subgroupName = reader.ReadObject() as string; _stats = CacheStatistics.ReadCacheStatistics(reader); _status = new BitSet(reader.ReadByte()); _dataAffinity = DataAffinity.ReadDataAffinity(reader); _connectedClients = (ArrayList)reader.ReadObject(); _isInproc = reader.ReadBoolean(); _rendererAddress = Address.ReadAddress(reader); _isStartedAsMirror = reader.ReadBoolean(); }
public void Serialize(CompactWriter writer) { Address.WriteAddress(writer, _address); writer.WriteObject(_subgroupName); CacheStatistics.WriteCacheStatistics(writer, _stats); writer.Write(_status.Data); DataAffinity.WriteDataAffinity(writer, _dataAffinity); writer.WriteObject(_connectedClients); writer.Write(_isInproc); Address.WriteAddress(writer, _rendererAddress); writer.WriteObject(_nodeGuid); writer.Write(_statsReplicationCounter); writer.Write((byte)CacheNodeStatus); }
public void Deserialize(CompactReader reader) { _address = Address.ReadAddress(reader); _subgroupName = reader.ReadObject() as string; //_subgroupName = reader.ReadString(); _stats = CacheStatistics.ReadCacheStatistics(reader); _status = new BitSet(reader.ReadByte()); _dataAffinity = DataAffinity.ReadDataAffinity(reader); _connectedClients = (ArrayList)reader.ReadObject(); _isInproc = reader.ReadBoolean(); _rendererAddress = Address.ReadAddress(reader); _nodeGuid = reader.ReadObject() as string; _statsReplicationCounter = reader.ReadInt32(); this.CacheNodeStatus = (Alachisoft.NCache.Common.Monitoring.CacheNodeStatus)reader.ReadByte(); }
/// <summary> /// Copy constructor /// </summary> /// <param name="info"></param> protected NodeInfo(NodeInfo info) { this._address = info._address == null ? null : info._address.Clone() as Address; this._rendererAddress = info._rendererAddress != null?info._rendererAddress.Clone() as Address : null; this._stats = info._stats == null ? null:info._stats.Clone() as CacheStatistics; this._status = info._status; this._subgroupName = info._subgroupName; this._isInproc = info._isInproc; this._dataAffinity = info._dataAffinity == null ? null : info._dataAffinity.Clone() as DataAffinity; _isStartedAsMirror = info.IsStartedAsMirror; if (info._connectedClients != null) { lock (info._connectedClients.SyncRoot) this._connectedClients = info._connectedClients.Clone() as ArrayList; } }
/// <summary> /// Copy constructor /// </summary> /// <param name="info"></param> protected NodeInfo(NodeInfo info) { this._address = info._address == null ? null : info._address.Clone() as Address; this._rendererAddress = info._rendererAddress != null?info._rendererAddress.Clone() as Address : null; this._stats = info._stats == null ? null : info._stats.Clone() as CacheStatistics; this._status = info._status; this._subgroupName = info._subgroupName; this._isInproc = info._isInproc; this._dataAffinity = info._dataAffinity == null ? null : info._dataAffinity.Clone() as DataAffinity; this._nodeGuid = info._nodeGuid; _statsReplicationCounter = info._statsReplicationCounter; this.CacheNodeStatus = info.CacheNodeStatus; if (info._connectedClients != null) { lock (info._connectedClients.SyncRoot) { this._connectedClients = info._connectedClients.Clone() as ArrayList; } } }