summaryrefslogtreecommitdiff
path: root/myisammrg
diff options
context:
space:
mode:
authorunknown <monty@donna.mysql.com>2000-09-21 01:58:38 +0300
committerunknown <monty@donna.mysql.com>2000-09-21 01:58:38 +0300
commit43044b685f765718f5f90ac26fa3e2317b5749e9 (patch)
treee2dd869fb38dfdf7e26817e7b0f7a7a6add22758 /myisammrg
parent73826420c3114dad809c2c051ba60a6e3f50ee20 (diff)
downloadmariadb-git-43044b685f765718f5f90ac26fa3e2317b5749e9.tar.gz
Fix for SAFE_MUTEX + MERGE tables
Docs/manual.texi: Fix for release include/my_pthread.h: Fix for SAFE_MUTEX for windows include/myisammrg.h: Fix for empty MERGE tables myisam/ft_stopwords.c: Free used memory myisammrg/myrg_open.c: Fix for empty MERGE tables myisammrg/myrg_queue.c: Fix for empty MERGE tables myisammrg/myrg_rfirst.c: cleanup myisammrg/myrg_rkey.c: cleanup mysys/my_thr_init.c: Fix SAFE_MUTEX for windows mysys/my_winthread.c: Fix SAFE_MUTEX for windows mysys/thr_mutex.c: Fix SAFE_MUTEX for windows sql/ha_myisammrg.cc: Fix for empty MERGE tables sql/mysqld.cc: Fix type
Diffstat (limited to 'myisammrg')
-rw-r--r--myisammrg/myrg_open.c14
-rw-r--r--myisammrg/myrg_queue.c31
-rw-r--r--myisammrg/myrg_rfirst.c2
-rw-r--r--myisammrg/myrg_rkey.c2
4 files changed, 29 insertions, 20 deletions
diff --git a/myisammrg/myrg_open.c b/myisammrg/myrg_open.c
index 7f80a88dddc..9159b4edb0f 100644
--- a/myisammrg/myrg_open.c
+++ b/myisammrg/myrg_open.c
@@ -86,6 +86,7 @@ int handle_locking;
*m_info=info;
m_info->open_tables=(MYRG_TABLE *) (m_info+1);
m_info->tables=files;
+ errpos=2;
for (i=files ; i-- > 0 ; )
{
@@ -104,16 +105,21 @@ int handle_locking;
m_info->open_tables[i].file_offset=(my_off_t) file_offset;
file_offset+=m_info->open_tables[i].table->state->data_file_length;
}
- errpos=2;
if (sizeof(my_off_t) == 4 && file_offset > (ulonglong) (ulong) ~0L)
{
my_errno=HA_ERR_RECORD_FILE_FULL;
goto err;
}
/* Allocate memory for queue */
- if (m_info->open_tables->table->s->base.keys &&
- _myrg_init_queue(m_info,0,HA_READ_KEY_EXACT))
- goto err;
+ m_info->keys=0;
+ if (files)
+ {
+ if ((m_info->keys=m_info->open_tables->table->s->base.keys) &&
+ _myrg_init_queue(m_info,0,HA_READ_KEY_EXACT))
+ goto err;
+ }
+ else
+ bzero((char*) &m_info->by_key,sizeof(m_info->by_key));
m_info->end_table=m_info->open_tables+files;
m_info->last_used_table=m_info->open_tables;
diff --git a/myisammrg/myrg_queue.c b/myisammrg/myrg_queue.c
index 4d94f984722..d6f831db48c 100644
--- a/myisammrg/myrg_queue.c
+++ b/myisammrg/myrg_queue.c
@@ -34,21 +34,24 @@ int _myrg_init_queue(MYRG_INFO *info,int inx,enum ha_rkey_function search_flag)
int error=0;
QUEUE *q= &(info->by_key);
- if (!is_queue_inited(q))
+ if (inx < (int) info->keys)
{
- if (init_queue(q,info->tables, 0,
- (myisam_readnext_vec[search_flag] == SEARCH_SMALLER),
- queue_key_cmp,
- info->open_tables->table->s->keyinfo[inx].seg))
- error=my_errno;
- }
- else
- {
- if (reinit_queue(q,info->tables, 0,
- (myisam_readnext_vec[search_flag] == SEARCH_SMALLER),
- queue_key_cmp,
- info->open_tables->table->s->keyinfo[inx].seg))
- error=my_errno;
+ if (!is_queue_inited(q))
+ {
+ if (init_queue(q,info->tables, 0,
+ (myisam_readnext_vec[search_flag] == SEARCH_SMALLER),
+ queue_key_cmp,
+ info->open_tables->table->s->keyinfo[inx].seg))
+ error=my_errno;
+ }
+ else
+ {
+ if (reinit_queue(q,info->tables, 0,
+ (myisam_readnext_vec[search_flag] == SEARCH_SMALLER),
+ queue_key_cmp,
+ info->open_tables->table->s->keyinfo[inx].seg))
+ error=my_errno;
+ }
}
return error;
}
diff --git a/myisammrg/myrg_rfirst.c b/myisammrg/myrg_rfirst.c
index 3f29414f076..0625e848660 100644
--- a/myisammrg/myrg_rfirst.c
+++ b/myisammrg/myrg_rfirst.c
@@ -27,7 +27,7 @@ int myrg_rfirst(MYRG_INFO *info, byte *buf, int inx)
if (_myrg_init_queue(info,inx,HA_READ_KEY_OR_NEXT))
return my_errno;
- for (table=info->open_tables ; table < info->end_table ; table++)
+ for (table=info->open_tables ; table != info->end_table ; table++)
{
if ((err=mi_rfirst(table->table,NULL,inx)))
{
diff --git a/myisammrg/myrg_rkey.c b/myisammrg/myrg_rkey.c
index 465d61ce3c6..d66d5ec3fe7 100644
--- a/myisammrg/myrg_rkey.c
+++ b/myisammrg/myrg_rkey.c
@@ -49,7 +49,7 @@ int myrg_rkey(MYRG_INFO *info,byte *record,int inx, const byte *key,
if (_myrg_init_queue(info,inx,search_flag))
return my_errno;
- for (table=info->open_tables ; table < info->end_table ; table++)
+ for (table=info->open_tables ; table != info->end_table ; table++)
{
mi=table->table;