merge from main

This commit is contained in:
greerdv
2021-05-19 12:14:25 +01:00
11816 changed files with 189923 additions and 1002401 deletions
@@ -546,4 +546,4 @@ namespace GridMate
}
}
#endif // GM_CARRIER_H
#endif // GM_CARRIER_H
@@ -160,4 +160,4 @@ namespace GridMate
};
}
#endif // GM_DEFAULT_SIMULATOR_H
#endif // GM_DEFAULT_SIMULATOR_H
@@ -296,7 +296,7 @@ DefaultTrafficControl::OnReceived(TrafficControlConnectionId id, DataGramControl
if (m_maxRecvPackets != 0)
{
--cd->m_recvPacketAllowance;
if (cd->m_recvPacketAllowance == 0) // hit the limit -> let's blacklist connection
if (cd->m_recvPacketAllowance == 0) // hit the limit
{
cd->m_canReceiveData = false;
}
@@ -195,4 +195,4 @@ namespace GridMate
};
}
#endif // GM_DEFAULT_TRAFFIC_CONTROL_H
#endif // GM_DEFAULT_TRAFFIC_CONTROL_H
@@ -1486,7 +1486,7 @@ namespace GridMate
// Only support a single cipher suite in OpenSSL that supports:
//
// ECDHE Master key exchange using ephemeral elliptic curve diffie-hellman.
// ECDHE Key exchange using ephemeral elliptic curve diffie-hellman.
// RSA Authentication (public and private key) used to sign ECDHE parameters and can be checked against a CA.
// AES256 AES cipher for symmetric key encryption using a 256-bit key.
// GCM Mode of operation for symmetric key encryption.
@@ -97,7 +97,7 @@ namespace GridMate
// Only support a single cipher suite in OpenSSL that supports:
//
// ECDHE Master key exchange using ephemeral elliptic curve diffie-hellman.
// ECDHE Key exchange using ephemeral elliptic curve diffie-hellman.
// RSA Authentication (public and private key) used to sign ECDHE parameters and can be checked against a CA.
// AES256 AES cipher for symmetric key encryption using a 256-bit key.
// GCM Mode of operation for symmetric key encryption.
@@ -280,4 +280,4 @@ namespace GridMate
};
}
#endif // GM_STREAM_SOCKET_DRIVER_H
#endif // GM_STREAM_SOCKET_DRIVER_H
@@ -25,4 +25,4 @@ namespace GridMate
}
}
#endif // GM_DEFAULT_TRAFFIC_CONTROL_H
#endif // GM_DEFAULT_TRAFFIC_CONTROL_H
@@ -63,4 +63,4 @@ namespace GridMate
}
}
#endif // GM_CARRIER_DRILLER_H
#endif // GM_CARRIER_DRILLER_H
@@ -142,4 +142,4 @@ namespace GridMate
m_output->Write(Tags::TIME_PROCESSED_MILLISEC, AZStd::chrono::milliseconds(AZStd::chrono::system_clock::now().time_since_epoch()).count());
}
}
}
}
@@ -78,4 +78,4 @@ namespace GridMate
}
}
#endif
#endif
@@ -78,4 +78,4 @@ namespace GridMate
}
}
#endif // GM_SESSION_DRILLER_H
#endif // GM_SESSION_DRILLER_H
@@ -52,6 +52,6 @@ namespace GridMate
bool DataSetBase::CanSet() const
{
return m_replicaChunk ? m_replicaChunk->IsMaster() : true;
return m_replicaChunk ? m_replicaChunk->IsPrimary() : true;
}
}
@@ -43,7 +43,7 @@ namespace GridMate
struct DataSetDefaultTraits
{
/**
* \brief Should a change in DataSet value invoke a callback on a master replica chunk?
* \brief Should a change in DataSet value invoke a callback on a primary replica chunk?
*
* By default, DataSet::BindInterface<C, &C::Callback> only invokes on client/non-authoritative replica chunks.
* This switch enables the callback on server/authoritative replica chunks.
@@ -55,7 +55,7 @@ namespace GridMate
};
/**
* \brief Turns on DataSet callbacks to be invoked on the master replica as well as client replicas.
* \brief Turns on DataSet callbacks to be invoked on the primary replica as well as client replicas.
*/
struct DataSetInvokeEverywhereTraits : DataSetDefaultTraits
{
@@ -200,7 +200,7 @@ namespace GridMate
}
/**
Modify the DataSet. Call this on the Master node to change the data,
Modify the DataSet. Call this on the Primary node to change the data,
which will be propagated to all proxies.
**/
void Set(const DataType& v)
@@ -214,7 +214,7 @@ namespace GridMate
}
/**
Modify the DataSet. Call this on the Master node to change the data,
Modify the DataSet. Call this on the Primary node to change the data,
which will be propagated to all proxies.
**/
void Set(DataType&& v)
@@ -228,7 +228,7 @@ namespace GridMate
}
/**
Modify the DataSet. Call this on the Master node to change the data,
Modify the DataSet. Call this on the Primary node to change the data,
which will be propagated to all proxies.
**/
template <class ... Args>
@@ -243,7 +243,7 @@ namespace GridMate
}
/**
Modify the DataSet directly without copying it. Call this on the Master node,
Modify the DataSet directly without copying it. Call this on the Primary node,
passing in a function object that takes the value by reference, optionally
modifies the data, and returns true if the data was changed.
**/
@@ -159,7 +159,7 @@ namespace GridMate
}
/**
Modify the DataSet. Call this on the Master node to change the data,
Modify the DataSet. Call this on the Primary node to change the data,
which will be propagated to all proxies.
**/
void Set(const FieldType& v)
@@ -201,7 +201,7 @@ namespace GridMate
private:
DataSet<FieldType, MarshalerType> m_absolutePortion;
DataSet<FieldType, DeltaMarshalerType> m_relativePortion;
FieldType m_combinedValue; // the latest value on either master or proxy
FieldType m_combinedValue; // the latest value on either primary or proxy
};
//-----------------------------------------------------------------------------
@@ -366,7 +366,7 @@ namespace GridMate
auto replica = Replica::CreateReplica("BitmaskInterestHandlerRules");
m_rulesReplica = CreateAndAttachReplicaChunk<BitmaskInterestChunk>(replica);
m_rm->AddMaster(replica);
m_rm->AddPrimary(replica);
}
void BitmaskInterestHandler::OnRulesHandlerUnregistered(InterestManager* manager)
@@ -238,4 +238,4 @@ namespace GridMate
///////////////////////////////////////////////////////////////////////////
}
#endif
#endif
@@ -206,7 +206,7 @@ namespace GridMate
return false;
}
if (replica->IsMaster()) // own the replica?
if (replica->IsPrimary()) // own the replica?
{
return true;
}
@@ -26,4 +26,4 @@ namespace GridMate
}
} // namespace GridMate
*/
*/
@@ -508,7 +508,7 @@ namespace GridMate
auto replica = Replica::CreateReplica("ProximityInterestHandlerRules");
m_rulesReplica = CreateAndAttachReplicaChunk<ProximityInterestChunk>(replica);
m_rm->AddMaster(replica);
m_rm->AddPrimary(replica);
}
void ProximityInterestHandler::OnRulesHandlerUnregistered(InterestManager* manager)
@@ -26,7 +26,7 @@ namespace GridMate
m_replicaMgr = replica->GetReplicaManager();
if (replica->IsMaster() && newOwnerId != m_replicaMgr->GetLocalPeerId())
if (replica->IsPrimary() && newOwnerId != m_replicaMgr->GetLocalPeerId())
{
m_sm.SetStateHandler(AZ_HSM_STATE_NAME(MST_TOP), AZ::HSM::StateHandler(this, &MigrationSequence::DefaultHandler), AZ::HSM::InvalidStateId, MST_MIGRATING);
}
@@ -312,7 +312,7 @@ namespace GridMate
return true;
case ME_MODIFY_NEW_OWNER:
m_newOwnerId = *static_cast<PeerId*>(event.userData);
if (m_replica->IsMaster() && m_newOwnerId != m_replicaMgr->m_self.GetId())
if (m_replica->IsPrimary() && m_newOwnerId != m_replicaMgr->m_self.GetId())
{
sm.Transition(MST_MIGRATING);
}
@@ -370,8 +370,8 @@ namespace GridMate
PeerId sourcePeerId = GetSourcePeerId();
bool shouldQueue = true;
bool processed = false;
bool isMaster = m_replicaChunk->IsMaster();
if (isMaster)
bool isPrimary = m_replicaChunk->IsPrimary();
if (isPrimary)
{
// We are authoritative so execute the RPC immediately, forwarding the args along
RpcRequest localRequest(this, rc.m_realTime, rc.m_realTime, rc.m_localTime);
@@ -385,7 +385,7 @@ namespace GridMate
if (shouldQueue)
{
TypeTuple* storage = aznew TypeTuple(this, RpcContext(rc.m_realTime, rc.m_realTime, rc.m_localTime, sourcePeerId), AZStd::forward<LocalArgs>(args) ...);
storage->m_authoritative = isMaster;
storage->m_authoritative = isPrimary;
storage->m_processed = processed;
storage->m_reliable = Traits::s_isReliable;
OnRpcRequest(storage);
@@ -106,7 +106,7 @@ namespace GridMate
//-----------------------------------------------------------------------------
void Replica::Destroy()
{
AZ_Assert(IsMaster(), "We don't own replica 0x%x!", GetRepId());
AZ_Assert(IsPrimary(), "We don't own replica 0x%x!", GetRepId());
if (m_manager)
{
m_manager->Destroy(this);
@@ -327,7 +327,7 @@ namespace GridMate
if (IsActive())
{
if (IsMaster())
if (IsPrimary())
{
EBUS_EVENT(Debug::ReplicaDrillerBus, OnRequestReplicaChangeOwnership, this, requestor);
@@ -68,7 +68,7 @@ namespace GridMate
Rep_ManagedAlloc = 1 << 1,
Rep_CanMigrate = 1 << 2,
Rep_New = 1 << 3,
Rep_Master = 1 << 4,
Rep_Primary = 1 << 4,
Rep_Active = 1 << 6,
Rep_ChangedOwner = 1 << 7,
Rep_SuspendDownstream = 1 << 8,
@@ -85,7 +85,7 @@ namespace GridMate
void Destroy();
void UpdateReplica(const ReplicaContext& rc); // Called when updating replica master from source
void UpdateReplica(const ReplicaContext& rc); // Called when updating replica primary from source
void UpdateFromReplica(const ReplicaContext& rc); // Called when updating game with replica info
bool AcceptChangeOwnership(PeerId requestor, const ReplicaContext& rc); // Return true to accept the transfer
void OnActivate(const ReplicaContext& rc);
@@ -112,8 +112,8 @@ namespace GridMate
void RequestChangeOwnership(PeerId newOwner = InvalidReplicaPeerId); // If newOwner is not specified we assume it should be the local peer
bool IsMaster() const { return !IsActive() || !!(m_flags & Rep_Master); }
bool IsProxy() const { return !IsMaster(); }
bool IsPrimary() const { return !IsActive() || !!(m_flags & Rep_Primary); }
bool IsProxy() const { return !IsPrimary(); }
bool IsNew() const { return !!(m_flags & Rep_New); }
bool IsNewOwner() const { return !!(m_flags & Rep_ChangedOwner); }
bool IsActive() const { return !!(m_flags & Rep_Active); }
@@ -170,7 +170,7 @@ namespace GridMate
void MarkRPCsAsRelayed();
void SetMaster(bool isMaster) { m_flags = isMaster ? m_flags | Rep_Master : m_flags & ~Rep_Master; }
void SetPrimary(bool isPrimary) { m_flags = isPrimary ? m_flags | Rep_Primary : m_flags & ~Rep_Primary; }
void SetNew() { m_flags |= Rep_New; }
void SetRepId(ReplicaId id);
void SetMigratable(bool migratable);
@@ -125,18 +125,18 @@ namespace GridMate
return false;
}
//-----------------------------------------------------------------------------
bool ReplicaChunkBase::IsMaster() const
bool ReplicaChunkBase::IsPrimary() const
{
if (m_replica)
{
return m_replica->IsMaster();
return m_replica->IsPrimary();
}
return true;
}
//-----------------------------------------------------------------------------
bool ReplicaChunkBase::IsProxy() const
{
return !IsMaster();
return !IsPrimary();
}
//-----------------------------------------------------------------------------
bool ReplicaChunkBase::IsDirty(AZ::u32 marshalFlags) const
@@ -398,8 +398,8 @@ namespace GridMate
{
if (mc.m_peer != m_replica->m_upstreamHop)
{
AZ_TracePrintf("GridMate", "Received dataset updates for replica id %08x(%s) from unexpected peer.", GetReplicaId(), IsActive() && IsMaster() ? "master" : "proxy");
if (IsMaster())
AZ_TracePrintf("GridMate", "Received dataset updates for replica id %08x(%s) from unexpected peer.", GetReplicaId(), IsActive() && IsPrimary() ? "primary" : "proxy");
if (IsPrimary())
{
mc.m_iBuf->Skip(mc.m_iBuf->Left());
return;
@@ -547,7 +547,7 @@ namespace GridMate
AZ_Assert(false, "Discarding non-authoritative RPC <%s> because s_allowNonAuthoritativeRequests trait is disabled!", GetDescriptor()->GetRpcName(this, rpc));
isRpcValid = false;
}
if (!rpc->IsAllowNonAuthoritativeRequestsRelay() && !IsMaster())
if (!rpc->IsAllowNonAuthoritativeRequestsRelay() && !IsPrimary())
{
AZ_Assert(false, "Discarding non-authoritative RPC <%s> because s_allowNonAuthoritativeRequestRelay trait is disabled!", GetDescriptor()->GetRpcName(this, rpc));
isRpcValid = false;
@@ -639,19 +639,19 @@ namespace GridMate
for (RPCQueue::iterator iRPC = m_rpcQueue.begin(); iRPC != m_rpcQueue.end(); )
{
Internal::RpcRequest* request = *iRPC;
bool isMaster = IsMaster(); // need to do this check after each RPC because ownership may change
bool isPrimary = IsPrimary(); // need to do this check after each RPC because ownership may change
if (!m_replica->IsActive()) // this can happen if replica was deactivated within a previous RPC call
{
request->m_relayed = true;
}
else if (!request->m_processed && (isMaster || request->m_authoritative))
else if (!request->m_processed && (isPrimary || request->m_authoritative))
{
request->m_realTime = rc.m_realTime;
request->m_localTime = rc.m_localTime;
bool ret = request->m_rpc->Invoke(request);
request->m_processed = true;
if (isMaster)
if (isPrimary)
{
if (ret)
{
@@ -45,17 +45,17 @@ namespace GridMate
/** A single unit of network functionality
A ReplicaChunk is a user extendable network object. One or more ReplicaChunks can be
owned by a Replica, which is both a container and manager for them. A replica is owned
by a Master, and is propagated to other network nodes, who interact with is as a Proxy.
by a Primary, and is propagated to other network nodes, who interact with is as a Proxy.
The data a ReplicaChunk contains should generally be related to the other data stored
within it. Since multiple chunks can be attached to a Replica, unrelated data can simply
be stored in other chunks on the same Replica.
A ReplicaChunk has two primary ways to interact with it: DataSets and Remote Procedure
Calls (RPCs).
DataSets store arbitrary data, which only the Master is able to modify. Any changes are
DataSets store arbitrary data, which only the Primary is able to modify. Any changes are
propagated to the Proxy ReplicaChunks on the other nodes.
RPCs are methods that can be executed on a remote node. They are first invoked on the
Master, who then decides if the invocation should be propagated to the Proxies.
Primary, who then decides if the invocation should be propagated to the Proxies.
ReplicaChunks can be created by inheriting from the class and registered by calling
ReplicaChunkDescriptorTable::RegisterChunkType() to create the factory required by
@@ -107,7 +107,7 @@ namespace GridMate
PeerId GetPeerId() const;
virtual ReplicaManager* GetReplicaManager();
bool IsActive() const;
bool IsMaster() const;
bool IsPrimary() const;
bool IsProxy() const;
virtual void OnAttachedToReplica(Replica* replica) { (void) replica; }
@@ -191,7 +191,7 @@ namespace GridMate
void AddDataSetEvent(DataSetBase* dataset); // Called to enqueue a user event handler for a modified DataSet on a proxy node
void SignalDataSetChanged(const DataSetBase& dataset); // Called when the DataSet changes on the master node
void SignalDataSetChanged(const DataSetBase& dataset); // Called when the DataSet changes on the primary node
void EnqueueMarshalTask();
@@ -84,4 +84,4 @@ namespace GridMate
static const ZoneMask ZoneMask_All = (ZoneMask) - 1;
} // namespace Gridmate
#endif // GM_REPLICADEFS_H
#endif // GM_REPLICADEFS_H
@@ -62,7 +62,7 @@ namespace GridMate
//! Called when an ownership transfer request is received.
virtual void OnRequestReplicaChangeOwnership(Replica* replica, PeerId requestor) { (void)replica; (void)requestor; }
//! Called when a replica changes ownership, not necessarily to or from the local node.
virtual void OnReplicaChangeOwnership(Replica* replica, bool wasMaster) { (void)replica; (void)wasMaster; }
virtual void OnReplicaChangeOwnership(Replica* replica, bool wasPrimary) { (void)replica; (void)wasPrimary; }
//! Called when a chunk has been created. It doesn't mean it will be added to the system.
//! Object will be partially constructed at this point if you inherit from ReplicaChunk
@@ -91,9 +91,9 @@ namespace GridMate
//! Called when data is received for a dataset.
virtual void OnReceiveDataSet(ReplicaChunkBase* chunk, AZ::u32 chunkIndex, DataSetBase* dataSet, PeerId from, PeerId to, const void* data, size_t len) { (void)chunk; (void)chunkIndex; (void)dataSet; (void)from; (void)to; (void)data; (void)len; }
//! Called when an rpc request is received. RpcRequest pointer will be null if rpc is called on master replica.
//! Called when an rpc request is received. RpcRequest pointer will be null if rpc is called on primary replica.
virtual void OnRequestRpc(ReplicaChunkBase* chunk, Internal::RpcRequest* rpc) { (void)chunk; (void)rpc; }
//! Called when an rpc is invoked. RpcRequest pointer will be null if rpc is called on master replica.
//! Called when an rpc is invoked. RpcRequest pointer will be null if rpc is called on primary replica.
virtual void OnInvokeRpc(ReplicaChunkBase* chunk, Internal::RpcRequest* rpc) { (void)chunk; (void)rpc; }
//! Called every time an rpc is sent to a peer.
virtual void OnSendRpc(ReplicaChunkBase* chunk, AZ::u32 chunkIndex, Internal::RpcRequest* rpc, PeerId from, PeerId to, const void* data, size_t len) { (void)chunk; (void)chunkIndex; (void)rpc; (void)from; (void)to; (void)data; (void)len; }
@@ -386,7 +386,7 @@ namespace GridMate
replica->SetMigratable(true);
// register global session info
// this one is kind of special so don't go through AddMaster()
// this one is kind of special so don't go through AddPrimary()
ReplicaContext rc(this, GetTime(), &m_self);
replica->m_createTime = rc.m_realTime;
replica->SetRepId(RepId_SessionInfo);
@@ -405,7 +405,7 @@ namespace GridMate
else
{
// take over ownership of the session info
AZ_Assert(!m_sessionInfo->IsMaster(), "We just became host but we were already the owner of sessionInfo!");
AZ_Assert(!m_sessionInfo->IsPrimary(), "We just became host but we were already the owner of sessionInfo!");
AZ_Assert(m_sessionInfo->m_pHostPeer->IsOrphan(), "We can't be promoted if we are still connected to the host!");
m_sessionInfo->m_pHostPeer->Remove(m_sessionInfo->GetReplica());
m_self.Add(m_sessionInfo->GetReplica());
@@ -903,7 +903,7 @@ namespace GridMate
ReplicaContext rc(this, GetTime());
for (auto& replicaObject : m_self.m_objectsTimeSort)
{
if (replicaObject.m_replica->IsMaster())
if (replicaObject.m_replica->IsPrimary())
{
replicaObject.m_replica->UpdateReplica(rc);
}
@@ -1357,11 +1357,11 @@ namespace GridMate
m_flags &= ~Rm_Processing;
}
//-----------------------------------------------------------------------------
void ReplicaManager::RegisterReplica(const ReplicaPtr& pReplica, bool isMaster, ReplicaContext& rc)
void ReplicaManager::RegisterReplica(const ReplicaPtr& pReplica, bool isPrimary, ReplicaContext& rc)
{
AZ_Assert((pReplica->m_flags & ~Replica::Rep_Traits) == 0, "This replica is not clean, flags=0x%x, rpcs=%d!", pReplica->m_flags);
AZ_Assert(pReplica->GetRepId() != InvalidReplicaId, "You should set the replica ID before you register it!");
pReplica->SetMaster(isMaster);
pReplica->SetPrimary(isPrimary);
pReplica->SetNew();
auto it = m_replicas.insert(AZStd::make_pair(pReplica->GetRepId(), pReplica)); // register with lookup table
(void)it;
@@ -1371,21 +1371,21 @@ namespace GridMate
OnReplicaChanged(pReplica);
}
//-----------------------------------------------------------------------------
ReplicaId ReplicaManager::AddMaster(const ReplicaPtr& pMaster)
ReplicaId ReplicaManager::AddPrimary(const ReplicaPtr& pPrimary)
{
AZ_Assert(IsReady(), "ReplicaManager is not ready!");
AZ_Assert(pMaster, "Attempting to register NULL replica!");
AZ_Assert(pPrimary, "Attempting to register NULL replica!");
ReplicaId newId = m_localIdBlocks.Alloc();
ReplicaContext rc(this, GetTime(), &m_self);
pMaster->m_createTime = rc.m_realTime;
pMaster->SetRepId(newId);
m_self.Add(pMaster.get());
AZStd::static_pointer_cast<ReplicaStatus>(pMaster->m_replicaStatus)->m_ownerSeq.Set(1);
pMaster->InitReplica(this);
RegisterReplica(pMaster, true, rc);
pPrimary->m_createTime = rc.m_realTime;
pPrimary->SetRepId(newId);
m_self.Add(pPrimary.get());
AZStd::static_pointer_cast<ReplicaStatus>(pPrimary->m_replicaStatus)->m_ownerSeq.Set(1);
pPrimary->InitReplica(this);
RegisterReplica(pPrimary, true, rc);
//AZ_TracePrintf("GridMate", "Peer 0x%x: Added replica master 0x%x.\n",
// GetLocalPeerId(), pMaster->GetRepId());
//AZ_TracePrintf("GridMate", "Peer 0x%x: Added replica primary 0x%x.\n",
// GetLocalPeerId(), pPrimary->GetRepId());
return newId;
}
@@ -1458,9 +1458,9 @@ namespace GridMate
continue;
}
ReplicaPeer* source = replica->IsMaster() ? &m_self : replica->m_upstreamHop;
ReplicaPeer* source = replica->IsPrimary() ? &m_self : replica->m_upstreamHop;
if (replica->IsMaster()
if (replica->IsPrimary()
|| (IsSyncHost() && source->GetId() != target->GetId() && !(source->GetMode() == Mode_Peer && target->GetMode() == Mode_Peer)))
{
ReplicaTarget::AddReplicaTarget(target, replica.get());
@@ -1471,7 +1471,7 @@ namespace GridMate
else
{
// Replica might've changed owner -> we need to update its targets accordingly
ReplicaPeer* source = replica->IsMaster() ? &m_self : replica->m_upstreamHop;
ReplicaPeer* source = replica->IsPrimary() ? &m_self : replica->m_upstreamHop;
for (auto it = replica->m_targets.begin(); it != replica->m_targets.end(); )
{
@@ -1652,14 +1652,14 @@ namespace GridMate
}
}
//-----------------------------------------------------------------------------
void ReplicaManager::ChangeReplicaOwnership(ReplicaPtr replica, const ReplicaContext& rc, bool isMaster)
void ReplicaManager::ChangeReplicaOwnership(ReplicaPtr replica, const ReplicaContext& rc, bool isPrimary)
{
bool wasMaster = replica->IsMaster();
if (wasMaster != isMaster) // wasMaster == isMaster can happen when host's replica is moved to client, and client confirms with Cmd_NewOwner
bool wasPrimary = replica->IsPrimary();
if (wasPrimary != isPrimary) // wasPrimary == isPrimary can happen when host's replica is moved to client, and client confirms with Cmd_NewOwner
{
replica->SetMaster(isMaster);
replica->SetPrimary(isPrimary);
replica->OnChangeOwnership(rc);
EBUS_EVENT(Debug::ReplicaDrillerBus, OnReplicaChangeOwnership, replica.get(), wasMaster);
EBUS_EVENT(Debug::ReplicaDrillerBus, OnReplicaChangeOwnership, replica.get(), wasPrimary);
}
}
//-----------------------------------------------------------------------------
@@ -190,7 +190,7 @@ namespace GridMate
//-----------------------------------------------------------------------------
struct ReplicaMgrDesc
{
// Single-master roles that replica managers can have
// Single-primary roles that replica managers can have
enum Roles
{
Role_SyncHost = 1 << 0,
@@ -421,13 +421,13 @@ namespace GridMate
size_t ReleaseIdBlock(PeerId requestor);
void _Unmarshal(ReadBuffer& rb, ReplicaPeer* from);
void RegisterReplica(const ReplicaPtr& pReplica, bool isMaster, ReplicaContext& rc);
void RegisterReplica(const ReplicaPtr& pReplica, bool isPrimary, ReplicaContext& rc);
void UnregisterReplica(const ReplicaPtr& replica, const ReplicaContext& rc);
void RemoveReplicaFromDownstream(const ReplicaPtr& replica, const ReplicaContext& rc);
void MigrateReplica(ReplicaPtr replica, PeerId newOwnerId);
void AnnounceReplicaMigrated(ReplicaId replicaId, PeerId newOwnerId);
void OnReplicaMigrated(ReplicaPtr replica, bool isOwner, const ReplicaContext& rc);
void ChangeReplicaOwnership(ReplicaPtr replica, const ReplicaContext& rc, bool isMaster);
void ChangeReplicaOwnership(ReplicaPtr replica, const ReplicaContext& rc, bool isPrimary);
void AckUpstreamSuspended(ReplicaId replicaId, PeerId sendTo, AZ::u32 requestTime);
void OnAckUpstreamSuspended(ReplicaId replicaId, PeerId from, AZ::u32 requestTime);
void AckDownstream(ReplicaId replicaId, PeerId sendTo, AZ::u32 requestTime);
@@ -595,7 +595,7 @@ namespace GridMate
* Replicas
*/
virtual ReplicaPtr FindReplica(ReplicaId replicaId);
ReplicaId AddMaster(const ReplicaPtr& pMaster);
ReplicaId AddPrimary(const ReplicaPtr& pPrimary);
/*
* Tasks
@@ -50,10 +50,10 @@ namespace GridMate
//! Called on the originator node to request replica migration.
Rpc<RpcArg<PeerId> >::BindInterface<ReplicaStatusInterface, & ReplicaStatusInterface::RequestOwnershipFn> RequestOwnership;
//! Called by the master to suspend upstream requests during replica migration.
//! Called by the primary to suspend upstream requests during replica migration.
Rpc<RpcArg<PeerId>, RpcArg<AZ::u32> >::BindInterface<ReplicaStatusInterface, & ReplicaStatusInterface::MigrationSuspendUpstreamFn, RpcAuthoritativeTraits> MigrationSuspendUpstream;
//! Called by the master to signal downstream flush during replica migration.
//! Called by the primary to signal downstream flush during replica migration.
Rpc<RpcArg<PeerId>, RpcArg<AZ::u32> >::BindInterface<ReplicaStatusInterface, & ReplicaStatusInterface::MigrationRequestDownstreamAckFn, RpcAuthoritativeTraits> MigrationRequestDownstreamAck;
struct ReplicaOptions
@@ -100,4 +100,4 @@ namespace GridMate
{
delete this;
}
}
}
@@ -84,7 +84,7 @@ namespace GridMate
// on activation of this replica, create our PeerInfo replica
Replica* peerReplica = Replica::CreateReplica("PeerInfo");
CreateAndAttachReplicaChunk<PeerReplica>(peerReplica);
rc.m_rm->AddMaster(peerReplica);
rc.m_rm->AddPrimary(peerReplica);
}
//-----------------------------------------------------------------------------
void SessionInfo::OnReplicaDeactivate(const ReplicaContext& rc)
@@ -132,7 +132,7 @@ namespace GridMate
(void)rc;
if (m_pMgr->IsSyncHost())
{
AZ_Assert(IsMaster(), "The host should always own sessionInfo!!!");
AZ_Assert(IsPrimary(), "The host should always own sessionInfo!!!");
AZ_Assert(m_pendingPeerReports.find(peerId) == m_pendingPeerReports.end(), "We are already waiting for reports for peer 0x%8x!", peerId);
vector<PeerId> peers;
@@ -205,7 +205,7 @@ namespace GridMate
//-----------------------------------------------------------------------------
void PeerReplica::OnReplicaActivate(const ReplicaContext& rc)
{
if (IsMaster())
if (IsPrimary())
{
m_peerId.Set(rc.m_rm->GetLocalPeerId());
}
@@ -294,7 +294,7 @@ namespace GridMate
//-----------------------------------------------------------------------------
ReplicaTask::TaskStatus ReplicaMarshalZombieTask::Run(const RunContext& context)
{
if (m_replica->IsMaster() || context.m_replicaManager->IsSyncHost())
if (m_replica->IsPrimary() || context.m_replicaManager->IsSyncHost())
{
m_replica->PrepareData(context.m_replicaManager->GetGridMate()->GetDefaultEndianType(),
// A zombie task occurs right before replica gets removed, by design it needs to set all properties one last time.
@@ -98,4 +98,4 @@ namespace GridMate
return shouldProcess;
}
}
}
@@ -35,7 +35,7 @@ namespace GridMate
};
/**
* Task to update master & proxy replicas.
* Task to update primary & proxy replicas.
* Processes RPCs and calls replicas UpdateFromReplica. Will complete immediately if no RPCs
* left queued after processing, otherweise will be repeated next update tick.
* Initiates replica migration if proxy owner has died.
@@ -149,4 +149,4 @@ namespace GridMate
}
#endif // GM_UTILS_DATA_MARSHAL
#pragma once
#pragma once
@@ -32,4 +32,4 @@ namespace GridMate
typedef AZ::EBus<LANSessionServiceInterface> LANSessionServiceBus;
}
#endif
#endif
@@ -61,4 +61,4 @@ namespace GridMate
};
}
#endif
#endif
@@ -960,7 +960,7 @@ GridSession::AddMember(GridMember* member)
replica->AttachReplicaChunk(member);
}
m_replicaMgr->AddMaster(replica);
m_replicaMgr->AddPrimary(replica);
member->m_isHost.Set(member->IsLocal());
}
@@ -1583,7 +1583,7 @@ GridSession::OnStateCreate(HSM& sm, const HSM::Event& e)
// Bind session replica
Replica* stateReplica = Replica::CreateReplica("SessionStateInfo");
stateReplica->AttachReplicaChunk(m_state);
m_replicaMgr->AddMaster(stateReplica);
m_replicaMgr->AddPrimary(stateReplica);
// Bind member replica
bool isAdded = AddMember(m_myMember);
@@ -2005,7 +2005,7 @@ GridMember::OnReplicaActivate(const ReplicaContext& rc)
{
// if this member is me... add my state to the system.
AZ_Assert(m_session->GetMyMember() == this, "The only local member should be myMember too!");
rc.m_rm->AddMaster(m_clientState->GetReplica());
rc.m_rm->AddPrimary(m_clientState->GetReplica());
// Both member and client state are valid! send member joined message
EBUS_DBG_EVENT(Debug::SessionDrillerBus, OnMemberJoined, m_session, this);
@@ -2052,7 +2052,7 @@ GridMember::OnReplicaChangeOwnership(const ReplicaContext& rc)
{
(void)rc;
AZ_Assert(m_session->IsMigratingHost(), "This function can be called only during host migration!");
if (IsMaster())
if (IsPrimary())
{
// Host owns the members, if I became the owner means I am the HOST!
if (m_session->m_myMember == this)
@@ -2084,7 +2084,7 @@ GridMember::OnKick(AZ::u8 reason, const RpcContext& rc)
m_session->Leave(false);
}
return true; // this is called only on the master
return true; // this is called only on the primary
}
return false;
}
@@ -2320,8 +2320,8 @@ void
GridMemberStateReplica::OnReplicaDeactivate(const ReplicaContext& rc)
{
(void)rc;
// for master (this is our state) we always keep it. So don't do anything.
if (IsMaster())
// for primary (this is our state) we always keep it. So don't do anything.
if (IsPrimary())
{
return;
}
@@ -31,4 +31,4 @@ namespace GridMate
};
}
#endif
#endif
@@ -11,4 +11,4 @@
*/
#pragma once
#include <GridMate/Carrier/SocketDriver_Android.h>
#include <GridMate/Carrier/SocketDriver_Android.h>
@@ -11,4 +11,4 @@
*/
#pragma once
#include <GridMate/Session/Session_Android.h>
#include <GridMate/Session/Session_Android.h>
@@ -15,4 +15,4 @@ ly_add_source_properties(
GridMate/Carrier/StreamSecureSocketDriver.cpp
PROPERTY COMPILE_OPTIONS
VALUES -Wno-deprecated-declarations
)
)
@@ -11,4 +11,4 @@
*/
#pragma once
#include <GridMate/Session/Session_Linux.h>
#include <GridMate/Session/Session_Linux.h>
@@ -38,4 +38,4 @@ namespace GridMate
extendedName = GridMate::string::format("%s::%s", hostName, procName);
}
}
}
}
@@ -11,4 +11,4 @@
*/
#pragma once
#include <GridMate/Session/Session_Windows.h>
#include <GridMate/Session/Session_Windows.h>
@@ -18,4 +18,4 @@
set(LY_BUILD_DEPENDENCIES
PRIVATE
ws2_32
)
)
@@ -11,4 +11,4 @@
*/
#pragma once
#include <GridMate/Session/Session_iOS.h>
#include <GridMate/Session/Session_iOS.h>
+9 -9
View File
@@ -534,7 +534,7 @@ namespace GridMate
auto replica = Replica::CreateReplica("ProximityInterestHandlerRules");
m_rulesReplica = CreateAndAttachReplicaChunk<ProximityInterestChunk>(replica);
m_rm->AddMaster(replica);
m_rm->AddPrimary(replica);
}
void ProximityInterestHandler::OnRulesHandlerUnregistered(InterestManager* manager)
@@ -658,7 +658,7 @@ class Integ_InterestTest
{
AZ_Printf("GridMate", "InterestTestChunk::OnReplicaActivate repId=%08X(%s) fromPeerId=%08X localPeerId=%08X\n",
GetReplicaId(),
IsMaster() ? "master" : "proxy",
IsPrimary() ? "primary" : "proxy",
rc.m_peer ? rc.m_peer->GetId() : 0,
rc.m_rm->GetLocalPeerId());
@@ -674,7 +674,7 @@ class Integ_InterestTest
{
AZ_Printf("GridMate", "InterestTestChunk::OnReplicaDeactivate repId=%08X(%s) fromPeerId=%08X localPeerId=%08X\n",
GetReplicaId(),
IsMaster() ? "master" : "proxy",
IsPrimary() ? "primary" : "proxy",
rc.m_peer ? rc.m_peer->GetId() : 0,
rc.m_rm->GetLocalPeerId());
@@ -734,7 +734,7 @@ class Integ_InterestTest
m_replica->m_data.Set(m_num);
m_replica->m_bitmaskAttributeData.Set(1 << i);
m_session->GetReplicaMgr()->AddMaster(r);
m_session->GetReplicaMgr()->AddPrimary(r);
}
void UpdateAttribute()
@@ -952,7 +952,7 @@ public:
if (numUpdates == 250)
{
// Checking everybody lost all replicas (except master)
// Checking everybody lost all replicas (except primary)
for (int i = 0; i < k_numMachines; ++i)
{
for (int j = 0; j < k_numMachines; ++j)
@@ -1079,11 +1079,11 @@ class LargeWorldTest
void OnReplicaActivate(const ReplicaContext& rc) override
{
/*if (!IsMaster())*/
/*if (!IsPrimary())*/
/*{
AZ_Printf("GridMate", "LargeWorldTestChunk::OnReplicaActivate repId=%08X(%s) fromPeerId=%08X localPeerId=%08X\n",
GetReplicaId(),
IsMaster() ? "master" : "proxy",
IsPrimary() ? "primary" : "proxy",
rc.m_peer ? rc.m_peer->GetId() : 0,
rc.m_rm->GetLocalPeerId());
}*/
@@ -1214,7 +1214,7 @@ class LargeWorldTest
m_replicas.push_back(replica);
m_session->GetReplicaMgr()->AddMaster(r);
m_session->GetReplicaMgr()->AddPrimary(r);
}
void PopulateWorld()
@@ -1453,7 +1453,7 @@ public:
if (numUpdates == 250)
{
// Checking everybody lost all replicas (except master)
// Checking everybody lost all replicas (except primary)
for (int i = 0; i < k_numMachines; ++i)
{
/*for (int j = 0; j < k_numMachines; ++j)
@@ -11,4 +11,4 @@
*/
#pragma once
#include <GridMateTests_Traits_Android.h>
#include <GridMateTests_Traits_Android.h>
@@ -11,4 +11,4 @@
*/
#pragma once
#include <GridMateTests_Traits_Linux.h>
#include <GridMateTests_Traits_Linux.h>
@@ -11,4 +11,4 @@
*/
#pragma once
#include <GridMateTests_Traits_Mac.h>
#include <GridMateTests_Traits_Mac.h>
@@ -11,4 +11,4 @@
*/
#pragma once
#include <GridMateTests_Traits_Windows.h>
#include <GridMateTests_Traits_Windows.h>
@@ -11,4 +11,4 @@
*/
#pragma once
#include <GridMateTests_Traits_iOS.h>
#include <GridMateTests_Traits_iOS.h>
+95 -95
View File
@@ -1615,7 +1615,7 @@ public:
{
(void)f;
(void)rc;
AZ_TracePrintf("GridMate", "Executed MyHandler123 requested at %u with %g on %s at %u.\n", rc.m_timestamp, f, GetReplica()->IsMaster() ? "Master" : "Proxy", rc.m_realTime);
AZ_TracePrintf("GridMate", "Executed MyHandler123 requested at %u with %g on %s at %u.\n", rc.m_timestamp, f, GetReplica()->IsPrimary() ? "Primary" : "Proxy", rc.m_realTime);
return true;
}
@@ -1653,14 +1653,14 @@ public:
(void)rc;
if (rc.m_rm->GetUserContext(12345))
{
AZ_TracePrintf("GridMate", "Activate %s with UserData:%p\n", GetReplica()->IsMaster() ? "master" : "proxy", rc.m_rm->GetUserContext(12345));
AZ_TracePrintf("GridMate", "Activate %s with UserData:%p\n", GetReplica()->IsPrimary() ? "primary" : "proxy", rc.m_rm->GetUserContext(12345));
}
if (IsProxy())
{
Bind(aznew MyObj());
}
if (IsMaster())
if (IsPrimary())
{
EBUS_EVENT(MigratableReplicaDebugMsgs::EBus, OnNewOwner, GetReplicaId(), rc.m_rm);
}
@@ -1679,9 +1679,9 @@ public:
void OnReplicaChangeOwnership(const ReplicaContext& rc) override
{
(void)rc;
AZ_TracePrintf("GridMate", "Migratable replica 0x%x became %s on Peer %d\n", (int) GetReplicaId(), IsMaster() ? "master" : "proxy", (int) rc.m_rm->GetLocalPeerId());
AZ_TracePrintf("GridMate", "Migratable replica 0x%x became %s on Peer %d\n", (int) GetReplicaId(), IsPrimary() ? "primary" : "proxy", (int) rc.m_rm->GetLocalPeerId());
if (IsMaster())
if (IsPrimary())
{
EBUS_EVENT(MigratableReplicaDebugMsgs::EBus, OnNewOwner, GetReplicaId(), rc.m_rm);
}
@@ -1725,7 +1725,7 @@ protected:
{
(void)f;
(void)rc;
AZ_TracePrintf("GridMate", "Executed MyHandler123 requested at %u with %g on %s at %u.\n", rc.m_timestamp, f, IsMaster() ? "Master" : "Proxy", rc.m_realTime);
AZ_TracePrintf("GridMate", "Executed MyHandler123 requested at %u with %g on %s at %u.\n", rc.m_timestamp, f, IsPrimary() ? "Primary" : "Proxy", rc.m_realTime);
return true;
}
bool MyHandler2(const float& f, int p2, const RpcContext& rc)
@@ -1733,7 +1733,7 @@ protected:
(void)f;
(void)p2;
(void)rc;
AZ_TracePrintf("GridMate", "Executed MyHandler2 requested at %u with %g,%d on %s at %u.\n", rc.m_timestamp, f, p2, IsMaster() ? "Master" : "Proxy", rc.m_realTime);
AZ_TracePrintf("GridMate", "Executed MyHandler2 requested at %u with %g,%d on %s at %u.\n", rc.m_timestamp, f, p2, IsPrimary() ? "Primary" : "Proxy", rc.m_realTime);
return true;
}
bool MyHandler3(const float& f, int p2, EBla p3, const RpcContext& rc)
@@ -1742,7 +1742,7 @@ protected:
(void)p2;
(void)p3;
(void)rc;
AZ_TracePrintf("GridMate", "Executed MyHandler3 requested at %u with %g,%d,%d on %s at %u.\n", rc.m_timestamp, f, p2, p3, IsMaster() ? "Master" : "Proxy", rc.m_realTime);
AZ_TracePrintf("GridMate", "Executed MyHandler3 requested at %u with %g,%d,%d on %s at %u.\n", rc.m_timestamp, f, p2, p3, IsPrimary() ? "Primary" : "Proxy", rc.m_realTime);
return true;
}
bool MyHandler4(const float& f, int p2, EBla p3, const IntVectorType& p4, const RpcContext& rc)
@@ -1752,13 +1752,13 @@ protected:
(void)p3;
(void)p4;
(void)rc;
AZ_TracePrintf("GridMate", "Executed MyHandler4 requested at %u with %g,%d,%d,%d,%d on %s at %u.\n", rc.m_timestamp, f, p2, p3, p4[0], p4[1], IsMaster() ? "Master" : "Proxy", rc.m_realTime);
AZ_TracePrintf("GridMate", "Executed MyHandler4 requested at %u with %g,%d,%d,%d,%d on %s at %u.\n", rc.m_timestamp, f, p2, p3, p4[0], p4[1], IsPrimary() ? "Primary" : "Proxy", rc.m_realTime);
return true;
}
bool MyHandlerUnreliable(const int& i, const RpcContext& rc)
{
(void)rc;
AZ_TracePrintf("GridMate", "Executed MyHandlerUnreliable requested at %u with %d on %s at %u.\n", rc.m_timestamp, i, IsMaster() ? "Master" : "Proxy", rc.m_realTime);
AZ_TracePrintf("GridMate", "Executed MyHandlerUnreliable requested at %u with %d on %s at %u.\n", rc.m_timestamp, i, IsPrimary() ? "Primary" : "Proxy", rc.m_realTime);
AZ_TEST_ASSERT(i > m_prevUnreliableValue);
if ((i - m_prevUnreliableValue) > 1)
{
@@ -1824,7 +1824,7 @@ public:
(void)rc;
if (rc.m_rm->GetUserContext(12345))
{
AZ_TracePrintf("GridMate", "Activate %s with UserData:%p\n", IsMaster() ? "master" : "proxy", rc.m_rm->GetUserContext(12345));
AZ_TracePrintf("GridMate", "Activate %s with UserData:%p\n", IsPrimary() ? "primary" : "proxy", rc.m_rm->GetUserContext(12345));
}
if (IsProxy())
{
@@ -1845,7 +1845,7 @@ public:
void OnReplicaChangeOwnership(const ReplicaContext& rc) override
{
(void)rc;
AZ_TracePrintf("GridMate", "NonMigratable replica 0x%x became %s on Peer %d\n", (int) GetReplicaId(), IsMaster() ? "master" : "proxy", (int) rc.m_rm->GetLocalPeerId());
AZ_TracePrintf("GridMate", "NonMigratable replica 0x%x became %s on Peer %d\n", (int) GetReplicaId(), IsPrimary() ? "primary" : "proxy", (int) rc.m_rm->GetLocalPeerId());
}
void Bind(MyObj* pObj)
@@ -1950,7 +1950,7 @@ TEST_F(Integ_ReplicaGMTest, ReplicaTest)
// put something on s1 to get it going
auto rep = Replica::CreateReplica(nullptr);
s1rep1 = CreateAndAttachReplicaChunk<MigratableReplica>(rep);
s1rep1id = sessions[s1].GetReplicaMgr().AddMaster(rep);
s1rep1id = sessions[s1].GetReplicaMgr().AddPrimary(rep);
s1rep1->Bind(s1obj1 = aznew MyObj());
// connect s2 to s1
@@ -1993,7 +1993,7 @@ TEST_F(Integ_ReplicaGMTest, ReplicaTest)
{
auto newReplica = Replica::CreateReplica(nullptr);
s2rep1 = CreateAndAttachReplicaChunk<MyDerivedReplica>(newReplica);
s2rep1id = sessions[s2].GetReplicaMgr().AddMaster(newReplica);
s2rep1id = sessions[s2].GetReplicaMgr().AddPrimary(newReplica);
s2rep1->Bind(s2obj1 = aznew MyObj());
}
else
@@ -2020,7 +2020,7 @@ TEST_F(Integ_ReplicaGMTest, ReplicaTest)
{
auto newReplica = Replica::CreateReplica(nullptr);
s1rep2 = CreateAndAttachReplicaChunk<NonMigratableReplica>(newReplica);
s1rep2id = sessions[s1].GetReplicaMgr().AddMaster(newReplica);
s1rep2id = sessions[s1].GetReplicaMgr().AddPrimary(newReplica);
s1rep2->Bind(s1obj2 = aznew MyObj);
}
else
@@ -2041,7 +2041,7 @@ TEST_F(Integ_ReplicaGMTest, ReplicaTest)
{
auto newReplica = Replica::CreateReplica(nullptr);
s3rep1 = CreateAndAttachReplicaChunk<MigratableReplica>(newReplica);
s3rep1id = sessions[s3].GetReplicaMgr().AddMaster(newReplica);
s3rep1id = sessions[s3].GetReplicaMgr().AddPrimary(newReplica);
s3rep1->Bind(s3obj1 = aznew MyObj());
}
else
@@ -2289,13 +2289,13 @@ TEST_F(Integ_ForcedReplicaMigrationTest, ForcedReplicaMigrationTest)
{
auto rep = Replica::CreateReplica(nullptr);
migrRep[i] = CreateAndAttachReplicaChunk<MigratableReplica>(rep, aznew MyObj());
peers[i].GetReplicaMgr().AddMaster(rep);
peers[i].GetReplicaMgr().AddPrimary(rep);
AZ_TEST_ASSERT(m_replicaOwnership[migrRep[i]->GetReplicaId()] == &peers[i].GetReplicaMgr());
}
{
auto rep = Replica::CreateReplica(nullptr);
nonMigrRep[i] = CreateAndAttachReplicaChunk<NonMigratableReplica>(rep, aznew MyObj());
peers[i].GetReplicaMgr().AddMaster(rep);
peers[i].GetReplicaMgr().AddPrimary(rep);
}
}
addReplicas = false;
@@ -2418,7 +2418,7 @@ public:
void OnReplicaActivate(const ReplicaContext& rc) override
{
if (IsMaster())
if (IsPrimary())
{
m_owner.Set(rc.m_rm->GetLocalPeerId() - 1);
m_control.Set(rc.m_rm->GetLocalPeerId() - 1);
@@ -2427,9 +2427,9 @@ public:
void OnReplicaChangeOwnership(const ReplicaContext& rc) override
{
if (IsMaster())
if (IsPrimary())
{
AZ_TracePrintf("GridMate", "OnChangeOwnership: 0x%04x Became master on node %d\n", GetReplicaId(), rc.m_rm->GetLocalPeerId() - 1);
AZ_TracePrintf("GridMate", "OnChangeOwnership: 0x%04x Became primary on node %d\n", GetReplicaId(), rc.m_rm->GetLocalPeerId() - 1);
m_owner.Set(rc.m_rm->GetLocalPeerId() - 1);
}
else
@@ -2591,18 +2591,18 @@ TEST_F(Integ_ReplicaMigrationRequestTest, ReplicaMigrationRequestTest)
{
auto rep = Replica::CreateReplica(nullptr);
nodes[iNode].m_always = CreateAndAttachReplicaChunk<AlwaysMigratable>(rep);
nodes[iNode].m_session.GetReplicaMgr().AddMaster(rep);
nodes[iNode].m_session.GetReplicaMgr().AddPrimary(rep);
}
{
auto rep = Replica::CreateReplica(nullptr);
nodes[iNode].m_never = CreateAndAttachReplicaChunk<NeverMigratable>(rep);
nodes[iNode].m_session.GetReplicaMgr().AddMaster(rep);
nodes[iNode].m_session.GetReplicaMgr().AddPrimary(rep);
}
{
auto rep = Replica::CreateReplica(nullptr);
nodes[iNode].m_sometimes = CreateAndAttachReplicaChunk<SometimesMigratable>(rep);
nodes[iNode].m_sometimes->m_acceptMigrationRequests = iNode == Peer1 || iNode == Client1;
nodes[iNode].m_session.GetReplicaMgr().AddMaster(rep);
nodes[iNode].m_session.GetReplicaMgr().AddPrimary(rep);
}
}
}
@@ -2675,7 +2675,7 @@ TEST_F(Integ_ReplicaMigrationRequestTest, ReplicaMigrationRequestTest)
AZ_TEST_ASSERT(nodes[Client1].m_always->m_accepted == 1);
AZ_TEST_ASSERT(nodes[Client1].m_always->GetReplica()->IsProxy());
AZ_TEST_ASSERT(nodes[Client1].m_always->m_owner.Get() == Client2);
AZ_TEST_ASSERT(nodes[Client2].m_session.GetReplicaMgr().FindReplica(nodes[Client1].m_always->GetReplicaId())->IsMaster());
AZ_TEST_ASSERT(nodes[Client2].m_session.GetReplicaMgr().FindReplica(nodes[Client1].m_always->GetReplicaId())->IsPrimary());
// C1 -> C2 -> Host (2nd migration)
ReplicaPtr aHonC1 = nodes[Host].m_session.GetReplicaMgr().FindReplica(nodes[Client1].m_always->GetReplicaId());
@@ -2737,7 +2737,7 @@ TEST_F(Integ_ReplicaMigrationRequestTest, ReplicaMigrationRequestTest)
AZ_TEST_ASSERT(nodes[Peer1].m_always->m_accepted == 1);
AZ_TEST_ASSERT(nodes[Peer1].m_always->GetReplica()->IsProxy());
AZ_TEST_ASSERT(nodes[Peer1].m_always->m_owner.Get() == Peer2);
AZ_TEST_ASSERT(nodes[Peer2].m_session.GetReplicaMgr().FindReplica(nodes[Peer1].m_always->GetReplicaId())->IsMaster());
AZ_TEST_ASSERT(nodes[Peer2].m_session.GetReplicaMgr().FindReplica(nodes[Peer1].m_always->GetReplicaId())->IsPrimary());
AZ_TEST_ASSERT(nodes[Peer1].m_always->m_control.Get() == Peer2);
// P2 -> Host -> C2 (both at same time, with C2 arriving second)
@@ -2750,7 +2750,7 @@ TEST_F(Integ_ReplicaMigrationRequestTest, ReplicaMigrationRequestTest)
AZ_TEST_ASSERT(aP2onH->m_accepted == 1);
AZ_TEST_ASSERT(aP2onH->GetReplica()->IsProxy());
AZ_TEST_ASSERT(aP2onH->m_owner.Get() == Client2);
AZ_TEST_ASSERT(nodes[Client2].m_session.GetReplicaMgr().FindReplica(nodes[Peer2].m_always->GetReplicaId())->IsMaster());
AZ_TEST_ASSERT(nodes[Client2].m_session.GetReplicaMgr().FindReplica(nodes[Peer2].m_always->GetReplicaId())->IsPrimary());
AZ_TEST_ASSERT(nodes[Peer2].m_always->m_control.Get() == Client2);
// Host -> C1
@@ -2758,7 +2758,7 @@ TEST_F(Integ_ReplicaMigrationRequestTest, ReplicaMigrationRequestTest)
AZ_TEST_ASSERT(nodes[Host].m_always->m_accepted == 1);
AZ_TEST_ASSERT(nodes[Host].m_always->GetReplica()->IsProxy());
AZ_TEST_ASSERT(nodes[Host].m_always->m_owner.Get() == Client1);
AZ_TEST_ASSERT(nodes[Client1].m_session.GetReplicaMgr().FindReplica(nodes[Host].m_always->GetReplicaId())->IsMaster());
AZ_TEST_ASSERT(nodes[Client1].m_session.GetReplicaMgr().FindReplica(nodes[Host].m_always->GetReplicaId())->IsPrimary());
AZ_TEST_ASSERT(nodes[Host].m_always->m_control.Get() == Client1);
// C1 -> C2 -> Host (2nd migration)
@@ -2771,7 +2771,7 @@ TEST_F(Integ_ReplicaMigrationRequestTest, ReplicaMigrationRequestTest)
AZ_TEST_ASSERT(aC1onC2->m_accepted == 1);
AZ_TEST_ASSERT(aC1onC2->GetReplica()->IsProxy());
AZ_TEST_ASSERT(aC1onC2->m_owner.Get() == Host);
AZ_TEST_ASSERT(nodes[Host].m_session.GetReplicaMgr().FindReplica(nodes[Client1].m_always->GetReplicaId())->IsMaster());
AZ_TEST_ASSERT(nodes[Host].m_session.GetReplicaMgr().FindReplica(nodes[Client1].m_always->GetReplicaId())->IsPrimary());
AZ_TEST_ASSERT(nodes[Client1].m_always->m_control.Get() == Host);
// C2 -> P1
@@ -2779,13 +2779,13 @@ TEST_F(Integ_ReplicaMigrationRequestTest, ReplicaMigrationRequestTest)
AZ_TEST_ASSERT(nodes[Client2].m_always->m_accepted == 1);
AZ_TEST_ASSERT(nodes[Client2].m_always->GetReplica()->IsProxy());
AZ_TEST_ASSERT(nodes[Client2].m_always->m_owner.Get() == Peer1);
AZ_TEST_ASSERT(nodes[Peer1].m_session.GetReplicaMgr().FindReplica(nodes[Client2].m_always->GetReplicaId())->IsMaster());
AZ_TEST_ASSERT(nodes[Peer1].m_session.GetReplicaMgr().FindReplica(nodes[Client2].m_always->GetReplicaId())->IsPrimary());
AZ_TEST_ASSERT(nodes[Client2].m_always->m_control.Get() == Peer1);
// P1 -> C1 (Forbidden)
AZ_TEST_ASSERT(nodes[Peer1].m_never->m_requests == 0);
AZ_TEST_ASSERT(nodes[Peer1].m_never->m_accepted == 0);
AZ_TEST_ASSERT(nodes[Peer1].m_never->GetReplica()->IsMaster());
AZ_TEST_ASSERT(nodes[Peer1].m_never->GetReplica()->IsPrimary());
AZ_TEST_ASSERT(nodes[Peer1].m_never->m_owner.Get() == Peer1);
AZ_TEST_ASSERT(nodes[Client1].m_session.GetReplicaMgr().FindReplica(nodes[Peer1].m_never->GetReplicaId())->IsProxy());
AZ_TEST_ASSERT(nodes[Peer1].m_never->m_control.Get() == Peer1);
@@ -2793,7 +2793,7 @@ TEST_F(Integ_ReplicaMigrationRequestTest, ReplicaMigrationRequestTest)
// C2 -> P2 (Forbidden)
AZ_TEST_ASSERT(nodes[Client2].m_never->m_requests == 0);
AZ_TEST_ASSERT(nodes[Client2].m_never->m_accepted == 0);
AZ_TEST_ASSERT(nodes[Client2].m_never->GetReplica()->IsMaster());
AZ_TEST_ASSERT(nodes[Client2].m_never->GetReplica()->IsPrimary());
AZ_TEST_ASSERT(nodes[Client2].m_never->m_owner.Get() == Client2);
AZ_TEST_ASSERT(nodes[Peer2].m_session.GetReplicaMgr().FindReplica(nodes[Client2].m_never->GetReplicaId())->IsProxy());
AZ_TEST_ASSERT(nodes[Client2].m_never->m_control.Get() == Client2);
@@ -2803,7 +2803,7 @@ TEST_F(Integ_ReplicaMigrationRequestTest, ReplicaMigrationRequestTest)
AZ_TEST_ASSERT(nodes[Peer1].m_sometimes->m_accepted == 1);
AZ_TEST_ASSERT(nodes[Peer1].m_sometimes->GetReplica()->IsProxy());
AZ_TEST_ASSERT(nodes[Peer1].m_sometimes->m_owner.Get() == Host);
AZ_TEST_ASSERT(nodes[Host].m_session.GetReplicaMgr().FindReplica(nodes[Peer1].m_sometimes->GetReplicaId())->IsMaster());
AZ_TEST_ASSERT(nodes[Host].m_session.GetReplicaMgr().FindReplica(nodes[Peer1].m_sometimes->GetReplicaId())->IsPrimary());
AZ_TEST_ASSERT(nodes[Peer1].m_sometimes->m_control.Get() == Host);
// C1 -> P1
@@ -2811,13 +2811,13 @@ TEST_F(Integ_ReplicaMigrationRequestTest, ReplicaMigrationRequestTest)
AZ_TEST_ASSERT(nodes[Client1].m_sometimes->m_accepted == 1);
AZ_TEST_ASSERT(nodes[Client1].m_sometimes->GetReplica()->IsProxy());
AZ_TEST_ASSERT(nodes[Client1].m_sometimes->m_owner.Get() == Peer1);
AZ_TEST_ASSERT(nodes[Peer1].m_session.GetReplicaMgr().FindReplica(nodes[Client1].m_sometimes->GetReplicaId())->IsMaster());
AZ_TEST_ASSERT(nodes[Peer1].m_session.GetReplicaMgr().FindReplica(nodes[Client1].m_sometimes->GetReplicaId())->IsPrimary());
AZ_TEST_ASSERT(nodes[Client1].m_sometimes->m_control.Get() == Peer1);
// P2 -> C2 (Forbidden)
AZ_TEST_ASSERT(nodes[Peer2].m_sometimes->m_requests == 1);
AZ_TEST_ASSERT(nodes[Peer2].m_sometimes->m_accepted == 0);
AZ_TEST_ASSERT(nodes[Peer2].m_sometimes->GetReplica()->IsMaster());
AZ_TEST_ASSERT(nodes[Peer2].m_sometimes->GetReplica()->IsPrimary());
AZ_TEST_ASSERT(nodes[Peer2].m_sometimes->m_owner.Get() == Peer2);
AZ_TEST_ASSERT(nodes[Client2].m_session.GetReplicaMgr().FindReplica(nodes[Peer2].m_never->GetReplicaId())->IsProxy());
AZ_TEST_ASSERT(nodes[Peer2].m_sometimes->m_control.Get() == Peer2);
@@ -2825,7 +2825,7 @@ TEST_F(Integ_ReplicaMigrationRequestTest, ReplicaMigrationRequestTest)
// C2 -> Host (Forbidden)
AZ_TEST_ASSERT(nodes[Client2].m_sometimes->m_requests == 1);
AZ_TEST_ASSERT(nodes[Client2].m_sometimes->m_accepted == 0);
AZ_TEST_ASSERT(nodes[Client2].m_sometimes->GetReplica()->IsMaster());
AZ_TEST_ASSERT(nodes[Client2].m_sometimes->GetReplica()->IsPrimary());
AZ_TEST_ASSERT(nodes[Client2].m_sometimes->m_owner.Get() == Client2);
AZ_TEST_ASSERT(nodes[Host].m_session.GetReplicaMgr().FindReplica(nodes[Client2].m_never->GetReplicaId())->IsProxy());
AZ_TEST_ASSERT(nodes[Client2].m_sometimes->m_control.Get() == Client2);
@@ -2946,12 +2946,12 @@ TEST_F(Integ_PeerRejoinTest, PeerRejoinTest)
{
auto rep = Replica::CreateReplica(nullptr);
migrRep[i] = CreateAndAttachReplicaChunk<MigratableReplica>(rep, aznew MyObj());
peers[i].GetReplicaMgr().AddMaster(rep);
peers[i].GetReplicaMgr().AddPrimary(rep);
}
{
auto rep = Replica::CreateReplica(nullptr);
nonMigrRep[i] = CreateAndAttachReplicaChunk<NonMigratableReplica>(rep, aznew MyObj());
peers[i].GetReplicaMgr().AddMaster(rep);
peers[i].GetReplicaMgr().AddPrimary(rep);
}
}
addReplicas = false;
@@ -3099,7 +3099,7 @@ public:
{
// make sure the requestor is set to s1
AZ_TEST_ASSERT(rpcContext.m_sourcePeer == s1 + 1);
if (IsMaster())
if (IsPrimary())
{
m_nAuthoritativeOnlyRpcCallsFromS1.Modify([](int& value) { ++value; return true; });
}
@@ -3114,7 +3114,7 @@ public:
{
// make sure the requestor is set to s2
AZ_TEST_ASSERT(rpcContext.m_sourcePeer == s2 + 1);
if (IsMaster())
if (IsPrimary())
{
m_nAuthoritativeOnlyRpcCallsFromS2.Modify([](int& value) { ++value; return true; });
}
@@ -3129,7 +3129,7 @@ public:
{
// make sure the requestor is set to s3
AZ_TEST_ASSERT(rpcContext.m_sourcePeer == s3 + 1);
if (IsMaster())
if (IsPrimary())
{
m_nAuthoritativeOnlyRpcCallsFromS3.Modify([](int& value) { ++value; return true; });
}
@@ -3168,7 +3168,7 @@ TEST_F(Integ_ReplicationSecurityOptionsTest, ReplicationSecurityOptionsTest)
ReplicaChunkDescriptorTable::Get().RegisterChunkType<TestChunk>();
MPSession sessions[nSessions];
ReplicaPtr masters[nSessions];
ReplicaPtr primarys[nSessions];
// initialize transport
int basePort = 4427;
@@ -3202,10 +3202,10 @@ TEST_F(Integ_ReplicationSecurityOptionsTest, ReplicationSecurityOptionsTest)
for (int i = 0; i < nSessions; ++i)
{
AZ_TEST_ASSERT(sessions[i].GetReplicaMgr().IsReady());
masters[i] = Replica::CreateReplica("ReplicationSecurityOptionsTest::TestReplica");
primarys[i] = Replica::CreateReplica("ReplicationSecurityOptionsTest::TestReplica");
TestChunkPtr chunk = CreateReplicaChunk<TestChunk>();
masters[i]->AttachReplicaChunk(chunk);
sessions[i].GetReplicaMgr().AddMaster(masters[i]);
primarys[i]->AttachReplicaChunk(chunk);
sessions[i].GetReplicaMgr().AddPrimary(primarys[i]);
}
}
@@ -3214,9 +3214,9 @@ TEST_F(Integ_ReplicationSecurityOptionsTest, ReplicationSecurityOptionsTest)
AZ_TEST_START_TRACE_SUPPRESSION;
for (int i = 0; i < nSessions; ++i)
{
sessions[s1].GetReplicaMgr().FindReplica(masters[i]->GetRepId())->FindReplicaChunk<TestChunk>()->ForwardSourcePeerRpcFromS1();
sessions[s2].GetReplicaMgr().FindReplica(masters[i]->GetRepId())->FindReplicaChunk<TestChunk>()->ForwardSourcePeerRpcFromS2();
sessions[s3].GetReplicaMgr().FindReplica(masters[i]->GetRepId())->FindReplicaChunk<TestChunk>()->ForwardSourcePeerRpcFromS3();
sessions[s1].GetReplicaMgr().FindReplica(primarys[i]->GetRepId())->FindReplicaChunk<TestChunk>()->ForwardSourcePeerRpcFromS1();
sessions[s2].GetReplicaMgr().FindReplica(primarys[i]->GetRepId())->FindReplicaChunk<TestChunk>()->ForwardSourcePeerRpcFromS2();
sessions[s3].GetReplicaMgr().FindReplica(primarys[i]->GetRepId())->FindReplicaChunk<TestChunk>()->ForwardSourcePeerRpcFromS3();
}
}
@@ -3227,36 +3227,36 @@ TEST_F(Integ_ReplicationSecurityOptionsTest, ReplicationSecurityOptionsTest)
AZ_TEST_STOP_TRACE_SUPPRESSION(2);
// All chunks should have received the call from the host
AZ_TEST_ASSERT(masters[s1]->FindReplicaChunk<TestChunk>()->m_nForwardSourcePeerRpcCallsFromS1 == 1);
AZ_TEST_ASSERT(masters[s2]->FindReplicaChunk<TestChunk>()->m_nForwardSourcePeerRpcCallsFromS1 == 1);
AZ_TEST_ASSERT(masters[s3]->FindReplicaChunk<TestChunk>()->m_nForwardSourcePeerRpcCallsFromS1 == 1);
AZ_TEST_ASSERT(primarys[s1]->FindReplicaChunk<TestChunk>()->m_nForwardSourcePeerRpcCallsFromS1 == 1);
AZ_TEST_ASSERT(primarys[s2]->FindReplicaChunk<TestChunk>()->m_nForwardSourcePeerRpcCallsFromS1 == 1);
AZ_TEST_ASSERT(primarys[s3]->FindReplicaChunk<TestChunk>()->m_nForwardSourcePeerRpcCallsFromS1 == 1);
// the host chunk should have received calls from both clients
AZ_TEST_ASSERT(masters[s1]->FindReplicaChunk<TestChunk>()->m_nForwardSourcePeerRpcCallsFromS2 == 1);
AZ_TEST_ASSERT(masters[s1]->FindReplicaChunk<TestChunk>()->m_nForwardSourcePeerRpcCallsFromS3 == 1);
AZ_TEST_ASSERT(primarys[s1]->FindReplicaChunk<TestChunk>()->m_nForwardSourcePeerRpcCallsFromS2 == 1);
AZ_TEST_ASSERT(primarys[s1]->FindReplicaChunk<TestChunk>()->m_nForwardSourcePeerRpcCallsFromS3 == 1);
// the chunk on s2 should receive its own call but not from s3
AZ_TEST_ASSERT(masters[s2]->FindReplicaChunk<TestChunk>()->m_nForwardSourcePeerRpcCallsFromS2 == 1);
AZ_TEST_ASSERT(masters[s2]->FindReplicaChunk<TestChunk>()->m_nForwardSourcePeerRpcCallsFromS3 == 0);
AZ_TEST_ASSERT(primarys[s2]->FindReplicaChunk<TestChunk>()->m_nForwardSourcePeerRpcCallsFromS2 == 1);
AZ_TEST_ASSERT(primarys[s2]->FindReplicaChunk<TestChunk>()->m_nForwardSourcePeerRpcCallsFromS3 == 0);
// the chunk on s3 should receive its own call but not from s2
AZ_TEST_ASSERT(masters[s3]->FindReplicaChunk<TestChunk>()->m_nForwardSourcePeerRpcCallsFromS2 == 0);
AZ_TEST_ASSERT(masters[s3]->FindReplicaChunk<TestChunk>()->m_nForwardSourcePeerRpcCallsFromS3 == 1);
AZ_TEST_ASSERT(primarys[s3]->FindReplicaChunk<TestChunk>()->m_nForwardSourcePeerRpcCallsFromS2 == 0);
AZ_TEST_ASSERT(primarys[s3]->FindReplicaChunk<TestChunk>()->m_nForwardSourcePeerRpcCallsFromS3 == 1);
// all datasets should have propagated properly
for (int i = 0; i < nSessions; ++i)
{
AZ_TEST_ASSERT(sessions[i].GetReplicaMgr().FindReplica(masters[s1]->GetRepId())->FindReplicaChunk<TestChunk>()->m_nForwardSourcePeerRpcCallsFromS1.Get() == masters[s1]->FindReplicaChunk<TestChunk>()->m_nForwardSourcePeerRpcCallsFromS1.Get());
AZ_TEST_ASSERT(sessions[i].GetReplicaMgr().FindReplica(masters[s1]->GetRepId())->FindReplicaChunk<TestChunk>()->m_nForwardSourcePeerRpcCallsFromS2.Get() == masters[s1]->FindReplicaChunk<TestChunk>()->m_nForwardSourcePeerRpcCallsFromS2.Get());
AZ_TEST_ASSERT(sessions[i].GetReplicaMgr().FindReplica(masters[s1]->GetRepId())->FindReplicaChunk<TestChunk>()->m_nForwardSourcePeerRpcCallsFromS3.Get() == masters[s1]->FindReplicaChunk<TestChunk>()->m_nForwardSourcePeerRpcCallsFromS3.Get());
AZ_TEST_ASSERT(sessions[i].GetReplicaMgr().FindReplica(primarys[s1]->GetRepId())->FindReplicaChunk<TestChunk>()->m_nForwardSourcePeerRpcCallsFromS1.Get() == primarys[s1]->FindReplicaChunk<TestChunk>()->m_nForwardSourcePeerRpcCallsFromS1.Get());
AZ_TEST_ASSERT(sessions[i].GetReplicaMgr().FindReplica(primarys[s1]->GetRepId())->FindReplicaChunk<TestChunk>()->m_nForwardSourcePeerRpcCallsFromS2.Get() == primarys[s1]->FindReplicaChunk<TestChunk>()->m_nForwardSourcePeerRpcCallsFromS2.Get());
AZ_TEST_ASSERT(sessions[i].GetReplicaMgr().FindReplica(primarys[s1]->GetRepId())->FindReplicaChunk<TestChunk>()->m_nForwardSourcePeerRpcCallsFromS3.Get() == primarys[s1]->FindReplicaChunk<TestChunk>()->m_nForwardSourcePeerRpcCallsFromS3.Get());
AZ_TEST_ASSERT(sessions[i].GetReplicaMgr().FindReplica(masters[s2]->GetRepId())->FindReplicaChunk<TestChunk>()->m_nForwardSourcePeerRpcCallsFromS1.Get() == masters[s2]->FindReplicaChunk<TestChunk>()->m_nForwardSourcePeerRpcCallsFromS1.Get());
AZ_TEST_ASSERT(sessions[i].GetReplicaMgr().FindReplica(masters[s2]->GetRepId())->FindReplicaChunk<TestChunk>()->m_nForwardSourcePeerRpcCallsFromS2.Get() == masters[s2]->FindReplicaChunk<TestChunk>()->m_nForwardSourcePeerRpcCallsFromS2.Get());
AZ_TEST_ASSERT(sessions[i].GetReplicaMgr().FindReplica(masters[s2]->GetRepId())->FindReplicaChunk<TestChunk>()->m_nForwardSourcePeerRpcCallsFromS3.Get() == masters[s2]->FindReplicaChunk<TestChunk>()->m_nForwardSourcePeerRpcCallsFromS3.Get());
AZ_TEST_ASSERT(sessions[i].GetReplicaMgr().FindReplica(primarys[s2]->GetRepId())->FindReplicaChunk<TestChunk>()->m_nForwardSourcePeerRpcCallsFromS1.Get() == primarys[s2]->FindReplicaChunk<TestChunk>()->m_nForwardSourcePeerRpcCallsFromS1.Get());
AZ_TEST_ASSERT(sessions[i].GetReplicaMgr().FindReplica(primarys[s2]->GetRepId())->FindReplicaChunk<TestChunk>()->m_nForwardSourcePeerRpcCallsFromS2.Get() == primarys[s2]->FindReplicaChunk<TestChunk>()->m_nForwardSourcePeerRpcCallsFromS2.Get());
AZ_TEST_ASSERT(sessions[i].GetReplicaMgr().FindReplica(primarys[s2]->GetRepId())->FindReplicaChunk<TestChunk>()->m_nForwardSourcePeerRpcCallsFromS3.Get() == primarys[s2]->FindReplicaChunk<TestChunk>()->m_nForwardSourcePeerRpcCallsFromS3.Get());
AZ_TEST_ASSERT(sessions[i].GetReplicaMgr().FindReplica(masters[s3]->GetRepId())->FindReplicaChunk<TestChunk>()->m_nForwardSourcePeerRpcCallsFromS1.Get() == masters[s3]->FindReplicaChunk<TestChunk>()->m_nForwardSourcePeerRpcCallsFromS1.Get());
AZ_TEST_ASSERT(sessions[i].GetReplicaMgr().FindReplica(masters[s3]->GetRepId())->FindReplicaChunk<TestChunk>()->m_nForwardSourcePeerRpcCallsFromS2.Get() == masters[s3]->FindReplicaChunk<TestChunk>()->m_nForwardSourcePeerRpcCallsFromS2.Get());
AZ_TEST_ASSERT(sessions[i].GetReplicaMgr().FindReplica(masters[s3]->GetRepId())->FindReplicaChunk<TestChunk>()->m_nForwardSourcePeerRpcCallsFromS3.Get() == masters[s3]->FindReplicaChunk<TestChunk>()->m_nForwardSourcePeerRpcCallsFromS3.Get());
AZ_TEST_ASSERT(sessions[i].GetReplicaMgr().FindReplica(primarys[s3]->GetRepId())->FindReplicaChunk<TestChunk>()->m_nForwardSourcePeerRpcCallsFromS1.Get() == primarys[s3]->FindReplicaChunk<TestChunk>()->m_nForwardSourcePeerRpcCallsFromS1.Get());
AZ_TEST_ASSERT(sessions[i].GetReplicaMgr().FindReplica(primarys[s3]->GetRepId())->FindReplicaChunk<TestChunk>()->m_nForwardSourcePeerRpcCallsFromS2.Get() == primarys[s3]->FindReplicaChunk<TestChunk>()->m_nForwardSourcePeerRpcCallsFromS2.Get());
AZ_TEST_ASSERT(sessions[i].GetReplicaMgr().FindReplica(primarys[s3]->GetRepId())->FindReplicaChunk<TestChunk>()->m_nForwardSourcePeerRpcCallsFromS3.Get() == primarys[s3]->FindReplicaChunk<TestChunk>()->m_nForwardSourcePeerRpcCallsFromS3.Get());
}
}
@@ -3265,9 +3265,9 @@ TEST_F(Integ_ReplicationSecurityOptionsTest, ReplicationSecurityOptionsTest)
AZ_TEST_START_TRACE_SUPPRESSION;
for (int i = 0; i < nSessions; ++i)
{
sessions[s1].GetReplicaMgr().FindReplica(masters[i]->GetRepId())->FindReplicaChunk<TestChunk>()->AuthoritativeOnlyRpcFromS1();
sessions[s2].GetReplicaMgr().FindReplica(masters[i]->GetRepId())->FindReplicaChunk<TestChunk>()->AuthoritativeOnlyRpcFromS2();
sessions[s3].GetReplicaMgr().FindReplica(masters[i]->GetRepId())->FindReplicaChunk<TestChunk>()->AuthoritativeOnlyRpcFromS3();
sessions[s1].GetReplicaMgr().FindReplica(primarys[i]->GetRepId())->FindReplicaChunk<TestChunk>()->AuthoritativeOnlyRpcFromS1();
sessions[s2].GetReplicaMgr().FindReplica(primarys[i]->GetRepId())->FindReplicaChunk<TestChunk>()->AuthoritativeOnlyRpcFromS2();
sessions[s3].GetReplicaMgr().FindReplica(primarys[i]->GetRepId())->FindReplicaChunk<TestChunk>()->AuthoritativeOnlyRpcFromS3();
}
}
@@ -3278,40 +3278,40 @@ TEST_F(Integ_ReplicationSecurityOptionsTest, ReplicationSecurityOptionsTest)
AZ_TEST_STOP_TRACE_SUPPRESSION(6);
// Each chunk should have received their own AuthoritativeOnlyRpc once.
AZ_TEST_ASSERT(masters[s1]->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyRpcCallsFromS1 == 1);
AZ_TEST_ASSERT(masters[s2]->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyRpcCallsFromS2 == 1);
AZ_TEST_ASSERT(masters[s3]->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyRpcCallsFromS3 == 1);
AZ_TEST_ASSERT(primarys[s1]->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyRpcCallsFromS1 == 1);
AZ_TEST_ASSERT(primarys[s2]->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyRpcCallsFromS2 == 1);
AZ_TEST_ASSERT(primarys[s3]->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyRpcCallsFromS3 == 1);
// Calls from other nodes should have been discarded.
AZ_TEST_ASSERT(masters[s1]->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyRpcCallsFromS2 == 0);
AZ_TEST_ASSERT(masters[s1]->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyRpcCallsFromS3 == 0);
AZ_TEST_ASSERT(masters[s2]->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyRpcCallsFromS1 == 0);
AZ_TEST_ASSERT(masters[s2]->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyRpcCallsFromS3 == 0);
AZ_TEST_ASSERT(masters[s3]->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyRpcCallsFromS1 == 0);
AZ_TEST_ASSERT(masters[s3]->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyRpcCallsFromS2 == 0);
AZ_TEST_ASSERT(primarys[s1]->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyRpcCallsFromS2 == 0);
AZ_TEST_ASSERT(primarys[s1]->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyRpcCallsFromS3 == 0);
AZ_TEST_ASSERT(primarys[s2]->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyRpcCallsFromS1 == 0);
AZ_TEST_ASSERT(primarys[s2]->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyRpcCallsFromS3 == 0);
AZ_TEST_ASSERT(primarys[s3]->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyRpcCallsFromS1 == 0);
AZ_TEST_ASSERT(primarys[s3]->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyRpcCallsFromS2 == 0);
// Calls should have successfully propagated to the other 2 proxies
AZ_TEST_ASSERT(sessions[s1].GetReplicaMgr().FindReplica(masters[s2]->GetRepId())->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyProxyRpcCallsFromS2 == 1);
AZ_TEST_ASSERT(sessions[s1].GetReplicaMgr().FindReplica(masters[s3]->GetRepId())->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyProxyRpcCallsFromS3 == 1);
AZ_TEST_ASSERT(sessions[s2].GetReplicaMgr().FindReplica(masters[s1]->GetRepId())->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyProxyRpcCallsFromS1 == 1);
AZ_TEST_ASSERT(sessions[s2].GetReplicaMgr().FindReplica(masters[s3]->GetRepId())->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyProxyRpcCallsFromS3 == 1);
AZ_TEST_ASSERT(sessions[s3].GetReplicaMgr().FindReplica(masters[s1]->GetRepId())->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyProxyRpcCallsFromS1 == 1);
AZ_TEST_ASSERT(sessions[s3].GetReplicaMgr().FindReplica(masters[s2]->GetRepId())->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyProxyRpcCallsFromS2 == 1);
AZ_TEST_ASSERT(sessions[s1].GetReplicaMgr().FindReplica(primarys[s2]->GetRepId())->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyProxyRpcCallsFromS2 == 1);
AZ_TEST_ASSERT(sessions[s1].GetReplicaMgr().FindReplica(primarys[s3]->GetRepId())->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyProxyRpcCallsFromS3 == 1);
AZ_TEST_ASSERT(sessions[s2].GetReplicaMgr().FindReplica(primarys[s1]->GetRepId())->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyProxyRpcCallsFromS1 == 1);
AZ_TEST_ASSERT(sessions[s2].GetReplicaMgr().FindReplica(primarys[s3]->GetRepId())->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyProxyRpcCallsFromS3 == 1);
AZ_TEST_ASSERT(sessions[s3].GetReplicaMgr().FindReplica(primarys[s1]->GetRepId())->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyProxyRpcCallsFromS1 == 1);
AZ_TEST_ASSERT(sessions[s3].GetReplicaMgr().FindReplica(primarys[s2]->GetRepId())->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyProxyRpcCallsFromS2 == 1);
// all datasets should have propagated properly
for (int i = 0; i < nSessions; ++i)
{
AZ_TEST_ASSERT(sessions[i].GetReplicaMgr().FindReplica(masters[s1]->GetRepId())->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyRpcCallsFromS1.Get() == masters[s1]->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyRpcCallsFromS1.Get());
AZ_TEST_ASSERT(sessions[i].GetReplicaMgr().FindReplica(masters[s1]->GetRepId())->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyRpcCallsFromS2.Get() == masters[s1]->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyRpcCallsFromS2.Get());
AZ_TEST_ASSERT(sessions[i].GetReplicaMgr().FindReplica(masters[s1]->GetRepId())->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyRpcCallsFromS3.Get() == masters[s1]->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyRpcCallsFromS3.Get());
AZ_TEST_ASSERT(sessions[i].GetReplicaMgr().FindReplica(primarys[s1]->GetRepId())->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyRpcCallsFromS1.Get() == primarys[s1]->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyRpcCallsFromS1.Get());
AZ_TEST_ASSERT(sessions[i].GetReplicaMgr().FindReplica(primarys[s1]->GetRepId())->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyRpcCallsFromS2.Get() == primarys[s1]->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyRpcCallsFromS2.Get());
AZ_TEST_ASSERT(sessions[i].GetReplicaMgr().FindReplica(primarys[s1]->GetRepId())->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyRpcCallsFromS3.Get() == primarys[s1]->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyRpcCallsFromS3.Get());
AZ_TEST_ASSERT(sessions[i].GetReplicaMgr().FindReplica(masters[s2]->GetRepId())->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyRpcCallsFromS1.Get() == masters[s2]->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyRpcCallsFromS1.Get());
AZ_TEST_ASSERT(sessions[i].GetReplicaMgr().FindReplica(masters[s2]->GetRepId())->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyRpcCallsFromS2.Get() == masters[s2]->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyRpcCallsFromS2.Get());
AZ_TEST_ASSERT(sessions[i].GetReplicaMgr().FindReplica(masters[s2]->GetRepId())->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyRpcCallsFromS3.Get() == masters[s2]->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyRpcCallsFromS3.Get());
AZ_TEST_ASSERT(sessions[i].GetReplicaMgr().FindReplica(primarys[s2]->GetRepId())->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyRpcCallsFromS1.Get() == primarys[s2]->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyRpcCallsFromS1.Get());
AZ_TEST_ASSERT(sessions[i].GetReplicaMgr().FindReplica(primarys[s2]->GetRepId())->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyRpcCallsFromS2.Get() == primarys[s2]->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyRpcCallsFromS2.Get());
AZ_TEST_ASSERT(sessions[i].GetReplicaMgr().FindReplica(primarys[s2]->GetRepId())->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyRpcCallsFromS3.Get() == primarys[s2]->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyRpcCallsFromS3.Get());
AZ_TEST_ASSERT(sessions[i].GetReplicaMgr().FindReplica(masters[s3]->GetRepId())->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyRpcCallsFromS1.Get() == masters[s3]->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyRpcCallsFromS1.Get());
AZ_TEST_ASSERT(sessions[i].GetReplicaMgr().FindReplica(masters[s3]->GetRepId())->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyRpcCallsFromS2.Get() == masters[s3]->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyRpcCallsFromS2.Get());
AZ_TEST_ASSERT(sessions[i].GetReplicaMgr().FindReplica(masters[s3]->GetRepId())->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyRpcCallsFromS3.Get() == masters[s3]->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyRpcCallsFromS3.Get());
AZ_TEST_ASSERT(sessions[i].GetReplicaMgr().FindReplica(primarys[s3]->GetRepId())->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyRpcCallsFromS1.Get() == primarys[s3]->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyRpcCallsFromS1.Get());
AZ_TEST_ASSERT(sessions[i].GetReplicaMgr().FindReplica(primarys[s3]->GetRepId())->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyRpcCallsFromS2.Get() == primarys[s3]->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyRpcCallsFromS2.Get());
AZ_TEST_ASSERT(sessions[i].GetReplicaMgr().FindReplica(primarys[s3]->GetRepId())->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyRpcCallsFromS3.Get() == primarys[s3]->FindReplicaChunk<TestChunk>()->m_nAuthoritativeOnlyRpcCallsFromS3.Get());
}
}
@@ -3594,7 +3594,7 @@ public:
auto rep = Replica::CreateReplica(nullptr);
auto chunk = CreateAndAttachReplicaChunk<StressTestReplica>(rep);
replicas.push_back(AZStd::make_pair(rep, chunk));
session.GetReplicaMgr().AddMaster(rep);
session.GetReplicaMgr().AddPrimary(rep);
}
}
@@ -3730,7 +3730,7 @@ public:
{
auto rep = Replica::CreateReplica(nullptr);
chunks[i] = CreateAndAttachReplicaChunk<BandwidthTestChunk>(rep);
sessions[sHost].GetReplicaMgr().AddMaster(rep);
sessions[sHost].GetReplicaMgr().AddPrimary(rep);
}
// connect to host
@@ -687,7 +687,7 @@ namespace ReplicaBehavior {
AZ_TEST_ASSERT(chunk->Data1.IsDefaultValue());
AZ_TEST_ASSERT(chunk->Data2.IsDefaultValue());
m_replicaIdDefault = m_sessions[sHost].GetReplicaMgr().AddMaster(replica);
m_replicaIdDefault = m_sessions[sHost].GetReplicaMgr().AddPrimary(replica);
}
}
@@ -725,7 +725,7 @@ namespace ReplicaBehavior {
AZ_TEST_ASSERT(!chunk->Data1.IsDefaultValue());
AZ_TEST_ASSERT(!chunk->Data2.IsDefaultValue());
m_replicaIdModified = m_sessions[sHost].GetReplicaMgr().AddMaster(replica);
m_replicaIdModified = m_sessions[sHost].GetReplicaMgr().AddPrimary(replica);
}
break;
}
@@ -816,7 +816,7 @@ namespace ReplicaBehavior {
LargeChunkWithDefaults* chunk = CreateAndAttachReplicaChunk<LargeChunkWithDefaults>(replica);
AZ_TEST_ASSERT(chunk);
m_replicaId = m_sessions[sHost].GetReplicaMgr().AddMaster(replica);
m_replicaId = m_sessions[sHost].GetReplicaMgr().AddPrimary(replica);
}
~Integ_ReplicaDefaultDataSetDriller()
@@ -923,13 +923,13 @@ namespace ReplicaBehavior {
ChunkWithBools* chunk1 = CreateAndAttachReplicaChunk<ChunkWithBools>(replica1);
AZ_TEST_ASSERT(chunk1);
m_replicaBoolsId = m_sessions[sHost].GetReplicaMgr().AddMaster(replica1);
m_replicaBoolsId = m_sessions[sHost].GetReplicaMgr().AddPrimary(replica1);
ReplicaPtr replica2 = Replica::CreateReplica(nullptr);
ChunkWithShortInts* chunk2 = CreateAndAttachReplicaChunk<ChunkWithShortInts>(replica2);
AZ_TEST_ASSERT(chunk2);
m_replicaU8Id = m_sessions[sHost].GetReplicaMgr().AddMaster(replica2);
m_replicaU8Id = m_sessions[sHost].GetReplicaMgr().AddPrimary(replica2);
}
~Integ_Replica_ComparePackingBoolsVsU8()
@@ -1058,7 +1058,7 @@ namespace ReplicaBehavior {
auto chunk = CreateAndAttachReplicaChunk<CustomMarshalerTestChunk>(replica);
AZ_TEST_ASSERT(chunk);
m_replicaId = m_sessions[sHost].GetReplicaMgr().AddMaster(replica);
m_replicaId = m_sessions[sHost].GetReplicaMgr().AddPrimary(replica);
}
~Integ_CheckDataSetStreamIsntWrittenMoreThanNecessary()
@@ -1155,7 +1155,7 @@ namespace ReplicaBehavior {
auto chunk = CreateAndAttachReplicaChunk<CustomMarshalerTestChunk>(replica);
AZ_TEST_ASSERT(chunk);
m_replicaId = m_sessions[sHost].GetReplicaMgr().AddMaster(replica);
m_replicaId = m_sessions[sHost].GetReplicaMgr().AddPrimary(replica);
}
~Integ_CheckDataSetStreamIsntWrittenMoreThanNecessaryOnceDirty()
@@ -1249,7 +1249,7 @@ namespace ReplicaBehavior {
ForcingDirtyTestChunk* chunk = CreateAndAttachReplicaChunk<ForcingDirtyTestChunk>(replica);
AZ_TEST_ASSERT(chunk);
m_replicaId = m_sessions[sHost].GetReplicaMgr().AddMaster(replica);
m_replicaId = m_sessions[sHost].GetReplicaMgr().AddPrimary(replica);
}
~Integ_CheckReplicaIsntSentWithNoChanges()
@@ -1360,7 +1360,7 @@ namespace ReplicaBehavior {
auto chunk = CreateAndAttachReplicaChunk<EntityLikeScriptReplicaChunk>(replica);
AZ_TEST_ASSERT(chunk);
m_replicaId = m_sessions[sHost].GetReplicaMgr().AddMaster(replica);
m_replicaId = m_sessions[sHost].GetReplicaMgr().AddPrimary(replica);
}
~Integ_CheckEntityScriptReplicaIsntSentWithNoChanges()
+105 -105
View File
@@ -73,12 +73,12 @@ public:
static const char* GetChunkName() { return "RPCChunk"; }
RPCChunk()
: m_fromMasterBroadcast(0)
, m_fromMasterNotBroadcast(0)
: m_fromPrimaryBroadcast(0)
, m_fromPrimaryNotBroadcast(0)
, m_fromProxyBroadcast(0)
, m_fromProxyNotBroadcast(0)
, FromMasterBroadcast("FromMasterBroadcast")
, FromMasterNotBroadcast("FromMasterNotBroadcast")
, FromPrimaryBroadcast("FromPrimaryBroadcast")
, FromPrimaryNotBroadcast("FromPrimaryNotBroadcast")
, FromProxyBroadcast("FromProxyBroadcast")
, FromProxyNotBroadcast("FromProxyNotBroadcast")
, BroadcastInt("BroadcastInt")
@@ -86,30 +86,30 @@ public:
bool IsReplicaMigratable() override { return false; }
bool FromMasterBroadcastFn(const RpcContext&)
bool FromPrimaryBroadcastFn(const RpcContext&)
{
AZ_TracePrintf("GridMate", "Executed FromMasterBroadcast %d %s\n", GetReplicaId(), GetReplica()->IsMaster() ? "master" : "proxy");
m_fromMasterBroadcast++;
AZ_TracePrintf("GridMate", "Executed FromPrimaryBroadcast %d %s\n", GetReplicaId(), GetReplica()->IsPrimary() ? "primary" : "proxy");
m_fromPrimaryBroadcast++;
return true;
}
bool FromMasterNotBroadcastFn(const RpcContext&)
bool FromPrimaryNotBroadcastFn(const RpcContext&)
{
AZ_TracePrintf("GridMate", "Executed FromMasterNotBroadcast %d %s\n", GetReplicaId(), GetReplica()->IsMaster() ? "master" : "proxy");
m_fromMasterNotBroadcast++;
AZ_TracePrintf("GridMate", "Executed FromPrimaryNotBroadcast %d %s\n", GetReplicaId(), GetReplica()->IsPrimary() ? "primary" : "proxy");
m_fromPrimaryNotBroadcast++;
return false;
}
bool FromProxyBroadcastFn(const RpcContext&)
{
AZ_TracePrintf("GridMate", "Executed FromProxyBroadcast %d %s\n", GetReplicaId(), GetReplica()->IsMaster() ? "master" : "proxy");
AZ_TracePrintf("GridMate", "Executed FromProxyBroadcast %d %s\n", GetReplicaId(), GetReplica()->IsPrimary() ? "primary" : "proxy");
m_fromProxyBroadcast++;
return true;
}
bool FromProxyNotBroadcastFn(const RpcContext&)
{
AZ_TracePrintf("GridMate", "Executed FromProxyNotBroadcast %d %s\n", GetReplicaId(), GetReplica()->IsMaster() ? "master" : "proxy");
AZ_TracePrintf("GridMate", "Executed FromProxyNotBroadcast %d %s\n", GetReplicaId(), GetReplica()->IsPrimary() ? "primary" : "proxy");
m_fromProxyNotBroadcast++;
return false;
}
@@ -120,14 +120,14 @@ public:
return true;
}
int m_fromMasterBroadcast;
int m_fromMasterNotBroadcast;
int m_fromPrimaryBroadcast;
int m_fromPrimaryNotBroadcast;
int m_fromProxyBroadcast;
int m_fromProxyNotBroadcast;
AZStd::vector<int> m_sentData;
Rpc<>::BindInterface<RPCChunk, & RPCChunk::FromMasterBroadcastFn> FromMasterBroadcast;
Rpc<>::BindInterface<RPCChunk, & RPCChunk::FromMasterNotBroadcastFn> FromMasterNotBroadcast;
Rpc<>::BindInterface<RPCChunk, & RPCChunk::FromPrimaryBroadcastFn> FromPrimaryBroadcast;
Rpc<>::BindInterface<RPCChunk, & RPCChunk::FromPrimaryNotBroadcastFn> FromPrimaryNotBroadcast;
Rpc<>::BindInterface<RPCChunk, & RPCChunk::FromProxyBroadcastFn> FromProxyBroadcast;
Rpc<>::BindInterface<RPCChunk, & RPCChunk::FromProxyNotBroadcastFn> FromProxyNotBroadcast;
Rpc<RpcArg<int> >::BindInterface<RPCChunk, & RPCChunk::BroadcastIntFn> BroadcastInt;
@@ -158,21 +158,21 @@ public:
bool Zero(const RpcContext&)
{
auto& list = (IsMaster() ? m_sentData : m_receivedData)[0];
auto& list = (IsPrimary() ? m_sentData : m_receivedData)[0];
(void) list;
return true;
}
bool One(AZ::u32 t1, const RpcContext&)
{
auto& list = (IsMaster() ? m_sentData : m_receivedData)[1];
auto& list = (IsPrimary() ? m_sentData : m_receivedData)[1];
list.push_back(t1);
return true;
}
bool Two(AZ::u32 t1, AZ::u32 t2, const RpcContext&)
{
auto& list = (IsMaster() ? m_sentData : m_receivedData)[2];
auto& list = (IsPrimary() ? m_sentData : m_receivedData)[2];
list.push_back(t1);
list.push_back(t2);
return true;
@@ -180,7 +180,7 @@ public:
bool Three(AZ::u32 t1, AZ::u32 t2, AZ::u32 t3, const RpcContext&)
{
auto& list = (IsMaster() ? m_sentData : m_receivedData)[3];
auto& list = (IsPrimary() ? m_sentData : m_receivedData)[3];
list.push_back(t1);
list.push_back(t2);
list.push_back(t3);
@@ -189,7 +189,7 @@ public:
bool Four(AZ::u32 t1, AZ::u32 t2, AZ::u32 t3, AZ::u32 t4, const RpcContext&)
{
auto& list = (IsMaster() ? m_sentData : m_receivedData)[4];
auto& list = (IsPrimary() ? m_sentData : m_receivedData)[4];
list.push_back(t1);
list.push_back(t2);
list.push_back(t3);
@@ -199,7 +199,7 @@ public:
bool Five(AZ::u32 t1, AZ::u32 t2, AZ::u32 t3, AZ::u32 t4, AZ::u32 t5, const RpcContext&)
{
auto& list = (IsMaster() ? m_sentData : m_receivedData)[5];
auto& list = (IsPrimary() ? m_sentData : m_receivedData)[5];
list.push_back(t1);
list.push_back(t2);
list.push_back(t3);
@@ -210,7 +210,7 @@ public:
bool Six(AZ::u32 t1, AZ::u32 t2, AZ::u32 t3, AZ::u32 t4, AZ::u32 t5, AZ::u32 t6, const RpcContext&)
{
auto& list = (IsMaster() ? m_sentData : m_receivedData)[6];
auto& list = (IsPrimary() ? m_sentData : m_receivedData)[6];
list.push_back(t1);
list.push_back(t2);
list.push_back(t3);
@@ -222,7 +222,7 @@ public:
bool Seven(AZ::u32 t1, AZ::u32 t2, AZ::u32 t3, AZ::u32 t4, AZ::u32 t5, AZ::u32 t6, AZ::u32 t7, const RpcContext&)
{
auto& list = (IsMaster() ? m_sentData : m_receivedData)[7];
auto& list = (IsPrimary() ? m_sentData : m_receivedData)[7];
list.push_back(t1);
list.push_back(t2);
list.push_back(t3);
@@ -235,7 +235,7 @@ public:
bool Eight(AZ::u32 t1, AZ::u32 t2, AZ::u32 t3, AZ::u32 t4, AZ::u32 t5, AZ::u32 t6, AZ::u32 t7, AZ::u32 t8, const RpcContext&)
{
auto& list = (IsMaster() ? m_sentData : m_receivedData)[8];
auto& list = (IsPrimary() ? m_sentData : m_receivedData)[8];
list.push_back(t1);
list.push_back(t2);
list.push_back(t3);
@@ -249,7 +249,7 @@ public:
bool Nine(AZ::u32 t1, AZ::u32 t2, AZ::u32 t3, AZ::u32 t4, AZ::u32 t5, AZ::u32 t6, AZ::u32 t7, AZ::u32 t8, AZ::u32 t9, const RpcContext&)
{
auto& list = (IsMaster() ? m_sentData : m_receivedData)[9];
auto& list = (IsPrimary() ? m_sentData : m_receivedData)[9];
list.push_back(t1);
list.push_back(t2);
list.push_back(t3);
@@ -890,7 +890,7 @@ public:
// put something on s1 to get it going
auto replica = Replica::CreateReplica(nullptr);
m_chunk = CreateAndAttachReplicaChunk<RPCChunk>(replica);
m_replicaId = m_sessions[sHost].GetReplicaMgr().AddMaster(replica);
m_replicaId = m_sessions[sHost].GetReplicaMgr().AddPrimary(replica);
}
RPCChunk::Ptr m_chunk;
@@ -905,11 +905,11 @@ TEST_F(Integ_ReplicaChunkRPCExec, ReplicaChunkRPCExec)
switch (tick)
{
case 10:
m_chunk->FromMasterBroadcast();
m_chunk->FromPrimaryBroadcast();
break;
case 20:
m_chunk->FromMasterNotBroadcast();
m_chunk->FromPrimaryNotBroadcast();
break;
case 30:
@@ -932,13 +932,13 @@ TEST_F(Integ_ReplicaChunkRPCExec, ReplicaChunkRPCExec)
auto s2proxy = m_sessions[s2].GetReplicaMgr().FindReplica(m_replicaId)->FindReplicaChunk<RPCChunk>();
auto s3proxy = m_sessions[s3].GetReplicaMgr().FindReplica(m_replicaId)->FindReplicaChunk<RPCChunk>();
AZ_TEST_ASSERT(s1host->m_fromMasterBroadcast == 1);
AZ_TEST_ASSERT(s2proxy->m_fromMasterBroadcast == 1);
AZ_TEST_ASSERT(s3proxy->m_fromMasterBroadcast == 1);
AZ_TEST_ASSERT(s1host->m_fromPrimaryBroadcast == 1);
AZ_TEST_ASSERT(s2proxy->m_fromPrimaryBroadcast == 1);
AZ_TEST_ASSERT(s3proxy->m_fromPrimaryBroadcast == 1);
AZ_TEST_ASSERT(s1host->m_fromMasterNotBroadcast == 1);
AZ_TEST_ASSERT(s2proxy->m_fromMasterNotBroadcast == 0);
AZ_TEST_ASSERT(s3proxy->m_fromMasterNotBroadcast == 0);
AZ_TEST_ASSERT(s1host->m_fromPrimaryNotBroadcast == 1);
AZ_TEST_ASSERT(s2proxy->m_fromPrimaryNotBroadcast == 0);
AZ_TEST_ASSERT(s3proxy->m_fromPrimaryNotBroadcast == 0);
AZ_TEST_ASSERT(s1host->m_fromProxyBroadcast == 1);
AZ_TEST_ASSERT(s2proxy->m_fromProxyBroadcast == 1);
@@ -965,12 +965,12 @@ public:
GM_CLASS_ALLOCATOR(DestroyRPCChunk);
DestroyRPCChunk()
: DestroyFromMaster("DestroyFromMaster")
: DestroyFromPrimary("DestroyFromPrimary")
, DestroyFromProxy("DestroyFromProxy")
, BeforeDestroyFromProxy("BeforeDestroyFromProxy")
, AfterDestroyFromProxy("AfterDestroyFromProxy")
, BeforeDestroyFromMaster("BeforeDestroyFromMaster")
, AfterDestroyFromMaster("AfterDestroyFromMaster")
, BeforeDestroyFromPrimary("BeforeDestroyFromPrimary")
, AfterDestroyFromPrimary("AfterDestroyFromPrimary")
{
}
@@ -979,11 +979,11 @@ public:
bool IsReplicaMigratable() override { return false; }
bool DestroyFromMasterFn(const RpcContext&)
bool DestroyFromPrimaryFn(const RpcContext&)
{
AZ_TracePrintf("GridMate", "Executed DestroyFromMaster %d %s\n", GetReplicaId(), GetReplica()->IsMaster() ? "master" : "proxy");
++s_destroyFromMasterCalls;
if (GetReplica()->IsMaster())
AZ_TracePrintf("GridMate", "Executed DestroyFromPrimary %d %s\n", GetReplicaId(), GetReplica()->IsPrimary() ? "primary" : "proxy");
++s_destroyFromPrimaryCalls;
if (GetReplica()->IsPrimary())
{
GetReplica()->Destroy();
}
@@ -992,9 +992,9 @@ public:
bool DestroyFromProxyFn(const RpcContext&)
{
AZ_TracePrintf("GridMate", "Executed DestroyFromProxy %d %s\n", GetReplicaId(), GetReplica()->IsMaster() ? "master" : "proxy");
AZ_TracePrintf("GridMate", "Executed DestroyFromProxy %d %s\n", GetReplicaId(), GetReplica()->IsPrimary() ? "primary" : "proxy");
++s_destroyFromProxyCalls;
if (GetReplica()->IsMaster())
if (GetReplica()->IsPrimary())
{
GetReplica()->Destroy();
}
@@ -1003,53 +1003,53 @@ public:
bool BeforeDestroyFromProxyFn(const RpcContext&)
{
AZ_TracePrintf("GridMate", "Executed BeforeDestroyFromProxy %d %s\n", GetReplicaId(), GetReplica()->IsMaster() ? "master" : "proxy");
AZ_TracePrintf("GridMate", "Executed BeforeDestroyFromProxy %d %s\n", GetReplicaId(), GetReplica()->IsPrimary() ? "primary" : "proxy");
++s_beforeDestroyFromProxyCalls;
return true;
}
bool AfterDestroyFromProxyFn(const RpcContext&)
{
AZ_TracePrintf("GridMate", "Executed AfterDestroyFromProxy %d %s\n", GetReplicaId(), GetReplica()->IsMaster() ? "master" : "proxy");
AZ_TracePrintf("GridMate", "Executed AfterDestroyFromProxy %d %s\n", GetReplicaId(), GetReplica()->IsPrimary() ? "primary" : "proxy");
++s_afterDestroyFromProxyCalls;
return true;
}
bool BeforeDestroyFromMasterFn(const RpcContext&)
bool BeforeDestroyFromPrimaryFn(const RpcContext&)
{
AZ_TracePrintf("GridMate", "Executed BeforeDestroyFromMaster %d %s\n", GetReplicaId(), GetReplica()->IsMaster() ? "master" : "proxy");
++s_beforeDestroyFromMasterCalls;
AZ_TracePrintf("GridMate", "Executed BeforeDestroyFromPrimary %d %s\n", GetReplicaId(), GetReplica()->IsPrimary() ? "primary" : "proxy");
++s_beforeDestroyFromPrimaryCalls;
return true;
}
bool AfterDestroyFromMasterFn(const RpcContext&)
bool AfterDestroyFromPrimaryFn(const RpcContext&)
{
AZ_TracePrintf("GridMate", "Executed AfterDestroyFromMaster %d %s\n", GetReplicaId(), GetReplica()->IsMaster() ? "master" : "proxy");
++s_afterDestroyFromMasterCalls;
AZ_TracePrintf("GridMate", "Executed AfterDestroyFromPrimary %d %s\n", GetReplicaId(), GetReplica()->IsPrimary() ? "primary" : "proxy");
++s_afterDestroyFromPrimaryCalls;
return true;
}
Rpc<>::BindInterface<DestroyRPCChunk, & DestroyRPCChunk::DestroyFromMasterFn> DestroyFromMaster;
Rpc<>::BindInterface<DestroyRPCChunk, & DestroyRPCChunk::DestroyFromPrimaryFn> DestroyFromPrimary;
Rpc<>::BindInterface<DestroyRPCChunk, & DestroyRPCChunk::DestroyFromProxyFn> DestroyFromProxy;
Rpc<>::BindInterface<DestroyRPCChunk, & DestroyRPCChunk::BeforeDestroyFromProxyFn> BeforeDestroyFromProxy;
Rpc<>::BindInterface<DestroyRPCChunk, & DestroyRPCChunk::AfterDestroyFromProxyFn> AfterDestroyFromProxy;
Rpc<>::BindInterface<DestroyRPCChunk, & DestroyRPCChunk::BeforeDestroyFromMasterFn> BeforeDestroyFromMaster;
Rpc<>::BindInterface<DestroyRPCChunk, & DestroyRPCChunk::AfterDestroyFromMasterFn> AfterDestroyFromMaster;
Rpc<>::BindInterface<DestroyRPCChunk, & DestroyRPCChunk::BeforeDestroyFromPrimaryFn> BeforeDestroyFromPrimary;
Rpc<>::BindInterface<DestroyRPCChunk, & DestroyRPCChunk::AfterDestroyFromPrimaryFn> AfterDestroyFromPrimary;
static int s_destroyFromMasterCalls;
static int s_beforeDestroyFromMasterCalls;
static int s_afterDestroyFromMasterCalls;
static int s_destroyFromPrimaryCalls;
static int s_beforeDestroyFromPrimaryCalls;
static int s_afterDestroyFromPrimaryCalls;
static int s_destroyFromProxyCalls;
static int s_beforeDestroyFromProxyCalls;
static int s_afterDestroyFromProxyCalls;
};
int DestroyRPCChunk::s_destroyFromProxyCalls = 0;
int DestroyRPCChunk::s_destroyFromMasterCalls = 0;
int DestroyRPCChunk::s_destroyFromPrimaryCalls = 0;
int DestroyRPCChunk::s_beforeDestroyFromProxyCalls = 0;
int DestroyRPCChunk::s_afterDestroyFromProxyCalls = 0;
int DestroyRPCChunk::s_beforeDestroyFromMasterCalls = 0;
int DestroyRPCChunk::s_afterDestroyFromMasterCalls = 0;
int DestroyRPCChunk::s_beforeDestroyFromPrimaryCalls = 0;
int DestroyRPCChunk::s_afterDestroyFromPrimaryCalls = 0;
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
@@ -1077,7 +1077,7 @@ public:
{
auto replica = Replica::CreateReplica(nullptr);
CreateAndAttachReplicaChunk<DestroyRPCChunk>(replica);
m_repId[i] = m_sessions[sHost].GetReplicaMgr().AddMaster(replica);
m_repId[i] = m_sessions[sHost].GetReplicaMgr().AddPrimary(replica);
}
}
@@ -1092,12 +1092,12 @@ TEST_F(Integ_ReplicaDestroyedInRPC, ReplicaDestroyedInRPC)
{
case 10:
{
// calling destroy on master
auto master = m_sessions[sHost].GetReplicaMgr().FindReplica(m_repId[0]);
auto masterChunk = master->FindReplicaChunk<DestroyRPCChunk>();
masterChunk->BeforeDestroyFromMaster();
masterChunk->DestroyFromMaster();
masterChunk->AfterDestroyFromMaster();
// calling destroy on primary
auto primary = m_sessions[sHost].GetReplicaMgr().FindReplica(m_repId[0]);
auto primaryChunk = primary->FindReplicaChunk<DestroyRPCChunk>();
primaryChunk->BeforeDestroyFromPrimary();
primaryChunk->DestroyFromPrimary();
primaryChunk->AfterDestroyFromPrimary();
// calling destroy on proxy
auto proxy = m_sessions[s2].GetReplicaMgr().FindReplica(m_repId[1]);
@@ -1113,15 +1113,15 @@ TEST_F(Integ_ReplicaDestroyedInRPC, ReplicaDestroyedInRPC)
{
// checking if before destroy RPC was called on every peer
AZ_TEST_ASSERT(DestroyRPCChunk::s_beforeDestroyFromProxyCalls == nSessions);
AZ_TEST_ASSERT(DestroyRPCChunk::s_beforeDestroyFromMasterCalls == nSessions);
AZ_TEST_ASSERT(DestroyRPCChunk::s_beforeDestroyFromPrimaryCalls == nSessions);
// checking if destroy itself was called on every peer
AZ_TEST_ASSERT(DestroyRPCChunk::s_destroyFromProxyCalls == nSessions);
AZ_TEST_ASSERT(DestroyRPCChunk::s_destroyFromMasterCalls == nSessions);
AZ_TEST_ASSERT(DestroyRPCChunk::s_destroyFromPrimaryCalls == nSessions);
// checking if after destroy RPC was never called
AZ_TEST_ASSERT(DestroyRPCChunk::s_afterDestroyFromProxyCalls == 0); // RPCs that arrive via the network after deactivation should be dropped.
AZ_TEST_ASSERT(DestroyRPCChunk::s_afterDestroyFromMasterCalls == 1); // RPCs explicitly called on an inactive replica should still be executed.
AZ_TEST_ASSERT(DestroyRPCChunk::s_afterDestroyFromPrimaryCalls == 1); // RPCs explicitly called on an inactive replica should still be executed.
return TestStatus::Completed;
}
@@ -1157,7 +1157,7 @@ public:
{
// put something on s1 to get it going
m_replica = Replica::CreateReplica(nullptr);
m_replicaId = m_sessions[sHost].GetReplicaMgr().AddMaster(m_replica);
m_replicaId = m_sessions[sHost].GetReplicaMgr().AddPrimary(m_replica);
}
ReplicaPtr m_replica;
@@ -1232,7 +1232,7 @@ public:
// put something on s1 to get it going
m_replica = Replica::CreateReplica(nullptr);
m_chunk = CreateAndAttachReplicaChunk<RPCChunk>(m_replica);
m_replicaId = m_sessions[sHost].GetReplicaMgr().AddMaster(m_replica);
m_replicaId = m_sessions[sHost].GetReplicaMgr().AddPrimary(m_replica);
}
ReplicaPtr m_replica;
@@ -1286,7 +1286,7 @@ public:
// put something on s1 to get it going
m_replica = Replica::CreateReplica(nullptr);
m_chunk = CreateAndAttachReplicaChunk<FullRPCChunk>(m_replica);
m_replicaId = m_sessions[sHost].GetReplicaMgr().AddMaster(m_replica);
m_replicaId = m_sessions[sHost].GetReplicaMgr().AddPrimary(m_replica);
}
ReplicaPtr m_replica;
@@ -1391,7 +1391,7 @@ public:
{
// put something on s1 to get it going
m_replica = Replica::CreateReplica(nullptr);
m_replicaId = m_sessions[sHost].GetReplicaMgr().AddMaster(m_replica);
m_replicaId = m_sessions[sHost].GetReplicaMgr().AddPrimary(m_replica);
}
@@ -1453,7 +1453,7 @@ public:
{
ReplicaPtr replica = Replica::CreateReplica(nullptr);
m_chunk = CreateAndAttachReplicaChunk<AllEventChunk>(replica);
m_replicaId = m_sessions[sHost].GetReplicaMgr().AddMaster(replica);
m_replicaId = m_sessions[sHost].GetReplicaMgr().AddPrimary(replica);
AZ_TEST_ASSERT(m_chunk->m_attaches == 1);
AZ_TEST_ASSERT(m_chunk->m_activates == 1);
@@ -1531,7 +1531,7 @@ public:
auto chunk = CreateAndAttachReplicaChunk<AllEventChunk>(replica);
AZ_TEST_ASSERT(chunk);
}
m_replicaId = m_sessions[sHost].GetReplicaMgr().AddMaster(replica);
m_replicaId = m_sessions[sHost].GetReplicaMgr().AddPrimary(replica);
auto numChunks = replica->GetNumChunks();
AZ_TEST_ASSERT(numChunks == GM_MAX_CHUNKS_PER_REPLICA);
@@ -1594,7 +1594,7 @@ public:
{
m_replica = Replica::CreateReplica(nullptr);
m_chunk = CreateAndAttachReplicaChunk<AllEventChunk>(m_replica);
m_replicaId = m_sessions[sHost].GetReplicaMgr().AddMaster(m_replica);
m_replicaId = m_sessions[sHost].GetReplicaMgr().AddPrimary(m_replica);
AZ_TEST_ASSERT(m_chunk->m_attaches == 1);
AZ_TEST_ASSERT(m_chunk->m_activates == 1);
@@ -1820,16 +1820,16 @@ public:
++m_numRequestChangeOwnership;
}
void OnReplicaChangeOwnership(Replica* replica, bool wasMaster) override
void OnReplicaChangeOwnership(Replica* replica, bool wasPrimary) override
{
AZ_TEST_ASSERT(replica);
switch (m_numChangedOwnership)
{
case 0: // host loses ownership
AZ_TEST_ASSERT(replica->IsProxy() && wasMaster == true);
AZ_TEST_ASSERT(replica->IsProxy() && wasPrimary == true);
break;
case 1: // peer acquires ownership
AZ_TEST_ASSERT(replica->IsMaster() && wasMaster == false);
AZ_TEST_ASSERT(replica->IsPrimary() && wasPrimary == false);
break;
default:
AZ_TEST_ASSERT(0);
@@ -2008,7 +2008,7 @@ public:
ReplicaPtr replica = Replica::CreateReplica(nullptr);
CreateAndAttachReplicaChunk<DrillerTestChunk>(replica);
m_replicaId = m_sessions[sHost].GetReplicaMgr().AddMaster(replica);
m_replicaId = m_sessions[sHost].GetReplicaMgr().AddPrimary(replica);
}
~Integ_ReplicaDriller()
@@ -2038,7 +2038,7 @@ TEST_F(Integ_ReplicaDriller, ReplicaDriller)
{
auto rep = m_sessions[s2].GetReplicaMgr().FindReplica(m_replicaId);
AZ_TEST_ASSERT(rep);
AZ_TEST_ASSERT(rep->IsMaster());
AZ_TEST_ASSERT(rep->IsPrimary());
rep->Destroy();
break;
}
@@ -2110,7 +2110,7 @@ public:
{
m_replica = Replica::CreateReplica(nullptr);
m_chunk = CreateAndAttachReplicaChunk<DataSetChunk>(m_replica);
m_replicaId = m_sessions[sHost].GetReplicaMgr().AddMaster(m_replica);
m_replicaId = m_sessions[sHost].GetReplicaMgr().AddPrimary(m_replica);
}
@@ -2172,16 +2172,16 @@ public:
{
m_replica = Replica::CreateReplica(nullptr);
m_chunk = CreateAndAttachReplicaChunk<CustomHandlerChunk>(m_replica);
m_replicaId = m_sessions[sHost].GetReplicaMgr().AddMaster(m_replica);
m_masterHandler.reset(aznew CustomHandler());
m_replicaId = m_sessions[sHost].GetReplicaMgr().AddPrimary(m_replica);
m_primaryHandler.reset(aznew CustomHandler());
m_proxyHandler.reset(aznew CustomHandler());
m_chunk->SetHandler(m_masterHandler.get());
m_chunk->SetHandler(m_primaryHandler.get());
}
ReplicaPtr m_replica;
ReplicaId m_replicaId;
CustomHandlerChunk::Ptr m_chunk;
AZStd::scoped_ptr<CustomHandler> m_masterHandler;
AZStd::scoped_ptr<CustomHandler> m_primaryHandler;
AZStd::scoped_ptr<CustomHandler> m_proxyHandler;
};
@@ -2262,7 +2262,7 @@ public:
{
m_replica = Replica::CreateReplica(nullptr);
m_chunk = CreateAndAttachReplicaChunk<NonConstMarshalerChunk>(m_replica);
m_replicaId = m_sessions[sHost].GetReplicaMgr().AddMaster(m_replica);
m_replicaId = m_sessions[sHost].GetReplicaMgr().AddPrimary(m_replica);
}
ReplicaPtr m_replica;
@@ -2338,7 +2338,7 @@ public:
{
m_replica = Replica::CreateReplica(nullptr);
m_chunk = CreateAndAttachReplicaChunk<SourcePeerChunk>(m_replica);
m_replicaId = m_sessions[sHost].GetReplicaMgr().AddMaster(m_replica);
m_replicaId = m_sessions[sHost].GetReplicaMgr().AddPrimary(m_replica);
}
ReplicaPtr m_replica;
@@ -2488,7 +2488,7 @@ public:
m_chunks[i] = CreateAndAttachReplicaChunk<PriorityChunk>(replica);
m_chunks[i]->m_value.Set(i + 1); // setting dataset values to 1..kNumReplicas
m_chunks[i]->SetPriority(k_replicaPriorityNormal + static_cast<ReplicaPriority>(i)); // the later created - the higher priorities, so should be sent in reverse order
m_sessions[sHost].GetReplicaMgr().AddMaster(replica);
m_sessions[sHost].GetReplicaMgr().AddPrimary(replica);
}
}
@@ -2594,7 +2594,7 @@ public:
ReplicaPtr replica = Replica::CreateReplica(nullptr);
m_chunk = CreateAndAttachReplicaChunk<SuspendUpdatesChunk>(replica);
m_sessions[sHost].GetReplicaMgr().AddMaster(replica);
m_sessions[sHost].GetReplicaMgr().AddPrimary(replica);
}
SuspendUpdatesChunk::Ptr m_chunk = nullptr;
@@ -2684,9 +2684,9 @@ public:
void OnReplicaActivate(const GridMate::ReplicaContext&) override
{
if (IsMaster())
if (IsPrimary())
{
nMasterActivations++;
nPrimaryActivations++;
}
else
{
@@ -2694,11 +2694,11 @@ public:
}
}
static int nMasterActivations;
static int nPrimaryActivations;
static int nProxyActivations;
};
};
int Integ_BasicHostChunkDescriptorTest::HostChunk::nMasterActivations = 0;
int Integ_BasicHostChunkDescriptorTest::HostChunk::nPrimaryActivations = 0;
int Integ_BasicHostChunkDescriptorTest::HostChunk::nProxyActivations = 0;
TEST_F(Integ_BasicHostChunkDescriptorTest, BasicHostChunkDescriptorTest)
@@ -2744,25 +2744,25 @@ TEST_F(Integ_BasicHostChunkDescriptorTest, BasicHostChunkDescriptorTest)
{
hostReplica = Replica::CreateReplica("HostReplica");
hostReplica->AttachReplicaChunk(CreateReplicaChunk<HostChunk>());
nodes[Host].GetReplicaMgr().AddMaster(hostReplica);
nodes[Host].GetReplicaMgr().AddPrimary(hostReplica);
}
if (tick == 300)
{
AZ_TEST_ASSERT(HostChunk::nMasterActivations == 1);
AZ_TEST_ASSERT(HostChunk::nPrimaryActivations == 1);
AZ_TEST_ASSERT(HostChunk::nProxyActivations == 1);
AZ_TEST_ASSERT(nodes[Client].GetReplicaMgr().FindReplica(hostReplica->GetRepId())->FindReplicaChunk<HostChunk>());
AZ_TEST_START_TRACE_SUPPRESSION;
clientReplica = Replica::CreateReplica("ClientReplica");
clientReplica->AttachReplicaChunk(CreateReplicaChunk<HostChunk>());
nodes[Client].GetReplicaMgr().AddMaster(clientReplica);
nodes[Client].GetReplicaMgr().AddPrimary(clientReplica);
}
if (tick == 400)
{
AZ_TEST_STOP_TRACE_SUPPRESSION(1);
AZ_TEST_ASSERT(HostChunk::nMasterActivations == 2);
AZ_TEST_ASSERT(HostChunk::nPrimaryActivations == 2);
AZ_TEST_ASSERT(HostChunk::nProxyActivations == 1);
AZ_TEST_ASSERT(!nodes[Host].GetReplicaMgr().FindReplica(clientReplica->GetRepId())->FindReplicaChunk<HostChunk>());
}
@@ -2792,10 +2792,10 @@ TEST_F(Integ_BasicHostChunkDescriptorTest, BasicHostChunkDescriptorTest)
}
/*
* Create and immedietly destroy master replica
* Create and immedietly destroy primary replica
* Test that it does not result in any network sync
*/
class Integ_CreateDestroyMaster
class Integ_CreateDestroyPrimary
: public Integ_SimpleTest
, public Debug::ReplicaDrillerBus::Handler
{
@@ -2831,7 +2831,7 @@ public:
}
};
TEST_F(Integ_CreateDestroyMaster, CreateDestroyMaster)
TEST_F(Integ_CreateDestroyPrimary, CreateDestroyPrimary)
{
RunTickLoop([this](int tick)-> TestStatus
{
@@ -2843,7 +2843,7 @@ TEST_F(Integ_CreateDestroyMaster, CreateDestroyMaster)
ConnectDriller();
auto replica = Replica::CreateReplica(nullptr);
CreateAndAttachReplicaChunk<DataSetChunk>(replica);
m_sessions[sHost].GetReplicaMgr().AddMaster(replica);
m_sessions[sHost].GetReplicaMgr().AddPrimary(replica);
// Destroying replica right away
replica->Destroy();
@@ -2894,7 +2894,7 @@ public:
LargeChunkWithDefaultsMedium* chunk = CreateAndAttachReplicaChunk<LargeChunkWithDefaultsMedium>(replica);
AZ_TEST_ASSERT(chunk);
m_replicaId = m_sessions[sHost].GetReplicaMgr().AddMaster(replica);
m_replicaId = m_sessions[sHost].GetReplicaMgr().AddPrimary(replica);
}
~ReplicaACKfeedbackTestFixture()
@@ -234,7 +234,7 @@ public:
/**
* OfflineModeTest verifies that replica chunks are usable without
* an active session, and basically behave as masters.
* an active session, and basically behave as primarys.
*/
class OfflineModeTest
: public UnitTest::GridMateMPTestFixture
@@ -297,7 +297,7 @@ public:
AZ_TEST_ASSERT(OfflineChunk::s_nInstances == 1);
ReplicaChunkPtr chunkPtr = offlineChunk;
chunkPtr->Init(ReplicaChunkClassId(OfflineChunk::GetChunkName()));
AZ_TEST_ASSERT(chunkPtr->IsMaster());
AZ_TEST_ASSERT(chunkPtr->IsPrimary());
AZ_TEST_ASSERT(!chunkPtr->IsProxy());
offlineChunk->m_data1.Set(5);
AZ_TEST_ASSERT(offlineChunk->m_data1.Get() == 5);
@@ -315,7 +315,7 @@ public:
return true;
});
AZ_TEST_ASSERT(offlineChunk->m_data2.Get() == 10);
AZ_TEST_ASSERT(offlineChunk->m_nCallsDataSetChangeCB == 0); // DataSet change CB doesn't get called on master.
AZ_TEST_ASSERT(offlineChunk->m_nCallsDataSetChangeCB == 0); // DataSet change CB doesn't get called on primary.
offlineChunk->CallRpc();
AZ_TEST_ASSERT(offlineChunk->m_nCallsRpcHandlerCB == 1);
@@ -325,11 +325,11 @@ public:
AZ_TEST_ASSERT(strcmp(offlineReplica->GetDebugName(), replicaName) == 0);
offlineReplica->AttachReplicaChunk(chunkPtr);
AZ_TEST_ASSERT(chunkPtr->IsMaster());
AZ_TEST_ASSERT(chunkPtr->IsPrimary());
AZ_TEST_ASSERT(!chunkPtr->IsProxy());
offlineReplica->DetachReplicaChunk(chunkPtr);
AZ_TEST_ASSERT(chunkPtr->IsMaster());
AZ_TEST_ASSERT(chunkPtr->IsPrimary());
AZ_TEST_ASSERT(!chunkPtr->IsProxy());
AZ_TEST_ASSERT(OfflineChunk::s_nInstances == 1);
@@ -462,7 +462,7 @@ public:
ReplicaPeer peer(&rm);
AZ_TracePrintf("GridMate", "\n");
Replica* replica = Replica::CreateReplica("TestMasterReplica");
Replica* replica = Replica::CreateReplica("TestPrimaryReplica");
ReplicaChunkDescriptorTable::Get().RegisterChunkType<SimpleDataSetChunk>();
AZStd::unique_ptr<SimpleDataSetChunk> chunk(CreateReplicaChunk<SimpleDataSetChunk>());
@@ -496,4 +496,4 @@ GM_TEST_SUITE(StreamSecureSocketDriverTests)
GM_TEST(Integ_StreamSecureSocketDriverTestsPingPong);
GM_TEST_SUITE_END()
#endif // AZ_TRAIT_GRIDMATE_ENABLE_OPENSSL
#endif // AZ_TRAIT_GRIDMATE_ENABLE_OPENSSL
@@ -1 +1 @@
480
480