summaryrefslogtreecommitdiff
path: root/myisam
diff options
context:
space:
mode:
authorunknown <monty@donna.mysql.com>2000-08-18 13:09:26 +0300
committerunknown <monty@donna.mysql.com>2000-08-18 13:09:26 +0300
commitd000fde588c33896739320df947ccf8cbad4b981 (patch)
treeb47f92fa5b8b69587ec57938ff7a9b322fec6d57 /myisam
parent340794dd2991246daf964e95067309c3183aa86a (diff)
parentf053a2846ae1479cfe0ca3efd0bb8bddc410f84b (diff)
downloadmariadb-git-d000fde588c33896739320df947ccf8cbad4b981.tar.gz
Merge
myisammrg/Makefile.am: Auto merged support-files/Makefile.am: Auto merged sql/ha_myisam.cc: Merge against serg's changes BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
Diffstat (limited to 'myisam')
-rw-r--r--myisam/ChangeLog5
-rw-r--r--myisam/Makefile.am3
-rw-r--r--myisam/mi_check.c14
-rw-r--r--myisam/mi_extra.c2
-rw-r--r--myisam/mi_page.c2
-rw-r--r--myisam/myisamchk.c41
6 files changed, 53 insertions, 14 deletions
diff --git a/myisam/ChangeLog b/myisam/ChangeLog
index a2cd00a8c50..e7950684f56 100644
--- a/myisam/ChangeLog
+++ b/myisam/ChangeLog
@@ -1,3 +1,8 @@
+2000-08-17 Michael Widenius <monty@mysql.com>
+
+* Add a new flag in share.staus so that we can quickly check if a table
+ is analyzed or not!
+
2000-07-02 Michael Widenius <monty@mysql.com>
* Added safety margin to guard against full index file.
diff --git a/myisam/Makefile.am b/myisam/Makefile.am
index 4a26fbae479..6c5767640c8 100644
--- a/myisam/Makefile.am
+++ b/myisam/Makefile.am
@@ -105,3 +105,6 @@ SUFFIXES = .sh
-e 's!@''PERL_DATA_DUMPER''@!@PERL_DATA_DUMPER@!' \
$< > $@-t
@MV@ $@-t $@
+
+# Don't update the files from bitkeeper
+%::SCCS/s.%
diff --git a/myisam/mi_check.c b/myisam/mi_check.c
index 50225cd71cb..bf9891ae7f8 100644
--- a/myisam/mi_check.c
+++ b/myisam/mi_check.c
@@ -1055,7 +1055,8 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info,
DBUG_ENTER("mi_repair");
start_records=info->state->records;
- new_header_length=(param->testflag & T_UNPACK) ? 0L : share->pack.header_length;
+ new_header_length=(param->testflag & T_UNPACK) ? 0L :
+ share->pack.header_length;
got_error=1;
new_file= -1;
if (!(param->testflag & T_SILENT))
@@ -1252,8 +1253,9 @@ err:
share->pack.header_length=0;
share->data_file_type=sort_info->new_data_file_type;
}
+ share->state.changed|=STATE_NOT_OPTIMIZED_KEYS | STATE_NOT_SORTED_PAGES;
DBUG_RETURN(got_error);
-} /* rep */
+}
/* Uppate keyfile when doing repair */
@@ -1431,6 +1433,7 @@ int mi_sort_index(MI_CHECK *param, register MI_INFO *info, my_string name)
for (key=0 ; key < info->s->state.header.max_block_size ; key++)
info->s->state.key_del[key]= HA_OFFSET_ERROR;
+ info->s->state.changed&= ~STATE_NOT_SORTED_PAGES;
DBUG_RETURN(0);
err:
@@ -1879,6 +1882,10 @@ err:
mi_mark_crashed_on_repair(info);
info->update|= HA_STATE_CHANGED;
}
+ else if (key_map == share->state.key_map)
+ share->state.changed&= ~STATE_NOT_OPTIMIZED_KEYS;
+ share->state.changed|=STATE_NOT_SORTED_PAGES;
+
my_free((gptr) sort_info->key_block,MYF(MY_ALLOW_ZERO_PTR));
my_free(sort_info->record,MYF(MY_ALLOW_ZERO_PTR));
my_free(sort_info->buff,MYF(MY_ALLOW_ZERO_PTR));
@@ -1891,7 +1898,7 @@ err:
share->pack.header_length=0;
}
DBUG_RETURN(got_error);
-} /* rep_by_sort */
+}
/* Read next record and return next key */
@@ -2813,6 +2820,7 @@ int update_state_info(MI_CHECK *param, MI_INFO *info,uint update)
memcpy((char*) share->state.rec_per_key_part,
(char*) param->rec_per_key_part,
sizeof(*param->rec_per_key_part)*key_parts);
+ share->state.changed&= ~STATE_NOT_ANALYZED;
}
if (update & (UPDATE_STAT | UPDATE_SORT | UPDATE_TIME | UPDATE_AUTO_INC))
{
diff --git a/myisam/mi_extra.c b/myisam/mi_extra.c
index 287f1dd34c8..b9ded70402a 100644
--- a/myisam/mi_extra.c
+++ b/myisam/mi_extra.c
@@ -205,7 +205,7 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function)
share->base.keystart;
if (!share->changed)
{
- share->state.changed|=1;
+ share->state.changed|= STATE_CHANGED | STATE_NOT_ANALYZED;
share->changed=1; /* Update on close */
if (!share->global_changed)
{
diff --git a/myisam/mi_page.c b/myisam/mi_page.c
index dd7de9ba8b6..bc0394aedca 100644
--- a/myisam/mi_page.c
+++ b/myisam/mi_page.c
@@ -103,6 +103,7 @@ int _mi_dispose(register MI_INFO *info, MI_KEYDEF *keyinfo, my_off_t pos)
old_link=info->s->state.key_del[keyinfo->block_size];
info->s->state.key_del[keyinfo->block_size]=pos;
mi_sizestore(buff,old_link);
+ info->s->state.changed|= STATE_NOT_SORTED_PAGES;
DBUG_RETURN(key_cache_write(info->s->kfile,pos,buff,
sizeof(buff),
(uint) keyinfo->block_length,
@@ -139,6 +140,7 @@ my_off_t _mi_new(register MI_INFO *info, MI_KEYDEF *keyinfo)
else
info->s->state.key_del[keyinfo->block_size]=mi_sizekorr(buff);
}
+ info->s->state.changed|= STATE_NOT_SORTED_PAGES;
DBUG_PRINT("exit",("Pos: %d",pos));
DBUG_RETURN(pos);
} /* _mi_new */
diff --git a/myisam/myisamchk.c b/myisam/myisamchk.c
index 4f2288322e8..abfb580b501 100644
--- a/myisam/myisamchk.c
+++ b/myisam/myisamchk.c
@@ -190,7 +190,7 @@ static struct option long_options[] =
static void print_version(void)
{
- printf("%s Ver 1.28 for %s at %s\n",my_progname,SYSTEM_TYPE,
+ printf("%s Ver 1.29 for %s at %s\n",my_progname,SYSTEM_TYPE,
MACHINE_TYPE);
}
@@ -520,7 +520,9 @@ static int myisamchk(MI_CHECK *param, my_string filename)
We are using --fast and the table is closed properly
We are using --check-only-changed-tables and the table hasn't changed
*/
- if ((param->testflag & T_CHECK_ONLY_CHANGED) && !share->state.changed ||
+ if (((param->testflag & T_CHECK_ONLY_CHANGED) &&
+ (share->state.changed & (STATE_CHANGED | STATE_CRASHED |
+ STATE_CRASHED_ON_REPAIR))) ||
(param->testflag & T_FAST) && share->state.open_count == 0)
{
if (!(param->testflag & T_SILENT) || param->testflag & T_INFO)
@@ -687,7 +689,8 @@ static int myisamchk(MI_CHECK *param, my_string filename)
if (!error && param->testflag & T_SORT_INDEX)
error=mi_sort_index(param,info,fixed_name);
if (!error)
- share->state.changed=0;
+ share->state.changed&= ~(STATE_CHANGED | STATE_CRASHED |
+ STATE_CRASHED_ON_REPAIR);
else
mi_mark_crashed(info);
}
@@ -734,9 +737,11 @@ static int myisamchk(MI_CHECK *param, my_string filename)
}
if (!error)
{
- if (share->state.changed && (param->testflag & T_UPDATE_STATE))
+ if ((share->state.changed & STATE_CHANGED) &&
+ (param->testflag & T_UPDATE_STATE))
info->update|=HA_STATE_CHANGED | HA_STATE_ROW_CHANGED;
- share->state.changed=0;
+ share->state.changed&= ~(STATE_CHANGED | STATE_CRASHED |
+ STATE_CRASHED_ON_REPAIR);
}
else if (!mi_is_crashed(info) &&
(param->testflag & T_UPDATE_STATE))
@@ -815,7 +820,7 @@ static void descript(MI_CHECK *param, register MI_INFO *info, my_string name)
reg3 MI_KEYDEF *keyinfo;
reg2 MI_KEYSEG *keyseg;
reg4 const char *text;
- char buff[40],length[10],*pos,*end;
+ char buff[160],length[10],*pos,*end;
enum en_fieldtype type;
MYISAM_SHARE *share=info->s;
char llbuff[22],llbuff2[22];
@@ -847,10 +852,26 @@ static void descript(MI_CHECK *param, register MI_INFO *info, my_string name)
get_date(buff,1,share->state.check_time);
printf("Recover time: %s\n",buff);
}
- printf("Status: %s\n",
- share->state.changed & 2 ? "crashed" :
- share->state.open_count ? "open" :
- share->state.changed ? "changed" : "checked");
+ pos=buff;
+ if (share->state.changed & STATE_CRASHED)
+ strmov(buff,"crashed");
+ else
+ {
+ if (share->state.open_count)
+ pos=strmov(pos,"open,");
+ if (share->state.changed & STATE_CHANGED)
+ pos=strmov(pos,"changed,");
+ else
+ pos=strmov(pos,"checked,");
+ if (!(share->state.changed & STATE_NOT_ANALYZED))
+ pos=strmov(pos,"analyzed,");
+ if (!(share->state.changed & STATE_NOT_OPTIMIZED_KEYS))
+ pos=strmov(pos,"optimized keys,");
+ if (!(share->state.changed & STATE_NOT_SORTED_PAGES))
+ pos=strmov(pos,"sorted index pages,");
+ pos[-1]=0; /* Remove extra ',' */
+ }
+ printf("Status: %s\n",buff);
if (share->base.auto_key)
{
printf("Auto increment key: %13d Last value: %13s\n",