Commit e7026604 authored by unknown's avatar unknown

A nasty fix when all rows are deleted with a write lock


sql/mysqld.cc:
  Some spelling checking error corrections a la Paul Dubois
parent 103e2936
...@@ -35,11 +35,11 @@ int mi_delete_all_rows(MI_INFO *info) ...@@ -35,11 +35,11 @@ int mi_delete_all_rows(MI_INFO *info)
if (_mi_mark_file_changed(info)) if (_mi_mark_file_changed(info))
goto err; goto err;
info->state->records=info->state->del=state->split=0; state->state.records=info->state->records=info->state->del=state->split=0;
state->dellink = HA_OFFSET_ERROR; state->dellink = HA_OFFSET_ERROR;
state->sortkey= (ushort) ~0; state->sortkey= (ushort) ~0;
info->state->key_file_length=share->base.keystart; info->state->key_file_length=share->base.keystart;
info->state->data_file_length=0; state->state.data_file_length=info->state->data_file_length=0;
info->state->empty=info->state->key_empty=0; info->state->empty=info->state->key_empty=0;
state->checksum=0; state->checksum=0;
......
...@@ -24,3 +24,16 @@ create table t1 (a bigint not null, primary key (a,a,a,a,a,a,a,a,a,a)); ...@@ -24,3 +24,16 @@ create table t1 (a bigint not null, primary key (a,a,a,a,a,a,a,a,a,a));
insert into t1 values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23),(27); insert into t1 values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23),(27);
delete from t1 where a=27; delete from t1 where a=27;
drop table t1; drop table t1;
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1), (2), (3);
LOCK TABLES t1 WRITE;
DELETE FROM t1;
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize status OK
SELECT * FROM t1;
a
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
drop table if exists t1;
...@@ -35,3 +35,11 @@ create table t1 (a bigint not null, primary key (a,a,a,a,a,a,a,a,a,a)); ...@@ -35,3 +35,11 @@ create table t1 (a bigint not null, primary key (a,a,a,a,a,a,a,a,a,a));
insert into t1 values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23),(27); insert into t1 values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23),(27);
delete from t1 where a=27; delete from t1 where a=27;
drop table t1; drop table t1;
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1), (2), (3);
LOCK TABLES t1 WRITE;
DELETE FROM t1;
OPTIMIZE TABLE t1;
SELECT * FROM t1;
CHECK TABLE t1;
drop table if exists t1;
...@@ -3004,10 +3004,10 @@ struct my_option my_long_options[] = ...@@ -3004,10 +3004,10 @@ struct my_option my_long_options[] =
{"delay-key-write", OPT_DELAY_KEY_WRITE, "Type of DELAY_KEY_WRITE", {"delay-key-write", OPT_DELAY_KEY_WRITE, "Type of DELAY_KEY_WRITE",
0,0,0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, 0,0,0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"delay-key-write-for-all-tables", OPT_DELAY_KEY_WRITE_ALL, {"delay-key-write-for-all-tables", OPT_DELAY_KEY_WRITE_ALL,
"Don't flush key buffers between writes for any MyISAM table (Depricated option, use --delay-key-write=all instead)", "Don't flush key buffers between writes for any MyISAM table (Deprecated option, use --delay-key-write=all instead)",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"enable-locking", OPT_ENABLE_LOCK, {"enable-locking", OPT_ENABLE_LOCK,
"Depricated option, use --external-locking instead", "Deprecated option, use --external-locking instead",
(gptr*) &opt_external_locking, (gptr*) &opt_external_locking, (gptr*) &opt_external_locking, (gptr*) &opt_external_locking,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifdef __NT__ #ifdef __NT__
...@@ -3244,7 +3244,7 @@ struct my_option my_long_options[] = ...@@ -3244,7 +3244,7 @@ struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifndef TO_BE_DELETED #ifndef TO_BE_DELETED
{"safe-show-database", OPT_SAFE_SHOW_DB, {"safe-show-database", OPT_SAFE_SHOW_DB,
"Depricated option; One should use GRANT SHOW DATABASES instead...", "Deprecated option; One should use GRANT SHOW DATABASES instead...",
(gptr*) &opt_safe_show_db, (gptr*) &opt_safe_show_db, 0, GET_BOOL, NO_ARG, (gptr*) &opt_safe_show_db, (gptr*) &opt_safe_show_db, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0}, 0, 0, 0, 0, 0, 0},
#endif #endif
...@@ -3274,7 +3274,7 @@ struct my_option my_long_options[] = ...@@ -3274,7 +3274,7 @@ struct my_option my_long_options[] =
{"skip-innodb", OPT_INNODB_SKIP, "Don't use Innodb (will save memory)", {"skip-innodb", OPT_INNODB_SKIP, "Don't use Innodb (will save memory)",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"skip-locking", OPT_SKIP_LOCK, {"skip-locking", OPT_SKIP_LOCK,
"Depricated option, use --skip-external-locking instead", "Deprecated option, use --skip-external-locking instead",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"skip-external-locking", OPT_SKIP_LOCK, "Do not use system (external) locking", {"skip-external-locking", OPT_SKIP_LOCK, "Do not use system (external) locking",
(gptr*) &opt_external_locking, (gptr*) &opt_external_locking, (gptr*) &opt_external_locking, (gptr*) &opt_external_locking,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment