Commit 2e15d13f authored by serg@serg.mysql.com's avatar serg@serg.mysql.com
Browse files

LOCK+change+OPTIMIZE MyISAM bug

parent 05f57e20
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -35,11 +35,11 @@ int mi_delete_all_rows(MI_INFO *info)
  if (_mi_mark_file_changed(info))
    goto err;

  state->state.records=info->state->records=info->state->del=state->split=0;
  info->state->records=info->state->del=state->split=0;
  state->dellink = HA_OFFSET_ERROR;
  state->sortkey=  (ushort) ~0;
  info->state->key_file_length=share->base.keystart;
  state->state.data_file_length=info->state->data_file_length=0;
  info->state->data_file_length=0;
  info->state->empty=info->state->key_empty=0;
  state->checksum=0;

+0 −13
Original line number Diff line number Diff line
@@ -24,16 +24,3 @@ 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);
delete from t1 where a=27;
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;
+8 −0
Original line number Diff line number Diff line
@@ -100,3 +100,11 @@ CHECK TABLE t1;
Table	Op	Msg_type	Msg_text
test.t1	check	status	OK
drop table t1;
CREATE TABLE t1 (a INT);
INSERT INTO  t1 VALUES (1), (2), (3);
LOCK TABLES t1 WRITE;
INSERT INTO  t1 VALUES (1), (2), (3);
OPTIMIZE TABLE t1;
Table	Op	Msg_type	Msg_text
test.t1	optimize	status	OK
DROP TABLE t1;
+0 −8
Original line number Diff line number Diff line
@@ -35,11 +35,3 @@ 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);
delete from t1 where a=27;
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;
+11 −0
Original line number Diff line number Diff line
@@ -93,3 +93,14 @@ INSERT INTO t1 (post_text) VALUES ('ceci est un test'),('ceci est un test'),('ce
REPAIR TABLE t1;
CHECK TABLE t1;
drop table t1;

#
# Test of OPTIMIZE of locked and modified tables
#
CREATE TABLE t1 (a INT);
INSERT INTO  t1 VALUES (1), (2), (3);
LOCK TABLES t1 WRITE;
INSERT INTO  t1 VALUES (1), (2), (3);
OPTIMIZE TABLE t1;
DROP TABLE t1;
Loading