diff options
author | unknown <monty@mashka.mysql.fi> | 2003-09-05 17:06:36 +0300 |
---|---|---|
committer | unknown <monty@mashka.mysql.fi> | 2003-09-05 17:06:36 +0300 |
commit | 07cacdcbe73670f9d2fde0adf68f5e2472d7c6bd (patch) | |
tree | 572e3b87fc0d320cc803880aeb73ed3658a330c9 /myisam | |
parent | a65f5081ba3b326b06f9cece549d7e2e319d8aba (diff) | |
parent | 04ff15001df1cf318e45a7a7abeb30ed9e578027 (diff) | |
download | mariadb-git-07cacdcbe73670f9d2fde0adf68f5e2472d7c6bd.tar.gz |
Merge bk-internal.mysql.com:/home/bk/mysql-4.0
into mashka.mysql.fi:/home/my/mysql-4.0
Diffstat (limited to 'myisam')
-rw-r--r-- | myisam/mi_locking.c | 6 | ||||
-rw-r--r-- | myisam/mi_open.c | 9 | ||||
-rw-r--r-- | myisam/mi_update.c | 32 |
3 files changed, 34 insertions, 13 deletions
diff --git a/myisam/mi_locking.c b/myisam/mi_locking.c index 18daebffa85..a707eb294a9 100644 --- a/myisam/mi_locking.c +++ b/myisam/mi_locking.c @@ -76,6 +76,8 @@ int mi_lock_database(MI_INFO *info, int lock_type) } if (!count) { + DBUG_PRINT("info",("changed: %u w_locks: %u", + (uint) share->changed, share->w_locks)); if (share->changed && !share->w_locks) { share->state.process= share->last_process=share->this_process; @@ -352,6 +354,8 @@ int _mi_writeinfo(register MI_INFO *info, uint operation) int error,olderror; MYISAM_SHARE *share=info->s; DBUG_ENTER("_mi_writeinfo"); + DBUG_PRINT("info",("operation: %u tot_locks: %u", operation, + share->tot_locks)); error=0; if (share->tot_locks == 0) @@ -379,9 +383,7 @@ int _mi_writeinfo(register MI_INFO *info, uint operation) my_errno=olderror; } else if (operation) - { share->changed= 1; /* Mark keyfile changed */ - } DBUG_RETURN(error); } /* _mi_writeinfo */ diff --git a/myisam/mi_open.c b/myisam/mi_open.c index 857ca1486fd..580261d8078 100644 --- a/myisam/mi_open.c +++ b/myisam/mi_open.c @@ -730,6 +730,7 @@ uint mi_state_info_write(File file, MI_STATE_INFO *state, uint pWrite) uchar *ptr=buff; uint i, keys= (uint) state->header.keys, key_blocks=state->header.max_block_size; + DBUG_ENTER("mi_state_info_write"); memcpy_fixed(ptr,&state->header,sizeof(state->header)); ptr+=sizeof(state->header); @@ -780,10 +781,10 @@ uint mi_state_info_write(File file, MI_STATE_INFO *state, uint pWrite) } if (pWrite & 1) - return my_pwrite(file,(char*) buff, (uint) (ptr-buff), 0L, - MYF(MY_NABP | MY_THREADSAFE)); - else - return my_write(file, (char*) buff, (uint) (ptr-buff), MYF(MY_NABP)); + DBUG_RETURN(my_pwrite(file,(char*) buff, (uint) (ptr-buff), 0L, + MYF(MY_NABP | MY_THREADSAFE))); + DBUG_RETURN(my_write(file, (char*) buff, (uint) (ptr-buff), + MYF(MY_NABP))); } 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; |