diff options
author | unknown <monty@donna.mysql.com> | 2001-01-28 21:35:50 +0200 |
---|---|---|
committer | unknown <monty@donna.mysql.com> | 2001-01-28 21:35:50 +0200 |
commit | 184e24b2253a81b03476e3d4d8cf56d5eb9dbf18 (patch) | |
tree | fabb5447e17b9f0959cb83b6d88351367ca53645 /myisam/mi_check.c | |
parent | 298ba0d39d6d38d5be860a3ad8a55b469b67e7d8 (diff) | |
download | mariadb-git-184e24b2253a81b03476e3d4d8cf56d5eb9dbf18.tar.gz |
Fixed ALTER TABLE on MERGE tables
Fixed bug in DISTINCT
Docs/manual.texi:
Updated Changelog
Cleaned up adding character sets
merge/open.c:
skip comments
myisam/mi_check.c:
Fixed bug when sorting index on Windows
myisammrg/myrg_info.c:
Use only portable printf arguments
myisammrg/myrg_rrnd.c:
Use only portable printf arguments
mysql-test/r/distinct.result:
Added test case for bug in distinct
mysql-test/r/merge.result:
Added test for ALTER TABLE
mysql-test/t/distinct.test:
Added test case for bug in distinct
mysql-test/t/merge.test:
Added test for ALTER TABLE
sql-bench/crash-me.sh:
Fixed portability issues
sql/ha_myisammrg.cc:
Fixed for ALTER TABLE on MERGE tables
sql/item_sum.cc:
Fixed bug in DISTINCT
sql/sql_db.cc:
Added test of namelen in check_db_name
sql/sql_select.cc:
Fixed bug in DISTINCT
sql/sql_select.h:
Fixed bug in DISTINCT
sql/sql_table.cc:
Fixed ALTER TABLE on MERGE tables
sql/table.cc:
Added test of namelen in check_db_name
sql/table.h:
Fixed ALTER TABLE on MERGE tables
Diffstat (limited to 'myisam/mi_check.c')
-rw-r--r-- | myisam/mi_check.c | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/myisam/mi_check.c b/myisam/mi_check.c index ee9e3387119..73738711188 100644 --- a/myisam/mi_check.c +++ b/myisam/mi_check.c @@ -1462,6 +1462,8 @@ int mi_sort_index(MI_CHECK *param, register MI_INFO *info, my_string name) reg1 MI_KEYDEF *keyinfo; File new_file; my_off_t index_pos[MI_MAX_POSSIBLE_KEY]; + uint r_locks,w_locks; + MYISAM_SHARE *share=info->s; DBUG_ENTER("sort_index"); if (!(param->testflag & T_SILENT)) @@ -1475,21 +1477,21 @@ int mi_sort_index(MI_CHECK *param, register MI_INFO *info, my_string name) param->temp_filename); DBUG_RETURN(-1); } - if (filecopy(param, new_file,info->s->kfile,0L, - (ulong) info->s->base.keystart, "headerblock")) + if (filecopy(param, new_file,share->kfile,0L, + (ulong) share->base.keystart, "headerblock")) goto err; - param->new_file_pos=info->s->base.keystart; - for (key= 0,keyinfo= &info->s->keyinfo[0]; key < info->s->base.keys ; + param->new_file_pos=share->base.keystart; + for (key= 0,keyinfo= &share->keyinfo[0]; key < share->base.keys ; key++,keyinfo++) { - if (!(((ulonglong) 1 << key) & info->s->state.key_map)) + if (!(((ulonglong) 1 << key) & share->state.key_map)) continue; - if (info->s->state.key_root[key] != HA_OFFSET_ERROR) + if (share->state.key_root[key] != HA_OFFSET_ERROR) { index_pos[key]=param->new_file_pos; /* Write first block here */ - if (sort_one_index(param,info,keyinfo,info->s->state.key_root[key], + if (sort_one_index(param,info,keyinfo,share->state.key_root[key], new_file)) goto err; } @@ -1498,19 +1500,24 @@ int mi_sort_index(MI_CHECK *param, register MI_INFO *info, my_string name) } /* Flush key cache for this file if we are calling this outside myisamchk */ - flush_key_blocks(info->s->kfile, FLUSH_IGNORE_CHANGED); + flush_key_blocks(share->kfile, FLUSH_IGNORE_CHANGED); /* Put same locks as old file */ - info->s->state.version=(ulong) time((time_t*) 0); - VOID(_mi_writeinfo(info,WRITEINFO_UPDATE_KEYFILE)); - VOID(my_close(info->s->kfile,MYF(MY_WME))); - info->s->kfile = -1; + share->state.version=(ulong) time((time_t*) 0); + r_locks=share->r_locks; w_locks=share->w_locks; + share->r_locks=share->w_locks=0; + (void) _mi_writeinfo(info,WRITEINFO_UPDATE_KEYFILE); + VOID(my_close(share->kfile,MYF(MY_WME))); + share->kfile = -1; VOID(my_close(new_file,MYF(MY_WME))); - if (change_to_newfile(info->s->filename,MI_NAME_IEXT,INDEX_TMP_EXT,0, + if (change_to_newfile(share->filename,MI_NAME_IEXT,INDEX_TMP_EXT,0, MYF(0)) || - mi_open_keyfile(info->s)) + mi_open_keyfile(share)) goto err2; - _mi_readinfo(info,F_WRLCK,0); + info->lock_type=F_UNLCK; /* Force mi_readinfo to lock */ + _mi_readinfo(info,F_WRLCK,0); /* Will lock the table */ + info->lock_type=F_WRLCK; + share->r_locks=r_locks; share->w_locks=w_locks; info->state->key_file_length=param->new_file_pos; info->update= (short) (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED); |