List:Commits« Previous MessageNext Message »
From:Michael Widenius Date:August 25 2008 6:23pm
Subject:bzr commit into mysql-6.0 branch (monty:2692)
View as plain text  
#At file:///home/my/mysql-6.0-maria/

 2692 Michael Widenius	2008-08-25 [merge]
      Merge with mysql-5.1-maria
modified:
  mysql-test/mysql-test-run.pl
  mysql-test/r/maria.result
  mysql-test/t/maria.test
  mysys/my_pread.c
  sql/sql_base.cc
  sql/sql_table.cc
  storage/maria/ha_maria.cc
  storage/maria/ma_check.c
  storage/maria/ma_checkpoint.c
  storage/maria/ma_close.c
  storage/maria/ma_create.c
  storage/maria/ma_dbug.c
  storage/maria/ma_delete.c
  storage/maria/ma_extra.c
  storage/maria/ma_info.c
  storage/maria/ma_keycache.c
  storage/maria/ma_locking.c
  storage/maria/ma_loghandler.c
  storage/maria/ma_open.c
  storage/maria/ma_pagecache.c
  storage/maria/ma_recovery.c
  storage/maria/ma_search.c
  storage/maria/ma_state.c
  storage/maria/ma_update.c
  storage/maria/ma_write.c
  storage/maria/maria_def.h
  storage/maria/maria_ftdump.c
  storage/maria/maria_pack.c
  storage/myisam/mi_search.c

per-file messages:
  mysql-test/r/maria.result
    Manual merge
  mysql-test/t/maria.test
    Manual merge
  mysys/my_pread.c
    Manual merge
  sql/sql_base.cc
    Manual merge
  sql/sql_table.cc
    Manual merge
  storage/maria/ha_maria.cc
    Manual merge
  storage/maria/ma_check.c
    Manual merge
