summaryrefslogtreecommitdiff
path: root/myisam/mi_update.c
diff options
context:
space:
mode:
authorunknown <monty@mashka.mysql.fi>2003-09-05 06:42:55 +0300
committerunknown <monty@mashka.mysql.fi>2003-09-05 06:42:55 +0300
commita91b55ce48ca9e4472eecdaefaa584af890821e4 (patch)
tree5dd76a6d814942ef3e3f103a780cc8adc7877e7d /myisam/mi_update.c
parent5e9e6eea1d98404826091dc49dd83fd6bae953af (diff)
downloadmariadb-git-a91b55ce48ca9e4472eecdaefaa584af890821e4.tar.gz
Fixed rare bug in MYISAM introduced in 4.0.3 where the index file header was not updated directly after an UPDATE of split dynamic rows.
myisam/mi_locking.c: Added DBUG info myisam/mi_open.c: Added DBUG info myisam/mi_update.c: More comments Fixed rare bug in MYISAM introduced in 4.0.3 where the index file header was not updated directly after an UPDATE of split dynamic rows. mysql-test/r/myisam.result: Added test case for MyISAM UPDATE bug mysql-test/t/myisam.test: Added test case for MyISAM UPDATE bug
Diffstat (limited to 'myisam/mi_update.c')
-rw-r--r--myisam/mi_update.c32
1 files changed, 25 insertions, 7 deletions
diff --git a/myisam/mi_update.c b/myisam/mi_update.c
index 1614d6ca19d..f9ed969d8b5 100644
--- a/myisam/mi_update.c
+++ b/myisam/mi_update.c
@@ -94,7 +94,14 @@ int mi_update(register MI_INFO *info, const byte *oldrec, byte *newrec)
if (_mi_ft_cmp(info,i,oldrec, newrec))
{
if ((int) i == info->lastinx)
+ {
+ /*
+ We are changeing the index we are reading on. Mark that
+ the index data has changed and we need to do a full search
+ when doing read-next
+ */
key_changed|=HA_STATE_WRITTEN;
+ }
changed|=((ulonglong) 1 << i);
if (_mi_ft_update(info,i,(char*) old_key,oldrec,newrec,pos))
goto err;
@@ -121,25 +128,36 @@ int mi_update(register MI_INFO *info, const byte *oldrec, byte *newrec)
}
/*
If we are running with external locking, we must update the index file
- that something has changed
+ that something has changed.
*/
if (changed || !my_disable_locking)
- key_changed|= HA_STATE_KEY_CHANGED;
+ key_changed|= HA_STATE_CHANGED;
if (share->calc_checksum)
{
info->checksum=(*share->calc_checksum)(info,newrec);
- key_changed|= HA_STATE_KEY_CHANGED; /* Must update index file */
+ /* Store new checksum in index file header */
+ key_changed|= HA_STATE_CHANGED;
}
{
- /* Don't update index file if data file is not extended */
+ /*
+ Don't update index file if data file is not extended and no status
+ information changed
+ */
MI_STATUS_INFO state;
+ ha_rows org_split;
+ my_off_t org_delete_link;
+
memcpy((char*) &state, (char*) info->state, sizeof(state));
+ org_split= share->state.split;
+ org_delete_link= share->state.dellink;
if ((*share->update_record)(info,pos,newrec))
goto err;
if (!key_changed &&
- memcmp((char*) &state, (char*) info->state, sizeof(state)))
- key_changed|= HA_STATE_KEY_CHANGED; /* Must update index file */
+ (memcmp((char*) &state, (char*) info->state, sizeof(state)) ||
+ org_split != share->state.split ||
+ org_delete_link != share->state.dellink))
+ key_changed|= HA_STATE_CHANGED; /* Must update index file */
}
if (auto_key_changed)
update_auto_increment(info,newrec);
@@ -163,7 +181,7 @@ err:
DBUG_PRINT("error",("key: %d errno: %d",i,my_errno));
save_errno=my_errno;
if (changed)
- key_changed|= HA_STATE_KEY_CHANGED;
+ key_changed|= HA_STATE_CHANGED;
if (my_errno == HA_ERR_FOUND_DUPP_KEY || my_errno == HA_ERR_RECORD_FILE_FULL)
{
info->errkey= (int) i;