diff options
author | Justin Clarke Casey | 2008-02-12 22:24:12 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-02-12 22:24:12 +0000 |
commit | c0211c1ca232742946e47346917f3f8ab5ff3acb (patch) | |
tree | 60efcd786e5414c247eee9510a11b7dba0980dd8 /OpenSim | |
parent | * Refactoring: Rename AssetTransactions.cs and AssetTransactionsManager and a... (diff) | |
download | opensim-SC_OLD-c0211c1ca232742946e47346917f3f8ab5ff3acb.zip opensim-SC_OLD-c0211c1ca232742946e47346917f3f8ab5ff3acb.tar.gz opensim-SC_OLD-c0211c1ca232742946e47346917f3f8ab5ff3acb.tar.bz2 opensim-SC_OLD-c0211c1ca232742946e47346917f3f8ab5ff3acb.tar.xz |
* Add missing locking to mysql inventory plugin
* Should resolve mantis 542
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs | 3 | ||||
-rw-r--r-- | OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs | 51 |
2 files changed, 34 insertions, 20 deletions
diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs index e9765a7..257747b 100644 --- a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs +++ b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs | |||
@@ -259,6 +259,9 @@ namespace OpenSim.Framework.Communications.Cache | |||
259 | 259 | ||
260 | public void HandlePurgeInventoryDescendents(IClientAPI remoteClient, LLUUID folderID) | 260 | public void HandlePurgeInventoryDescendents(IClientAPI remoteClient, LLUUID folderID) |
261 | { | 261 | { |
262 | // m_log.InfoFormat("[INVENTORYCACHE]: Purging folder {0} for {1} uuid {2}", | ||
263 | // folderID, remoteClient.Name, remoteClient.AgentId); | ||
264 | |||
262 | CachedUserInfo userProfile; | 265 | CachedUserInfo userProfile; |
263 | if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile)) | 266 | if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile)) |
264 | { | 267 | { |
diff --git a/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs b/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs index 57c2c9f..8257a23 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs | |||
@@ -38,7 +38,8 @@ namespace OpenSim.Framework.Data.MySQL | |||
38 | /// </summary> | 38 | /// </summary> |
39 | public class MySQLInventoryData : IInventoryData | 39 | public class MySQLInventoryData : IInventoryData |
40 | { | 40 | { |
41 | private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | 41 | private static readonly log4net.ILog m_log |
42 | = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | ||
42 | 43 | ||
43 | /// <summary> | 44 | /// <summary> |
44 | /// The database manager | 45 | /// The database manager |
@@ -514,7 +515,10 @@ namespace OpenSim.Framework.Data.MySQL | |||
514 | 515 | ||
515 | try | 516 | try |
516 | { | 517 | { |
517 | cmd.ExecuteNonQuery(); | 518 | lock (database) |
519 | { | ||
520 | cmd.ExecuteNonQuery(); | ||
521 | } | ||
518 | } | 522 | } |
519 | catch (Exception e) | 523 | catch (Exception e) |
520 | { | 524 | { |
@@ -543,10 +547,12 @@ namespace OpenSim.Framework.Data.MySQL | |||
543 | cmd.Parameters.AddWithValue("?folderID", folder.folderID.ToString()); | 547 | cmd.Parameters.AddWithValue("?folderID", folder.folderID.ToString()); |
544 | cmd.Parameters.AddWithValue("?parentFolderID", folder.parentID.ToString()); | 548 | cmd.Parameters.AddWithValue("?parentFolderID", folder.parentID.ToString()); |
545 | 549 | ||
546 | |||
547 | try | 550 | try |
548 | { | 551 | { |
549 | cmd.ExecuteNonQuery(); | 552 | lock (database) |
553 | { | ||
554 | cmd.ExecuteNonQuery(); | ||
555 | } | ||
550 | } | 556 | } |
551 | catch (Exception e) | 557 | catch (Exception e) |
552 | { | 558 | { |
@@ -586,11 +592,15 @@ namespace OpenSim.Framework.Data.MySQL | |||
586 | protected void deleteOneFolder(LLUUID folderID) | 592 | protected void deleteOneFolder(LLUUID folderID) |
587 | { | 593 | { |
588 | try | 594 | try |
589 | { | 595 | { |
590 | MySqlCommand cmd = | 596 | MySqlCommand cmd = |
591 | new MySqlCommand("DELETE FROM inventoryfolders WHERE folderID=?uuid", database.Connection); | 597 | new MySqlCommand("DELETE FROM inventoryfolders WHERE folderID=?uuid", database.Connection); |
592 | cmd.Parameters.AddWithValue("?uuid", folderID.ToString()); | 598 | cmd.Parameters.AddWithValue("?uuid", folderID.ToString()); |
593 | cmd.ExecuteNonQuery(); | 599 | |
600 | lock (database) | ||
601 | { | ||
602 | cmd.ExecuteNonQuery(); | ||
603 | } | ||
594 | } | 604 | } |
595 | catch (MySqlException e) | 605 | catch (MySqlException e) |
596 | { | 606 | { |
@@ -606,7 +616,11 @@ namespace OpenSim.Framework.Data.MySQL | |||
606 | MySqlCommand cmd = | 616 | MySqlCommand cmd = |
607 | new MySqlCommand("DELETE FROM inventoryitems WHERE parentFolderID=?uuid", database.Connection); | 617 | new MySqlCommand("DELETE FROM inventoryitems WHERE parentFolderID=?uuid", database.Connection); |
608 | cmd.Parameters.AddWithValue("?uuid", folderID.ToString()); | 618 | cmd.Parameters.AddWithValue("?uuid", folderID.ToString()); |
609 | cmd.ExecuteNonQuery(); | 619 | |
620 | lock (database) | ||
621 | { | ||
622 | cmd.ExecuteNonQuery(); | ||
623 | } | ||
610 | } | 624 | } |
611 | catch (MySqlException e) | 625 | catch (MySqlException e) |
612 | { | 626 | { |
@@ -622,21 +636,18 @@ namespace OpenSim.Framework.Data.MySQL | |||
622 | /// <param name="folderId">Id of folder to delete</param> | 636 | /// <param name="folderId">Id of folder to delete</param> |
623 | public void deleteInventoryFolder(LLUUID folderID) | 637 | public void deleteInventoryFolder(LLUUID folderID) |
624 | { | 638 | { |
625 | lock (database) | 639 | List<InventoryFolderBase> subFolders = getFolderHierarchy(folderID); |
626 | { | ||
627 | List<InventoryFolderBase> subFolders = getFolderHierarchy(folderID); | ||
628 | |||
629 | //Delete all sub-folders | ||
630 | foreach (InventoryFolderBase f in subFolders) | ||
631 | { | ||
632 | deleteOneFolder(f.folderID); | ||
633 | deleteItemsInFolder(f.folderID); | ||
634 | } | ||
635 | 640 | ||
636 | //Delete the actual row | 641 | //Delete all sub-folders |
637 | deleteOneFolder(folderID); | 642 | foreach (InventoryFolderBase f in subFolders) |
638 | deleteItemsInFolder(folderID); | 643 | { |
644 | deleteOneFolder(f.folderID); | ||
645 | deleteItemsInFolder(f.folderID); | ||
639 | } | 646 | } |
647 | |||
648 | //Delete the actual row | ||
649 | deleteOneFolder(folderID); | ||
650 | deleteItemsInFolder(folderID); | ||
640 | } | 651 | } |
641 | } | 652 | } |
642 | } \ No newline at end of file | 653 | } \ No newline at end of file |