summaryrefslogtreecommitdiff
path: root/myisam
diff options
context:
space:
mode:
authorunknown <monty@donna.mysql.com>2000-11-21 03:43:34 +0200
committerunknown <monty@donna.mysql.com>2000-11-21 03:43:34 +0200
commit7c881e34ef78cd541cb98738215c8f062024dbad (patch)
tree18fdf025bea7d918e304f45384902d822f68f2f6 /myisam
parent675d1803db1ea6da10dda7ac05ec7800bf6a0d31 (diff)
downloadmariadb-git-7c881e34ef78cd541cb98738215c8f062024dbad.tar.gz
Fixed problem with auto-repair of MyISAM tables
Fixed bug in ISAM and MyISAM when updating from multiple-processes Docs/manual.texi: Updated changelog client/mysqladmin.c: Upgraded version number because the change of llstr() is visible extra/perror.c: Added new error message include/my_base.h: Added HA_ERR_CRASHED_ON_USAGE isam/rnext.c: Fixed bug when updating from multiple-processes isam/rprev.c: Fixed bug when updating from multiple-processes libmysql/libmysql.c: Fixed that mysql->options.client_flag was used properly myisam/mi_locking.c: Fixed bug when updating from multiple-processes myisam/mi_open.c: Fixed bug when updating from multiple-processes Added HA_ERR_CRASHED_ON_USAGE myisam/mi_rnext.c: Fixed bug when updating from multiple-processes myisam/mi_rprev.c: Fixed bug when updating from multiple-processes myisam/myisamchk.c: Added HA_ERR_CRASHED_ON_USAGE sql/sql_base.cc: Fixed problem with auto-repair of MyISAM tables sql/table.cc: Fixed problem with auto-repair of MyISAM tables
Diffstat (limited to 'myisam')
-rw-r--r--myisam/mi_locking.c1
-rw-r--r--myisam/mi_open.c5
-rw-r--r--myisam/mi_rnext.c7
-rw-r--r--myisam/mi_rprev.c5
-rw-r--r--myisam/myisamchk.c9
5 files changed, 20 insertions, 7 deletions
diff --git a/myisam/mi_locking.c b/myisam/mi_locking.c
index 45bb2cd7164..057efb96185 100644
--- a/myisam/mi_locking.c
+++ b/myisam/mi_locking.c
@@ -382,6 +382,7 @@ int _mi_test_if_changed(register MI_INFO *info)
share->state.unique != info->last_unique ||
share->state.update_count != info->last_loop)
{ /* Keyfile has changed */
+ DBUG_PRINT("info",("index file changed"));
if (share->state.process != share->this_process)
VOID(flush_key_blocks(share->kfile,FLUSH_RELEASE));
share->last_process=share->state.process;
diff --git a/myisam/mi_open.c b/myisam/mi_open.c
index c29a4a843ca..2eab33228dc 100644
--- a/myisam/mi_open.c
+++ b/myisam/mi_open.c
@@ -182,7 +182,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
{
DBUG_PRINT("error",("Table is marked as crashed"));
my_errno=((share->state.changed & STATE_CRASHED_ON_REPAIR) ?
- HA_ERR_CRASHED_ON_REPAIR : HA_ERR_CRASHED);
+ HA_ERR_CRASHED_ON_REPAIR : HA_ERR_CRASHED_ON_USAGE);
goto err;
}
/* Correct max_file_length based on length of sizeof_t */
@@ -732,7 +732,8 @@ char *mi_state_info_read(char *ptr, MI_STATE_INFO *state)
state->process= mi_uint4korr(ptr); ptr +=4;
state->unique = mi_uint4korr(ptr); ptr +=4;
state->status = mi_uint4korr(ptr); ptr +=4;
- ptr +=4; /* extra */
+ state->update_count=mi_uint4korr(ptr); ptr +=4;
+
for (i=0; i < keys; i++)
{
state->key_root[i]= mi_sizekorr(ptr); ptr +=8;
diff --git a/myisam/mi_rnext.c b/myisam/mi_rnext.c
index f7e7b61d934..f297740af60 100644
--- a/myisam/mi_rnext.c
+++ b/myisam/mi_rnext.c
@@ -25,7 +25,7 @@
int mi_rnext(MI_INFO *info, byte *buf, int inx)
{
- int error;
+ int error,changed;
uint flag;
DBUG_ENTER("mi_rnext");
@@ -39,10 +39,13 @@ int mi_rnext(MI_INFO *info, byte *buf, int inx)
DBUG_RETURN(my_errno);
if (info->s->concurrent_insert)
rw_rdlock(&info->s->key_root_lock[inx]);
+ changed=_mi_test_if_changed(info);
if (!flag)
+ {
error=_mi_search_first(info,info->s->keyinfo+inx,
info->s->state.key_root[inx]);
- else if (_mi_test_if_changed(info) == 0)
+ }
+ else if (!changed)
error=_mi_search_next(info,info->s->keyinfo+inx,info->lastkey,
info->lastkey_length,flag,
info->s->state.key_root[inx]);
diff --git a/myisam/mi_rprev.c b/myisam/mi_rprev.c
index 471eecc33f5..69d18b10287 100644
--- a/myisam/mi_rprev.c
+++ b/myisam/mi_rprev.c
@@ -25,7 +25,7 @@
int mi_rprev(MI_INFO *info, byte *buf, int inx)
{
- int error;
+ int error,changed;
register uint flag;
MYISAM_SHARE *share=info->s;
DBUG_ENTER("mi_rprev");
@@ -38,12 +38,13 @@ int mi_rprev(MI_INFO *info, byte *buf, int inx)
if (_mi_readinfo(info,F_RDLCK,1))
DBUG_RETURN(my_errno);
+ changed=_mi_test_if_changed(info);
if (share->concurrent_insert)
rw_rdlock(&share->key_root_lock[inx]);
if (!flag)
error=_mi_search_last(info, share->keyinfo+inx,
share->state.key_root[inx]);
- else if (_mi_test_if_changed(info) == 0)
+ else if (!changed)
error=_mi_search_next(info,share->keyinfo+inx,info->lastkey,
info->lastkey_length,flag,
share->state.key_root[inx]);
diff --git a/myisam/myisamchk.c b/myisam/myisamchk.c
index b18f42bfb81..d045bf0018b 100644
--- a/myisam/myisamchk.c
+++ b/myisam/myisamchk.c
@@ -196,7 +196,7 @@ static struct option long_options[] =
static void print_version(void)
{
- printf("%s Ver 1.36 for %s at %s\n",my_progname,SYSTEM_TYPE,
+ printf("%s Ver 1.37 for %s at %s\n",my_progname,SYSTEM_TYPE,
MACHINE_TYPE);
}
@@ -502,8 +502,15 @@ static int myisamchk(MI_CHECK *param, my_string filename)
param->error_printed=1;
switch (my_errno) {
case HA_ERR_CRASHED:
+ case HA_ERR_WRONG_TABLE_DEF:
mi_check_print_error(param,"'%s' is not a MyISAM-table",filename);
break;
+ case HA_ERR_CRASHED_ON_USAGE:
+ mi_check_print_error(param,"'%s' is marked as crashed",filename);
+ break;
+ case HA_ERR_CRASHED_ON_REPAIR:
+ mi_check_print_error(param,"'%s' is marked as crashed after last repair",filename);
+ break;
case HA_ERR_OLD_FILE:
mi_check_print_error(param,"'%s' is a old type of MyISAM-table", filename);
break;