aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MySQL/MySQLUserData.cs
diff options
context:
space:
mode:
authorAdam Frisby2008-10-31 04:58:14 +0000
committerAdam Frisby2008-10-31 04:58:14 +0000
commit129610e797548f7b384f772408d2069ae58e00ce (patch)
tree52faee4363a9ea02c9fb0c230ee13e6d6ce454b7 /OpenSim/Data/MySQL/MySQLUserData.cs
parenttest: Extend malformed packet test to actually check that a valid packet can ... (diff)
downloadopensim-SC-129610e797548f7b384f772408d2069ae58e00ce.zip
opensim-SC-129610e797548f7b384f772408d2069ae58e00ce.tar.gz
opensim-SC-129610e797548f7b384f772408d2069ae58e00ce.tar.bz2
opensim-SC-129610e797548f7b384f772408d2069ae58e00ce.tar.xz
* Added some debug information to MySQL UserDataManager to help diagnose a potential issue when in high load. Related to mantis #2508.
Diffstat (limited to 'OpenSim/Data/MySQL/MySQLUserData.cs')
-rw-r--r--OpenSim/Data/MySQL/MySQLUserData.cs42
1 files changed, 24 insertions, 18 deletions
diff --git a/OpenSim/Data/MySQL/MySQLUserData.cs b/OpenSim/Data/MySQL/MySQLUserData.cs
index ecd534a..2937ea8 100644
--- a/OpenSim/Data/MySQL/MySQLUserData.cs
+++ b/OpenSim/Data/MySQL/MySQLUserData.cs
@@ -71,7 +71,7 @@ namespace OpenSim.Data.MySQL
71 throw new PluginNotInitialisedException(Name); 71 throw new PluginNotInitialisedException(Name);
72 } 72 }
73 73
74 public MySQLSuperManager GetLockedConnection() 74 public MySQLSuperManager GetLockedConnection(string why)
75 { 75 {
76 int lockedCons = 0; 76 int lockedCons = 0;
77 while (true) 77 while (true)
@@ -86,6 +86,7 @@ namespace OpenSim.Data.MySQL
86 if (!x.Locked) 86 if (!x.Locked)
87 { 87 {
88 x.GetLock(); 88 x.GetLock();
89 x.Running = why;
89 return x; 90 return x;
90 } 91 }
91 92
@@ -96,6 +97,11 @@ namespace OpenSim.Data.MySQL
96 System.Threading.Thread.Sleep(1000); // Wait some time before searching them again. 97 System.Threading.Thread.Sleep(1000); // Wait some time before searching them again.
97 m_log.Debug( 98 m_log.Debug(
98 "WARNING: All threads are in use. Probable cause: Something didnt release a mutex properly, or high volume of requests inbound."); 99 "WARNING: All threads are in use. Probable cause: Something didnt release a mutex properly, or high volume of requests inbound.");
100 m_log.Debug("Current connections-in-use dump:");
101 foreach (KeyValuePair<int, MySQLSuperManager> kvp in m_dbconnections)
102 {
103 m_log.Debug(kvp.Value.Running);
104 }
99 } 105 }
100 } 106 }
101 } 107 }
@@ -167,7 +173,7 @@ namespace OpenSim.Data.MySQL
167 // see IUserDataPlugin 173 // see IUserDataPlugin
168 public override UserProfileData GetUserByName(string user, string last) 174 public override UserProfileData GetUserByName(string user, string last)
169 { 175 {
170 MySQLSuperManager dbm = GetLockedConnection(); 176 MySQLSuperManager dbm = GetLockedConnection("GetUserByName");
171 177
172 try 178 try
173 { 179 {
@@ -202,7 +208,7 @@ namespace OpenSim.Data.MySQL
202 208
203 public override void AddNewUserFriend(UUID friendlistowner, UUID friend, uint perms) 209 public override void AddNewUserFriend(UUID friendlistowner, UUID friend, uint perms)
204 { 210 {
205 MySQLSuperManager dbm = GetLockedConnection(); 211 MySQLSuperManager dbm = GetLockedConnection("AddNewUserFriend");
206 212
207 int dtvalue = Util.UnixTimeSinceEpoch(); 213 int dtvalue = Util.UnixTimeSinceEpoch();
208 214
@@ -246,7 +252,7 @@ namespace OpenSim.Data.MySQL
246 252
247 public override void RemoveUserFriend(UUID friendlistowner, UUID friend) 253 public override void RemoveUserFriend(UUID friendlistowner, UUID friend)
248 { 254 {
249 MySQLSuperManager dbm = GetLockedConnection(); 255 MySQLSuperManager dbm = GetLockedConnection("RemoveUserFriend");
250 256
251 Dictionary<string, string> param = new Dictionary<string, string>(); 257 Dictionary<string, string> param = new Dictionary<string, string>();
252 param["?ownerID"] = friendlistowner.ToString(); 258 param["?ownerID"] = friendlistowner.ToString();
@@ -280,7 +286,7 @@ namespace OpenSim.Data.MySQL
280 286
281 public override void UpdateUserFriendPerms(UUID friendlistowner, UUID friend, uint perms) 287 public override void UpdateUserFriendPerms(UUID friendlistowner, UUID friend, uint perms)
282 { 288 {
283 MySQLSuperManager dbm = GetLockedConnection(); 289 MySQLSuperManager dbm = GetLockedConnection("UpdateUserFriendPerms");
284 290
285 Dictionary<string, string> param = new Dictionary<string, string>(); 291 Dictionary<string, string> param = new Dictionary<string, string>();
286 param["?ownerID"] = friendlistowner.ToString(); 292 param["?ownerID"] = friendlistowner.ToString();
@@ -311,7 +317,7 @@ namespace OpenSim.Data.MySQL
311 317
312 public override List<FriendListItem> GetUserFriendList(UUID friendlistowner) 318 public override List<FriendListItem> GetUserFriendList(UUID friendlistowner)
313 { 319 {
314 MySQLSuperManager dbm = GetLockedConnection(); 320 MySQLSuperManager dbm = GetLockedConnection("GetUserFriendList");
315 List<FriendListItem> Lfli = new List<FriendListItem>(); 321 List<FriendListItem> Lfli = new List<FriendListItem>();
316 322
317 Dictionary<string, string> param = new Dictionary<string, string>(); 323 Dictionary<string, string> param = new Dictionary<string, string>();
@@ -367,7 +373,7 @@ namespace OpenSim.Data.MySQL
367 373
368 public override List<AvatarPickerAvatar> GeneratePickerResults(UUID queryID, string query) 374 public override List<AvatarPickerAvatar> GeneratePickerResults(UUID queryID, string query)
369 { 375 {
370 MySQLSuperManager dbm = GetLockedConnection(); 376 MySQLSuperManager dbm = GetLockedConnection("GeneratePickerResults");
371 377
372 List<AvatarPickerAvatar> returnlist = new List<AvatarPickerAvatar>(); 378 List<AvatarPickerAvatar> returnlist = new List<AvatarPickerAvatar>();
373 379
@@ -457,7 +463,7 @@ namespace OpenSim.Data.MySQL
457 /// <returns>User profile data</returns> 463 /// <returns>User profile data</returns>
458 public override UserProfileData GetUserByUUID(UUID uuid) 464 public override UserProfileData GetUserByUUID(UUID uuid)
459 { 465 {
460 MySQLSuperManager dbm = GetLockedConnection(); 466 MySQLSuperManager dbm = GetLockedConnection("GetUserByUUID");
461 try 467 try
462 { 468 {
463 Dictionary<string, string> param = new Dictionary<string, string>(); 469 Dictionary<string, string> param = new Dictionary<string, string>();
@@ -514,7 +520,7 @@ namespace OpenSim.Data.MySQL
514 /// <remarks>is it still used ?</remarks> 520 /// <remarks>is it still used ?</remarks>
515 public override void StoreWebLoginKey(UUID AgentID, UUID WebLoginKey) 521 public override void StoreWebLoginKey(UUID AgentID, UUID WebLoginKey)
516 { 522 {
517 MySQLSuperManager dbm = GetLockedConnection(); 523 MySQLSuperManager dbm = GetLockedConnection("StoreWebLoginKey");
518 524
519 Dictionary<string, string> param = new Dictionary<string, string>(); 525 Dictionary<string, string> param = new Dictionary<string, string>();
520 param["?UUID"] = AgentID.ToString(); 526 param["?UUID"] = AgentID.ToString();
@@ -546,7 +552,7 @@ namespace OpenSim.Data.MySQL
546 /// <returns>The users session</returns> 552 /// <returns>The users session</returns>
547 public override UserAgentData GetAgentByUUID(UUID uuid) 553 public override UserAgentData GetAgentByUUID(UUID uuid)
548 { 554 {
549 MySQLSuperManager dbm = GetLockedConnection(); 555 MySQLSuperManager dbm = GetLockedConnection("GetAgentByUUID");
550 556
551 try 557 try
552 { 558 {
@@ -587,7 +593,7 @@ namespace OpenSim.Data.MySQL
587 { 593 {
588 return; 594 return;
589 } 595 }
590 MySQLSuperManager dbm = GetLockedConnection(); 596 MySQLSuperManager dbm = GetLockedConnection("AddNewUserProfile");
591 597
592 try 598 try
593 { 599 {
@@ -621,7 +627,7 @@ namespace OpenSim.Data.MySQL
621 if (agent.ProfileID == zero || agent.SessionID == zero) 627 if (agent.ProfileID == zero || agent.SessionID == zero)
622 return; 628 return;
623 629
624 MySQLSuperManager dbm = GetLockedConnection(); 630 MySQLSuperManager dbm = GetLockedConnection("AddNewUserAgent");
625 try 631 try
626 { 632 {
627 dbm.Manager.insertAgentRow(agent); 633 dbm.Manager.insertAgentRow(agent);
@@ -643,7 +649,7 @@ namespace OpenSim.Data.MySQL
643 /// <param name="user">The profile data to use to update the DB</param> 649 /// <param name="user">The profile data to use to update the DB</param>
644 public override bool UpdateUserProfile(UserProfileData user) 650 public override bool UpdateUserProfile(UserProfileData user)
645 { 651 {
646 MySQLSuperManager dbm = GetLockedConnection(); 652 MySQLSuperManager dbm = GetLockedConnection("UpdateUserProfile");
647 try 653 try
648 { 654 {
649 dbm.Manager.updateUserRow(user.ID, user.FirstName, user.SurName, user.PasswordHash, user.PasswordSalt, 655 dbm.Manager.updateUserRow(user.ID, user.FirstName, user.SurName, user.PasswordHash, user.PasswordSalt,
@@ -695,7 +701,7 @@ namespace OpenSim.Data.MySQL
695 /// </summary> 701 /// </summary>
696 public override AvatarAppearance GetUserAppearance(UUID user) 702 public override AvatarAppearance GetUserAppearance(UUID user)
697 { 703 {
698 MySQLSuperManager dbm = GetLockedConnection(); 704 MySQLSuperManager dbm = GetLockedConnection("GetUserAppearance");
699 try 705 try
700 { 706 {
701 Dictionary<string, string> param = new Dictionary<string, string>(); 707 Dictionary<string, string> param = new Dictionary<string, string>();
@@ -740,7 +746,7 @@ namespace OpenSim.Data.MySQL
740 // override 746 // override
741 public override void UpdateUserAppearance(UUID user, AvatarAppearance appearance) 747 public override void UpdateUserAppearance(UUID user, AvatarAppearance appearance)
742 { 748 {
743 MySQLSuperManager dbm = GetLockedConnection(); 749 MySQLSuperManager dbm = GetLockedConnection("UpdateUserAppearance");
744 try 750 try
745 { 751 {
746 appearance.Owner = user; 752 appearance.Owner = user;
@@ -779,7 +785,7 @@ namespace OpenSim.Data.MySQL
779 785
780 public Hashtable GetUserAttachments(UUID agentID) 786 public Hashtable GetUserAttachments(UUID agentID)
781 { 787 {
782 MySQLSuperManager dbm = GetLockedConnection(); 788 MySQLSuperManager dbm = GetLockedConnection("GetUserAttachments");
783 789
784 Dictionary<string, string> param = new Dictionary<string, string>(); 790 Dictionary<string, string> param = new Dictionary<string, string>();
785 param["?uuid"] = agentID.ToString(); 791 param["?uuid"] = agentID.ToString();
@@ -810,7 +816,7 @@ namespace OpenSim.Data.MySQL
810 816
811 public void UpdateUserAttachments(UUID agentID, Hashtable data) 817 public void UpdateUserAttachments(UUID agentID, Hashtable data)
812 { 818 {
813 MySQLSuperManager dbm = GetLockedConnection(); 819 MySQLSuperManager dbm = GetLockedConnection("UpdateUserAttachments");
814 try 820 try
815 { 821 {
816 dbm.Manager.writeAttachments(agentID, data); 822 dbm.Manager.writeAttachments(agentID, data);
@@ -823,7 +829,7 @@ namespace OpenSim.Data.MySQL
823 829
824 public override void ResetAttachments(UUID userID) 830 public override void ResetAttachments(UUID userID)
825 { 831 {
826 MySQLSuperManager dbm = GetLockedConnection(); 832 MySQLSuperManager dbm = GetLockedConnection("ResetAttachments");
827 833
828 Dictionary<string, string> param = new Dictionary<string, string>(); 834 Dictionary<string, string> param = new Dictionary<string, string>();
829 param["?uuid"] = userID.ToString(); 835 param["?uuid"] = userID.ToString();