summaryrefslogtreecommitdiff
path: root/myisam
diff options
context:
space:
mode:
authorunknown <monty@narttu.mysql.fi>2003-08-25 14:27:32 +0300
committerunknown <monty@narttu.mysql.fi>2003-08-25 14:27:32 +0300
commite8007ae77b20a6c51daaa47da78c65fe0b0fdac8 (patch)
tree938a55a6e041a1bfd4c0e3a6e9df608ef77d093b /myisam
parent2ad17fa6e0e99ddd5d78a941bee7221808ee773f (diff)
downloadmariadb-git-e8007ae77b20a6c51daaa47da78c65fe0b0fdac8.tar.gz
Update of VC++ project files (to remove link warnings)
Fix unlock error in myisamchk on windows when doing --sort-index Use SetFilePointer instead of SetFilePointerEx VC++Files/client/mysql.dsp: Update of project files VC++Files/client/mysqladmin.dsp: Update of project files VC++Files/client/mysqlclient.dsp: Update of project files VC++Files/client/mysqldump.dsp: Update of project files VC++Files/client/mysqlimport.dsp: Update of project files VC++Files/client/mysqlshow.dsp: Update of project files VC++Files/comp_err/comp_err.dsp: Update of project files VC++Files/innobase/innobase.dsp: Update of project files VC++Files/isamchk/isamchk.dsp: Update of project files VC++Files/libmysql/libmysql.dsp: Update of project files VC++Files/libmysqld/libmysqld.dsp: Update of project files VC++Files/libmysqltest/myTest.dsp: Update of project files VC++Files/my_print_defaults/my_print_defaults.dsp: Update of project files VC++Files/myisamlog/myisamlog.dsp: Update of project files VC++Files/mysql.dsw: Update of project files VC++Files/mysqlbinlog/mysqlbinlog.dsp: Update of project files VC++Files/mysqlcheck/mysqlcheck.dsp: Update of project files VC++Files/mysqldemb/mysqldemb.dsp: Update of project files VC++Files/mysqlmanager/MySqlManager.dsp: Update of project files VC++Files/mysqlserver/mysqlserver.dsp: Update of project files VC++Files/mysqlshutdown/mysqlshutdown.dsp: Update of project files VC++Files/mysys/mysys.dsp: Update of project files VC++Files/pack_isam/pack_isam.dsp: Update of project files VC++Files/perror/perror.dsp: Update of project files VC++Files/replace/replace.dsp: Update of project files VC++Files/sql/mysqld.dsp: Update of project files VC++Files/test1/test1.dsp: Update of project files VC++Files/thr_test/thr_test.dsp: Update of project files VC++Files/vio/vio.dsp: Update of project files VC++Files/zlib/zlib.dsp: Update of project files myisam/mi_check.c: Fix unlock error in myisamchk on windows when doing --sort-index myisam/mi_locking.c: Fix unlock error in myisamchk on windows when doing --sort-index myisam/myisamchk.c: New comment mysys/my_chsize.c: Use SetFilePointer instead of SetFilePointerEx, as the first is more portable sql/handler.cc: Fix compiler warning sql/log_event.cc: Fix compiler warning
Diffstat (limited to 'myisam')
-rw-r--r--myisam/mi_check.c17
-rw-r--r--myisam/mi_locking.c6
-rw-r--r--myisam/myisamchk.c5
3 files changed, 21 insertions, 7 deletions
diff --git a/myisam/mi_check.c b/myisam/mi_check.c
index 0d7d7fae628..106e65e90d3 100644
--- a/myisam/mi_check.c
+++ b/myisam/mi_check.c
@@ -1513,6 +1513,7 @@ int mi_sort_index(MI_CHECK *param, register MI_INFO *info, my_string name)
File new_file;
my_off_t index_pos[MI_MAX_POSSIBLE_KEY];
uint r_locks,w_locks;
+ int old_lock;
MYISAM_SHARE *share=info->s;
MI_STATE_INFO old_state;
DBUG_ENTER("sort_index");
@@ -1556,8 +1557,11 @@ int mi_sort_index(MI_CHECK *param, register MI_INFO *info, my_string name)
flush_key_blocks(share->kfile, FLUSH_IGNORE_CHANGED);
share->state.version=(ulong) time((time_t*) 0);
- old_state=share->state; /* save state if not stored */
- r_locks=share->r_locks; w_locks=share->w_locks;
+ old_state= share->state; /* save state if not stored */
+ r_locks= share->r_locks;
+ w_locks= share->w_locks;
+ old_lock= info->lock_type;
+
/* Put same locks as old file */
share->r_locks= share->w_locks= share->tot_locks= 0;
(void) _mi_writeinfo(info,WRITEINFO_UPDATE_KEYFILE);
@@ -1568,12 +1572,13 @@ int mi_sort_index(MI_CHECK *param, register MI_INFO *info, my_string name)
MYF(0)) ||
mi_open_keyfile(share))
goto err2;
- info->lock_type=F_UNLCK; /* Force mi_readinfo to lock */
+ 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->lock_type= old_lock;
+ share->r_locks= r_locks;
+ share->w_locks= w_locks;
share->tot_locks= r_locks+w_locks;
- share->state=old_state; /* Restore old state */
+ share->state= old_state; /* Restore old state */
info->state->key_file_length=param->new_file_pos;
info->update= (short) (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED);
diff --git a/myisam/mi_locking.c b/myisam/mi_locking.c
index 22772a3dd2e..19fd99779ba 100644
--- a/myisam/mi_locking.c
+++ b/myisam/mi_locking.c
@@ -35,6 +35,7 @@ int mi_lock_database(MI_INFO *info, int lock_type)
MYISAM_SHARE *share=info->s;
uint flag;
DBUG_ENTER("mi_lock_database");
+ DBUG_PRINT("info",("lock_type: %d", lock_type));
if (share->options & HA_OPTION_READ_ONLY_DATA ||
info->lock_type == lock_type)
@@ -53,10 +54,13 @@ int mi_lock_database(MI_INFO *info, int lock_type)
{
switch (lock_type) {
case F_UNLCK:
+ DBUG_PRINT("info", ("old lock: %d", info->lock_type));
if (info->lock_type == F_RDLCK)
count= --share->r_locks;
- else
+ else if (info->lock_type == F_WRLCK)
count= --share->w_locks;
+ else
+ count= 1; /* F_EXTRA_LCK */
--share->tot_locks;
if (info->lock_type == F_WRLCK && !share->w_locks &&
!share->delay_key_write && flush_key_blocks(share->kfile,FLUSH_KEEP))
diff --git a/myisam/myisamchk.c b/myisam/myisamchk.c
index a0b4515f1dd..a41292aeb04 100644
--- a/myisam/myisamchk.c
+++ b/myisam/myisamchk.c
@@ -882,6 +882,11 @@ static int myisamchk(MI_CHECK *param, my_string filename)
param->error_printed=0;
goto end2;
}
+ /*
+ _mi_readinfo() has locked the table.
+ We mark the table as locked (without doing file locks) to be able to
+ use functions that only works on locked tables (like row caching).
+ */
mi_lock_database(info, F_EXTRA_LCK);
datafile=info->dfile;