List:Commits« Previous MessageNext Message »
From:rburnett Date:November 7 2008 8:17pm
Subject:Connector/NET commit: r1445 - in branches/5.2: . MySql.Data/Provider/Source
View as plain text  
Modified:
   branches/5.2/CHANGES
   branches/5.2/MySql.Data/Provider/Source/CharSetMap.cs
Log:
- fixed problem where CharSetMap.GetDefaultCollation and CharSetMap.GetMaxLengths
  might have a thread sync issue on high load systems.  They were not locking
  the static collections there were initializing. (bug #40231)  


Modified: branches/5.2/CHANGES
===================================================================
--- branches/5.2/CHANGES	2008-11-06 20:39:05 UTC (rev 1444)
+++ branches/5.2/CHANGES	2008-11-07 19:17:22 UTC (rev 1445)
@@ -30,6 +30,9 @@
   and therefore return strings with a bad encoding.
 - fixed bug where provider was attempting to use the new parameters I_S view on servers
   that didn't have it (bug #40382)
+- fixed problem where CharSetMap.GetDefaultCollation and CharSetMap.GetMaxLengths
+  might have a thread sync issue on high load systems.  They were not locking
+  the static collections there were initializing. (bug #40231)  
   
   
 Version 5.2.3 - 8/14/08

Modified: branches/5.2/MySql.Data/Provider/Source/CharSetMap.cs
===================================================================
--- branches/5.2/MySql.Data/Provider/Source/CharSetMap.cs	2008-11-06 20:39:05 UTC (rev
1444)
+++ branches/5.2/MySql.Data/Provider/Source/CharSetMap.cs	2008-11-07 19:17:22 UTC (rev
1445)
@@ -166,8 +166,11 @@
 
         internal static string GetDefaultCollation(string charset, MySqlConnection
connection)
         {
-            if (defaultCollations == null)
-                InitCollections(connection);
+            lock (defaultCollations)
+            {
+                if (defaultCollations == null)
+                    InitCollections(connection);
+            }
             if (!defaultCollations.ContainsKey(charset))
                 return null;
             return defaultCollations[charset];
@@ -175,8 +178,13 @@
 
         internal static int GetMaxLength(string charset, MySqlConnection connection)
         {
-            if (maxLengths == null)
-                InitCollections(connection);
+            // we lock on defaultCollations here too so GetDefaultCollation
+            // is on the same lock as us.
+            lock (defaultCollations)
+            {
+                if (maxLengths == null)
+                    InitCollections(connection);
+            }
 
             if (!maxLengths.ContainsKey(charset))
                 return 1;

Thread
Connector/NET commit: r1445 - in branches/5.2: . MySql.Data/Provider/Sourcerburnett7 Nov