summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Widenius <monty@mysql.com>2008-08-25 14:49:47 +0300
committerMichael Widenius <monty@mysql.com>2008-08-25 14:49:47 +0300
commit1a5de5bc82cee3c2411862b8ef32588b530a780f (patch)
tree2baced329239d24a26baaa76e655f5c457d9dcbf
parentd145362edf0c6c640b46eb08db18e2781d128075 (diff)
downloadmariadb-git-1a5de5bc82cee3c2411862b8ef32588b530a780f.tar.gz
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 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
-rw-r--r--mysys/my_pread.c2
-rw-r--r--storage/maria/ha_maria.cc10
-rw-r--r--storage/maria/ma_check.c16
-rw-r--r--storage/maria/ma_checkpoint.c9
-rw-r--r--storage/maria/ma_create.c4
-rw-r--r--storage/maria/ma_dbug.c2
-rw-r--r--storage/maria/ma_delete.c5
-rw-r--r--storage/maria/ma_info.c11
-rw-r--r--storage/maria/ma_keycache.c4
-rw-r--r--storage/maria/ma_locking.c2
-rw-r--r--storage/maria/ma_loghandler.c14
-rw-r--r--storage/maria/ma_open.c40
-rw-r--r--storage/maria/ma_pagecache.c21
-rw-r--r--storage/maria/ma_recovery.c18
-rw-r--r--storage/maria/ma_update.c5
-rw-r--r--storage/maria/ma_write.c4
-rw-r--r--storage/maria/maria_def.h13
-rw-r--r--storage/maria/maria_ftdump.c3
-rw-r--r--storage/maria/maria_pack.c10
19 files changed, 108 insertions, 85 deletions
diff --git a/mysys/my_pread.c b/mysys/my_pread.c
index 146e07773e6..5c27cf73482 100644
--- a/mysys/my_pread.c
+++ b/mysys/my_pread.c
@@ -60,7 +60,7 @@ size_t my_pread(File Filedes, uchar *Buffer, size_t Count, my_off_t offset,
#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;
diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc
index 0f763e3fafe..79d323efab2 100644
--- a/storage/maria/ha_maria.cc
+++ b/storage/maria/ha_maria.cc
@@ -1279,7 +1279,7 @@ int ha_maria::zerofill(THD * thd, HA_CHECK_OPT *check_opt)
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, bool do_optimize)
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;
diff --git a/storage/maria/ma_check.c b/storage/maria/ma_check.c
index fa987673914..c64c879992c 100644
--- a/storage/maria/ma_check.c
+++ b/storage/maria/ma_check.c
@@ -2476,7 +2476,7 @@ int maria_repair(HA_CHECK *param, register MARIA_HA *info,
{
/* 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, register MARIA_HA *info,
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, register MARIA_HA *info, char *name)
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, register MARIA_HA *info,
{
/* 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, register MARIA_HA *info,
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 *param, register MARIA_HA *info,
{
/* 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(MARIA_SORT_PARAM *param, File new_file)
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);
diff --git a/storage/maria/ma_checkpoint.c b/storage/maria/ma_checkpoint.c
index 804993c90a5..a58a768185b 100644
--- a/storage/maria/ma_checkpoint.c
+++ b/storage/maria/ma_checkpoint.c
@@ -820,7 +820,7 @@ static int collect_tables(LEX_STRING *str, LSN checkpoint_start_log_horizon)
*/
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 *str, LSN checkpoint_start_log_horizon)
@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 *str, LSN checkpoint_start_log_horizon)
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 *str, LSN checkpoint_start_log_horizon)
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)
diff --git a/storage/maria/ma_create.c b/storage/maria/ma_create.c
index 8afd277d9e1..3ccd879673a 100644
--- a/storage/maria/ma_create.c
+++ b/storage/maria/ma_create.c
@@ -1349,9 +1349,9 @@ int _ma_update_state_lsns_sub(MARIA_SHARE *share, LSN lsn, TrID create_trid,
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)
diff --git a/storage/maria/ma_dbug.c b/storage/maria/ma_dbug.c
index 149cc74fbe9..4ae45ca9b7a 100644
--- a/storage/maria/ma_dbug.c
+++ b/storage/maria/ma_dbug.c
@@ -184,7 +184,7 @@ my_bool _ma_check_table_is_closed(const char *name, const char *where)
{
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)
{
diff --git a/storage/maria/ma_delete.c b/storage/maria/ma_delete.c
index 92f27938d0c..26cc202f542 100644
--- a/storage/maria/ma_delete.c
+++ b/storage/maria/ma_delete.c
@@ -122,8 +122,9 @@ int maria_delete(MARIA_HA *info,const uchar *record)
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);
diff --git a/storage/maria/ma_info.c b/storage/maria/ma_info.c
index 1bb351bfbb5..1bbfa3cbf7e 100644
--- a/storage/maria/ma_info.c
+++ b/storage/maria/ma_info.c
@@ -81,8 +81,8 @@ int maria_status(MARIA_HA *info, register MARIA_INFO *x, uint flag)
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, register MARIA_INFO *x, uint flag)
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);
diff --git a/storage/maria/ma_keycache.c b/storage/maria/ma_keycache.c
index 9295904dbcf..39fc7d421ae 100644
--- a/storage/maria/ma_keycache.c
+++ b/storage/maria/ma_keycache.c
@@ -105,8 +105,8 @@ int maria_assign_to_pagecache(MARIA_HA *info,
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);
diff --git a/storage/maria/ma_locking.c b/storage/maria/ma_locking.c
index 4ddfa285d37..1ad41e5b213 100644
--- a/storage/maria/ma_locking.c
+++ b/storage/maria/ma_locking.c
@@ -34,7 +34,7 @@ int maria_lock_database(MARIA_HA *info, int lock_type)
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);
diff --git a/storage/maria/ma_loghandler.c b/storage/maria/ma_loghandler.c
index c1be6691d16..67e05d10bce 100644
--- a/storage/maria/ma_loghandler.c
+++ b/storage/maria/ma_loghandler.c
@@ -7686,7 +7686,7 @@ int translog_assign_id_to_share(MARIA_HA *tbl_info, TRN *trn)
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 *tbl_info, TRN *trn)
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) +
diff --git a/storage/maria/ma_open.c b/storage/maria/ma_open.c
index 04ad99a56ca..a97acabe4ac 100644
--- a/storage/maria/ma_open.c
+++ b/storage/maria/ma_open.c
@@ -62,7 +62,7 @@ MARIA_HA *_ma_test_if_reopen(const char *filename)
{
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, int mode, uint open_flags)
/* 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, int mode, uint open_flags)
(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, int mode, uint open_flags)
(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, MARIA_SHARE *share,
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);
diff --git a/storage/maria/ma_pagecache.c b/storage/maria/ma_pagecache.c
index 3e28835d4a8..cb4b0f0aed1 100644
--- a/storage/maria/ma_pagecache.c
+++ b/storage/maria/ma_pagecache.c
@@ -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 *pagecache,
if (error)
{
block->status|= PCBLOCK_ERROR;
+ block->error= error;
my_debug_put_break_here();
}
else
@@ -2618,6 +2621,7 @@ static void read_block(PAGECACHE *pagecache,
{
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(PAGECACHE *pagecache,
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 *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;
diff --git a/storage/maria/ma_recovery.c b/storage/maria/ma_recovery.c
index ad75a84aa1f..26d29aec4be 100644
--- a/storage/maria/ma_recovery.c
+++ b/storage/maria/ma_recovery.c
@@ -866,7 +866,7 @@ prototype_redo_exec_hook(REDO_RENAME_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;
@@ -1008,7 +1008,7 @@ prototype_redo_exec_hook(REDO_REPAIR_TABLE)
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 char *name, LSN lsn_of_file_id)
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 char *name, LSN lsn_of_file_id)
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_record(const
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_record(const
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 char *name, TRANSLOG_ADDRESS addr)
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))
diff --git a/storage/maria/ma_update.c b/storage/maria/ma_update.c
index 29246d2d07e..a178f5d47a7 100644
--- a/storage/maria/ma_update.c
+++ b/storage/maria/ma_update.c
@@ -188,8 +188,9 @@ int maria_update(register MARIA_HA *info, const uchar *oldrec, uchar *newrec)
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);
diff --git a/storage/maria/ma_write.c b/storage/maria/ma_write.c
index e91b3f77f61..642741bf6b9 100644
--- a/storage/maria/ma_write.c
+++ b/storage/maria/ma_write.c
@@ -227,8 +227,8 @@ int maria_write(MARIA_HA *info, uchar *record)
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;
}
diff --git a/storage/maria/maria_def.h b/storage/maria/maria_def.h
index c1160993607..17ae1360b80 100644
--- a/storage/maria/maria_def.h
+++ b/storage/maria/maria_def.h
@@ -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(MARIA_HA *maria, MARIA_BIT_BUFF *bit_buff,
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,
diff --git a/storage/maria/maria_ftdump.c b/storage/maria/maria_ftdump.c
index 978082adb78..5e3b47b956e 100644
--- a/storage/maria/maria_ftdump.c
+++ b/storage/maria/maria_ftdump.c
@@ -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;
}
diff --git a/storage/maria/maria_pack.c b/storage/maria/maria_pack.c
index 858f054a9f5..b9466475548 100644
--- a/storage/maria/maria_pack.c
+++ b/storage/maria/maria_pack.c
@@ -510,11 +510,11 @@ static int compress(PACK_MRG_INFO *mrg,char *result_table)
/* 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,char *result_table)
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