List:Maria Storage Engine« Previous MessageNext Message »
From:Michael Widenius Date:August 25 2008 11:49am
Subject:bzr commit into MySQL/Maria:mysql-maria branch (monty:2663)
View as plain text  
#At bzr+ssh://bk-internal.mysql.com/bzrroot/server/mysql-maria/

 2663 Michael Widenius	2008-08-25
      Changed all file names in maria to LEX_STRING and removed some calls to strlen()
      Ensure that pagecache gives correct error number even if error for block happend
modified:
  mysys/my_pread.c
  storage/maria/ha_maria.cc
  storage/maria/ma_check.c
  storage/maria/ma_checkpoint.c
  storage/maria/ma_create.c
  storage/maria/ma_dbug.c
  storage/maria/ma_delete.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_update.c
  storage/maria/ma_write.c
  storage/maria/maria_def.h
  storage/maria/maria_ftdump.c
  storage/maria/maria_pack.c

per-file messages:
  mysys/my_pread.c
    Indentation fix
  storage/maria/ha_maria.cc
    filenames changed to be of type LEX_STRING
  storage/maria/ma_check.c
    filenames changed to be of type LEX_STRING
  storage/maria/ma_checkpoint.c
    filenames changed to be of type LEX_STRING
  storage/maria/ma_create.c
    filenames changed to be of type LEX_STRING
  storage/maria/ma_dbug.c
    filenames changed to be of type LEX_STRING
  storage/maria/ma_delete.c
    filenames changed to be of type LEX_STRING
  storage/maria/ma_info.c
    filenames changed to be of type LEX_STRING
  storage/maria/ma_keycache.c
    filenames changed to be of type LEX_STRING
  storage/maria/ma_locking.c
    filenames changed to be of type LEX_STRING
  storage/maria/ma_loghandler.c
    filenames changed to be of type LEX_STRING
  storage/maria/ma_open.c
    filenames changed to be of type LEX_STRING
  storage/maria/ma_pagecache.c
    Store error number for last failed operation in the page block
    This should fix some asserts() when errno was not properly set after failure to read block in another thread
  storage/maria/ma_recovery.c
    filenames changed to be of type LEX_STRING
  storage/maria/ma_update.c
    filenames changed to be of type LEX_STRING
  storage/maria/ma_write.c
    filenames changed to be of type LEX_STRING
  storage/maria/maria_def.h
    filenames changed to be of type LEX_STRING
  storage/maria/maria_ftdump.c
    filenames changed to be of type LEX_STRING
  storage/maria/maria_pack.c
    filenames changed to be of type LEX_STRING
=== modified file 'mysys/my_pread.c'
--- a/mysys/my_pread.c	2008-04-28 16:24:05 +0000
+++ b/mysys/my_pread.c	2008-08-25 11:49:47 +0000
@@ -60,7 +60,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 */
 #ifndef HAVE_PREAD
     pthread_mutex_lock(&my_file_info[Filedes].mutex);
     readbytes= (uint) -1;

=== modified file 'storage/maria/ha_maria.cc'
--- a/storage/maria/ha_maria.cc	2008-08-24 13:29:34 +0000
+++ b/storage/maria/ha_maria.cc	2008-08-25 11:49:47 +0000
@@ -1279,7 +1279,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)
   {
@@ -1356,7 +1356,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 &&
@@ -2176,11 +2176,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;

=== modified file 'storage/maria/ma_check.c'
--- a/storage/maria/ma_check.c	2008-07-10 14:51:59 +0000
+++ b/storage/maria/ma_check.c	2008-08-25 11:49:47 +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)) |
@@ -2993,7 +2993,7 @@ int maria_sort_index(HA_CHECK *param, re
   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,
+  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_create.c'
--- a/storage/maria/ma_create.c	2008-07-09 09:02:27 +0000
+++ b/storage/maria/ma_create.c	2008-08-25 11:49:47 +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 05:18:28 +0000
+++ b/storage/maria/ma_dbug.c	2008-08-25 11:49:47 +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-08-24 13:29:34 +0000
+++ b/storage/maria/ma_delete.c	2008-08-25 11:49:47 +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);

=== modified file 'storage/maria/ma_info.c'
--- a/storage/maria/ma_info.c	2008-05-29 15:33:33 +0000
+++ b/storage/maria/ma_info.c	2008-08-25 11:49:47 +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 09:02:27 +0000
+++ b/storage/maria/ma_locking.c	2008-08-25 11:49:47 +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 09:02:27 +0000
+++ b/storage/maria/ma_loghandler.c	2008-08-25 11:49:47 +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-18 22:21:22 +0000
+++ b/storage/maria/ma_open.c	2008-08-25 11:49:47 +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) {
@@ -1712,7 +1724,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 +1737,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-04-24 15:22:51 +0000
+++ b/storage/maria/ma_pagecache.c	2008-08-25 11:49:47 +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-07-12 14:59:54 +0000
+++ b/storage/maria/ma_recovery.c	2008-08-25 11:49:47 +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_update.c'
--- a/storage/maria/ma_update.c	2008-06-26 05:18:28 +0000
+++ b/storage/maria/ma_update.c	2008-08-25 11:49:47 +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 13:09:30 +0000
+++ b/storage/maria/ma_write.c	2008-08-25 11:49:47 +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 05:18:28 +0000
+++ b/storage/maria/maria_ftdump.c	2008-08-25 11:49:47 +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 09:02:27 +0000
+++ b/storage/maria/maria_pack.c	2008-08-25 11:49:47 +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

Thread
bzr commit into MySQL/Maria:mysql-maria branch (monty:2663) Michael Widenius25 Aug