reduce some spam on log
parent
169f161576
commit
c2ab11a51e
|
@ -27,10 +27,8 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Threading;
|
using System.Text;
|
||||||
using System.Xml;
|
|
||||||
|
|
||||||
using log4net;
|
using log4net;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
|
@ -38,13 +36,8 @@ using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Serialization.External;
|
using OpenSim.Framework.Serialization.External;
|
||||||
|
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
using OpenSim.Region.Framework.Scenes.Serialization;
|
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
|
||||||
using OpenSim.Services.Interfaces;
|
using OpenSim.Services.Interfaces;
|
||||||
|
|
||||||
//using HyperGrid.Framework;
|
|
||||||
//using OpenSim.Region.Communications.Hypergrid;
|
|
||||||
|
|
||||||
namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
{
|
{
|
||||||
public class HGAssetMapper
|
public class HGAssetMapper
|
||||||
|
@ -114,20 +107,20 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
return asset;
|
return asset;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool PostAsset(string url, AssetBase asset)
|
public bool PostAsset(string url, AssetBase asset, bool verbose = true)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(url))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (!url.EndsWith("/") && !url.EndsWith("="))
|
|
||||||
url = url + "/";
|
|
||||||
|
|
||||||
if (asset == null)
|
if (asset == null)
|
||||||
{
|
{
|
||||||
m_log.Warn("[HG ASSET MAPPER]: Tried to post asset to remote server, but asset not in local cache.");
|
m_log.Warn("[HG ASSET MAPPER]: Tried to post asset to remote server, but asset not in local cache.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(url))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!url.EndsWith("/") && !url.EndsWith("="))
|
||||||
|
url = url + "/";
|
||||||
|
|
||||||
// See long comment in AssetCache.AddAsset
|
// See long comment in AssetCache.AddAsset
|
||||||
if (asset.Temporary || asset.Local)
|
if (asset.Temporary || asset.Local)
|
||||||
return true;
|
return true;
|
||||||
|
@ -150,14 +143,15 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
string id = m_scene.AssetService.Store(asset1);
|
string id = m_scene.AssetService.Store(asset1);
|
||||||
if (String.IsNullOrEmpty(id))
|
if (String.IsNullOrEmpty(id))
|
||||||
{
|
{
|
||||||
|
if (verbose)
|
||||||
m_log.DebugFormat("[HG ASSET MAPPER]: Asset server {0} did not accept {1}", url, asset.ID);
|
m_log.DebugFormat("[HG ASSET MAPPER]: Asset server {0} did not accept {1}", url, asset.ID);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
|
if (verbose)
|
||||||
m_log.DebugFormat("[HG ASSET MAPPER]: Posted copy of asset {0} from local asset server to {1}", asset1.ID, url);
|
m_log.DebugFormat("[HG ASSET MAPPER]: Posted copy of asset {0} from local asset server to {1}", asset1.ID, url);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void Copy(AssetBase from, AssetBase to)
|
private void Copy(AssetBase from, AssetBase to)
|
||||||
{
|
{
|
||||||
|
@ -176,13 +170,14 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(meta.CreatorID))
|
if (!string.IsNullOrEmpty(meta.CreatorID))
|
||||||
{
|
{
|
||||||
UUID uuid = UUID.Zero;
|
if(UUID.TryParse(meta.CreatorID, out UUID uuid))
|
||||||
UUID.TryParse(meta.CreatorID, out uuid);
|
{
|
||||||
UserAccount creator = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, uuid);
|
UserAccount creator = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, uuid);
|
||||||
if (creator != null)
|
if (creator != null)
|
||||||
meta.CreatorID = m_HomeURI + ";" + creator.FirstName + " " + creator.LastName;
|
meta.CreatorID = m_HomeURI + ";" + creator.FirstName + " " + creator.LastName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected byte[] AdjustIdentifiers(byte[] data)
|
protected byte[] AdjustIdentifiers(byte[] data)
|
||||||
{
|
{
|
||||||
|
@ -240,17 +235,15 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
|
|
||||||
public void Post(UUID assetID, UUID ownerID, string userAssetURL)
|
public void Post(UUID assetID, UUID ownerID, string userAssetURL)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[HG ASSET MAPPER]: Starting to send asset {0} with children to asset server {1}", assetID, userAssetURL);
|
|
||||||
|
|
||||||
// Find all the embedded assets
|
|
||||||
|
|
||||||
AssetBase asset = m_scene.AssetService.Get(assetID.ToString());
|
AssetBase asset = m_scene.AssetService.Get(assetID.ToString());
|
||||||
if (asset == null)
|
if (asset == null)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[HG ASSET MAPPER]: Something wrong with asset {0}, it could not be found", assetID);
|
m_log.DebugFormat("[HG ASSET MAPPER POST]: Something wrong with asset {0}, it could not be found", assetID);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
m_log.DebugFormat("[HG ASSET MAPPER POST]: Starting to send asset {0} to asset server {1}", assetID, userAssetURL);
|
||||||
|
|
||||||
|
// Find all the embedded assets
|
||||||
HGUuidGatherer uuidGatherer = new HGUuidGatherer(m_scene.AssetService, string.Empty);
|
HGUuidGatherer uuidGatherer = new HGUuidGatherer(m_scene.AssetService, string.Empty);
|
||||||
uuidGatherer.AddForInspection(asset.FullID);
|
uuidGatherer.AddForInspection(asset.FullID);
|
||||||
uuidGatherer.GatherAll();
|
uuidGatherer.GatherAll();
|
||||||
|
@ -266,7 +259,16 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
foreach (UUID id in uuidGatherer.GatheredUuids.Keys)
|
foreach (UUID id in uuidGatherer.GatheredUuids.Keys)
|
||||||
remoteAssetIDs[i++] = url + id.ToString();
|
remoteAssetIDs[i++] = url + id.ToString();
|
||||||
|
|
||||||
bool[] exist = m_scene.AssetService.AssetsExist(remoteAssetIDs);
|
bool[] exist;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
exist = m_scene.AssetService.AssetsExist(remoteAssetIDs);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("[HG ASSET MAPPER POST]: Problems sending asset {0} to asset server {1}", assetID, userAssetURL);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var existSet = new HashSet<string>();
|
var existSet = new HashSet<string>();
|
||||||
i = 0;
|
i = 0;
|
||||||
|
@ -280,27 +282,34 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
// Send only those assets which don't already exist in the destination server
|
// Send only those assets which don't already exist in the destination server
|
||||||
|
|
||||||
bool success = true;
|
bool success = true;
|
||||||
|
var notFound = new List<string>();
|
||||||
|
var posted = new List<string>();
|
||||||
|
|
||||||
foreach (UUID uuid in uuidGatherer.GatheredUuids.Keys)
|
foreach (UUID uuid in uuidGatherer.GatheredUuids.Keys)
|
||||||
{
|
{
|
||||||
if (!existSet.Contains(uuid.ToString()))
|
string idstr = uuid.ToString();
|
||||||
{
|
if (existSet.Contains(idstr))
|
||||||
asset = m_scene.AssetService.Get(uuid.ToString());
|
continue;
|
||||||
|
|
||||||
|
asset = m_scene.AssetService.Get(idstr);
|
||||||
if (asset == null)
|
if (asset == null)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[HG ASSET MAPPER]: Could not find asset {0}", uuid);
|
notFound.Add(idstr);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
success &= PostAsset(userAssetURL, asset);
|
bool b = PostAsset(userAssetURL, asset, false);
|
||||||
|
if(b)
|
||||||
|
posted.Add(idstr);
|
||||||
|
success &= b;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.Error(
|
m_log.Error(
|
||||||
string.Format(
|
string.Format(
|
||||||
"[HG ASSET MAPPER]: Failed to post asset {0} (type {1}, length {2}) referenced from {3} to {4} with exception ",
|
"[HG ASSET MAPPER POST]: Failed to post asset {0} (type {1}, length {2}) referenced from {3} to {4} with exception ",
|
||||||
asset.ID, asset.Type, asset.Data.Length, assetID, userAssetURL),
|
asset.ID, asset.Type, asset.Data.Length, assetID, userAssetURL),
|
||||||
e);
|
e);
|
||||||
|
|
||||||
|
@ -311,19 +320,56 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
StringBuilder sb = null;
|
||||||
else
|
if (notFound.Count > 0)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat(
|
if (sb == null)
|
||||||
"[HG ASSET MAPPER]: Didn't post asset {0} referenced from {1} because it already exists in asset server {2}",
|
sb = new StringBuilder(512);
|
||||||
uuid, assetID, userAssetURL);
|
i = notFound.Count;
|
||||||
|
sb.Append("[HG ASSET MAPPER POST]: Missing assets:\n\t");
|
||||||
|
for (int j = 0; j < notFound.Count; ++j)
|
||||||
|
{
|
||||||
|
sb.Append(notFound[j]);
|
||||||
|
if (i < j)
|
||||||
|
sb.Append(',');
|
||||||
}
|
}
|
||||||
|
m_log.Debug(sb.ToString());
|
||||||
|
sb.Clear();
|
||||||
|
}
|
||||||
|
if (existSet.Count > 0)
|
||||||
|
{
|
||||||
|
if (sb == null)
|
||||||
|
sb = new StringBuilder(512);
|
||||||
|
i = existSet.Count;
|
||||||
|
sb.Append("[HG ASSET MAPPER POST]: Already at destination server:\n\t");
|
||||||
|
foreach (UUID id in existSet)
|
||||||
|
{
|
||||||
|
sb.Append(id);
|
||||||
|
if (--i > 0)
|
||||||
|
sb.Append(',');
|
||||||
|
}
|
||||||
|
m_log.Debug(sb.ToString());
|
||||||
|
sb.Clear();
|
||||||
|
}
|
||||||
|
if (posted.Count > 0)
|
||||||
|
{
|
||||||
|
if (sb == null)
|
||||||
|
sb = new StringBuilder(512);
|
||||||
|
i = posted.Count;
|
||||||
|
sb.Append("[HG ASSET MAPPER POST]: Posted assets:\n\t");
|
||||||
|
for (int j = 0; j < posted.Count; ++j)
|
||||||
|
{
|
||||||
|
sb.Append(posted[j]);
|
||||||
|
if (i < j)
|
||||||
|
sb.Append(',');
|
||||||
|
}
|
||||||
|
m_log.Debug(sb.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!success)
|
if (!success)
|
||||||
m_log.DebugFormat("[HG ASSET MAPPER]: Problems sending asset {0} with children to asset server {1}", assetID, userAssetURL);
|
m_log.DebugFormat("[HG ASSET MAPPER POST]: Problems sending asset {0} to asset server {1}", assetID, userAssetURL);
|
||||||
else
|
else
|
||||||
m_log.DebugFormat("[HG ASSET MAPPER]: Successfully sent asset {0} with children to asset server {1}", assetID, userAssetURL);
|
m_log.DebugFormat("[HG ASSET MAPPER POST]: Successfully sent asset {0} to asset server {1}", assetID, userAssetURL);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
Loading…
Reference in New Issue