=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl	2008-08-13 10:36:29 +0000
+++ b/mysql-test/mysql-test-run.pl	2008-08-25 18:23:18 +0000
@@ -3670,15 +3670,17 @@ sub mysqld_arguments ($$$$) {
   mtr_add_arg($args, "%s--basedir=%s", $prefix, $path_my_basedir);
   mtr_add_arg($args, "%s--character-sets-dir=%s", $prefix, $path_charsetsdir);
 
-  if ( $mysql_version_id >= 50036)
+  if (!$opt_extern)
   {
-    # By default, prevent the started mysqld to access files outside of vardir
-    mtr_add_arg($args, "%s--secure-file-priv=%s", $prefix, $opt_vardir);
-  }
+    if ( $mysql_version_id >= 50036)
+    {
+      # Prevent the started mysqld to access files outside of vardir
+      mtr_add_arg($args, "%s--secure-file-priv=%s", $prefix, $opt_vardir);
+    }
 
-  if ( $mysql_version_id >= 50000 )
-  {
-    mtr_add_arg($args, "%s--log-bin-trust-function-creators", $prefix);
+    if ( $mysql_version_id >= 50000 ) {
+      mtr_add_arg($args, "%s--log-bin-trust-function-creators", $prefix);
+    }
   }
 
   mtr_add_arg($args, "%s--default-character-set=latin1", $prefix);
@@ -3730,7 +3732,7 @@ sub mysqld_arguments ($$$$) {
 
   mtr_add_arg($args, "%s--disable-sync-frm", $prefix);  # Faster test
 
-  if ( $mysql_version_id >= 50106 )
+  if (!$opt_extern and $mysql_version_id >= 50106 )
   {
     # Turn on logging to bothe tables and file
     mtr_add_arg($args, "%s--log-output=table,file", $prefix);

=== modified file 'mysql-test/r/maria.result'
--- a/mysql-test/r/maria.result	2008-08-20 15:02:09 +0000
+++ b/mysql-test/r/maria.result	2008-08-25 18:23:18 +0000
@@ -2229,3 +2229,12 @@ insert t1 values (2,3), (sleep(10),sleep
 LOCK TABLES t1 write concurrent;
 insert t1 values (7,8);
 drop table t1;
+create table t1 (a int) engine=maria transactional=1;
+insert into t1 values (1);
+lock table t1 write concurrent;
+delete from t1;
+ERROR 42000: The storage engine for the table doesn't support DELETE in WRITE CONCURRENT
+drop table t1;
+ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
+unlock tables;
+drop table t1;

=== modified file 'mysql-test/t/maria.test'
--- a/mysql-test/t/maria.test	2008-08-20 15:02:09 +0000
+++ b/mysql-test/t/maria.test	2008-08-25 18:23:18 +0000
@@ -1515,6 +1515,20 @@ connection default;
 --reap
 drop table t1;
 
+#
+# BUG#38606  test suite
+#
+create table t1 (a int) engine=maria transactional=1;
+insert into t1 values (1);
+lock table t1 write concurrent;
+# should be fixed with fully implemented versioning
+--error ER_CHECK_NOT_IMPLEMENTED
+delete from t1;
+--error 1099
+drop table t1;
+unlock tables;
+drop table t1;
+
 --disable_result_log
 --disable_query_log
 eval set global storage_engine=$default_engine, maria_page_checksum=$default_checksum;

=== modified file 'mysys/my_pread.c'
--- a/mysys/my_pread.c	2008-06-05 16:11:22 +0000
+++ b/mysys/my_pread.c	2008-08-25 18:23:18 +0000
@@ -132,7 +132,7 @@ size_t my_pread(File Filedes, uchar *Buf
 #endif
   for (;;)
   {
-    errno=0;					/* Linux, Windows don't reset this on EOF/success */
+    errno= 0;    /* Linux, Windows don't reset this on EOF/success */
 #if !defined (HAVE_PREAD) && !defined (__WIN__)
     pthread_mutex_lock(&my_file_info[Filedes].mutex);
     readbytes= (uint) -1;

=== modified file 'sql/sql_base.cc'
--- a/sql/sql_base.cc	2008-08-13 10:36:29 +0000
+++ b/sql/sql_base.cc	2008-08-25 18:23:18 +0000
@@ -1247,6 +1247,10 @@ close_all_tables_for_name(THD *thd, TABL
         This allows one to use this function after a table
         has been unlocked, e.g. in partition management.
       */
+
+      /* Inform handler that table will be dropped after close */
+      table->file->extra(HA_EXTRA_PREPARE_FOR_DROP);
+
       mysql_lock_remove(thd, thd->lock, table);
 
       thd->locked_tables_list.unlink_from_list(thd,
@@ -2074,6 +2078,7 @@ bool wait_while_table_is_used(THD *thd, 
 void drop_open_table(THD *thd, TABLE *table, const char *db_name,
                      const char *table_name)
 {
+  DBUG_ENTER("drop_open_table");
   if (table->s->tmp_table)
     close_temporary_table(thd, table, 1, 1);
   else
@@ -2085,10 +2090,12 @@ void drop_open_table(THD *thd, TABLE *ta
     table->s->version= 0;
 
     pthread_mutex_lock(&LOCK_open);
+    table->file->extra(HA_EXTRA_PREPARE_FOR_DROP);
     close_thread_table(thd, &thd->open_tables);
     quick_rm_table(table_type, db_name, table_name, 0);
     pthread_mutex_unlock(&LOCK_open);
   }
+  DBUG_VOID_RETURN;
 }
 
 

=== modified file 'sql/sql_table.cc'
--- a/sql/sql_table.cc	2008-08-13 10:36:29 +0000
+++ b/sql/sql_table.cc	2008-08-25 18:23:18 +0000
@@ -7382,7 +7382,7 @@ err:
   if (errpos >= 3 && to->file->ha_end_bulk_insert(error > 1) && error <= 0)
   {
     to->file->print_error(my_errno,MYF(0));
-    error=1;
+    error= 1;
   }
   to->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY);
 
@@ -7405,6 +7405,8 @@ err:
   to->file->ha_release_auto_increment();
   if (errpos >= 2 && to->file->ha_external_lock(thd,F_UNLCK))
     error=1;
+  if (error < 0 && to->file->extra(HA_EXTRA_PREPARE_FOR_RENAME))
+    error= 1;
   DBUG_RETURN(error > 0 ? -1 : 0);
 }
 

=== modified file 'storage/maria/ha_maria.cc'
--- a/storage/maria/ha_maria.cc	2008-08-20 15:02:09 +0000
+++ b/storage/maria/ha_maria.cc	2008-08-25 18:23:18 +0000
@@ -44,6 +44,7 @@ C_MODE_END
 #ifdef MARIA_CANNOT_ROLLBACK
 #define trans_register_ha(A, B, C)  do { /* nothing */ } while(0)
 #endif
+#define THD_TRN (*(TRN **)thd_ha_data(thd, maria_hton))
 
 ulong pagecache_division_limit, pagecache_age_threshold;
 ulonglong pagecache_buffer_size;
@@ -1164,7 +1165,7 @@ int ha_maria::zerofill(THD * thd, HA_CHE
   param.op_name= "zerofill";
   param.testflag= check_opt->flags | T_SILENT | T_ZEROFILL;
   param.sort_buffer_length= THDVAR(thd, sort_buffer_size);
-  error=maria_zerofill(&param, file, share->open_file_name);
+  error=maria_zerofill(&param, file, share->open_file_name.str);
 
   if (!error)
   {
@@ -1241,7 +1242,7 @@ int ha_maria::repair(THD *thd, HA_CHECK 
   param->thd= thd;
   param->tmpdir= &mysql_tmpdir_list;
   param->out_flag= 0;
-  strmov(fixed_name, share->open_file_name);
+  strmov(fixed_name, share->open_file_name.str);
 
   // Don't lock tables if we have used LOCK TABLE
   if (!thd->locked_tables_mode &&
@@ -1844,10 +1845,18 @@ bool ha_maria::is_crashed() const
           (my_disable_locking && file->s->state.open_count));
 }
 
+#define CHECK_UNTIL_WE_FULLY_IMPLEMENTED_VERSIONING(msg) \
+  do { \
+    if (file->lock.type == TL_WRITE_CONCURRENT_INSERT) \
+    { \
+      my_error(ER_CHECK_NOT_IMPLEMENTED, MYF(0), msg); \
+      return 1; \
+    } \
+  } while(0)
 
 int ha_maria::update_row(const uchar * old_data, uchar * new_data)
 {
-  DBUG_ASSERT(file->lock.type != TL_WRITE_CONCURRENT_INSERT);
+  CHECK_UNTIL_WE_FULLY_IMPLEMENTED_VERSIONING("UPDATE in WRITE CONCURRENT");
   ha_statistic_increment(&SSV::ha_update_count);
   if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE)
     table->timestamp_field->set_time();
@@ -1857,7 +1866,7 @@ int ha_maria::update_row(const uchar * o
 
 int ha_maria::delete_row(const uchar * buf)
 {
-  DBUG_ASSERT(file->lock.type != TL_WRITE_CONCURRENT_INSERT);
+  CHECK_UNTIL_WE_FULLY_IMPLEMENTED_VERSIONING("DELETE in WRITE CONCURRENT");
   ha_statistic_increment(&SSV::ha_delete_count);
   return maria_delete(file, buf);
 }
@@ -2061,11 +2070,11 @@ int ha_maria::info(uint flag)
        if table is symlinked (Ie;  Real name is not same as generated name)
     */
     data_file_name= index_file_name= 0;
-    fn_format(name_buff, file->s->open_file_name, "", MARIA_NAME_DEXT,
+    fn_format(name_buff, file->s->open_file_name.str, "", MARIA_NAME_DEXT,
               MY_APPEND_EXT | MY_UNPACK_FILENAME);
     if (strcmp(name_buff, maria_info.data_file_name))
-      data_file_name=maria_info.data_file_name;
-    fn_format(name_buff, file->s->open_file_name, "", MARIA_NAME_IEXT,
+      data_file_name =maria_info.data_file_name;
+    fn_format(name_buff, file->s->open_file_name.str, "", MARIA_NAME_IEXT,
               MY_APPEND_EXT | MY_UNPACK_FILENAME);
     if (strcmp(name_buff, maria_info.index_file_name))
       index_file_name=maria_info.index_file_name;
@@ -2087,6 +2096,21 @@ int ha_maria::extra(enum ha_extra_functi
 {
   if ((specialflag & SPECIAL_SAFE_MODE) && operation == HA_EXTRA_KEYREAD)
     return 0;
+
+  /*
+    We have to set file->trn here because in some cases we call
+    extern_lock(F_UNLOCK) (which resets file->trn) followed by maria_close()
+    without calling commit/rollback in between.  If file->trn is not set
+    we can't remove file->share from the transaction list in the extra() call.
+  */
+
+  if (!file->trn &&
+      (operation == HA_EXTRA_PREPARE_FOR_DROP ||
+       operation == HA_EXTRA_PREPARE_FOR_RENAME))
+  {
+    THD *thd= table->in_use;
+    file->trn= THD_TRN;
+  }
   return maria_extra(file, operation, 0);
 }
 
@@ -2126,8 +2150,6 @@ int ha_maria::delete_table(const char *n
   return maria_delete_table(name);
 }
 
-#define THD_TRN (*(TRN **)thd_ha_data(thd, maria_hton))
-
 int ha_maria::external_lock(THD *thd, int lock_type)
 {
   TRN *trn= THD_TRN;

=== modified file 'storage/maria/ma_check.c'
--- a/storage/maria/ma_check.c	2008-07-10 15:20:07 +0000
+++ b/storage/maria/ma_check.c	2008-08-25 18:23:18 +0000
@@ -2476,7 +2476,7 @@ int maria_repair(HA_CHECK *param, regist
   {
     /* Get real path for data file */
     if ((new_file= my_create(fn_format(param->temp_filename,
-                                       share->data_file_name, "",
+                                       share->data_file_name.str, "",
                                        DATA_TMP_EXT, 2+4),
                              0,param->tmpfile_createflag,
                              MYF(0))) < 0)
@@ -2680,7 +2680,7 @@ int maria_repair(HA_CHECK *param, regist
       my_close(new_file, MYF(MY_WME));
     new_file= -1;
     change_data_file_descriptor(info, -1);
-    if (maria_change_to_newfile(share->data_file_name,MARIA_NAME_DEXT,
+    if (maria_change_to_newfile(share->data_file_name.str, MARIA_NAME_DEXT,
                                 DATA_TMP_EXT,
                                 (param->testflag & T_BACKUP_DATA ?
                                  MYF(MY_REDEL_MAKE_BACKUP): MYF(0)) |
@@ -2992,8 +2992,8 @@ int maria_sort_index(HA_CHECK *param, re
   (void)(my_close(share->kfile.file, MYF(MY_WME)));
   share->kfile.file = -1;
   pthread_mutex_unlock(&share->intern_lock);
-  (void)(my_close(new_file,MYF(MY_WME)));
-  if (maria_change_to_newfile(share->index_file_name, MARIA_NAME_IEXT,
+  (void) my_close(new_file,MYF(MY_WME));
+  if (maria_change_to_newfile(share->index_file_name.str, MARIA_NAME_IEXT,
                               INDEX_TMP_EXT, sync_dir) ||
       _ma_open_keyfile(share))
     goto err2;
@@ -3524,7 +3524,7 @@ int maria_repair_by_sort(HA_CHECK *param
   {
     /* Get real path for data file */
     if ((new_file=my_create(fn_format(param->temp_filename,
-                                      share->data_file_name, "",
+                                      share->data_file_name.str, "",
                                       DATA_TMP_EXT, 2+4),
                             0,param->tmpfile_createflag,
                             MYF(0))) < 0)
@@ -3789,7 +3789,7 @@ int maria_repair_by_sort(HA_CHECK *param
         new_file= -1;
       }
       change_data_file_descriptor(info, -1);
-      if (maria_change_to_newfile(share->data_file_name,MARIA_NAME_DEXT,
+      if (maria_change_to_newfile(share->data_file_name.str, MARIA_NAME_DEXT,
                                   DATA_TMP_EXT,
                                   (param->testflag & T_BACKUP_DATA ?
                                    MYF(MY_REDEL_MAKE_BACKUP): MYF(0)) |
@@ -4070,7 +4070,7 @@ int maria_repair_parallel(HA_CHECK *para
   {
     /* Get real path for data file */
     if ((new_file= my_create(fn_format(param->temp_filename,
-                                       share->data_file_name, "",
+                                       share->data_file_name.str, "",
                                        DATA_TMP_EXT,
                                        2+4),
                              0,param->tmpfile_createflag,
@@ -4397,7 +4397,7 @@ err:
     {
       my_close(new_file,MYF(0));
       info->dfile.file= new_file= -1;
-      if (maria_change_to_newfile(share->data_file_name,MARIA_NAME_DEXT,
+      if (maria_change_to_newfile(share->data_file_name.str, MARIA_NAME_DEXT,
                                   DATA_TMP_EXT,
                                   MYF((param->testflag & T_BACKUP_DATA ?
                                        MY_REDEL_MAKE_BACKUP : 0) |
@@ -6236,7 +6236,7 @@ static my_bool create_new_data_handle(MA
   MARIA_HA *new_info;
   DBUG_ENTER("create_new_data_handle");
 
-  if (!(sort_info->new_info= maria_open(info->s->open_file_name, O_RDWR,
+  if (!(sort_info->new_info= maria_open(info->s->open_file_name.str, O_RDWR,
                                         HA_OPEN_COPY | HA_OPEN_FOR_REPAIR)))
     DBUG_RETURN(1);
 

=== modified file 'storage/maria/ma_checkpoint.c'
--- a/storage/maria/ma_checkpoint.c	2008-07-05 11:03:21 +0000
+++ b/storage/maria/ma_checkpoint.c	2008-08-25 11:49:47 +0000
@@ -820,7 +820,7 @@ static int collect_tables(LEX_STRING *st
       */
       share->in_checkpoint= MARIA_CHECKPOINT_LOOKS_AT_ME;
       /** @todo avoid strlen() */
-      total_names_length+= strlen(share->open_file_name);
+      total_names_length+= share->open_file_name.length;
     }
   }
 
@@ -894,7 +894,7 @@ static int collect_tables(LEX_STRING *st
        @todo We should not look at tables which didn't change since last
        checkpoint.
     */
-    DBUG_PRINT("info",("looking at table '%s'", share->open_file_name));
+    DBUG_PRINT("info",("looking at table '%s'", share->open_file_name.str));
     if (state_copy == state_copies_end) /* we have no more cached states */
     {
       /*
@@ -978,8 +978,7 @@ static int collect_tables(LEX_STRING *st
     DBUG_PRINT("info", ("ignore_share: %d", ignore_share));
     if (!ignore_share)
     {
-      /** @todo avoid strlen */
-      uint open_file_name_len= strlen(share->open_file_name) + 1;
+      uint open_file_name_len= share->open_file_name.length + 1;
       /* remember the descriptors for background flush */
       *(dfiles_end++)= dfile;
       *(kfiles_end++)= kfile;
@@ -1000,7 +999,7 @@ static int collect_tables(LEX_STRING *st
         If no crash, maria_close() will write the exact value.
       */
       state_copy->state.first_bitmap_with_space= ~(ulonglong)0;
-      memcpy(ptr, share->open_file_name, open_file_name_len);
+      memcpy(ptr, share->open_file_name.str, open_file_name_len);
       ptr+= open_file_name_len;
       if (cmp_translog_addr(share->state.is_of_horizon,
                             checkpoint_start_log_horizon) >= 0)

=== modified file 'storage/maria/ma_close.c'
--- a/storage/maria/ma_close.c	2008-07-09 21:25:29 +0000
+++ b/storage/maria/ma_close.c	2008-08-25 18:23:18 +0000
@@ -69,6 +69,10 @@ int maria_close(register MARIA_HA *info)
   if (flag)
   {
     /* Last close of file; Flush everything */
+
+    /* Check that we don't have any dangling pointers from the transaction */
+    DBUG_ASSERT(share->in_trans == 0);
+
     if (share->kfile.file >= 0)
     {
       if ((*share->once_end)(share))

=== modified file 'storage/maria/ma_create.c'
--- a/storage/maria/ma_create.c	2008-07-09 21:25:29 +0000
+++ b/storage/maria/ma_create.c	2008-08-25 18:23:18 +0000
@@ -1349,9 +1349,9 @@ int _ma_update_state_lsns_sub(MARIA_SHAR
     int res;
     LEX_CUSTRING log_array[TRANSLOG_INTERNAL_PARTS + 1];
     /* table name is logged only for information */
-    log_array[TRANSLOG_INTERNAL_PARTS + 0].str=    share->open_file_name;
+    log_array[TRANSLOG_INTERNAL_PARTS + 0].str=    share->open_file_name.str;
     log_array[TRANSLOG_INTERNAL_PARTS + 0].length=
-      strlen(log_array[TRANSLOG_INTERNAL_PARTS + 0].str) + 1;
+      share->open_file_name.length + 1;
     if ((res= translog_write_record(&lsn, LOGREC_IMPORTED_TABLE,
                                     &dummy_transaction_object, NULL,
                                     (translog_size_t)

=== modified file 'storage/maria/ma_dbug.c'
--- a/storage/maria/ma_dbug.c	2008-06-26 17:48:42 +0000
+++ b/storage/maria/ma_dbug.c	2008-08-25 18:23:18 +0000
@@ -184,7 +184,7 @@ my_bool _ma_check_table_is_closed(const 
   {
     MARIA_HA *info=(MARIA_HA*) pos->data;
     MARIA_SHARE *share= info->s;
-    if (!strcmp(share->unique_file_name,filename))
+    if (!strcmp(share->unique_file_name.str, filename))
     {
       if (share->last_version)
       {

=== modified file 'storage/maria/ma_delete.c'
--- a/storage/maria/ma_delete.c	2008-07-09 21:25:29 +0000
+++ b/storage/maria/ma_delete.c	2008-08-25 18:23:18 +0000
@@ -122,8 +122,9 @@ int maria_delete(MARIA_HA *info,const uc
   allow_break();			/* Allow SIGHUP & SIGINT */
   if (info->invalidator != 0)
   {
-    DBUG_PRINT("info", ("invalidator... '%s' (delete)", share->open_file_name));
-    (*info->invalidator)(share->open_file_name);
+    DBUG_PRINT("info", ("invalidator... '%s' (delete)",
+                        share->open_file_name.str));
+    (*info->invalidator)(share->open_file_name.str);
     info->invalidator=0;
   }
   DBUG_RETURN(0);
@@ -780,6 +781,7 @@ static int underflow(register MARIA_HA *
       first_key)
   {
     size_t tmp_length;
+    uint next_page_flag;
     /* Use page right of anc-page */
     DBUG_PRINT("test",("use right page"));
 
@@ -805,6 +807,7 @@ static int underflow(register MARIA_HA *
                            DFLT_INIT_HITS, buff, 0, &next_page_link))
       goto err;
     next_buff_length= _ma_get_page_used(share, buff);
+    next_page_flag=   _ma_get_keypage_flag(share,buff);
     DBUG_DUMP("next", buff, next_buff_length);
 
     /* find keys to make a big key-page */
@@ -829,7 +832,7 @@ static int underflow(register MARIA_HA *
     _ma_store_page_used(share, buff, buff_length);
 
     /* Set page flag from combination of both key pages and parting key */
-    page_flag= (_ma_get_keypage_flag(share, buff) |
+    page_flag= (next_page_flag |
                 _ma_get_keypage_flag(share, leaf_buff));
     if (anc_key.flag & (SEARCH_USER_KEY_HAS_TRANSID |
                         SEARCH_PAGE_KEY_HAS_TRANSID))

=== modified file 'storage/maria/ma_extra.c'
--- a/storage/maria/ma_extra.c	2008-08-12 10:59:30 +0000
+++ b/storage/maria/ma_extra.c	2008-08-25 18:23:18 +0000
@@ -347,7 +347,7 @@ int maria_extra(MARIA_HA *info, enum ha_
       if (do_flush)
       {
         /* Save the state so that others can find it from disk. */
-        if (_ma_state_info_write(share, 1 | 2) ||
+        if ((share->changed && _ma_state_info_write(share, 1 | 2)) ||
             my_sync(share->kfile.file, MYF(0)))
           error= my_errno;
         else

=== modified file 'storage/maria/ma_info.c'
--- a/storage/maria/ma_info.c	2008-06-05 16:11:22 +0000
+++ b/storage/maria/ma_info.c	2008-08-25 18:23:18 +0000
@@ -81,8 +81,8 @@ int maria_status(MARIA_HA *info, registe
     x->sortkey= -1;				/* No clustering */
     x->rec_per_key	= share->state.rec_per_key_part;
     x->key_map	 	= share->state.key_map;
-    x->data_file_name   = share->data_file_name;
-    x->index_file_name  = share->index_file_name;
+    x->data_file_name   = share->data_file_name.str;
+    x->index_file_name  = share->index_file_name.str;
     x->data_file_type   = share->data_file_type;
   }
   if ((flag & HA_STATUS_TIME) && !my_fstat(info->dfile.file, &state, MYF(0)))
@@ -118,13 +118,14 @@ int maria_status(MARIA_HA *info, registe
     void
 */
 
-void _ma_report_error(int errcode, const char *file_name)
+void _ma_report_error(int errcode, const LEX_STRING *name)
 {
-  size_t  length;
+  size_t length;
+  const char *file_name= name->str;
   DBUG_ENTER("_ma_report_error");
   DBUG_PRINT("enter",("errcode %d, table '%s'", errcode, file_name));
 
-  if ((length= strlen(file_name)) > 64)
+  if ((length= name->length) > 64)
   {
     /* we first remove the directory */
     size_t dir_length= dirname_length(file_name);

=== modified file 'storage/maria/ma_keycache.c'
--- a/storage/maria/ma_keycache.c	2007-10-04 17:33:42 +0000
+++ b/storage/maria/ma_keycache.c	2008-08-25 11:49:47 +0000
@@ -105,8 +105,8 @@ int maria_assign_to_pagecache(MARIA_HA *
   share->pagecache= pagecache;
 
   /* store the key cache in the global hash structure for future opens */
-  if (multi_pagecache_set((uchar*) share->unique_file_name,
-			  share->unique_name_length,
+  if (multi_pagecache_set((uchar*) share->unique_file_name.str,
+                          share->unique_file_name.length,
 			  share->pagecache))
     error= my_errno;
   pthread_mutex_unlock(&share->intern_lock);

=== modified file 'storage/maria/ma_locking.c'
--- a/storage/maria/ma_locking.c	2008-07-09 21:25:29 +0000
+++ b/storage/maria/ma_locking.c	2008-08-25 18:23:18 +0000
@@ -34,7 +34,7 @@ int maria_lock_database(MARIA_HA *info, 
                       lock_type, info->lock_type, share->r_locks,
                       share->w_locks,
                       share->global_changed, share->state.open_count,
-                      share->index_file_name));
+                      share->index_file_name.str));
   if (share->options & HA_OPTION_READ_ONLY_DATA ||
       info->lock_type == lock_type)
     DBUG_RETURN(0);

=== modified file 'storage/maria/ma_loghandler.c'
--- a/storage/maria/ma_loghandler.c	2008-07-09 21:25:29 +0000
+++ b/storage/maria/ma_loghandler.c	2008-08-25 18:23:18 +0000
@@ -7686,7 +7686,7 @@ int translog_assign_id_to_share(MARIA_HA
   DBUG_ASSERT(share->data_file_type == BLOCK_RECORD);
   /* re-check under mutex to avoid having 2 ids for the same share */
   pthread_mutex_lock(&share->intern_lock);
-  if (likely(share->id == 0))
+  if (unlikely(share->id == 0))
   {
     LSN lsn;
     LEX_CUSTRING log_array[TRANSLOG_INTERNAL_PARTS + 2];
@@ -7717,13 +7717,13 @@ int translog_assign_id_to_share(MARIA_HA
       is not realpath-ed, etc) which is good: the log can be moved to another
       directory and continue working.
     */
-    log_array[TRANSLOG_INTERNAL_PARTS + 1].str= share->open_file_name;
-    /**
-       @todo if we had the name's length in MARIA_SHARE we could avoid this
-       strlen()
-    */
+    log_array[TRANSLOG_INTERNAL_PARTS + 1].str= share->open_file_name.str;
     log_array[TRANSLOG_INTERNAL_PARTS + 1].length=
-      strlen(share->open_file_name) + 1;
+      share->open_file_name.length + 1;
+    /*
+      We can't unlock share->intern_lock before the log entry is written to
+      ensure no one uses the id before it's logged.
+    */
     if (unlikely(translog_write_record(&lsn, LOGREC_FILE_ID, trn, tbl_info,
                                        (translog_size_t)
                                        (sizeof(log_data) +

=== modified file 'storage/maria/ma_open.c'
--- a/storage/maria/ma_open.c	2008-08-24 19:28:12 +0000
+++ b/storage/maria/ma_open.c	2008-08-25 18:23:18 +0000
@@ -62,7 +62,7 @@ MARIA_HA *_ma_test_if_reopen(const char 
   {
     MARIA_HA *info=(MARIA_HA*) pos->data;
     MARIA_SHARE *share= info->s;
-    if (!strcmp(share->unique_file_name,filename) && share->last_version)
+    if (!strcmp(share->unique_file_name.str,filename) && share->last_version)
       return info;
   }
   return 0;
@@ -212,7 +212,7 @@ err:
   if ((save_errno == HA_ERR_CRASHED) ||
       (save_errno == HA_ERR_CRASHED_ON_USAGE) ||
       (save_errno == HA_ERR_CRASHED_ON_REPAIR))
-    _ma_report_error(save_errno, share->open_file_name);
+    _ma_report_error(save_errno, &share->open_file_name);
   switch (errpos) {
   case 6:
     (*share->end)(&info);
@@ -480,6 +480,10 @@ MARIA_HA *maria_open(const char *name, i
     /* Add space for node pointer */
     share->base.max_key_length+= share->base.key_reflength;
 
+    share->unique_file_name.length= strlen(name_buff);
+    share->index_file_name.length=  strlen(index_name);
+    share->data_file_name.length=   strlen(data_name);
+    share->open_file_name.length=   strlen(name);
     if (!my_multi_malloc(MY_WME,
 			 &share,sizeof(*share),
 			 &share->state.rec_per_key_part,
@@ -495,10 +499,14 @@ MARIA_HA *maria_open(const char *name, i
 			 (share->base.fields+1)*sizeof(MARIA_COLUMNDEF),
                          &share->column_nr, share->base.fields*sizeof(uint16),
 			 &share->blobs,sizeof(MARIA_BLOB)*share->base.blobs,
-			 &share->unique_file_name,strlen(name_buff)+1,
-			 &share->index_file_name,strlen(index_name)+1,
-			 &share->data_file_name,strlen(data_name)+1,
-                         &share->open_file_name,strlen(name)+1,
+			 &share->unique_file_name.str,
+			 share->unique_file_name.length+1,
+			 &share->index_file_name.str,
+                         share->index_file_name.length+1,
+			 &share->data_file_name.str,
+                         share->data_file_name.length+1,
+                         &share->open_file_name.str,
+                         share->open_file_name.length+1,
 			 &share->state.key_root,keys*sizeof(my_off_t),
 			 &share->mmap_lock,sizeof(rw_lock_t),
 			 NullS))
@@ -512,11 +520,10 @@ MARIA_HA *maria_open(const char *name, i
 	   (char*) nulls_per_key_part, sizeof(long)*key_parts);
     memcpy((char*) share->state.key_root,
 	   (char*) key_root, sizeof(my_off_t)*keys);
-    strmov(share->unique_file_name, name_buff);
-    share->unique_name_length= (uint) strlen(name_buff);
-    strmov(share->index_file_name,  index_name);
-    strmov(share->data_file_name,   data_name);
-    strmov(share->open_file_name,   name);
+    strmov(share->unique_file_name.str, name_buff);
+    strmov(share->index_file_name.str, index_name);
+    strmov(share->data_file_name.str,  data_name);
+    strmov(share->open_file_name.str,  name);
 
     share->block_size= share->base.block_size;   /* Convenience */
     {
@@ -886,7 +893,12 @@ err:
   if ((save_errno == HA_ERR_CRASHED) ||
       (save_errno == HA_ERR_CRASHED_ON_USAGE) ||
       (save_errno == HA_ERR_CRASHED_ON_REPAIR))
-    _ma_report_error(save_errno, name);
+  {
+    LEX_STRING tmp_name;
+    tmp_name.str= (char*) name;
+    tmp_name.length= strlen(name);
+    _ma_report_error(save_errno, &tmp_name);
+  }
   if (save_errno == HA_ERR_OLD_FILE) /* uuid is different ? */
     save_errno= HA_ERR_CRASHED_ON_USAGE; /* the code to trigger auto-repair */
   switch (errpos) {
@@ -1186,6 +1198,7 @@ uint _ma_state_info_write(MARIA_SHARE *s
   res= _ma_state_info_write_sub(share->kfile.file, &share->state, pWrite);
   if (pWrite & 4)
     pthread_mutex_unlock(&share->intern_lock);
+  share->changed= 0;
   return res;
 }
 
@@ -1712,7 +1725,7 @@ int _ma_open_datafile(MARIA_HA *info, MA
                       File file_to_dup __attribute__((unused)))
 {
   info->dfile.file= share->bitmap.file.file=
-    my_open(share->data_file_name, share->mode | O_SHARE,
+    my_open(share->data_file_name.str, share->mode | O_SHARE,
             MYF(MY_WME));
   return info->dfile.file >= 0 ? 0 : 1;
 }
@@ -1725,7 +1738,7 @@ int _ma_open_keyfile(MARIA_SHARE *share)
     against a concurrent checkpoint.
   */
   pthread_mutex_lock(&share->intern_lock);
-  share->kfile.file= my_open(share->unique_file_name,
+  share->kfile.file= my_open(share->unique_file_name.str,
                              share->mode | O_SHARE,
                              MYF(MY_WME));
   pthread_mutex_unlock(&share->intern_lock);

=== modified file 'storage/maria/ma_pagecache.c'
--- a/storage/maria/ma_pagecache.c	2008-05-29 15:44:11 +0000
+++ b/storage/maria/ma_pagecache.c	2008-08-25 18:23:18 +0000
@@ -305,12 +305,13 @@ struct st_pagecache_block_link
   ulonglong last_hit_time; /* timestamp of the last hit                      */
   WQUEUE
     wqueue[COND_SIZE];    /* queues on waiting requests for new/old pages    */
-  uint requests;          /* number of requests for the block                */
-  uint status;            /* state of the block                              */
-  uint pins;              /* pin counter                                     */
-  uint wlocks;            /* write locks counter                             */
-  uint rlocks;            /* read locks counter                              */
-  uint rlocks_queue;      /* rd. locks waiting wr. lock of this thread       */
+  uint32 requests;        /* number of requests for the block                */
+  uint32 pins;            /* pin counter                                     */
+  uint32 wlocks;          /* write locks counter                             */
+  uint32 rlocks;          /* read locks counter                              */
+  uint32 rlocks_queue;    /* rd. locks waiting wr. lock of this thread       */
+  uint16 status;          /* state of the block                              */
+  int16  error;           /* error code for block in case of error */
   enum PCBLOCK_TEMPERATURE temperature; /* block temperature: cold, warm, hot*/
   enum pagecache_page_type type; /* type of the block                        */
   uint hits_left;         /* number of hits left until promotion             */
@@ -2068,6 +2069,7 @@ restart:
                             (my_bool)(block->hash_link ? 1 : 0));
           PCBLOCK_INFO(block);
           block->status= error ? PCBLOCK_ERROR : 0;
+          block->error=  error;
 #ifndef DBUG_OFF
           block->type= PAGECACHE_EMPTY_PAGE;
           if (error)
@@ -2606,6 +2608,7 @@ static void read_block(PAGECACHE *pageca
     if (error)
     {
       block->status|= PCBLOCK_ERROR;
+      block->error=   error;
       my_debug_put_break_here();
     }
     else
@@ -2618,6 +2621,7 @@ static void read_block(PAGECACHE *pageca
       {
         DBUG_PRINT("error", ("read callback problem"));
         block->status|= PCBLOCK_ERROR;
+        block->error=  my_errno;
         my_debug_put_break_here();
       }
     }
@@ -3229,6 +3233,8 @@ restart:
         pagecache_pthread_mutex_lock(&pagecache->cache_lock);
 #endif
       }
+      else
+        my_errno= block->error;
     }
 
     remove_reader(block);
@@ -3313,6 +3319,7 @@ static my_bool pagecache_delete_internal
       if (error)
       {
         block->status|= PCBLOCK_ERROR;
+        block->error=   error;
         my_debug_put_break_here();
         goto err;
       }
@@ -3771,6 +3778,7 @@ restart:
         {
           DBUG_PRINT("error", ("read callback problem"));
           block->status|= PCBLOCK_ERROR;
+          block->error= my_errno;
           my_debug_put_break_here();
         }
         KEYCACHE_DBUG_PRINT("key_cache_insert",
@@ -4067,6 +4075,7 @@ static int flush_cached_blocks(PAGECACHE
     if (error)
     {
       block->status|= PCBLOCK_ERROR;
+      block->error=   error;
       my_debug_put_break_here();
       if (!*first_errno)
         *first_errno= my_errno ? my_errno : -1;

=== modified file 'storage/maria/ma_recovery.c'
--- a/storage/maria/ma_recovery.c	2008-08-12 10:59:30 +0000
+++ b/storage/maria/ma_recovery.c	2008-08-25 18:23:18 +0000
@@ -866,7 +866,7 @@ prototype_redo_exec_hook(REDO_RENAME_TAB
       ALERT_USER();
       goto end;
     }
-    if (close_one_table(info->s->open_file_name, rec->lsn) ||
+    if (close_one_table(info->s->open_file_name.str, rec->lsn) ||
         maria_close(info))
       goto end;
     info= NULL;
@@ -1008,7 +1008,7 @@ prototype_redo_exec_hook(REDO_REPAIR_TAB
   tprint(tracef, "   repairing...\n");
 
   maria_chk_init(&param);
-  param.isam_file_name= name= info->s->open_file_name;
+  param.isam_file_name= name= info->s->open_file_name.str;
   param.testflag= uint8korr(rec->header + FILEID_STORE_SIZE);
   param.tmpdir= maria_tmpdir;
   DBUG_ASSERT(maria_tmpdir);
@@ -1085,7 +1085,7 @@ prototype_redo_exec_hook(REDO_DROP_TABLE
       ALERT_USER();
       goto end;
     }
-    if (close_one_table(info->s->open_file_name, rec->lsn) ||
+    if (close_one_table(info->s->open_file_name.str, rec->lsn) ||
         maria_close(info))
       goto end;
     info= NULL;
@@ -1141,7 +1141,7 @@ prototype_redo_exec_hook(FILE_ID)
   info= all_tables[sid].info;
   if (info != NULL)
   {
-    tprint(tracef, "   Closing table '%s'\n", info->s->open_file_name);
+    tprint(tracef, "   Closing table '%s'\n", info->s->open_file_name.str);
     prepare_table_for_close(info, rec->lsn);
     if (maria_close(info))
     {
@@ -1201,7 +1201,7 @@ static int new_table(uint16 sid, const c
       It could be that we have in the log
       FILE_ID(t1,10) ... (t1 was flushed) ... FILE_ID(t1,12);
     */
-    if (close_one_table(share->open_file_name, lsn_of_file_id))
+    if (close_one_table(share->open_file_name.str, lsn_of_file_id))
       goto end;
   }
   if (!share->base.born_transactional)
@@ -1230,7 +1230,7 @@ static int new_table(uint16 sid, const c
   if (maria_is_crashed(info))
   {
     eprint(tracef, "Table '%s' is crashed, skipping it. Please repair it with"
-           " maria_chk -r", share->open_file_name);
+           " maria_chk -r", share->open_file_name.str);
     error= -1; /* not fatal, try with other tables */
     goto end;
     /*
@@ -2828,7 +2828,7 @@ static MARIA_HA *get_MARIA_HA_from_REDO_
     return NULL;
   }
   share= info->s;
-  tprint(tracef, ", '%s'", share->open_file_name);
+  tprint(tracef, ", '%s'", share->open_file_name.str);
   DBUG_ASSERT(in_redo_phase);
   if (cmp_translog_addr(rec->lsn, share->lsn_of_file_id) <= 0)
   {
@@ -2899,7 +2899,7 @@ static MARIA_HA *get_MARIA_HA_from_UNDO_
     return NULL;
   }
   share= info->s;
-  tprint(tracef, ", '%s'", share->open_file_name);
+  tprint(tracef, ", '%s'", share->open_file_name.str);
   if (cmp_translog_addr(rec->lsn, share->lsn_of_file_id) <= 0)
   {
     tprint(tracef, ", table's LOGREC_FILE_ID has LSN (%lu,0x%lx) more recent"
@@ -3188,7 +3188,7 @@ static my_bool close_one_table(const cha
        internal_table++)
   {
     MARIA_HA *info= internal_table->info;
-    if ((info != NULL) && !strcmp(info->s->open_file_name, name))
+    if ((info != NULL) && !strcmp(info->s->open_file_name.str, name))
     {
       prepare_table_for_close(info, addr);
       if (maria_close(info))

=== modified file 'storage/maria/ma_search.c'
--- a/storage/maria/ma_search.c	2008-08-16 09:49:28 +0000
+++ b/storage/maria/ma_search.c	2008-08-24 13:29:34 +0000
@@ -2194,9 +2194,10 @@ int _ma_calc_bin_pack_key_length(const M
 
     if (next_length > ref_length)
     {
-      /* We put a key with different case between two keys with the same prefix
-         Extend next key to have same prefix as
-         this key */
+      /*
+        We put a key with different case between two keys with the same prefix
+        Extend next key to have same prefix as this key
+      */
       s_temp->n_ref_length= ref_length;
       s_temp->prev_length=  next_length-ref_length;
       s_temp->prev_key+=    ref_length;
@@ -2206,13 +2207,13 @@ int _ma_calc_bin_pack_key_length(const M
     }
     /* Check how many characters are identical to next key */
     key= s_temp->key+next_length;
+    s_temp->prev_length= 0;
     while (*key++ == *next_key++) ;
     if ((ref_length= (uint) (key - s_temp->key)-1) == next_length)
     {
       s_temp->next_key_pos=0;
       return (s_temp->move_length= length);  /* Can't pack next key */
     }
-    s_temp->prev_length=0;
     s_temp->n_ref_length=ref_length;
     return s_temp->move_length= (int) (length-(ref_length - next_length) -
                                        next_length_pack +

=== modified file 'storage/maria/ma_state.c'
--- a/storage/maria/ma_state.c	2008-07-12 14:14:28 +0000
+++ b/storage/maria/ma_state.c	2008-08-18 22:21:22 +0000
@@ -79,6 +79,9 @@ my_bool _ma_setup_live_state(MARIA_HA *i
 
   pthread_mutex_lock(&share->intern_lock);
   share->in_trans++;
+  DBUG_PRINT("info", ("share: 0x%lx  in_trans: %d",
+                      (ulong) share, share->in_trans));
+
   history= share->state_history;
 
   /*
@@ -359,15 +362,16 @@ my_bool _ma_trnman_end_trans_hook(TRN *t
 {
   my_bool error= 0;
   MARIA_USED_TABLES *tables, *next;
+  DBUG_ENTER("_ma_trnman_end_trans_hook");
   
   for (tables= (MARIA_USED_TABLES*) trn->used_tables;
        tables;
        tables= next)
   {
+    MARIA_SHARE *share= tables->share;
     next= tables->next;
     if (commit)
     {
-      MARIA_SHARE *share= tables->share;
       MARIA_STATE_HISTORY *history;
 
       pthread_mutex_lock(&share->intern_lock);
@@ -405,13 +409,27 @@ my_bool _ma_trnman_end_trans_hook(TRN *t
         /* Remove not visible states */
         share->state_history= _ma_remove_not_visible_states(history, 0, 1);
       }
+      DBUG_PRINT("info", ("share: 0x%lx  in_trans: %d",
+                          (ulong) share, share->in_trans));
+      share->in_trans--;
+      pthread_mutex_unlock(&share->intern_lock);
+    }
+    else
+    {
+#ifndef DBUG_OFF
+      /*
+        We need to keep share->in_trans correct in the debug library
+        because of the assert in maria_close()
+      */
+      pthread_mutex_lock(&share->intern_lock);
       share->in_trans--;
       pthread_mutex_unlock(&share->intern_lock);
+#endif
     }
     my_free(tables, MYF(0));
   }
   trn->used_tables= 0;
-  return error;
+  DBUG_RETURN(error);
 }
 
 
@@ -421,11 +439,18 @@ my_bool _ma_trnman_end_trans_hook(TRN *t
    @notes
      This is used when we unlock a table from a group of locked tables
      just before doing a rename or drop table.
+
+     share->internal_lock must be locked when function is called
 */
 
 void _ma_remove_table_from_trnman(MARIA_SHARE *share, TRN *trn)
 {
   MARIA_USED_TABLES *tables, **prev;
+  DBUG_ENTER("_ma_remove_table_from_trnman");
+  DBUG_PRINT("enter", ("share: 0x%lx  in_trans: %d",
+                       (ulong) share, share->in_trans));
+
+  safe_mutex_assert_owner(&share->intern_lock);
   
   for (prev= (MARIA_USED_TABLES**) &trn->used_tables, tables= *prev;
        tables;
@@ -434,11 +459,14 @@ void _ma_remove_table_from_trnman(MARIA_
     if (tables->share == share)
     {
       *prev= tables->next;
+      share->in_trans--;
+      DBUG_PRINT("info", ("in_trans: %d", share->in_trans));
       my_free(tables, MYF(0));
+      break;
     }
-    else
-      prev= &tables->next;
+    prev= &tables->next;
   }
+  DBUG_VOID_RETURN;
 }
 
 

=== modified file 'storage/maria/ma_update.c'
--- a/storage/maria/ma_update.c	2008-06-26 17:48:42 +0000
+++ b/storage/maria/ma_update.c	2008-08-25 18:23:18 +0000
@@ -188,8 +188,9 @@ int maria_update(register MARIA_HA *info
   allow_break();				/* Allow SIGHUP & SIGINT */
   if (info->invalidator != 0)
   {
-    DBUG_PRINT("info", ("invalidator... '%s' (update)", share->open_file_name));
-    (*info->invalidator)(share->open_file_name);
+    DBUG_PRINT("info", ("invalidator... '%s' (update)",
+                        share->open_file_name.str));
+    (*info->invalidator)(share->open_file_name.str);
     info->invalidator=0;
   }
   DBUG_RETURN(0);

=== modified file 'storage/maria/ma_write.c'
--- a/storage/maria/ma_write.c	2008-07-09 21:25:29 +0000
+++ b/storage/maria/ma_write.c	2008-08-25 18:23:18 +0000
@@ -227,8 +227,8 @@ int maria_write(MARIA_HA *info, uchar *r
   if (info->invalidator != 0)
   {
     DBUG_PRINT("info", ("invalidator... '%s' (update)",
-                        share->open_file_name));
-    (*info->invalidator)(share->open_file_name);
+                        share->open_file_name.str));
+    (*info->invalidator)(share->open_file_name.str);
     info->invalidator=0;
   }
 

=== modified file 'storage/maria/maria_def.h'
--- a/storage/maria/maria_def.h	2008-06-26 05:18:28 +0000
+++ b/storage/maria/maria_def.h	2008-08-25 11:49:47 +0000
@@ -274,10 +274,10 @@ typedef struct st_maria_share
   MARIA_PACK pack;			/* Data about packed records */
   MARIA_BLOB *blobs;			/* Pointer to blobs */
   uint16 *column_nr;			/* Original column order */
-  char *unique_file_name;		/* realpath() of index file */
-  char *data_file_name;			/* Resolved path names from symlinks */
-  char *index_file_name;
-  char *open_file_name;			/* parameter to open filename */
+  LEX_STRING unique_file_name;		/* realpath() of index file */
+  LEX_STRING data_file_name;		/* Resolved path names from symlinks */
+  LEX_STRING index_file_name;
+  LEX_STRING open_file_name;		/* parameter to open filename */
   uchar *file_map;			/* mem-map of file if possible */
   PAGECACHE *pagecache;			/* ref to the current key cache */
   MARIA_DECODE_TREE *decode_trees;
@@ -345,7 +345,6 @@ typedef struct st_maria_share
   ulong max_pack_length;
   ulong state_diff_length;
   uint rec_reflength;			/* rec_reflength in use now */
-  uint unique_name_length;
   uint keypage_header;
   uint32 ftparsers;			/* Number of distinct ftparsers
 						   + 1 */
@@ -661,7 +660,7 @@ struct st_maria_handler
 */
 #define maria_print_error(SHARE, ERRNO)                         \
   do{ if (!maria_in_ha_maria)                                   \
-      _ma_report_error((ERRNO), (SHARE)->index_file_name); }    \
+      _ma_report_error((ERRNO), &(SHARE)->index_file_name); }    \
   while(0)
 #else
 #define maria_print_error(SHARE, ERRNO) while (0)
@@ -1029,7 +1028,7 @@ extern uint _ma_pack_get_block_info(MARI
                                     size_t *rec_buff_size,
                                     File file, my_off_t filepos);
 extern void _ma_store_blob_length(uchar *pos, uint pack_length, uint length);
-extern void _ma_report_error(int errcode, const char *file_name);
+extern void _ma_report_error(int errcode, const LEX_STRING *file_name);
 extern my_bool _ma_memmap_file(MARIA_HA *info);
 extern void _ma_unmap_file(MARIA_HA *info);
 extern uint _ma_save_pack_length(uint version, uchar * block_buff,

=== modified file 'storage/maria/maria_ftdump.c'
--- a/storage/maria/maria_ftdump.c	2008-06-26 17:48:42 +0000
+++ b/storage/maria/maria_ftdump.c	2008-08-25 18:23:18 +0000
@@ -100,7 +100,8 @@ int main(int argc,char *argv[])
   if ((inx >= info->s->base.keys) ||
       !(info->s->keyinfo[inx].flag & HA_FULLTEXT))
   {
-    printf("Key %d in table %s is not a FULLTEXT key\n", inx, info->s->open_file_name);
+    printf("Key %d in table %s is not a FULLTEXT key\n", inx,
+           info->s->open_file_name.str);
     goto err;
   }
 

=== modified file 'storage/maria/maria_pack.c'
--- a/storage/maria/maria_pack.c	2008-07-09 21:25:29 +0000
+++ b/storage/maria/maria_pack.c	2008-08-25 18:23:18 +0000
@@ -510,11 +510,11 @@ static int compress(PACK_MRG_INFO *mrg,c
 
   /* Create temporary or join file */
   if (backup)
-    (void)(fn_format(org_name,isam_file->s->open_file_name,"",MARIA_NAME_DEXT,
-                   2));
+    (void) fn_format(org_name,isam_file->s->open_file_name.str,
+                     "",MARIA_NAME_DEXT, 2);
   else
-    (void)(fn_format(org_name,isam_file->s->open_file_name,"",MARIA_NAME_DEXT,
-                   2+4+16));
+    (void) fn_format(org_name,isam_file->s->open_file_name.str,
+                     "",MARIA_NAME_DEXT, 2+4+16);
 
   if (init_pagecache(maria_pagecache, MARIA_MIN_PAGE_CACHE_SIZE, 0, 0,
                      maria_block_size, MY_WME) == 0)
@@ -709,7 +709,7 @@ static int compress(PACK_MRG_INFO *mrg,c
       if (backup)
       {
 	if (my_rename(org_name,make_old_name(temp_name,
-                                             isam_file->s->open_file_name),
+                                             isam_file->s->open_file_name.str),
 		      MYF(MY_WME)))
 	  error=1;
 	else

=== modified file 'storage/myisam/mi_search.c'
--- a/storage/myisam/mi_search.c	2008-05-29 15:44:11 +0000
+++ b/storage/myisam/mi_search.c	2008-08-25 18:23:18 +0000
@@ -1802,13 +1802,13 @@ _mi_calc_bin_pack_key_length(MI_KEYDEF *
     }
     /* Check how many characters are identical to next key */
     key= s_temp->key+next_length;
+    s_temp->prev_length= 0;
     while (*key++ == *next_key++) ;
     if ((ref_length= (uint) (key - s_temp->key)-1) == next_length)
     {
       s_temp->next_key_pos=0;
       return length;                            /* can't pack next key */
     }
-    s_temp->prev_length=0;
     s_temp->n_ref_length=ref_length;
     return (int) (length-(ref_length - next_length) - next_length_pack +
                   get_pack_length(ref_length));

Thread
bzr commit into mysql-6.0 branch (monty:2692) Michael Widenius25 Aug