summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <Sinisa@sinisa.nasamreza.org>2002-08-28 16:41:23 +0300
committerunknown <Sinisa@sinisa.nasamreza.org>2002-08-28 16:41:23 +0300
commit9210160c5560c61044dd1529c9fa4de46e126a77 (patch)
tree69f65dccef0752eb3d30c80ef25a24beec3d36cf
parent63cdfc4b436baec414f587535fbdca0119765615 (diff)
downloadmariadb-git-9210160c5560c61044dd1529c9fa4de46e126a77.tar.gz
Little but nasty bug with BDB and alter table
-rw-r--r--Docs/manual.texi3
-rw-r--r--mysql-test/r/bdb-alter-table-1.result4
-rw-r--r--mysql-test/r/bdb-alter-table-2.result4
-rw-r--r--mysql-test/t/bdb-alter-table-1.test12
-rw-r--r--mysql-test/t/bdb-alter-table-2.test3
-rw-r--r--sql/sql_table.cc13
6 files changed, 34 insertions, 5 deletions
diff --git a/Docs/manual.texi b/Docs/manual.texi
index 77122dce2d8..9bbb9fa0c5a 100644
--- a/Docs/manual.texi
+++ b/Docs/manual.texi
@@ -46929,6 +46929,9 @@ not yet 100% confident in this code.
@appendixsubsec Changes in release 3.23.53
@itemize @bullet
@item
+Fixed a bug with BDB @code[ALTER TABLE] with dropping column, and shutdown
+immediately thereafter.
+@item
Fixed problem with @code{UNSIGNED BIGINT} on AIX (again).
@item
Fixed bug in pthread_mutex_trylock() on HPUX 11.0
diff --git a/mysql-test/r/bdb-alter-table-1.result b/mysql-test/r/bdb-alter-table-1.result
new file mode 100644
index 00000000000..3742f45eb7a
--- /dev/null
+++ b/mysql-test/r/bdb-alter-table-1.result
@@ -0,0 +1,4 @@
+objid tablename oid test
+1 t1 4 9
+2 metatable 1 9
+3 metaindex 1 9
diff --git a/mysql-test/r/bdb-alter-table-2.result b/mysql-test/r/bdb-alter-table-2.result
new file mode 100644
index 00000000000..19c6d5e1ff9
--- /dev/null
+++ b/mysql-test/r/bdb-alter-table-2.result
@@ -0,0 +1,4 @@
+objid tablename oid
+1 t1 4
+2 metatable 1
+3 metaindex 1
diff --git a/mysql-test/t/bdb-alter-table-1.test b/mysql-test/t/bdb-alter-table-1.test
new file mode 100644
index 00000000000..25a86cd92f6
--- /dev/null
+++ b/mysql-test/t/bdb-alter-table-1.test
@@ -0,0 +1,12 @@
+-- source include/have_bdb.inc
+
+#
+# Small basic test for ALTER TABLE bug ..
+#
+drop table if exists t1;
+create table t1(objid BIGINT not null, tablename varchar(64), oid BIGINT not null, test BIGINT, PRIMARY KEY (objid), UNIQUE(tablename)) type=BDB;
+insert into t1 values(1, 't1',4,9);
+insert into t1 values(2, 'metatable',1,9);
+insert into t1 values(3, 'metaindex',1,9 );
+select * from t1;
+alter table t1 drop column test;
diff --git a/mysql-test/t/bdb-alter-table-2.test b/mysql-test/t/bdb-alter-table-2.test
new file mode 100644
index 00000000000..69ff04ee24a
--- /dev/null
+++ b/mysql-test/t/bdb-alter-table-2.test
@@ -0,0 +1,3 @@
+-- source include/have_bdb.inc
+select * from t1;
+drop table t1; \ No newline at end of file
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 9a5056a1f35..534b267403c 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -1665,11 +1665,6 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
VOID(pthread_cond_broadcast(&COND_refresh));
goto err;
}
-#ifdef HAVE_BERKELEY_DB
- extern bool berkeley_flush_logs(void);
- if (old_db_type == DB_TYPE_BERKELEY_DB && berkeley_flush_logs())
- goto err;
-#endif
thd->proc_info="end";
mysql_update_log.write(thd, thd->query,thd->query_length);
if (mysql_bin_log.is_open())
@@ -1679,6 +1674,14 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
}
VOID(pthread_cond_broadcast(&COND_refresh));
VOID(pthread_mutex_unlock(&LOCK_open));
+#ifdef HAVE_BERKELEY_DB
+ extern bool berkeley_flush_logs(void);
+ if (old_db_type == DB_TYPE_BERKELEY_DB)
+ {
+ (void)berkeley_flush_logs();
+ table=open_ltable(thd,table_list,TL_READ);
+ }
+#endif
end_temporary:
sprintf(tmp_name,ER(ER_INSERT_INFO),(ulong) (copied+deleted),