Added logic in RegionSyncModule so that a SyncRelay node (e.g. PSA) only sends out updates for a bucket

that has properties updated in the last update interval.
dsg
Huaiyu (Kitty) Liu 2011-03-11 16:29:10 -08:00
parent 37dd39fd5d
commit 4803745c0d
1 changed files with 46 additions and 4 deletions

View File

@ -198,16 +198,16 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
foreach (string bucketName in m_propertyBucketNames)
{
if (m_isSyncRelay || part.HasPropertyUpdatedLocallyInGivenBucket(bucketName))
//if (m_isSyncRelay || part.HasPropertyUpdatedLocallyInGivenBucket(bucketName))
if(ToSendoutUpdate(part, bucketName))
{
lock (m_primUpdateLocks[bucketName])
{
//m_log.Debug("Queueing to bucket " + bucketName + " with part " + part.Name + ", " + part.UUID);
m_log.Debug("Queueing to bucket " + bucketName + " with part " + part.Name + ", " + part.UUID);
m_primUpdates[bucketName][part.UUID] = part;
}
}
}
}
}
@ -708,6 +708,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
private delegate void PrimUpdatePerBucketSender(string bucketName, List<SceneObjectPart> primUpdates);
private Dictionary<string, PrimUpdatePerBucketSender> m_primUpdatesPerBucketSender = new Dictionary<string, PrimUpdatePerBucketSender>();
//Timestamps that record the last time each any updates have been sent out for a given bucket
private Dictionary<string, long> m_lastUpdateSentTime = new Dictionary<string, long>();
private object m_updateScenePresenceLock = new object();
private Dictionary<UUID, ScenePresence> m_presenceUpdates = new Dictionary<UUID, ScenePresence>();
@ -735,6 +737,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
//Going forward, we may serialize the properties differently, e.g. using OSDMap
private void PrimUpdatesGeneralBucketSender(string bucketName, List<SceneObjectPart> primUpdates)
{
UpdateBucektLastSentTime(bucketName);
Dictionary<UUID, SceneObjectGroup> updatedObjects = new Dictionary<UUID, SceneObjectGroup>();
foreach (SceneObjectPart part in primUpdates)
{
@ -747,10 +751,13 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
SymmetricSyncMessage syncMsg = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.UpdatedObject, sogxml);
SendObjectUpdateToRelevantSyncConnectors(sog, syncMsg);
}
}
private void PrimUpdatesPhysicsBucketSender(string bucketName, List<SceneObjectPart> primUpdates)
{
UpdateBucektLastSentTime(bucketName);
foreach (SceneObjectPart updatedPart in primUpdates)
{
updatedPart.UpdateTaintedBucketSyncInfo(bucketName, DateTime.Now.Ticks);
@ -796,7 +803,39 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
//m_log.DebugFormat("{0}: PhysBucketSender for {1}, pos={2}", LogHeader, updatedPart.UUID.ToString(), pa.Position.ToString());
SendObjectUpdateToRelevantSyncConnectors(updatedPart, syncMsg);
}
}
private void UpdateBucektLastSentTime(string bucketName)
{
long timeStamp = DateTime.Now.Ticks;
/*
if (m_lastUpdateSentTime.ContainsKey(bucketName))
{
m_lastUpdateSentTime[bucketName] = timeStamp;
}
else
{
m_lastUpdateSentTime.Add(bucketName, timeStamp);
}
* */
m_lastUpdateSentTime[bucketName] = timeStamp;
}
private bool ToSendoutUpdate(SceneObjectPart part, string bucketName)
{
if (!m_isSyncRelay)
{
return part.HasPropertyUpdatedLocallyInGivenBucket(bucketName);
}
//if this is a relay node, forward out the updates that have not been sent out since lastUpdateSentTime
if (m_lastUpdateSentTime[bucketName] <= part.BucketSyncInfoList[bucketName].LastUpdateTimeStamp)
return true;
else
return false;
}
//If nothing configured in the config file, this is the default settings for grouping properties into different bucket
private void PopulatePropertyBuketMapByDefault()
{
@ -811,6 +850,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
m_primUpdatesPerBucketSender.Add("General", PrimUpdatesGeneralBucketSender);
m_primUpdatesPerBucketSender.Add("Physics", PrimUpdatesPhysicsBucketSender);
m_lastUpdateSentTime.Add("General", 0);
m_lastUpdateSentTime.Add("Physics", 0);
//Mapping properties to buckets.
foreach (SceneObjectPartProperties property in Enum.GetValues(typeof(SceneObjectPartProperties)))
{