List:Commits« Previous MessageNext Message »
From:Alexander Barkov Date:April 7 2009 7:05am
Subject:bzr commit into mysql-6.0-bugteam branch (bar:3185)
View as plain text  
#At file:///home/bar/mysql-bzr/mysql-6.0-bugteam/ based on revid:bar@stripped

 3185 Alexander Barkov	2009-04-07 [merge]
      Merging changes from 5.1-bugteam (bug 42649)

    modified:
      mysys/charset.c
=== modified file 'mysys/charset.c'
--- a/mysys/charset.c	2009-03-17 20:07:27 +0000
+++ b/mysys/charset.c	2009-04-07 07:03:53 +0000
@@ -522,29 +522,40 @@ static CHARSET_INFO *get_internal_charse
 {
   char  buf[FN_REFLEN];
   CHARSET_INFO *cs;
-  /*
-    To make things thread safe we are not allowing other threads to interfere
-    while we may changing the cs_info_table
-  */
-  pthread_mutex_lock(&THR_LOCK_charset);
+
   if ((cs= all_charsets[cs_number]))
   {
-    if (!(cs->state & MY_CS_COMPILED) && !(cs->state & MY_CS_LOADED))
+    if (cs->state & MY_CS_READY)  /* if CS is already initialized */
+        return cs;
+
+    /*
+      To make things thread safe we are not allowing other threads to interfere
+      while we may changing the cs_info_table
+    */
+    pthread_mutex_lock(&THR_LOCK_charset);
+
+    if (!(cs->state & (MY_CS_COMPILED|MY_CS_LOADED))) /* if CS is not in memory */
     {
       strxmov(get_charsets_dir(buf), cs->csname, ".xml", NullS);
       my_read_charset_file(buf,flags);
     }
-    cs= (cs->state & MY_CS_AVAILABLE) ? cs : NULL;
-  }
-  if (cs && !(cs->state & MY_CS_READY))
-  {
-    if ((cs->cset->init && cs->cset->init(cs, cs_alloc)) ||
-        (cs->coll->init && cs->coll->init(cs, cs_alloc)))
-      cs= NULL;
+
+    if (cs->state & MY_CS_AVAILABLE)
+    {
+      if (!(cs->state & MY_CS_READY))
+      {
+        if ((cs->cset->init && cs->cset->init(cs, cs_alloc)) ||
+            (cs->coll->init && cs->coll->init(cs, cs_alloc)))
+          cs= NULL;
+        else
+          cs->state|= MY_CS_READY;
+      }
+    }
     else
-      cs->state|= MY_CS_READY;
+      cs= NULL;
+
+    pthread_mutex_unlock(&THR_LOCK_charset);
   }
-  pthread_mutex_unlock(&THR_LOCK_charset);
   return cs;
 }
 


Attachment: [text/bzr-bundle] bzr/bar@mysql.com-20090407070353-dljrdyt0cyn4cqak.bundle
Thread
bzr commit into mysql-6.0-bugteam branch (bar:3185) Alexander Barkov7 Apr