From e13feaa3758051c1fc6c5fb68be6c9570519ced5 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Wed, 16 Jan 2008 21:43:22 +0000 Subject: [PATCH] * More prim inventory synchronization * Remove some mysql verbosity --- .../Framework/Data.MySQL/MySQLDataStore.cs | 41 ++++++++++--------- .../Framework/Data.SQLite/SQLiteRegionData.cs | 25 ++++++----- 2 files changed, 36 insertions(+), 30 deletions(-) diff --git a/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs b/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs index 183a2f93cc..50623df839 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs @@ -1222,34 +1222,37 @@ namespace OpenSim.Framework.Data.MySQL foreach (DataRow row in dbItemRows) { - MainLog.Instance.Verbose( - "DATASTORE", - "Found item {0}, {1} in prim id {2}", - row["name"], row["itemID"], primID); +// MainLog.Instance.Verbose( +// "DATASTORE", +// "Found item {0}, {1} in prim id {2}", +// row["name"], row["itemID"], primID); dbItemsToRemove.Add((String)row["itemID"], row); } // Eliminate rows from the deletion set which already exist for this prim's inventory // TODO Very temporary, need to take account of simple metadata changes soon - foreach (LLUUID itemId in items.Keys) + lock (items) { - String rawItemId = itemId.ToString(); - - if (dbItemsToRemove.ContainsKey(rawItemId)) + foreach (LLUUID itemId in items.Keys) { - MainLog.Instance.Verbose( - "DATASTORE", - "Discarding item {0}, {1} from remove candidates for prim id {2}", - items[itemId].Name, rawItemId, primID); + String rawItemId = itemId.ToString(); - dbItemsToRemove.Remove(rawItemId); - } - else - { - itemsToAdd.Add(items[itemId]); - } - } + if (dbItemsToRemove.ContainsKey(rawItemId)) + { +// MainLog.Instance.Verbose( +// "DATASTORE", +// "Discarding item {0}, {1} from remove candidates for prim id {2}", +// items[itemId].Name, rawItemId, primID); + + dbItemsToRemove.Remove(rawItemId); + } + else + { + itemsToAdd.Add(items[itemId]); + } + } + } // Delete excess rows foreach (DataRow row in dbItemsToRemove.Values) diff --git a/OpenSim/Framework/Data.SQLite/SQLiteRegionData.cs b/OpenSim/Framework/Data.SQLite/SQLiteRegionData.cs index 94c05e1b29..1364d3ea2d 100644 --- a/OpenSim/Framework/Data.SQLite/SQLiteRegionData.cs +++ b/OpenSim/Framework/Data.SQLite/SQLiteRegionData.cs @@ -1283,19 +1283,22 @@ namespace OpenSim.Framework.Data.SQLite // Eliminate rows from the deletion set which already exist for this prim's inventory // TODO Very temporary, need to take account of simple metadata changes soon - foreach (LLUUID itemId in items.Keys) + lock (items) { - String rawItemId = itemId.ToString(); - - if (dbItemsToRemove.ContainsKey(rawItemId)) + foreach (LLUUID itemId in items.Keys) { - dbItemsToRemove.Remove(rawItemId); - } - else - { - itemsToAdd.Add(items[itemId]); - } - } + String rawItemId = itemId.ToString(); + + if (dbItemsToRemove.ContainsKey(rawItemId)) + { + dbItemsToRemove.Remove(rawItemId); + } + else + { + itemsToAdd.Add(items[itemId]); + } + } + } // Delete excess rows foreach (DataRow row in dbItemsToRemove.Values)