Below is the list of changes that have just been committed into a local
5.1 repository of istruewing. When istruewing does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2007-01-03 10:28:58+01:00, istruewing@stripped +9 -0
Merge chilla.local:/home/mydev/mysql-5.0-axmrg
into chilla.local:/home/mydev/mysql-5.1-axmrg
MERGE: 1.1810.2362.34
sql/lock.cc@stripped, 2007-01-03 10:28:52+01:00, istruewing@stripped +0 -0
Auto merged
MERGE: 1.64.1.29
sql/sql_update.cc@stripped, 2007-01-03 10:28:52+01:00, istruewing@stripped +0 -0
Auto merged
MERGE: 1.154.2.55
sql/table.cc@stripped, 2007-01-03 10:28:53+01:00, istruewing@stripped +0 -0
Auto merged
MERGE: 1.160.1.83
storage/myisam/mi_dynrec.c@stripped, 2007-01-03 10:28:53+01:00, istruewing@stripped +0 -0
Auto merged
MERGE: 1.37.17.2
storage/myisam/mi_dynrec.c@stripped, 2007-01-03 10:28:52+01:00, istruewing@stripped +0 -0
Merge rename: myisam/mi_dynrec.c -> storage/myisam/mi_dynrec.c
storage/myisam/mi_locking.c@stripped, 2007-01-03 10:28:53+01:00, istruewing@stripped +0 -0
Auto merged
MERGE: 1.38.8.2
storage/myisam/mi_locking.c@stripped, 2007-01-03 10:28:52+01:00, istruewing@stripped +0 -0
Merge rename: myisam/mi_locking.c -> storage/myisam/mi_locking.c
storage/myisam/mi_open.c@stripped, 2007-01-03 10:28:53+01:00, istruewing@stripped +0 -0
Auto merged
MERGE: 1.90.15.2
storage/myisam/mi_open.c@stripped, 2007-01-03 10:28:52+01:00, istruewing@stripped +0 -0
Merge rename: myisam/mi_open.c -> storage/myisam/mi_open.c
storage/myisam/mi_update.c@stripped, 2007-01-03 10:28:53+01:00, istruewing@stripped +0 -0
Auto merged
MERGE: 1.17.9.2
storage/myisam/mi_update.c@stripped, 2007-01-03 10:28:52+01:00, istruewing@stripped +0 -0
Merge rename: myisam/mi_update.c -> storage/myisam/mi_update.c
storage/myisam/mi_write.c@stripped, 2007-01-03 10:28:53+01:00, istruewing@stripped +0 -0
Auto merged
MERGE: 1.50.15.2
storage/myisam/mi_write.c@stripped, 2007-01-03 10:28:52+01:00, istruewing@stripped +0 -0
Merge rename: myisam/mi_write.c -> storage/myisam/mi_write.c
storage/myisam/myisamdef.h@stripped, 2007-01-03 10:28:53+01:00, istruewing@stripped +0 -0
Auto merged
MERGE: 1.74.16.2
storage/myisam/myisamdef.h@stripped, 2007-01-03 10:28:52+01:00, istruewing@stripped +0 -0
Merge rename: myisam/myisamdef.h -> storage/myisam/myisamdef.h
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: istruewing
# Host: chilla.local
# Root: /home/mydev/mysql-5.1-axmrg/RESYNC
--- 1.37.17.1/myisam/mi_dynrec.c 2007-01-03 10:29:06 +01:00
+++ 1.57/storage/myisam/mi_dynrec.c 2007-01-03 10:29:06 +01:00
@@ -49,6 +49,180 @@ static int _mi_cmp_buffer(File file, con
/* Interface function from MI_INFO */
+#ifdef HAVE_MMAP
+
+/*
+ Create mmaped area for MyISAM handler
+
+ SYNOPSIS
+ mi_dynmap_file()
+ info MyISAM handler
+
+ RETURN
+ 0 ok
+ 1 error.
+*/
+
+my_bool mi_dynmap_file(MI_INFO *info, my_off_t size)
+{
+ DBUG_ENTER("mi_dynmap_file");
+ if (size > (my_off_t) (~((size_t) 0)) - MEMMAP_EXTRA_MARGIN)
+ {
+ DBUG_PRINT("warning", ("File is too large for mmap"));
+ DBUG_RETURN(1);
+ }
+ info->s->file_map= (byte*)
+ my_mmap(0, (size_t)(size + MEMMAP_EXTRA_MARGIN),
+ info->s->mode==O_RDONLY ? PROT_READ :
+ PROT_READ | PROT_WRITE,
+ MAP_SHARED | MAP_NORESERVE,
+ info->dfile, 0L);
+ if (info->s->file_map == (byte*) MAP_FAILED)
+ {
+ info->s->file_map= NULL;
+ DBUG_RETURN(1);
+ }
+#if defined(HAVE_MADVISE)
+ madvise(info->s->file_map, size, MADV_RANDOM);
+#endif
+ info->s->mmaped_length= size;
+ DBUG_RETURN(0);
+}
+
+
+/*
+ Resize mmaped area for MyISAM handler
+
+ SYNOPSIS
+ mi_remap_file()
+ info MyISAM handler
+
+ RETURN
+*/
+
+void mi_remap_file(MI_INFO *info, my_off_t size)
+{
+ if (info->s->file_map)
+ {
+ VOID(my_munmap(info->s->file_map,
+ (size_t) info->s->mmaped_length + MEMMAP_EXTRA_MARGIN));
+ mi_dynmap_file(info, size);
+ }
+}
+#endif
+
+
+/*
+ Read bytes from MySAM handler, using mmap or pread
+
+ SYNOPSIS
+ mi_mmap_pread()
+ info MyISAM handler
+ Buffer Input buffer
+ Count Count of bytes for read
+ offset Start position
+ MyFlags
+
+ RETURN
+ 0 ok
+*/
+
+uint mi_mmap_pread(MI_INFO *info, byte *Buffer,
+ uint Count, my_off_t offset, myf MyFlags)
+{
+ DBUG_PRINT("info", ("mi_read with mmap %d\n", info->dfile));
+ if (info->s->concurrent_insert)
+ rw_rdlock(&info->s->mmap_lock);
+
+ /*
+ The following test may fail in the following cases:
+ - We failed to remap a memory area (fragmented memory?)
+ - This thread has done some writes, but not yet extended the
+ memory mapped area.
+ */
+
+ if (info->s->mmaped_length >= offset + Count)
+ {
+ memcpy(Buffer, info->s->file_map + offset, Count);
+ if (info->s->concurrent_insert)
+ rw_unlock(&info->s->mmap_lock);
+ return 0;
+ }
+ else
+ {
+ if (info->s->concurrent_insert)
+ rw_unlock(&info->s->mmap_lock);
+ return my_pread(info->dfile, Buffer, Count, offset, MyFlags);
+ }
+}
+
+
+ /* wrapper for my_pread in case if mmap isn't used */
+
+uint mi_nommap_pread(MI_INFO *info, byte *Buffer,
+ uint Count, my_off_t offset, myf MyFlags)
+{
+ return my_pread(info->dfile, Buffer, Count, offset, MyFlags);
+}
+
+
+/*
+ Write bytes to MySAM handler, using mmap or pwrite
+
+ SYNOPSIS
+ mi_mmap_pwrite()
+ info MyISAM handler
+ Buffer Output buffer
+ Count Count of bytes for write
+ offset Start position
+ MyFlags
+
+ RETURN
+ 0 ok
+ !=0 error. In this case return error from pwrite
+*/
+
+uint mi_mmap_pwrite(MI_INFO *info, byte *Buffer,
+ uint Count, my_off_t offset, myf MyFlags)
+{
+ DBUG_PRINT("info", ("mi_write with mmap %d\n", info->dfile));
+ if (info->s->concurrent_insert)
+ rw_rdlock(&info->s->mmap_lock);
+
+ /*
+ The following test may fail in the following cases:
+ - We failed to remap a memory area (fragmented memory?)
+ - This thread has done some writes, but not yet extended the
+ memory mapped area.
+ */
+
+ if (info->s->mmaped_length >= offset + Count)
+ {
+ memcpy(info->s->file_map + offset, Buffer, Count);
+ if (info->s->concurrent_insert)
+ rw_unlock(&info->s->mmap_lock);
+ return 0;
+ }
+ else
+ {
+ info->s->nonmmaped_inserts++;
+ if (info->s->concurrent_insert)
+ rw_unlock(&info->s->mmap_lock);
+ return my_pwrite(info->dfile, Buffer, Count, offset, MyFlags);
+ }
+
+}
+
+
+ /* wrapper for my_pwrite in case if mmap isn't used */
+
+uint mi_nommap_pwrite(MI_INFO *info, byte *Buffer,
+ uint Count, my_off_t offset, myf MyFlags)
+{
+ return my_pwrite(info->dfile, Buffer, Count, offset, MyFlags);
+}
+
+
int _mi_write_dynamic_record(MI_INFO *info, const byte *record)
{
ulong reclength=_mi_rec_pack(info,info->rec_buff,record);
@@ -242,7 +416,7 @@ static bool unlink_deleted_block(MI_INFO
& BLOCK_DELETED))
DBUG_RETURN(1); /* Something is wrong */
mi_sizestore(tmp.header+4,block_info->next_filepos);
- if (my_pwrite(info->dfile,(char*) tmp.header+4,8,
+ if (info->s->file_write(info,(char*) tmp.header+4,8,
block_info->prev_filepos+4, MYF(MY_NABP)))
DBUG_RETURN(1);
/* Unlink block from next block */
@@ -252,7 +426,7 @@ static bool unlink_deleted_block(MI_INFO
& BLOCK_DELETED))
DBUG_RETURN(1); /* Something is wrong */
mi_sizestore(tmp.header+12,block_info->prev_filepos);
- if (my_pwrite(info->dfile,(char*) tmp.header+12,8,
+ if (info->s->file_write(info,(char*) tmp.header+12,8,
block_info->next_filepos+12,
MYF(MY_NABP)))
DBUG_RETURN(1);
@@ -303,7 +477,7 @@ static int update_backward_delete_link(M
{
char buff[8];
mi_sizestore(buff,filepos);
- if (my_pwrite(info->dfile,buff, 8, delete_block+12, MYF(MY_NABP)))
+ if (info->s->file_write(info,buff, 8, delete_block+12, MYF(MY_NABP)))
DBUG_RETURN(1); /* Error on write */
}
else
@@ -361,7 +535,7 @@ static int delete_dynamic_record(MI_INFO
bfill(block_info.header+12,8,255);
else
mi_sizestore(block_info.header+12,block_info.next_filepos);
- if (my_pwrite(info->dfile,(byte*) block_info.header,20,filepos,
+ if (info->s->file_write(info,(byte*) block_info.header,20,filepos,
MYF(MY_NABP)))
DBUG_RETURN(1);
info->s->state.dellink = filepos;
@@ -544,7 +718,7 @@ int _mi_write_part_record(MI_INFO *info,
else
{
info->rec_cache.seek_not_done=1;
- if (my_pwrite(info->dfile,(byte*) *record-head_length,length+extra_length+
+ if (info->s->file_write(info,(byte*) *record-head_length,length+extra_length+
del_length,filepos,info->s->write_flag))
goto err;
}
@@ -654,7 +828,7 @@ static int update_dynamic_record(MI_INFO
mi_int3store(del_block.header+1, rest_length);
mi_sizestore(del_block.header+4,info->s->state.dellink);
bfill(del_block.header+12,8,255);
- if (my_pwrite(info->dfile,(byte*) del_block.header,20, next_pos,
+ if (info->s->file_write(info,(byte*) del_block.header,20, next_pos,
MYF(MY_NABP)))
DBUG_RETURN(1);
info->s->state.dellink= next_pos;
@@ -1236,7 +1410,13 @@ int _mi_read_dynamic_record(MI_INFO *inf
info->rec_cache.pos_in_file < filepos + block_info.data_len &&
flush_io_cache(&info->rec_cache))
goto err;
- if (my_read(file, (byte*) to, block_info.data_len, MYF(MY_NABP)))
+ /*
+ What a pity that this method is not called 'file_pread' and that
+ there is no equivalent without seeking. We are at the right
+ position already. :(
+ */
+ if (info->s->file_read(info, (byte*) to, block_info.data_len,
+ filepos, MYF(MY_NABP)))
goto panic;
left_length-=block_info.data_len;
to+=block_info.data_len;
--- 1.38.8.1/myisam/mi_locking.c 2007-01-03 10:29:06 +01:00
+++ 1.52/storage/myisam/mi_locking.c 2007-01-03 10:29:06 +01:00
@@ -20,7 +20,7 @@
isamdatabase.
*/
-#include "myisamdef.h"
+#include "ftdefs.h"
/* lock table by F_UNLCK, F_RDLCK or F_WRLCK */
@@ -37,7 +37,6 @@ int mi_lock_database(MI_INFO *info, int
share->w_locks,
share->global_changed, share->state.open_count,
share->index_file_name));
-
if (share->options & HA_OPTION_READ_ONLY_DATA ||
info->lock_type == lock_type)
DBUG_RETURN(0);
@@ -55,6 +54,7 @@ int mi_lock_database(MI_INFO *info, int
{
switch (lock_type) {
case F_UNLCK:
+ ftparser_call_deinitializer(info);
if (info->lock_type == F_RDLCK)
count= --share->r_locks;
else
@@ -83,6 +83,18 @@ int mi_lock_database(MI_INFO *info, int
(uint) share->changed, share->w_locks));
if (share->changed && !share->w_locks)
{
+#ifdef HAVE_MMAP
+ if ((info->s->mmaped_length != info->s->state.state.data_file_length) &&
+ (info->s->nonmmaped_inserts > MAX_NONMAPPED_INSERTS))
+ {
+ if (info->s->concurrent_insert)
+ rw_wrlock(&info->s->mmap_lock);
+ mi_remap_file(info, info->s->state.state.data_file_length);
+ info->s->nonmmaped_inserts= 0;
+ if (info->s->concurrent_insert)
+ rw_unlock(&info->s->mmap_lock);
+ }
+#endif
share->state.process= share->last_process=share->this_process;
share->state.unique= info->last_unique= info->this_unique;
share->state.update_count= info->last_loop= ++info->this_loop;
@@ -214,6 +226,7 @@ int mi_lock_database(MI_INFO *info, int
}
}
VOID(_mi_test_if_changed(info));
+
info->lock_type=lock_type;
info->invalidator=info->s->invalidator;
share->w_locks++;
--- 1.90.15.1/myisam/mi_open.c 2007-01-03 10:29:06 +01:00
+++ 1.112/storage/myisam/mi_open.c 2007-01-03 10:29:06 +01:00
@@ -94,7 +94,8 @@ MI_INFO *mi_open(const char *name, int m
head_length=sizeof(share_buff.state.header);
bzero((byte*) &info,sizeof(info));
- my_realpath(name_buff, fn_format(org_name,name,"",MI_NAME_IEXT,4),MYF(0));
+ my_realpath(name_buff, fn_format(org_name,name,"",MI_NAME_IEXT,
+ MY_UNPACK_FILENAME),MYF(0));
pthread_mutex_lock(&THR_LOCK_myisam);
if (!(old_info=test_if_reopen(name_buff)))
{
@@ -140,17 +141,27 @@ MI_INFO *mi_open(const char *name, int m
~(HA_OPTION_PACK_RECORD | HA_OPTION_PACK_KEYS |
HA_OPTION_COMPRESS_RECORD | HA_OPTION_READ_ONLY_DATA |
HA_OPTION_TEMP_COMPRESS_RECORD | HA_OPTION_CHECKSUM |
- HA_OPTION_TMP_TABLE | HA_OPTION_DELAY_KEY_WRITE))
+ HA_OPTION_TMP_TABLE | HA_OPTION_DELAY_KEY_WRITE |
+ HA_OPTION_RELIES_ON_SQL_LAYER))
{
DBUG_PRINT("error",("wrong options: 0x%lx", share->options));
my_errno=HA_ERR_OLD_FILE;
goto err;
}
+ if ((share->options & HA_OPTION_RELIES_ON_SQL_LAYER) &&
+ ! (open_flags & HA_OPEN_FROM_SQL_LAYER))
+ {
+ DBUG_PRINT("error", ("table cannot be openned from non-sql layer"));
+ my_errno= HA_ERR_UNSUPPORTED;
+ goto err;
+ }
/* Don't call realpath() if the name can't be a link */
if (!strcmp(name_buff, org_name) ||
my_readlink(index_name, org_name, MYF(0)) == -1)
(void) strmov(index_name, org_name);
- (void) fn_format(data_name,org_name,"",MI_NAME_DEXT,2+4+16);
+ *strrchr(org_name, '.')= '\0';
+ (void) fn_format(data_name,org_name,"",MI_NAME_DEXT,
+ MY_APPEND_EXT|MY_UNPACK_FILENAME|MY_RESOLVE_SYMLINKS);
info_length=mi_uint2korr(share->state.header.header_length);
base_pos=mi_uint2korr(share->state.header.base_pos);
@@ -196,9 +207,9 @@ MI_INFO *mi_open(const char *name, int m
if (len != MI_BASE_INFO_SIZE)
{
DBUG_PRINT("warning",("saved_base_info_length: %d base_info_length: %d",
- len,MI_BASE_INFO_SIZE))
+ len,MI_BASE_INFO_SIZE));
}
- disk_pos= (char*)
+ disk_pos= (char*)
my_n_base_info_read((uchar*) disk_cache + base_pos, &share->base);
share->state.state_length=base_pos;
@@ -286,10 +297,11 @@ MI_INFO *mi_open(const char *name, int m
&share->data_file_name,strlen(data_name)+1,
&share->state.key_root,keys*sizeof(my_off_t),
&share->state.key_del,
- (share->state.header.max_block_size*sizeof(my_off_t)),
+ (share->state.header.max_block_size_index*sizeof(my_off_t)),
#ifdef THREAD
&share->key_root_lock,sizeof(rw_lock_t)*keys,
#endif
+ &share->mmap_lock,sizeof(rw_lock_t),
NullS))
goto err;
errpos=4;
@@ -300,7 +312,7 @@ MI_INFO *mi_open(const char *name, int m
(char*) key_root, sizeof(my_off_t)*keys);
memcpy((char*) share->state.key_del,
(char*) key_del, (sizeof(my_off_t) *
- share->state.header.max_block_size));
+ share->state.header.max_block_size_index));
strmov(share->unique_file_name, name_buff);
share->unique_name_length= strlen(name_buff);
strmov(share->index_file_name, index_name);
@@ -421,6 +433,7 @@ MI_INFO *mi_open(const char *name, int m
pos->flag=0;
pos++;
}
+ share->ftparsers= 0;
}
disk_pos_assert(disk_pos + share->base.fields *MI_COLUMNDEF_SIZE, end_pos);
@@ -463,7 +476,6 @@ MI_INFO *mi_open(const char *name, int m
(keys ? MI_INDEX_BLOCK_MARGIN *
share->blocksize * keys : 0));
share->blocksize=min(IO_SIZE,myisam_block_size);
-
share->data_file_type=STATIC_RECORD;
if (share->options & HA_OPTION_COMPRESS_RECORD)
{
@@ -481,11 +493,13 @@ MI_INFO *mi_open(const char *name, int m
share->data_file_type = DYNAMIC_RECORD;
my_afree((gptr) disk_cache);
mi_setup_functions(share);
+ share->is_log_table= FALSE;
#ifdef THREAD
thr_lock_init(&share->lock);
VOID(pthread_mutex_init(&share->intern_lock,MY_MUTEX_INIT_FAST));
for (i=0; i<keys; i++)
VOID(my_rwlock_init(&share->key_root_lock[i], NULL));
+ VOID(my_rwlock_init(&share->mmap_lock, NULL));
if (!thr_lock_inited)
{
/* Probably a single threaded program; Don't use concurrent inserts */
@@ -741,6 +755,8 @@ void mi_setup_functions(register MYISAM_
share->compare_unique=_mi_cmp_static_unique;
share->calc_checksum= mi_static_checksum;
}
+ share->file_read= mi_nommap_pread;
+ share->file_write= mi_nommap_pwrite;
if (!(share->options & HA_OPTION_CHECKSUM))
share->calc_checksum=0;
return;
@@ -810,7 +826,7 @@ uint mi_state_info_write(File file, MI_S
uchar buff[MI_STATE_INFO_SIZE + MI_STATE_EXTRA_SIZE];
uchar *ptr=buff;
uint i, keys= (uint) state->header.keys,
- key_blocks=state->header.max_block_size;
+ key_blocks=state->header.max_block_size_index;
DBUG_ENTER("mi_state_info_write");
memcpy_fixed(ptr,&state->header,sizeof(state->header));
@@ -876,7 +892,7 @@ uchar *mi_state_info_read(uchar *ptr, MI
ptr +=sizeof(state->header);
keys=(uint) state->header.keys;
key_parts=mi_uint2korr(state->header.key_parts);
- key_blocks=state->header.max_block_size;
+ key_blocks=state->header.max_block_size_index;
state->open_count = mi_uint2korr(ptr); ptr +=2;
state->changed= (bool) *ptr++;
@@ -1049,9 +1065,11 @@ char *mi_keydef_read(char *ptr, MI_KEYDE
keydef->keylength = mi_uint2korr(ptr); ptr +=2;
keydef->minlength = mi_uint2korr(ptr); ptr +=2;
keydef->maxlength = mi_uint2korr(ptr); ptr +=2;
- keydef->block_size = keydef->block_length/MI_MIN_KEY_BLOCK_LENGTH-1;
+ keydef->block_size_index= keydef->block_length/MI_MIN_KEY_BLOCK_LENGTH-1;
keydef->underflow_block_length=keydef->block_length/3;
keydef->version = 0; /* Not saved */
+ keydef->parser = &ft_default_parser;
+ keydef->ftparser_nr = 0;
return ptr;
}
--- 1.50.15.1/myisam/mi_write.c 2007-01-03 10:29:06 +01:00
+++ 1.67/storage/myisam/mi_write.c 2007-01-03 10:29:06 +01:00
@@ -162,6 +162,18 @@ int mi_write(MI_INFO *info, byte *record
(*info->invalidator)(info->filename);
info->invalidator=0;
}
+
+ /*
+ Update status of the table. We need to do so after each row write
+ for the log tables, as we want the new row to become visible to
+ other threads as soon as possible. We don't lock mutex here
+ (as it is required by pthread memory visibility rules) as (1) it's
+ not critical to use outdated share->is_log_table value (2) locking
+ mutex here for every write is too expensive.
+ */
+ if (share->is_log_table)
+ mi_update_status((void*) info);
+
allow_break(); /* Allow SIGHUP & SIGINT */
DBUG_RETURN(0);
--- 1.74.16.1/myisam/myisamdef.h 2007-01-03 10:29:06 +01:00
+++ 1.97/storage/myisam/myisamdef.h 2007-01-03 10:29:06 +01:00
@@ -54,7 +54,7 @@ typedef struct st_mi_state_info
uchar keys; /* number of keys in file */
uchar uniques; /* number of UNIQUE definitions */
uchar language; /* Language for indexes */
- uchar max_block_size; /* max keyblock size */
+ uchar max_block_size_index; /* max keyblock size */
uchar fulltext_keys;
uchar not_used; /* To align to 8 */
} header;
@@ -152,6 +152,7 @@ typedef struct st_mi_isam_pack {
uchar version;
} MI_PACK;
+#define MAX_NONMAPPED_INSERTS 1000
typedef struct st_mi_isam_share { /* Shared between opens */
MI_STATE_INFO state;
@@ -180,6 +181,8 @@ typedef struct st_mi_isam_share { /* Sha
ha_checksum (*calc_checksum)(struct st_myisam_info*, const byte *);
int (*compare_unique)(struct st_myisam_info*, MI_UNIQUEDEF *,
const byte *record, my_off_t pos);
+ uint (*file_read)(MI_INFO *, byte *, uint, my_off_t, myf);
+ uint (*file_write)(MI_INFO *, byte *, uint, my_off_t, myf);
invalidator_by_filename invalidator; /* query cache invalidator */
ulong this_process; /* processid */
ulong last_process; /* For table-change-check */
@@ -190,6 +193,7 @@ typedef struct st_mi_isam_share { /* Sha
ulong state_diff_length;
uint rec_reflength; /* rec_reflength in use now */
uint unique_name_length;
+ uint32 ftparsers; /* Number of distinct ftparsers + 1 */
File kfile; /* Shared keyfile */
File data_file; /* Shared data file */
int mode; /* mode of file on open */
@@ -198,6 +202,9 @@ typedef struct st_mi_isam_share { /* Sha
uint blocksize; /* blocksize of keyfile */
myf write_flag;
enum data_file_type data_file_type;
+ /* Below flag is needed to make log tables work with concurrent insert */
+ my_bool is_log_table;
+
my_bool changed, /* If changed since lock */
global_changed, /* If changed since open */
not_flushed,
@@ -208,6 +215,10 @@ typedef struct st_mi_isam_share { /* Sha
pthread_mutex_t intern_lock; /* Locking for use with _locking */
rw_lock_t *key_root_lock;
#endif
+ my_off_t mmaped_length;
+ uint nonmmaped_inserts; /* counter of writing in non-mmaped
+ area */
+ rw_lock_t mmap_lock;
} MYISAM_SHARE;
@@ -228,12 +239,14 @@ struct st_myisam_info {
/* accumulate indexfile changes between write's */
TREE *bulk_insert;
DYNAMIC_ARRAY *ft1_to_ft2; /* used only in ft1->ft2 conversion */
- char *filename; /* parameter to open filename */
- uchar *buff, /* Temp area for key */
- *lastkey,*lastkey2; /* Last used search key */
- uchar *first_mbr_key; /* Searhed spatial key */
- byte *rec_buff; /* Tempbuff for recordpack */
- uchar *int_keypos, /* Save position for next/previous */
+ MEM_ROOT ft_memroot; /* used by the parser */
+ MYSQL_FTPARSER_PARAM *ftparser_param; /* share info between init/deinit */
+ char *filename; /* parameter to open filename */
+ uchar *buff, /* Temp area for key */
+ *lastkey,*lastkey2; /* Last used search key */
+ uchar *first_mbr_key; /* Searhed spatial key */
+ byte *rec_buff; /* Tempbuff for recordpack */
+ uchar *int_keypos, /* Save position for next/previous */
*int_maxpos; /* -""- */
uint int_nod_flag; /* -""- */
uint32 int_keytree_version; /* -""- */
@@ -322,6 +335,7 @@ typedef struct st_mi_sort_param
uchar **sort_keys;
byte *rec_buff;
void *wordlist, *wordptr;
+ MEM_ROOT wordroot;
char *record;
MY_TMPDIR *tmpdir;
int (*key_cmp)(struct st_mi_sort_param *, const void *, const void *);
@@ -435,7 +449,7 @@ typedef struct st_mi_sort_param
#define MI_FOUND_WRONG_KEY 32738 /* Impossible value from ha_key_cmp */
#define MI_MAX_KEY_BLOCK_SIZE (MI_MAX_KEY_BLOCK_LENGTH/MI_MIN_KEY_BLOCK_LENGTH)
-#define MI_BLOCK_SIZE(key_length,data_pointer,key_pointer) (((((key_length)+(data_pointer)+(key_pointer))*4+(key_pointer)+2)/myisam_block_size+1)*myisam_block_size)
+#define MI_BLOCK_SIZE(key_length,data_pointer,key_pointer,block_size) (((((key_length)+(data_pointer)+(key_pointer))*4+(key_pointer)+2)/(block_size)+1)*(block_size))
#define MI_MAX_KEYPTR_SIZE 5 /* For calculating block lengths */
#define MI_MIN_KEYBLOCK_LENGTH 50 /* When to split delete blocks */
@@ -700,6 +714,14 @@ extern void _mi_unmap_file(MI_INFO *info
extern uint save_pack_length(uint version, byte *block_buff, ulong length);
extern uint read_pack_length(uint version, const uchar *buf, ulong *length);
extern uint calc_pack_length(uint version, ulong length);
+extern uint mi_mmap_pread(MI_INFO *info, byte *Buffer,
+ uint Count, my_off_t offset, myf MyFlags);
+extern uint mi_mmap_pwrite(MI_INFO *info, byte *Buffer,
+ uint Count, my_off_t offset, myf MyFlags);
+extern uint mi_nommap_pread(MI_INFO *info, byte *Buffer,
+ uint Count, my_off_t offset, myf MyFlags);
+extern uint mi_nommap_pwrite(MI_INFO *info, byte *Buffer,
+ uint Count, my_off_t offset, myf MyFlags);
uint mi_state_info_write(File file, MI_STATE_INFO *state, uint pWrite);
uchar *mi_state_info_read(uchar *ptr, MI_STATE_INFO *state);
@@ -741,6 +763,8 @@ my_bool check_table_is_closed(const char
int mi_open_datafile(MI_INFO *info, MYISAM_SHARE *share, File file_to_dup);
int mi_open_keyfile(MYISAM_SHARE *share);
void mi_setup_functions(register MYISAM_SHARE *share);
+my_bool mi_dynmap_file(MI_INFO *info, my_off_t size);
+void mi_remap_file(MI_INFO *info, my_off_t size);
/* Functions needed by mi_check */
volatile int *killed_ptr(MI_CHECK *param);
| Thread |
|---|
| • bk commit into 5.1 tree (istruewing:1.2376) | ingo | 3 Jan |