add more cooldown to flotsam cache files expire

This commit is contained in:
UbitUmarov
2020-05-18 00:20:28 +01:00
parent fe72b54652
commit 4fa8e20aab
3 changed files with 129 additions and 40 deletions

View File

@@ -122,7 +122,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
public static bool TryFromXml(string xml, out CoalescedSceneObjects coa)
{
// m_log.DebugFormat("[COALESCED SCENE OBJECTS SERIALIZER]: TryFromXml() deserializing {0}", xml);
// m_log.DebugFormat("[COALESCED SCENE OBJECTS SERIALIZER]: TryFromXml() deserializing {0}", xml);
coa = null;
@@ -137,9 +137,9 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
if (reader.Name != "CoalescedObject")
{
// m_log.DebugFormat(
// "[COALESCED SCENE OBJECTS SERIALIZER]: TryFromXml() root element was {0} so returning false",
// reader.Name);
// m_log.DebugFormat(
// "[COALESCED SCENE OBJECTS SERIALIZER]: TryFromXml() root element was {0} so returning false",
// reader.Name);
return false;
}
@@ -178,12 +178,73 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
}
catch (Exception e)
{
m_log.Error("[COALESCED SCENE OBJECTS SERIALIZER]: Deserialization of xml failed ", e);
m_log.Error("[COALESCED SCENE OBJECTS SERIALIZER]: Deserialization of xml failed ", e);
Util.LogFailedXML("[COALESCED SCENE OBJECTS SERIALIZER]:", xml);
return false;
}
return true;
}
public static bool TryFromXmlData(byte[] data, out CoalescedSceneObjects coa)
{
// m_log.DebugFormat("[COALESCED SCENE OBJECTS SERIALIZER]: TryFromXml() deserializing {0}", xml);
coa = null;
try
{
// Quickly check if this is a coalesced object, without fully parsing the XML
using (MemoryStream ms = new MemoryStream(data))
{
using (XmlTextReader reader = new XmlTextReader(ms))
{
reader.MoveToContent(); // skip possible xml declaration
if (reader.Name != "CoalescedObject")
{
return false;
}
}
ms.Seek(0, SeekOrigin.Begin);
XmlDocument doc = new XmlDocument();
doc.Load(ms);
XmlElement e = (XmlElement)doc.SelectSingleNode("/CoalescedObject");
if (e == null)
return false;
coa = new CoalescedSceneObjects(UUID.Zero);
XmlNodeList groups = e.SelectNodes("SceneObjectGroup");
int i = 0;
foreach (XmlNode n in groups)
{
SceneObjectGroup so = SceneObjectSerializer.FromOriginalXmlFormat(n.OuterXml);
if (so != null)
{
coa.Add(so);
}
else
{
// XXX: Possibly we should fail outright here rather than continuing if a particular component of the
// coalesced object fails to load.
m_log.WarnFormat(
"[COALESCED SCENE OBJECTS SERIALIZER]: Deserialization of xml for component {0} failed. Continuing.",
i);
}
i++;
}
}
}
catch (Exception e)
{
m_log.Error("[COALESCED SCENE OBJECTS SERIALIZER]: Deserialization of binary xml failed ", e);
return false;
}
return true;
}
}
}

View File

@@ -293,6 +293,33 @@ namespace OpenSim.Region.Framework.Scenes
possibleNotAssetCount = 0;
}
public bool AddGathered(UUID uuid, sbyte type)
{
if (uuid == UUID.Zero)
return false;
if (ToSkip.Contains(uuid))
return false;
if (FailedUUIDs.Contains(uuid))
{
if (UncertainAssetsUUIDs.Contains(uuid))
possibleNotAssetCount++;
else
ErrorCount++;
return false;
}
if (GatheredUuids.ContainsKey(uuid))
return false;
if (m_assetUuidsToInspect.Contains(uuid))
return false;
// m_log.DebugFormat("[UUID GATHERER]: Adding asset {0} for inspection", uuid);
GatheredUuids[uuid] = type;
return true;
}
/// <summary>
/// Adds the asset uuid for inspection during the gathering process.
/// </summary>
@@ -346,8 +373,8 @@ namespace OpenSim.Region.Framework.Scenes
{
SceneObjectPart part = parts[i];
// m_log.DebugFormat(
// "[UUID GATHERER]: Getting part {0}, {1} for object {2}", part.Name, part.UUID, sceneObject.UUID);
// m_log.DebugFormat(
// "[UUID GATHERER]: Getting part {0}, {1} for object {2}", part.Name, part.UUID, sceneObject.UUID);
try
{
@@ -406,13 +433,6 @@ namespace OpenSim.Region.Framework.Scenes
AddForInspection(tii.AssetID, (sbyte)tii.Type);
}
// FIXME: We need to make gathering modular but we cannot yet, since gatherers are not guaranteed
// to be called with scene objects that are in a scene (e.g. in the case of hg asset mapping and
// inventory transfer. There needs to be a way for a module to register a method without assuming a
// Scene.EventManager is present.
// part.ParentGroup.Scene.EventManager.TriggerGatherUuids(part, assetUuids);
// still needed to retrieve textures used as materials for any parts containing legacy materials stored in DynAttrs
RecordMaterialsUuids(part);
}
catch (Exception e)
@@ -778,10 +798,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="sceneObjectAsset"></param>
private void RecordSceneObjectAssetUuids(AssetBase sceneObjectAsset)
{
string xml = Utils.BytesToString(sceneObjectAsset.Data);
CoalescedSceneObjects coa;
if (CoalescedSceneObjectsSerializer.TryFromXml(xml, out coa))
if (CoalescedSceneObjectsSerializer.TryFromXmlData(sceneObjectAsset.Data, out CoalescedSceneObjects coa))
{
foreach (SceneObjectGroup sog in coa.Objects)
{
@@ -791,7 +808,7 @@ namespace OpenSim.Region.Framework.Scenes
}
else
{
SceneObjectGroup sog = SceneObjectSerializer.FromOriginalXmlFormat(xml);
SceneObjectGroup sog = SceneObjectSerializer.FromOriginalXmlFormat(Utils.BytesToString(sceneObjectAsset.Data));
if (null != sog)
{
sog.TemporaryInstance = true;