diff options
author | monty@hundin.mysql.fi <> | 2001-08-19 14:43:51 +0300 |
---|---|---|
committer | monty@hundin.mysql.fi <> | 2001-08-19 14:43:51 +0300 |
commit | a1be2a894f339f7b14a6b654c961d77ba13298d4 (patch) | |
tree | e2a8b10d8dae9fee5283beb230210199e135ef74 /myisam | |
parent | 1e1a1ec064de1f6ddbd0ae433b83d7c8647557a3 (diff) | |
download | mariadb-git-a1be2a894f339f7b14a6b654c961d77ba13298d4.tar.gz |
Fix of UNION code
Added heap_delete_table
Added HA_EXTRA_PREPARE_FOR_DELETE
Added and use my_dup() for faster open of tables.
Removed not working no-mix-table-type
Diffstat (limited to 'myisam')
-rw-r--r-- | myisam/mi_check.c | 4 | ||||
-rw-r--r-- | myisam/mi_extra.c | 5 | ||||
-rw-r--r-- | myisam/mi_open.c | 29 | ||||
-rw-r--r-- | myisam/myisamchk.c | 2 | ||||
-rw-r--r-- | myisam/myisamdef.h | 6 |
5 files changed, 25 insertions, 21 deletions
diff --git a/myisam/mi_check.c b/myisam/mi_check.c index a02652f0b48..e5557e5f842 100644 --- a/myisam/mi_check.c +++ b/myisam/mi_check.c @@ -1321,7 +1321,7 @@ err: DATA_TMP_EXT, share->base.raid_chunks, (param->testflag & T_BACKUP_DATA ? MYF(MY_REDEL_MAKE_BACKUP): MYF(0))) || - mi_open_datafile(info,share)) + mi_open_datafile(info,share,-1)) got_error=1; } } @@ -2039,7 +2039,7 @@ err: DATA_TMP_EXT, share->base.raid_chunks, (param->testflag & T_BACKUP_DATA ? MYF(MY_REDEL_MAKE_BACKUP): MYF(0))) || - mi_open_datafile(info,share)) + mi_open_datafile(info,share,-1)) got_error=1; } } diff --git a/myisam/mi_extra.c b/myisam/mi_extra.c index d7f3e4dc04a..eb7285491ed 100644 --- a/myisam/mi_extra.c +++ b/myisam/mi_extra.c @@ -245,12 +245,15 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function) } break; case HA_EXTRA_FORCE_REOPEN: + case HA_EXTRA_PREPARE_FOR_DELETE: pthread_mutex_lock(&THR_LOCK_myisam); share->last_version= 0L; /* Impossible version */ #ifdef __WIN__ /* Close the isam and data files as Win32 can't drop an open table */ pthread_mutex_lock(&share->intern_lock); - if (flush_key_blocks(share->kfile,FLUSH_RELEASE)) + if (flush_key_blocks(share->kfile, + (function == HA_EXTRA_FORCE_REOPEN ? + FLUSH_RELEASE : FLUSH_IGNORE_CHANGED))) { error=my_errno; share->changed=1; diff --git a/myisam/mi_open.c b/myisam/mi_open.c index 4d8a5c2a1d6..36cf8cfd6bd 100644 --- a/myisam/mi_open.c +++ b/myisam/mi_open.c @@ -366,7 +366,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags) lock_error=1; /* Database unlocked */ } - if (mi_open_datafile(&info, share)) + if (mi_open_datafile(&info, share, -1)) goto err; errpos=5; @@ -439,7 +439,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags) my_errno=EACCES; /* Can't open in write mode */ goto err; } - if (mi_open_datafile(&info, share)) + if (mi_open_datafile(&info, share, old_info->dfile)) goto err; errpos=5; } @@ -1012,25 +1012,26 @@ char *mi_recinfo_read(char *ptr, MI_COLUMNDEF *recinfo) ** Help functions for recover *************************************************************************/ -int mi_open_datafile(MI_INFO *info, MYISAM_SHARE *share) +int mi_open_datafile(MI_INFO *info, MYISAM_SHARE *share, File file_to_dup) { #ifdef USE_RAID if (share->base.raid_type) { - if ((info->dfile=my_raid_open(share->data_file_name, - share->mode | O_SHARE, - share->base.raid_type, - share->base.raid_chunks, - share->base.raid_chunksize, - MYF(MY_WME | MY_RAID))) < 0) - return 1; + info->dfile=my_raid_open(share->data_file_name, + share->mode | O_SHARE, + share->base.raid_type, + share->base.raid_chunks, + share->base.raid_chunksize, + MYF(MY_WME | MY_RAID)); } else #endif - if ((info->dfile=my_open(share->data_file_name, share->mode | O_SHARE, - MYF(MY_WME))) < 0) - return 1; - return 0; + if (file_to_dup >= 0) + info->dfile=my_dup(file_to_dup,MYF(MY_WME)); + else + info->dfile=my_open(share->data_file_name, share->mode | O_SHARE, + MYF(MY_WME)); + return info->dfile >= 0 ? 0 : 1; } diff --git a/myisam/myisamchk.c b/myisam/myisamchk.c index f650e4312f7..fa07d19ddbd 100644 --- a/myisam/myisamchk.c +++ b/myisam/myisamchk.c @@ -712,7 +712,7 @@ static int myisamchk(MI_CHECK *param, my_string filename) error|=change_to_newfile(filename,MI_NAME_DEXT,DATA_TMP_EXT, raid_chunks, MYF(0)); - if (mi_open_datafile(info,info->s)) + if (mi_open_datafile(info,info->s, -1)) error=1; param->out_flag&= ~O_NEW_DATA; /* We are using new datafile */ param->read_cache.file=info->dfile; diff --git a/myisam/myisamdef.h b/myisam/myisamdef.h index 865c47fb7ea..9da669e8438 100644 --- a/myisam/myisamdef.h +++ b/myisam/myisamdef.h @@ -169,8 +169,8 @@ typedef struct st_mi_isam_share { /* Shared between opens */ ulong last_version; /* Version on start */ ulong options; /* Options used */ uint rec_reflength; /* rec_reflength in use now */ - int kfile; /* Shared keyfile */ - int data_file; /* Shared data file */ + File kfile; /* Shared keyfile */ + File data_file; /* Shared data file */ int mode; /* mode of file on open */ uint reopen; /* How many times reopened */ uint w_locks,r_locks; /* Number of read/write locks */ @@ -642,7 +642,7 @@ my_bool mi_check_status(void* param); void mi_disable_non_unique_index(MI_INFO *info, ha_rows rows); my_bool check_table_is_closed(const char *name, const char *where); -int mi_open_datafile(MI_INFO *info, MYISAM_SHARE *share); +int mi_open_datafile(MI_INFO *info, MYISAM_SHARE *share, File file_to_dup); int mi_open_keyfile(MYISAM_SHARE *share); int _mi_init_bulk_insert(MI_INFO *info); |