fix an issue I found where primshapes weren't every being removed
because of a logic error. attempt to speed up deletes a bit by batching up all the primitem deletes and primshape deletes into single delete statements. This removes the lock/release/lock/release/lock/release for loop.0.6.1-post-fixes
parent
b4a725ed87
commit
a260466147
|
@ -300,20 +300,22 @@ namespace OpenSim.Data.MySQL
|
||||||
reader.Close();
|
reader.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (UUID uuid in uuids)
|
// delete the main prims
|
||||||
RemoveItems(uuid);
|
|
||||||
|
|
||||||
cmd.CommandText = "delete from prims where SceneGroupID= ?UUID";
|
cmd.CommandText = "delete from prims where SceneGroupID= ?UUID";
|
||||||
|
|
||||||
ExecuteNonQuery(cmd);
|
|
||||||
|
|
||||||
cmd.CommandText = "delete from primshapes where UUID = ?UUID";
|
|
||||||
|
|
||||||
ExecuteNonQuery(cmd);
|
ExecuteNonQuery(cmd);
|
||||||
cmd.Dispose();
|
cmd.Dispose();
|
||||||
|
|
||||||
|
// there is no way this should be < 1 unless there is
|
||||||
|
// a very corrupt database, but in that case be extra
|
||||||
|
// safe anyway.
|
||||||
|
if (uuids.Count > 0)
|
||||||
|
{
|
||||||
|
RemoveShapes(uuids);
|
||||||
|
RemoveItems(uuids);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Remove all persisted items of the given prim.
|
/// Remove all persisted items of the given prim.
|
||||||
/// The caller must acquire the necessrary synchronization locks
|
/// The caller must acquire the necessrary synchronization locks
|
||||||
|
@ -335,6 +337,77 @@ namespace OpenSim.Data.MySQL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Remove all persisted shapes for a list of prims
|
||||||
|
/// The caller must acquire the necessrary synchronization locks
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="uuids">the list of UUIDs</param>
|
||||||
|
private void RemoveShapes(List<UUID> uuids)
|
||||||
|
{
|
||||||
|
lock (m_Connection)
|
||||||
|
{
|
||||||
|
string sql = "delete from primshapes where ";
|
||||||
|
MySqlCommand cmd = m_Connection.CreateCommand();
|
||||||
|
|
||||||
|
for (int i = 0; i < uuids.Count; i++)
|
||||||
|
{
|
||||||
|
if ((i + 1) == uuids.Count)
|
||||||
|
{// end of the list
|
||||||
|
sql += "(UUID = ?UUID" + i + ")";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sql += "(UUID = ?UUID" + i + ") or ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cmd.CommandText = sql;
|
||||||
|
|
||||||
|
for (int i = 0; i < uuids.Count; i++)
|
||||||
|
{
|
||||||
|
cmd.Parameters.AddWithValue("UUID" + i, uuids[i].ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
ExecuteNonQuery(cmd);
|
||||||
|
cmd.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Remove all persisted items for a list of prims
|
||||||
|
/// The caller must acquire the necessrary synchronization locks
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="uuids">the list of UUIDs</param>
|
||||||
|
private void RemoveItems(List<UUID> uuids)
|
||||||
|
{
|
||||||
|
lock (m_Connection)
|
||||||
|
{
|
||||||
|
string sql = "delete from primitems where ";
|
||||||
|
MySqlCommand cmd = m_Connection.CreateCommand();
|
||||||
|
|
||||||
|
for (int i = 0; i < uuids.Count; i++)
|
||||||
|
{
|
||||||
|
if ((i + 1) == uuids.Count)
|
||||||
|
{// end of the list
|
||||||
|
sql += "(PrimID = ?PrimID" + i + ")";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sql += "(PrimID = ?PrimID" + i + ") or ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cmd.CommandText = sql;
|
||||||
|
|
||||||
|
for (int i = 0; i < uuids.Count; i++)
|
||||||
|
{
|
||||||
|
cmd.Parameters.AddWithValue("PrimID" + i, uuids[i].ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
ExecuteNonQuery(cmd);
|
||||||
|
cmd.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public List<SceneObjectGroup> LoadObjects(UUID regionUUID)
|
public List<SceneObjectGroup> LoadObjects(UUID regionUUID)
|
||||||
{
|
{
|
||||||
UUID lastGroupID = UUID.Zero;
|
UUID lastGroupID = UUID.Zero;
|
||||||
|
|
Loading…
Reference in New Issue