a few more changes to iar/oar assets save error/warning to show problems known to be asset errors

0.9.0-post-fixes
UbitUmarov 2017-06-24 02:01:48 +01:00
parent 0a1f497dee
commit 191661b51d
3 changed files with 70 additions and 24 deletions

View File

@ -223,10 +223,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
if (SaveAssets && itemAssetType != AssetType.Link && itemAssetType != AssetType.LinkFolder)
{
int curErrorCntr = m_assetGatherer.ErrorCount;
int possible = m_assetGatherer.possibleNotAssetCount;
m_assetGatherer.AddForInspection(inventoryItem.AssetID);
m_assetGatherer.GatherAll();
curErrorCntr = m_assetGatherer.ErrorCount - curErrorCntr;
if(curErrorCntr > 0)
possible = m_assetGatherer.possibleNotAssetCount - possible;
if(curErrorCntr > 0 || possible > 0)
{
string spath;
int indx = path.IndexOf("__");
@ -235,15 +238,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
else
spath = path;
if(curErrorCntr > 1)
if(curErrorCntr > 0)
{
m_log.WarnFormat("[INVENTORY ARCHIVER Warning]: item {0} '{1}', type {2}, in '{3}', contains {4} references to possible missing or damaged assets )",
m_log.ErrorFormat("[INVENTORY ARCHIVER Warning]: item {0} '{1}', type {2}, in '{3}', contains {4} references to missing or damaged assets",
inventoryItem.ID, inventoryItem.Name, itemAssetType.ToString(), spath, curErrorCntr);
if(possible > 0)
m_log.WarnFormat("[INVENTORY ARCHIVER Warning]: item also contains {0} references that may be to missing or damaged assets or not a problem", possible);
}
else if(curErrorCntr == 1)
{
m_log.WarnFormat("[INVENTORY ARCHIVER Warning]: item {0} '{1}', type {2}, in '{3}', contains a reference to a possible missing or damaged asset)",
inventoryItem.ID, inventoryItem.Name, itemAssetType.ToString(), spath);
else if(possible > 0)
{
m_log.WarnFormat("[INVENTORY ARCHIVER Warning]: item {0} '{1}', type {2}, in '{3}', contains {4} references that may be to missing or damaged assets or not a problem", inventoryItem.ID, inventoryItem.Name, itemAssetType.ToString(), spath, possible);
}
}
}

View File

@ -182,11 +182,12 @@ namespace OpenSim.Region.CoreModules.World.Archiver
Dictionary<UUID, sbyte> assetUuids = new Dictionary<UUID, sbyte>();
HashSet<UUID> failedIDs = new HashSet<UUID>();
HashSet<UUID> uncertainAssetsUUIDs = new HashSet<UUID>();
scenesGroup.ForEachScene(delegate(Scene scene)
{
string regionDir = MultiRegionFormat ? scenesGroup.GetRegionDir(scene.RegionInfo.RegionID) : "";
ArchiveOneRegion(scene, regionDir, assetUuids, failedIDs);
ArchiveOneRegion(scene, regionDir, assetUuids, failedIDs, uncertainAssetsUUIDs);
});
// Archive the assets
@ -217,7 +218,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
}
}
private void ArchiveOneRegion(Scene scene, string regionDir, Dictionary<UUID, sbyte> assetUuids, HashSet<UUID> failedIDs)
private void ArchiveOneRegion(Scene scene, string regionDir, Dictionary<UUID, sbyte> assetUuids,
HashSet<UUID> failedIDs, HashSet<UUID> uncertainAssetsUUIDs)
{
m_log.InfoFormat("[ARCHIVER]: Writing region {0}", scene.Name);
@ -253,24 +255,28 @@ namespace OpenSim.Region.CoreModules.World.Archiver
if (SaveAssets)
{
UuidGatherer assetGatherer = new UuidGatherer(scene.AssetService, assetUuids, failedIDs);
UuidGatherer assetGatherer = new UuidGatherer(scene.AssetService, assetUuids, failedIDs, uncertainAssetsUUIDs);
int prevAssets = assetUuids.Count;
foreach (SceneObjectGroup sceneObject in sceneObjects)
{
int curErrorCntr = assetGatherer.ErrorCount;
int possible = assetGatherer.possibleNotAssetCount;
assetGatherer.AddForInspection(sceneObject);
assetGatherer.GatherAll();
curErrorCntr = assetGatherer.ErrorCount - curErrorCntr;
if(curErrorCntr > 1)
possible = assetGatherer.possibleNotAssetCount - possible;
if(curErrorCntr > 0)
{
m_log.WarnFormat("[ARCHIVER Warning]: object {0} '{1}', at {2}, contains {3} references to possible missing or damaged assets",
m_log.ErrorFormat("[ARCHIVER]: object {0} '{1}', at {2}, contains {3} references to missing or damaged assets",
sceneObject.UUID, sceneObject.Name ,sceneObject.AbsolutePosition.ToString(), curErrorCntr);
if(possible > 0)
m_log.WarnFormat("[ARCHIVER Warning]: object also contains {0} references that may be to missing or damaged assets or not a problem", possible);
}
else if(curErrorCntr == 1)
{
m_log.WarnFormat("[ARCHIVER Warning]: object {0} '{1}', at {2}, contains a reference to a possible missing or damaged assets",
sceneObject.UUID, sceneObject.Name, sceneObject.AbsolutePosition.ToString());
else if(possible > 0)
{
m_log.WarnFormat("[ARCHIVER Warning]: object {0} '{1}', at {2}, contains {3} references that may be to missing or damaged assets or not a problem",
sceneObject.UUID, sceneObject.Name ,sceneObject.AbsolutePosition.ToString(), possible);
}
}

View File

@ -66,6 +66,8 @@ namespace OpenSim.Region.Framework.Scenes
/// <value>The gathered uuids.</value>
public IDictionary<UUID, sbyte> GatheredUuids { get; private set; }
public HashSet<UUID> FailedUUIDs { get; private set; }
public HashSet<UUID> UncertainAssetsUUIDs { get; private set; }
public int possibleNotAssetCount { get; set; }
public int ErrorCount { get; private set; }
/// <summary>
/// Gets the next UUID to inspect.
@ -93,8 +95,10 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="assetService">
/// Asset service.
/// </param>
public UuidGatherer(IAssetService assetService) : this(assetService, new Dictionary<UUID, sbyte>(), new HashSet <UUID>()) {}
public UuidGatherer(IAssetService assetService, IDictionary<UUID, sbyte> collector) : this(assetService, collector, new HashSet <UUID>()) {}
public UuidGatherer(IAssetService assetService) : this(assetService, new Dictionary<UUID, sbyte>(),
new HashSet <UUID>(),new HashSet <UUID>()) {}
public UuidGatherer(IAssetService assetService, IDictionary<UUID, sbyte> collector) : this(assetService, collector,
new HashSet <UUID>(), new HashSet <UUID>()) {}
/// <summary>
/// Initializes a new instance of the <see cref="OpenSim.Region.Framework.Scenes.UuidGatherer"/> class.
@ -106,7 +110,7 @@ namespace OpenSim.Region.Framework.Scenes
/// Gathered UUIDs will be collected in this dictionary.
/// It can be pre-populated if you want to stop the gatherer from analyzing assets that have already been fetched and inspected.
/// </param>
public UuidGatherer(IAssetService assetService, IDictionary<UUID, sbyte> collector, HashSet <UUID> failedIDs)
public UuidGatherer(IAssetService assetService, IDictionary<UUID, sbyte> collector, HashSet <UUID> failedIDs, HashSet <UUID> uncertainAssetsUUIDs)
{
m_assetService = assetService;
GatheredUuids = collector;
@ -114,7 +118,9 @@ namespace OpenSim.Region.Framework.Scenes
// FIXME: Not efficient for searching, can improve.
m_assetUuidsToInspect = new Queue<UUID>();
FailedUUIDs = failedIDs;
UncertainAssetsUUIDs = uncertainAssetsUUIDs;
ErrorCount = 0;
possibleNotAssetCount = 0;
}
/// <summary>
@ -124,8 +130,17 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="uuid">UUID.</param>
public bool AddForInspection(UUID uuid)
{
if(uuid == UUID.Zero)
return false;
if(FailedUUIDs.Contains(uuid))
return false;
{
if(UncertainAssetsUUIDs.Contains(uuid))
possibleNotAssetCount++;
else
ErrorCount++;
return false;
}
if(GatheredUuids.ContainsKey(uuid))
return false;
if (m_assetUuidsToInspect.Contains(uuid))
@ -283,9 +298,15 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="assetUuid">The uuid of the asset for which to gather referenced assets</param>
private void GetAssetUuids(UUID assetUuid)
{
if(assetUuid == UUID.Zero)
return;
if(FailedUUIDs.Contains(assetUuid))
{
ErrorCount++;
if(UncertainAssetsUUIDs.Contains(assetUuid))
possibleNotAssetCount++;
else
ErrorCount++;
return;
}
@ -309,11 +330,17 @@ namespace OpenSim.Region.Framework.Scenes
if(assetBase == null)
{
// m_log.ErrorFormat("[UUID GATHERER]: asset {0} not found", assetUuid);
ErrorCount++;
FailedUUIDs.Add(assetUuid);
if(UncertainAssetsUUIDs.Contains(assetUuid))
possibleNotAssetCount++;
else
ErrorCount++;
return;
}
if(UncertainAssetsUUIDs.Contains(assetUuid))
UncertainAssetsUUIDs.Remove(assetUuid);
sbyte assetType = assetBase.Type;
if(assetBase.Data == null || assetBase.Data.Length == 0)
@ -363,10 +390,16 @@ namespace OpenSim.Region.Framework.Scenes
private void AddForInspection(UUID assetUuid, sbyte assetType)
{
if(assetUuid == UUID.Zero)
return;
// Here, we want to collect uuids which require further asset fetches but mark the others as gathered
if(FailedUUIDs.Contains(assetUuid))
{
ErrorCount++;
if(UncertainAssetsUUIDs.Contains(assetUuid))
possibleNotAssetCount++;
else
ErrorCount++;
return;
}
if(GatheredUuids.ContainsKey(assetUuid))
@ -502,8 +535,11 @@ namespace OpenSim.Region.Framework.Scenes
foreach (Match uuidMatch in uuidMatches)
{
UUID uuid = new UUID(uuidMatch.Value);
if(uuid == UUID.Zero)
continue;
// m_log.DebugFormat("[UUID GATHERER]: Recording {0} in text", uuid);
if(!UncertainAssetsUUIDs.Contains(uuid))
UncertainAssetsUUIDs.Add(uuid);
AddForInspection(uuid);
}
}