* Fix race condition in save oar
parent
60c2edce68
commit
ecbeb5cea1
|
@ -311,8 +311,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[RADMIN] Terrain Loading: failed: {0}", e.Message);
|
m_log.ErrorFormat("[RADMIN]: Terrain Loading: failed: {0}", e.Message);
|
||||||
m_log.DebugFormat("[RADMIN] Terrain Loading: failed: {0}", e.ToString());
|
m_log.DebugFormat("[RADMIN]: Terrain Loading: failed: {0}", e.ToString());
|
||||||
|
|
||||||
responseData["success"] = false;
|
responseData["success"] = false;
|
||||||
responseData["error"] = e.Message;
|
responseData["error"] = e.Message;
|
||||||
|
@ -325,7 +325,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
|
|
||||||
public XmlRpcResponse XmlRpcShutdownMethod(XmlRpcRequest request, IPEndPoint remoteClient)
|
public XmlRpcResponse XmlRpcShutdownMethod(XmlRpcRequest request, IPEndPoint remoteClient)
|
||||||
{
|
{
|
||||||
|
|
||||||
m_log.Info("[RADMIN]: Received Shutdown Administrator Request");
|
m_log.Info("[RADMIN]: Received Shutdown Administrator Request");
|
||||||
|
|
||||||
XmlRpcResponse response = new XmlRpcResponse();
|
XmlRpcResponse response = new XmlRpcResponse();
|
||||||
|
@ -759,7 +758,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
||||||
/// <description>error message if success is false</description></item>
|
/// <description>error message if success is false</description></item>
|
||||||
/// </list>
|
/// </list>
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
|
|
||||||
public XmlRpcResponse XmlRpcModifyRegionMethod(XmlRpcRequest request, IPEndPoint remoteClient)
|
public XmlRpcResponse XmlRpcModifyRegionMethod(XmlRpcRequest request, IPEndPoint remoteClient)
|
||||||
{
|
{
|
||||||
m_log.Info("[RADMIN]: ModifyRegion: new request");
|
m_log.Info("[RADMIN]: ModifyRegion: new request");
|
||||||
|
|
|
@ -196,6 +196,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset
|
||||||
public bool Get(string id, Object sender, AssetRetrieved handler)
|
public bool Get(string id, Object sender, AssetRetrieved handler)
|
||||||
{
|
{
|
||||||
AssetBase asset = null;
|
AssetBase asset = null;
|
||||||
|
|
||||||
if (m_Cache != null)
|
if (m_Cache != null)
|
||||||
m_Cache.Get(id);
|
m_Cache.Get(id);
|
||||||
|
|
||||||
|
@ -209,6 +210,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset
|
||||||
{
|
{
|
||||||
if ((a != null) && (m_Cache != null))
|
if ((a != null) && (m_Cache != null))
|
||||||
m_Cache.Cache(a);
|
m_Cache.Cache(a);
|
||||||
|
|
||||||
handler.BeginInvoke(assetID, s, a, null, null);
|
handler.BeginInvoke(assetID, s, a, null, null);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -217,8 +219,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset
|
||||||
{
|
{
|
||||||
if (m_Cache != null)
|
if (m_Cache != null)
|
||||||
m_Cache.Cache(asset);
|
m_Cache.Cache(asset);
|
||||||
|
|
||||||
if (asset.Temporary || asset.Local)
|
if (asset.Temporary || asset.Local)
|
||||||
return asset.ID;
|
return asset.ID;
|
||||||
|
|
||||||
return m_AssetService.Store(asset);
|
return m_AssetService.Store(asset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -310,6 +310,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
asset.Type = assetType;
|
asset.Type = assetType;
|
||||||
asset.Data = data;
|
asset.Data = data;
|
||||||
|
|
||||||
|
// We're relying on the asset service to do the sensible thing and not store the asset if it already
|
||||||
|
// exists.
|
||||||
m_scene.AssetService.Store(asset);
|
m_scene.AssetService.Store(asset);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -136,7 +136,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
|
|
||||||
m_archiveWriter.Close();
|
m_archiveWriter.Close();
|
||||||
|
|
||||||
m_log.InfoFormat("[ARCHIVER]: Wrote out OpenSimulator archive for {0}", m_scene.RegionInfo.RegionName);
|
m_log.InfoFormat("[ARCHIVER]: Finished writing out OAR for {0}", m_scene.RegionInfo.RegionName);
|
||||||
|
|
||||||
m_scene.EventManager.TriggerOarFileSaved(m_requestId, String.Empty);
|
m_scene.EventManager.TriggerOarFileSaved(m_requestId, String.Empty);
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,20 +70,20 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
private int m_repliesRequired;
|
private int m_repliesRequired;
|
||||||
|
|
||||||
/// <value>
|
/// <value>
|
||||||
/// Asset cache used to request the assets
|
/// Asset service used to request the assets
|
||||||
/// </value>
|
/// </value>
|
||||||
protected IAssetService m_assetCache;
|
protected IAssetService m_assetService;
|
||||||
|
|
||||||
protected AssetsArchiver m_assetsArchiver;
|
protected AssetsArchiver m_assetsArchiver;
|
||||||
|
|
||||||
protected internal AssetsRequest(
|
protected internal AssetsRequest(
|
||||||
AssetsArchiver assetsArchiver, ICollection<UUID> uuids,
|
AssetsArchiver assetsArchiver, ICollection<UUID> uuids,
|
||||||
IAssetService assetCache, AssetsRequestCallback assetsRequestCallback)
|
IAssetService assetService, AssetsRequestCallback assetsRequestCallback)
|
||||||
{
|
{
|
||||||
m_assetsArchiver = assetsArchiver;
|
m_assetsArchiver = assetsArchiver;
|
||||||
m_uuids = uuids;
|
m_uuids = uuids;
|
||||||
m_assetsRequestCallback = assetsRequestCallback;
|
m_assetsRequestCallback = assetsRequestCallback;
|
||||||
m_assetCache = assetCache;
|
m_assetService = assetService;
|
||||||
m_repliesRequired = uuids.Count;
|
m_repliesRequired = uuids.Count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,14 +93,15 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
|
|
||||||
// We can stop here if there are no assets to fetch
|
// We can stop here if there are no assets to fetch
|
||||||
if (m_repliesRequired == 0)
|
if (m_repliesRequired == 0)
|
||||||
m_assetsRequestCallback(m_foundAssetUuids, m_notFoundAssetUuids);
|
PerformAssetsRequestCallback();
|
||||||
|
|
||||||
foreach (UUID uuid in m_uuids)
|
foreach (UUID uuid in m_uuids)
|
||||||
{
|
{
|
||||||
m_assetCache.Get(uuid.ToString(), this, AssetRequestCallback);
|
m_assetService.Get(uuid.ToString(), this, AssetRequestCallback);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool done = false;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Called back by the asset cache when it has the asset
|
/// Called back by the asset cache when it has the asset
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -108,7 +109,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
/// <param name="asset"></param>
|
/// <param name="asset"></param>
|
||||||
public void AssetRequestCallback(string id, object sender, AssetBase asset)
|
public void AssetRequestCallback(string id, object sender, AssetBase asset)
|
||||||
{
|
{
|
||||||
//m_log.DebugFormat("[ARCHIVER]: Received callback for asset {0}", assetID);
|
try
|
||||||
|
{
|
||||||
|
lock (this)
|
||||||
|
{
|
||||||
|
//m_log.DebugFormat("[ARCHIVER]: Received callback for asset {0}", id);
|
||||||
|
|
||||||
if (asset != null)
|
if (asset != null)
|
||||||
{
|
{
|
||||||
|
@ -122,10 +127,15 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
|
|
||||||
if (m_foundAssetUuids.Count + m_notFoundAssetUuids.Count == m_repliesRequired)
|
if (m_foundAssetUuids.Count + m_notFoundAssetUuids.Count == m_repliesRequired)
|
||||||
{
|
{
|
||||||
|
if (done)
|
||||||
|
throw new Exception("AArgh");
|
||||||
|
|
||||||
m_log.DebugFormat(
|
m_log.DebugFormat(
|
||||||
"[ARCHIVER]: Successfully added {0} assets ({1} assets missing)",
|
"[ARCHIVER]: Successfully added {0} assets ({1} assets missing)",
|
||||||
m_foundAssetUuids.Count, m_notFoundAssetUuids.Count);
|
m_foundAssetUuids.Count, m_notFoundAssetUuids.Count);
|
||||||
|
|
||||||
|
done = true;
|
||||||
|
|
||||||
// We want to stop using the asset cache thread asap
|
// We want to stop using the asset cache thread asap
|
||||||
// as we now need to do the work of producing the rest of the archive
|
// as we now need to do the work of producing the rest of the archive
|
||||||
Thread newThread = new Thread(PerformAssetsRequestCallback);
|
Thread newThread = new Thread(PerformAssetsRequestCallback);
|
||||||
|
@ -133,6 +143,12 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
newThread.Start();
|
newThread.Start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.ErrorFormat("[ARCHIVER]: AssetRequestCallback failed with {0}", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Perform the callback on the original requester of the assets
|
/// Perform the callback on the original requester of the assets
|
||||||
|
|
Loading…
Reference in New Issue