Remove parts locking from data classes since these are using a copy of the scene object
parent
166ab59420
commit
692cf3c657
|
@ -89,7 +89,6 @@ namespace OpenSim.Data.MSSQL
|
||||||
Dictionary<UUID, SceneObjectGroup> objects = new Dictionary<UUID, SceneObjectGroup>();
|
Dictionary<UUID, SceneObjectGroup> objects = new Dictionary<UUID, SceneObjectGroup>();
|
||||||
SceneObjectGroup grp = null;
|
SceneObjectGroup grp = null;
|
||||||
|
|
||||||
|
|
||||||
string sql = "SELECT *, " +
|
string sql = "SELECT *, " +
|
||||||
"sort = CASE WHEN prims.UUID = prims.SceneGroupID THEN 0 ELSE 1 END " +
|
"sort = CASE WHEN prims.UUID = prims.SceneGroupID THEN 0 ELSE 1 END " +
|
||||||
"FROM prims " +
|
"FROM prims " +
|
||||||
|
@ -232,65 +231,62 @@ namespace OpenSim.Data.MSSQL
|
||||||
/// <param name="regionUUID"></param>
|
/// <param name="regionUUID"></param>
|
||||||
public void StoreObject(SceneObjectGroup obj, UUID regionUUID)
|
public void StoreObject(SceneObjectGroup obj, UUID regionUUID)
|
||||||
{
|
{
|
||||||
lock (obj.Children)
|
_Log.DebugFormat("[MSSQL]: Adding/Changing SceneObjectGroup: {0} to region: {1}, object has {2} prims.", obj.UUID, regionUUID, obj.Children.Count);
|
||||||
|
|
||||||
|
using (SqlConnection conn = new SqlConnection(m_connectionString))
|
||||||
{
|
{
|
||||||
_Log.DebugFormat("[MSSQL]: Adding/Changing SceneObjectGroup: {0} to region: {1}, object has {2} prims.", obj.UUID, regionUUID, obj.Children.Count);
|
conn.Open();
|
||||||
|
SqlTransaction transaction = conn.BeginTransaction();
|
||||||
|
|
||||||
using (SqlConnection conn = new SqlConnection(m_connectionString))
|
try
|
||||||
{
|
{
|
||||||
conn.Open();
|
foreach (SceneObjectPart sceneObjectPart in obj.Children.Values)
|
||||||
SqlTransaction transaction = conn.BeginTransaction();
|
{
|
||||||
|
//Update prim
|
||||||
|
using (SqlCommand sqlCommand = conn.CreateCommand())
|
||||||
|
{
|
||||||
|
sqlCommand.Transaction = transaction;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
StoreSceneObjectPrim(sceneObjectPart, sqlCommand, obj.UUID, regionUUID);
|
||||||
|
}
|
||||||
|
catch (SqlException sqlEx)
|
||||||
|
{
|
||||||
|
_Log.ErrorFormat("[REGION DB]: Store SceneObjectPrim SQL error: {0} at line {1}", sqlEx.Message, sqlEx.LineNumber);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Update primshapes
|
||||||
|
using (SqlCommand sqlCommand = conn.CreateCommand())
|
||||||
|
{
|
||||||
|
sqlCommand.Transaction = transaction;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
StoreSceneObjectPrimShapes(sceneObjectPart, sqlCommand, obj.UUID, regionUUID);
|
||||||
|
}
|
||||||
|
catch (SqlException sqlEx)
|
||||||
|
{
|
||||||
|
_Log.ErrorFormat("[REGION DB]: Store SceneObjectPrimShapes SQL error: {0} at line {1}", sqlEx.Message, sqlEx.LineNumber);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
transaction.Commit();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_Log.ErrorFormat("[REGION DB]: Store SceneObjectGroup error: {0}, Rolling back...", ex.Message);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
foreach (SceneObjectPart sceneObjectPart in obj.Children.Values)
|
transaction.Rollback();
|
||||||
{
|
|
||||||
//Update prim
|
|
||||||
using (SqlCommand sqlCommand = conn.CreateCommand())
|
|
||||||
{
|
|
||||||
sqlCommand.Transaction = transaction;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
StoreSceneObjectPrim(sceneObjectPart, sqlCommand, obj.UUID, regionUUID);
|
|
||||||
}
|
|
||||||
catch (SqlException sqlEx)
|
|
||||||
{
|
|
||||||
_Log.ErrorFormat("[REGION DB]: Store SceneObjectPrim SQL error: {0} at line {1}", sqlEx.Message, sqlEx.LineNumber);
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Update primshapes
|
|
||||||
using (SqlCommand sqlCommand = conn.CreateCommand())
|
|
||||||
{
|
|
||||||
sqlCommand.Transaction = transaction;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
StoreSceneObjectPrimShapes(sceneObjectPart, sqlCommand, obj.UUID, regionUUID);
|
|
||||||
}
|
|
||||||
catch (SqlException sqlEx)
|
|
||||||
{
|
|
||||||
_Log.ErrorFormat("[REGION DB]: Store SceneObjectPrimShapes SQL error: {0} at line {1}", sqlEx.Message, sqlEx.LineNumber);
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
transaction.Commit();
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex2)
|
||||||
{
|
{
|
||||||
_Log.ErrorFormat("[REGION DB]: Store SceneObjectGroup error: {0}, Rolling back...", ex.Message);
|
//Show error
|
||||||
try
|
_Log.InfoFormat("[REGION DB]: Rollback of SceneObjectGroup store transaction failed with error: {0}", ex2.Message);
|
||||||
{
|
|
||||||
transaction.Rollback();
|
|
||||||
}
|
|
||||||
catch (Exception ex2)
|
|
||||||
{
|
|
||||||
//Show error
|
|
||||||
_Log.InfoFormat("[REGION DB]: Rollback of SceneObjectGroup store transaction failed with error: {0}", ex2.Message);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -135,115 +135,112 @@ namespace OpenSim.Data.MySQL
|
||||||
dbcon.Open();
|
dbcon.Open();
|
||||||
MySqlCommand cmd = dbcon.CreateCommand();
|
MySqlCommand cmd = dbcon.CreateCommand();
|
||||||
|
|
||||||
lock (obj.Children)
|
foreach (SceneObjectPart prim in obj.Children.Values)
|
||||||
{
|
{
|
||||||
foreach (SceneObjectPart prim in obj.Children.Values)
|
cmd.Parameters.Clear();
|
||||||
{
|
|
||||||
cmd.Parameters.Clear();
|
|
||||||
|
|
||||||
cmd.CommandText = "replace into prims (" +
|
cmd.CommandText = "replace into prims (" +
|
||||||
"UUID, CreationDate, " +
|
"UUID, CreationDate, " +
|
||||||
"Name, Text, Description, " +
|
"Name, Text, Description, " +
|
||||||
"SitName, TouchName, ObjectFlags, " +
|
"SitName, TouchName, ObjectFlags, " +
|
||||||
"OwnerMask, NextOwnerMask, GroupMask, " +
|
"OwnerMask, NextOwnerMask, GroupMask, " +
|
||||||
"EveryoneMask, BaseMask, PositionX, " +
|
"EveryoneMask, BaseMask, PositionX, " +
|
||||||
"PositionY, PositionZ, GroupPositionX, " +
|
"PositionY, PositionZ, GroupPositionX, " +
|
||||||
"GroupPositionY, GroupPositionZ, VelocityX, " +
|
"GroupPositionY, GroupPositionZ, VelocityX, " +
|
||||||
"VelocityY, VelocityZ, AngularVelocityX, " +
|
"VelocityY, VelocityZ, AngularVelocityX, " +
|
||||||
"AngularVelocityY, AngularVelocityZ, " +
|
"AngularVelocityY, AngularVelocityZ, " +
|
||||||
"AccelerationX, AccelerationY, " +
|
"AccelerationX, AccelerationY, " +
|
||||||
"AccelerationZ, RotationX, " +
|
"AccelerationZ, RotationX, " +
|
||||||
"RotationY, RotationZ, " +
|
"RotationY, RotationZ, " +
|
||||||
"RotationW, SitTargetOffsetX, " +
|
"RotationW, SitTargetOffsetX, " +
|
||||||
"SitTargetOffsetY, SitTargetOffsetZ, " +
|
"SitTargetOffsetY, SitTargetOffsetZ, " +
|
||||||
"SitTargetOrientW, SitTargetOrientX, " +
|
"SitTargetOrientW, SitTargetOrientX, " +
|
||||||
"SitTargetOrientY, SitTargetOrientZ, " +
|
"SitTargetOrientY, SitTargetOrientZ, " +
|
||||||
"RegionUUID, CreatorID, " +
|
"RegionUUID, CreatorID, " +
|
||||||
"OwnerID, GroupID, " +
|
"OwnerID, GroupID, " +
|
||||||
"LastOwnerID, SceneGroupID, " +
|
"LastOwnerID, SceneGroupID, " +
|
||||||
"PayPrice, PayButton1, " +
|
"PayPrice, PayButton1, " +
|
||||||
"PayButton2, PayButton3, " +
|
"PayButton2, PayButton3, " +
|
||||||
"PayButton4, LoopedSound, " +
|
"PayButton4, LoopedSound, " +
|
||||||
"LoopedSoundGain, TextureAnimation, " +
|
"LoopedSoundGain, TextureAnimation, " +
|
||||||
"OmegaX, OmegaY, OmegaZ, " +
|
"OmegaX, OmegaY, OmegaZ, " +
|
||||||
"CameraEyeOffsetX, CameraEyeOffsetY, " +
|
"CameraEyeOffsetX, CameraEyeOffsetY, " +
|
||||||
"CameraEyeOffsetZ, CameraAtOffsetX, " +
|
"CameraEyeOffsetZ, CameraAtOffsetX, " +
|
||||||
"CameraAtOffsetY, CameraAtOffsetZ, " +
|
"CameraAtOffsetY, CameraAtOffsetZ, " +
|
||||||
"ForceMouselook, ScriptAccessPin, " +
|
"ForceMouselook, ScriptAccessPin, " +
|
||||||
"AllowedDrop, DieAtEdge, " +
|
"AllowedDrop, DieAtEdge, " +
|
||||||
"SalePrice, SaleType, " +
|
"SalePrice, SaleType, " +
|
||||||
"ColorR, ColorG, ColorB, ColorA, " +
|
"ColorR, ColorG, ColorB, ColorA, " +
|
||||||
"ParticleSystem, ClickAction, Material, " +
|
"ParticleSystem, ClickAction, Material, " +
|
||||||
"CollisionSound, CollisionSoundVolume, " +
|
"CollisionSound, CollisionSoundVolume, " +
|
||||||
"PassTouches, " +
|
"PassTouches, " +
|
||||||
"LinkNumber, MediaURL) values (" + "?UUID, " +
|
"LinkNumber, MediaURL) values (" + "?UUID, " +
|
||||||
"?CreationDate, ?Name, ?Text, " +
|
"?CreationDate, ?Name, ?Text, " +
|
||||||
"?Description, ?SitName, ?TouchName, " +
|
"?Description, ?SitName, ?TouchName, " +
|
||||||
"?ObjectFlags, ?OwnerMask, ?NextOwnerMask, " +
|
"?ObjectFlags, ?OwnerMask, ?NextOwnerMask, " +
|
||||||
"?GroupMask, ?EveryoneMask, ?BaseMask, " +
|
"?GroupMask, ?EveryoneMask, ?BaseMask, " +
|
||||||
"?PositionX, ?PositionY, ?PositionZ, " +
|
"?PositionX, ?PositionY, ?PositionZ, " +
|
||||||
"?GroupPositionX, ?GroupPositionY, " +
|
"?GroupPositionX, ?GroupPositionY, " +
|
||||||
"?GroupPositionZ, ?VelocityX, " +
|
"?GroupPositionZ, ?VelocityX, " +
|
||||||
"?VelocityY, ?VelocityZ, ?AngularVelocityX, " +
|
"?VelocityY, ?VelocityZ, ?AngularVelocityX, " +
|
||||||
"?AngularVelocityY, ?AngularVelocityZ, " +
|
"?AngularVelocityY, ?AngularVelocityZ, " +
|
||||||
"?AccelerationX, ?AccelerationY, " +
|
"?AccelerationX, ?AccelerationY, " +
|
||||||
"?AccelerationZ, ?RotationX, " +
|
"?AccelerationZ, ?RotationX, " +
|
||||||
"?RotationY, ?RotationZ, " +
|
"?RotationY, ?RotationZ, " +
|
||||||
"?RotationW, ?SitTargetOffsetX, " +
|
"?RotationW, ?SitTargetOffsetX, " +
|
||||||
"?SitTargetOffsetY, ?SitTargetOffsetZ, " +
|
"?SitTargetOffsetY, ?SitTargetOffsetZ, " +
|
||||||
"?SitTargetOrientW, ?SitTargetOrientX, " +
|
"?SitTargetOrientW, ?SitTargetOrientX, " +
|
||||||
"?SitTargetOrientY, ?SitTargetOrientZ, " +
|
"?SitTargetOrientY, ?SitTargetOrientZ, " +
|
||||||
"?RegionUUID, ?CreatorID, ?OwnerID, " +
|
"?RegionUUID, ?CreatorID, ?OwnerID, " +
|
||||||
"?GroupID, ?LastOwnerID, ?SceneGroupID, " +
|
"?GroupID, ?LastOwnerID, ?SceneGroupID, " +
|
||||||
"?PayPrice, ?PayButton1, ?PayButton2, " +
|
"?PayPrice, ?PayButton1, ?PayButton2, " +
|
||||||
"?PayButton3, ?PayButton4, ?LoopedSound, " +
|
"?PayButton3, ?PayButton4, ?LoopedSound, " +
|
||||||
"?LoopedSoundGain, ?TextureAnimation, " +
|
"?LoopedSoundGain, ?TextureAnimation, " +
|
||||||
"?OmegaX, ?OmegaY, ?OmegaZ, " +
|
"?OmegaX, ?OmegaY, ?OmegaZ, " +
|
||||||
"?CameraEyeOffsetX, ?CameraEyeOffsetY, " +
|
"?CameraEyeOffsetX, ?CameraEyeOffsetY, " +
|
||||||
"?CameraEyeOffsetZ, ?CameraAtOffsetX, " +
|
"?CameraEyeOffsetZ, ?CameraAtOffsetX, " +
|
||||||
"?CameraAtOffsetY, ?CameraAtOffsetZ, " +
|
"?CameraAtOffsetY, ?CameraAtOffsetZ, " +
|
||||||
"?ForceMouselook, ?ScriptAccessPin, " +
|
"?ForceMouselook, ?ScriptAccessPin, " +
|
||||||
"?AllowedDrop, ?DieAtEdge, ?SalePrice, " +
|
"?AllowedDrop, ?DieAtEdge, ?SalePrice, " +
|
||||||
"?SaleType, ?ColorR, ?ColorG, " +
|
"?SaleType, ?ColorR, ?ColorG, " +
|
||||||
"?ColorB, ?ColorA, ?ParticleSystem, " +
|
"?ColorB, ?ColorA, ?ParticleSystem, " +
|
||||||
"?ClickAction, ?Material, ?CollisionSound, " +
|
"?ClickAction, ?Material, ?CollisionSound, " +
|
||||||
"?CollisionSoundVolume, ?PassTouches, ?LinkNumber, ?MediaURL)";
|
"?CollisionSoundVolume, ?PassTouches, ?LinkNumber, ?MediaURL)";
|
||||||
|
|
||||||
FillPrimCommand(cmd, prim, obj.UUID, regionUUID);
|
FillPrimCommand(cmd, prim, obj.UUID, regionUUID);
|
||||||
|
|
||||||
ExecuteNonQuery(cmd);
|
ExecuteNonQuery(cmd);
|
||||||
|
|
||||||
cmd.Parameters.Clear();
|
cmd.Parameters.Clear();
|
||||||
|
|
||||||
cmd.CommandText = "replace into primshapes (" +
|
cmd.CommandText = "replace into primshapes (" +
|
||||||
"UUID, Shape, ScaleX, ScaleY, " +
|
"UUID, Shape, ScaleX, ScaleY, " +
|
||||||
"ScaleZ, PCode, PathBegin, PathEnd, " +
|
"ScaleZ, PCode, PathBegin, PathEnd, " +
|
||||||
"PathScaleX, PathScaleY, PathShearX, " +
|
"PathScaleX, PathScaleY, PathShearX, " +
|
||||||
"PathShearY, PathSkew, PathCurve, " +
|
"PathShearY, PathSkew, PathCurve, " +
|
||||||
"PathRadiusOffset, PathRevolutions, " +
|
"PathRadiusOffset, PathRevolutions, " +
|
||||||
"PathTaperX, PathTaperY, PathTwist, " +
|
"PathTaperX, PathTaperY, PathTwist, " +
|
||||||
"PathTwistBegin, ProfileBegin, ProfileEnd, " +
|
"PathTwistBegin, ProfileBegin, ProfileEnd, " +
|
||||||
"ProfileCurve, ProfileHollow, Texture, " +
|
"ProfileCurve, ProfileHollow, Texture, " +
|
||||||
"ExtraParams, State, Media) values (?UUID, " +
|
"ExtraParams, State, Media) values (?UUID, " +
|
||||||
"?Shape, ?ScaleX, ?ScaleY, ?ScaleZ, " +
|
"?Shape, ?ScaleX, ?ScaleY, ?ScaleZ, " +
|
||||||
"?PCode, ?PathBegin, ?PathEnd, " +
|
"?PCode, ?PathBegin, ?PathEnd, " +
|
||||||
"?PathScaleX, ?PathScaleY, " +
|
"?PathScaleX, ?PathScaleY, " +
|
||||||
"?PathShearX, ?PathShearY, " +
|
"?PathShearX, ?PathShearY, " +
|
||||||
"?PathSkew, ?PathCurve, ?PathRadiusOffset, " +
|
"?PathSkew, ?PathCurve, ?PathRadiusOffset, " +
|
||||||
"?PathRevolutions, ?PathTaperX, " +
|
"?PathRevolutions, ?PathTaperX, " +
|
||||||
"?PathTaperY, ?PathTwist, " +
|
"?PathTaperY, ?PathTwist, " +
|
||||||
"?PathTwistBegin, ?ProfileBegin, " +
|
"?PathTwistBegin, ?ProfileBegin, " +
|
||||||
"?ProfileEnd, ?ProfileCurve, " +
|
"?ProfileEnd, ?ProfileCurve, " +
|
||||||
"?ProfileHollow, ?Texture, ?ExtraParams, " +
|
"?ProfileHollow, ?Texture, ?ExtraParams, " +
|
||||||
"?State, ?Media)";
|
"?State, ?Media)";
|
||||||
|
|
||||||
FillShapeCommand(cmd, prim);
|
FillShapeCommand(cmd, prim);
|
||||||
|
|
||||||
ExecuteNonQuery(cmd);
|
ExecuteNonQuery(cmd);
|
||||||
}
|
|
||||||
|
|
||||||
cmd.Dispose();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cmd.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -360,13 +360,10 @@ namespace OpenSim.Data.SQLite
|
||||||
|
|
||||||
lock (ds)
|
lock (ds)
|
||||||
{
|
{
|
||||||
lock (obj.Children)
|
foreach (SceneObjectPart prim in obj.Children.Values)
|
||||||
{
|
{
|
||||||
foreach (SceneObjectPart prim in obj.Children.Values)
|
// m_log.Info("[REGION DB]: Adding obj: " + obj.UUID + " to region: " + regionUUID);
|
||||||
{
|
addPrim(prim, obj.UUID, regionUUID);
|
||||||
// m_log.Info("[REGION DB]: Adding obj: " + obj.UUID + " to region: " + regionUUID);
|
|
||||||
addPrim(prim, obj.UUID, regionUUID);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -327,13 +327,10 @@ namespace OpenSim.Data.SQLiteLegacy
|
||||||
|
|
||||||
lock (ds)
|
lock (ds)
|
||||||
{
|
{
|
||||||
lock (obj.Children)
|
foreach (SceneObjectPart prim in obj.Children.Values)
|
||||||
{
|
{
|
||||||
foreach (SceneObjectPart prim in obj.Children.Values)
|
// m_log.Info("[REGION DB]: Adding obj: " + obj.UUID + " to region: " + regionUUID);
|
||||||
{
|
addPrim(prim, obj.UUID, regionUUID);
|
||||||
// m_log.Info("[REGION DB]: Adding obj: " + obj.UUID + " to region: " + regionUUID);
|
|
||||||
addPrim(prim, obj.UUID, regionUUID);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue