summaryrefslogtreecommitdiff
path: root/myisam
diff options
context:
space:
mode:
authorunknown <monty@hundin.mysql.fi>2001-12-05 13:08:00 +0200
committerunknown <monty@hundin.mysql.fi>2001-12-05 13:08:00 +0200
commit083194b188058be1ae66edf0ca7abb6138dec4d3 (patch)
treeebaaee150fd57244707948e9099cf10b4299d8e4 /myisam
parentba3037cadd79c7143771d470edaab0a3bfc6520d (diff)
parent97c1b3915e4456cf24377592030408cf51a9dd35 (diff)
downloadmariadb-git-083194b188058be1ae66edf0ca7abb6138dec4d3.tar.gz
merge
Docs/manual.texi: Auto merged myisam/ft_boolean_search.c: Auto merged myisam/ft_dump.c: Merge
Diffstat (limited to 'myisam')
-rw-r--r--myisam/ft_boolean_search.c6
-rw-r--r--myisam/ft_dump.c18
-rw-r--r--myisam/ft_parser.c5
-rw-r--r--myisam/ft_static.c2
-rw-r--r--myisam/ft_update.c5
-rw-r--r--myisam/ftdefs.h2
-rw-r--r--myisam/mi_delete.c6
-rw-r--r--myisam/mi_locking.c5
-rw-r--r--myisam/mi_update.c6
-rw-r--r--myisam/mi_write.c6
-rw-r--r--myisam/myisamdef.h80
11 files changed, 82 insertions, 59 deletions
diff --git a/myisam/ft_boolean_search.c b/myisam/ft_boolean_search.c
index fce6fee7c8d..5e471daa0ed 100644
--- a/myisam/ft_boolean_search.c
+++ b/myisam/ft_boolean_search.c
@@ -86,7 +86,7 @@ typedef struct st_ft_info {
MEM_ROOT mem_root;
} FTB;
-int FTB_WORD_cmp(void *v, byte *a, byte *b)
+int FTB_WORD_cmp(void *v __attribute__((unused)), byte *a, byte *b)
{
/* ORDER BY docid, ndepth DESC */
int i=CMP_NUM(((FTB_WORD *)a)->docid, ((FTB_WORD *)b)->docid);
@@ -109,7 +109,7 @@ void _ftb_parse_query(FTB *ftb, byte **start, byte *end,
return;
param.prev=' ';
- while (res=ft_get_word(start,end,&w,&param))
+ while ((res=ft_get_word(start,end,&w,&param)))
{
byte r=param.plusminus;
float weight=(param.pmsign ? nwghts : wghts)[(r>5)?5:((r<-5)?-5:r)];
@@ -277,7 +277,7 @@ void _ftb_climb_the_tree(FTB_WORD *ftbw, my_off_t curdoc)
int ft_boolean_read_next(FT_INFO *ftb, char *record)
{
- FTB_EXPR *ftbe, *up;
+ FTB_EXPR *ftbe;
FTB_WORD *ftbw;
MI_INFO *info=ftb->info;
MI_KEYDEF *keyinfo=info->s->keyinfo+ftb->keynr;
diff --git a/myisam/ft_dump.c b/myisam/ft_dump.c
index 48c26d1aa79..07d079cea1e 100644
--- a/myisam/ft_dump.c
+++ b/myisam/ft_dump.c
@@ -209,15 +209,15 @@ static void get_options(int argc, char *argv[])
static void usage(char *argv[])
{
- printf("
-Use: %s [-%s] <table_name> <index_no>
-
--d dump index (incl. data offsets and word weights)
--s report global stats
--l report length distribution
--c calculate per-word stats (counts and global weights)
--v be verbose
--h this text\n
+ printf("\n\
+Use: %s [-%s] <table_name> <index_no>\n\
+\n\
+-d Dump index (incl. data offsets and word weights)\n\
+-s Report global stats\n\
+-c Calculate per-word stats (counts and global weights)\n\
+-l Report length distribution\n\
+-v Be verbose\n\
+-h This text\n\
", *argv, options);
exit(1);
}
diff --git a/myisam/ft_parser.c b/myisam/ft_parser.c
index 0d1495da548..c1b1190bcab 100644
--- a/myisam/ft_parser.c
+++ b/myisam/ft_parser.c
@@ -38,8 +38,9 @@ typedef struct st_ft_docstat {
static int FT_WORD_cmp(void* cmp_arg, FT_WORD *w1, FT_WORD *w2)
{
return _mi_compare_text(default_charset_info,
- (uchar*) w1->pos,w1->len,
- (uchar*) w2->pos, w2->len,(my_bool)cmp_arg);
+ (uchar*) w1->pos, w1->len,
+ (uchar*) w2->pos, w2->len,
+ (my_bool) (cmp_arg != 0));
}
static int walk_and_copy(FT_WORD *word,uint32 count,FT_DOCSTAT *docstat)
diff --git a/myisam/ft_static.c b/myisam/ft_static.c
index 08ecbdc1009..566b08596a3 100644
--- a/myisam/ft_static.c
+++ b/myisam/ft_static.c
@@ -21,7 +21,7 @@
ulong ft_min_word_len=4;
ulong ft_max_word_len=HA_FT_MAXLEN;
ulong ft_max_word_len_for_sort=20;
-char *ft_boolean_syntax="+ -><()~*";
+const char *ft_boolean_syntax="+ -><()~*";
const MI_KEYSEG ft_keysegs[FT_SEGS]={
{
diff --git a/myisam/ft_update.c b/myisam/ft_update.c
index 1bc0ace6c77..3d394eeacac 100644
--- a/myisam/ft_update.c
+++ b/myisam/ft_update.c
@@ -67,8 +67,9 @@ uint _mi_ft_parse(TREE *parsed, MI_INFO *info, uint keynr, const byte *record)
return 0;
}
-FT_WORD * _mi_ft_parserecord(MI_INFO *info, uint keynr, byte *keybuf,
- const byte *record)
+FT_WORD * _mi_ft_parserecord(MI_INFO *info, uint keynr,
+ byte *keybuf __attribute__((unused)),
+ const byte *record)
{
TREE ptree;
diff --git a/myisam/ftdefs.h b/myisam/ftdefs.h
index 147c3f5b5e6..ee35ccbb14a 100644
--- a/myisam/ftdefs.h
+++ b/myisam/ftdefs.h
@@ -123,6 +123,7 @@ byte ft_simple_get_word(byte **, byte *, FT_WORD *);
int ft_parse(TREE *, byte *, int);
FT_WORD * ft_linearize(/*MI_INFO *, uint, byte *, */TREE *);
FT_WORD * _mi_ft_parserecord(MI_INFO *, uint, byte *, const byte *);
+uint _mi_ft_parse(TREE *parsed, MI_INFO *info, uint keynr, const byte *record);
const struct _ft_vft _ft_vft_nlq;
FT_INFO *ft_init_nlq_search(MI_INFO *, uint, byte *, uint, my_bool);
@@ -141,4 +142,3 @@ void ft_boolean_close_search(FT_INFO *);
float ft_boolean_get_relevance(FT_INFO *);
my_off_t ft_boolean_get_docid(FT_INFO *);
void ft_boolean_reinit_search(FT_INFO *);
-
diff --git a/myisam/mi_delete.c b/myisam/mi_delete.c
index 65d245e64f9..2a0cd6f6b6d 100644
--- a/myisam/mi_delete.c
+++ b/myisam/mi_delete.c
@@ -97,6 +97,12 @@ int mi_delete(MI_INFO *info,const byte *record)
myisam_log_command(MI_LOG_DELETE,info,(byte*) lastpos,sizeof(lastpos),0);
VOID(_mi_writeinfo(info,WRITEINFO_UPDATE_KEYFILE));
allow_break(); /* Allow SIGHUP & SIGINT */
+ if (info->invalidator != 0)
+ {
+ DBUG_PRINT("info", ("invalidator... '%s' (delete)", info->filename));
+ (*info->invalidator)(info->filename);
+ info->invalidator=0;
+ }
DBUG_RETURN(0);
err:
diff --git a/myisam/mi_locking.c b/myisam/mi_locking.c
index 68ef52ea819..22ec4ba875c 100644
--- a/myisam/mi_locking.c
+++ b/myisam/mi_locking.c
@@ -43,8 +43,7 @@ int mi_lock_database(MI_INFO *info, int lock_type)
pthread_mutex_lock(&share->intern_lock);
if (share->kfile >= 0) /* May only be false on windows */
{
- switch (lock_type)
- {
+ switch (lock_type) {
case F_UNLCK:
if (info->lock_type == F_RDLCK)
count= --share->r_locks;
@@ -201,6 +200,7 @@ int mi_lock_database(MI_INFO *info, int lock_type)
}
VOID(_mi_test_if_changed(info));
info->lock_type=lock_type;
+ info->invalidator=info->s->invalidator;
share->w_locks++;
share->tot_locks++;
break;
@@ -319,6 +319,7 @@ int _mi_readinfo(register MI_INFO *info, int lock_type, int check_keybuffer)
}
if (check_keybuffer)
VOID(_mi_test_if_changed(info));
+ info->invalidator=info->s->invalidator;
}
else if (lock_type == F_WRLCK && info->lock_type == F_RDLCK)
{
diff --git a/myisam/mi_update.c b/myisam/mi_update.c
index ac843dbb6bd..bb022c5f4cd 100644
--- a/myisam/mi_update.c
+++ b/myisam/mi_update.c
@@ -136,6 +136,12 @@ int mi_update(register MI_INFO *info, const byte *oldrec, byte *newrec)
myisam_log_record(MI_LOG_UPDATE,info,newrec,info->lastpos,0);
VOID(_mi_writeinfo(info,key_changed ? WRITEINFO_UPDATE_KEYFILE : 0));
allow_break(); /* Allow SIGHUP & SIGINT */
+ if (info->invalidator != 0)
+ {
+ DBUG_PRINT("info", ("invalidator... '%s' (update)", info->filename));
+ (*info->invalidator)(info->filename);
+ info->invalidator=0;
+ }
DBUG_RETURN(0);
err:
diff --git a/myisam/mi_write.c b/myisam/mi_write.c
index 5c6db053829..1dd4820bc03 100644
--- a/myisam/mi_write.c
+++ b/myisam/mi_write.c
@@ -149,6 +149,12 @@ int mi_write(MI_INFO *info, byte *record)
info->lastpos=filepos;
myisam_log_record(MI_LOG_WRITE,info,record,filepos,0);
VOID(_mi_writeinfo(info, WRITEINFO_UPDATE_KEYFILE));
+ if (info->invalidator != 0)
+ {
+ DBUG_PRINT("info", ("invalidator... '%s' (update)", info->filename));
+ (*info->invalidator)(info->filename);
+ info->invalidator=0;
+ }
allow_break(); /* Allow SIGHUP & SIGINT */
DBUG_RETURN(0);
diff --git a/myisam/myisamdef.h b/myisam/myisamdef.h
index e8b9c1b83ec..203101a2f48 100644
--- a/myisam/myisamdef.h
+++ b/myisam/myisamdef.h
@@ -66,8 +66,10 @@ typedef struct st_mi_state_info
ulong unique; /* Unique number for this process */
ulong update_count; /* Updated for each write lock */
ulong status;
+ ulong *rec_per_key_part;
my_off_t *key_root; /* Start of key trees */
my_off_t *key_del; /* delete links for trees */
+ my_off_t rec_per_key_rows; /* Rows when calculating rec_per_key */
ulong sec_index_changed; /* Updated when new sec_index */
ulong sec_index_used; /* which extra index are in use */
@@ -80,8 +82,6 @@ typedef struct st_mi_state_info
uint sortkey; /* sorted by this key (not used) */
uint open_count;
uint8 changed; /* Changed since myisamchk */
- my_off_t rec_per_key_rows; /* Rows when calculating rec_per_key */
- ulong *rec_per_key_part;
/* the following isn't saved on disk */
uint state_diff_length; /* Should be 0 */
@@ -164,10 +164,25 @@ typedef struct st_mi_isam_share { /* Shared between opens */
char *data_file_name, /* Resolved path names from symlinks */
*index_file_name;
byte *file_map; /* mem-map of file if possible */
+ MI_DECODE_TREE *decode_trees;
+ uint16 *decode_tables;
+ int (*read_record)(struct st_myisam_info*, my_off_t, byte*);
+ int (*write_record)(struct st_myisam_info*, const byte*);
+ int (*update_record)(struct st_myisam_info*, my_off_t, const byte*);
+ int (*delete_record)(struct st_myisam_info*);
+ int (*read_rnd)(struct st_myisam_info*, byte*, my_off_t, my_bool);
+ int (*compare_record)(struct st_myisam_info*, const byte *);
+ 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);
+ invalidator_by_filename invalidator; /* query cache invalidator */
ulong this_process; /* processid */
ulong last_process; /* For table-change-check */
ulong last_version; /* Version on start */
ulong options; /* Options used */
+ ulong min_pack_length; /* Theese are used by packed data */
+ ulong max_pack_length;
+ ulong state_diff_length;
uint rec_reflength; /* rec_reflength in use now */
File kfile; /* Shared keyfile */
File data_file; /* Shared data file */
@@ -175,29 +190,15 @@ typedef struct st_mi_isam_share { /* Shared between opens */
uint reopen; /* How many times reopened */
uint w_locks,r_locks,tot_locks; /* Number of read/write locks */
uint blocksize; /* blocksize of keyfile */
- ulong min_pack_length; /* Theese are used by packed data */
- ulong max_pack_length;
- ulong state_diff_length;
+ myf write_flag;
+ int rnd; /* rnd-counter */
+ enum data_file_type data_file_type;
my_bool changed, /* If changed since lock */
global_changed, /* If changed since open */
not_flushed,
temporary,delay_key_write,
concurrent_insert,
fulltext_index;
- myf write_flag;
- int rnd; /* rnd-counter */
- MI_DECODE_TREE *decode_trees;
- uint16 *decode_tables;
- enum data_file_type data_file_type;
- int (*read_record)(struct st_myisam_info*, my_off_t, byte*);
- int (*write_record)(struct st_myisam_info*, const byte*);
- int (*update_record)(struct st_myisam_info*, my_off_t, const byte*);
- int (*delete_record)(struct st_myisam_info*);
- int (*read_rnd)(struct st_myisam_info*, byte*, my_off_t, my_bool);
- int (*compare_record)(struct st_myisam_info*, const byte *);
- 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);
#ifdef THREAD
THR_LOCK lock;
pthread_mutex_t intern_lock; /* Locking for use with _locking */
@@ -215,16 +216,22 @@ typedef struct st_mi_bit_buff { /* Used for packing of record */
uint error;
} MI_BIT_BUFF;
-
struct st_myisam_info {
MYISAM_SHARE *s; /* Shared between open:s */
MI_STATUS_INFO *state,save_state;
MI_BLOB *blobs; /* Pointer to blobs */
- int dfile; /* The datafile */
- MI_BIT_BUFF bit_buff;
- uint opt_flag; /* Optim. for space/speed */
- uint update; /* If file changed since open */
+ MI_BIT_BUFF bit_buff;
+ /* accumulate indexfile changes between write's */
+ TREE *bulk_insert;
char *filename; /* parameter to open filename */
+ uchar *buff, /* Temp area for key */
+ *lastkey,*lastkey2; /* Last used search key */
+ byte *rec_buff, /* Tempbuff for recordpack */
+ *rec_alloc; /* Malloced area for record */
+ uchar *int_keypos, /* Save position for next/previous */
+ *int_maxpos; /* -""- */
+ int (*read_record)(struct st_myisam_info*, my_off_t, byte*);
+ invalidator_by_filename invalidator; /* query cache invalidator */
ulong this_unique; /* uniq filenumber or thread */
ulong last_unique; /* last unique number */
ulong this_loop; /* counter for this open */
@@ -233,20 +240,16 @@ struct st_myisam_info {
nextpos; /* Position to next record */
my_off_t save_lastpos;
my_off_t pos; /* Intern variable */
+ my_off_t last_keypage; /* Last key page read */
+ my_off_t last_search_keypage; /* Last keypage when searching */
+ my_off_t dupp_key_pos;
ha_checksum checksum;
ulong packed_length,blob_length; /* Length of found, packed record */
+ int dfile; /* The datafile */
+ uint opt_flag; /* Optim. for space/speed */
+ uint update; /* If file changed since open */
uint alloced_rec_buff_length; /* Max recordlength malloced */
- uchar *buff, /* Temp area for key */
- *lastkey,*lastkey2; /* Last used search key */
- byte *rec_buff, /* Tempbuff for recordpack */
- *rec_alloc; /* Malloced area for record */
- uchar *int_keypos, /* Save position for next/previous */
- *int_maxpos; /* -""- */
- uint32 int_keytree_version; /* -""- */
uint int_nod_flag; /* -""- */
- my_off_t last_keypage; /* Last key page read */
- my_off_t last_search_keypage; /* Last keypage when searching */
- my_off_t dupp_key_pos;
int lastinx; /* Last used index */
uint lastkey_length; /* Length of key in lastkey */
uint last_rkey_length; /* Last length in mi_rkey() */
@@ -257,16 +260,15 @@ struct st_myisam_info {
uint data_changed; /* Somebody has changed data */
uint save_update; /* When using KEY_READ */
int save_lastinx;
+ uint32 int_keytree_version; /* -""- */
+ LIST open_list;
+ IO_CACHE rec_cache; /* When cacheing records */
+ myf lock_wait; /* is 0 or MY_DONT_WAIT */
my_bool was_locked; /* Was locked in panic */
my_bool quick_mode;
my_bool page_changed; /* If info->buff can't be used for rnext */
my_bool buff_used; /* If info->buff has to be reread for rnext */
my_bool use_packed_key; /* For MYISAMMRG */
- TREE *bulk_insert; /* accumulate indexfile changes between mi_write's */
- myf lock_wait; /* is 0 or MY_DONT_WAIT */
- int (*read_record)(struct st_myisam_info*, my_off_t, byte*);
- LIST open_list;
- IO_CACHE rec_cache; /* When cacheing records */
#ifdef THREAD
THR_LOCK_DATA lock;
#endif