summaryrefslogtreecommitdiff
path: root/bdb
diff options
context:
space:
mode:
authorunknown <monty@donna.mysql.fi>2001-03-06 20:38:53 +0200
committerunknown <monty@donna.mysql.fi>2001-03-06 20:38:53 +0200
commit08d7d5cf331a9f0e860792c356201ef386ceea5d (patch)
tree9613587a263dc7a069c1038873e71db018c29273 /bdb
parenta9c60a41feb2189e270c41def107d40c1f00b8b5 (diff)
downloadmariadb-git-08d7d5cf331a9f0e860792c356201ef386ceea5d.tar.gz
Patch from sleepycat to fix problem with BDB and log files
Print full command name to log files Convert table type to supported onces on ALTER TABLE Docs/manual.texi: Updates from user comments bdb/log/log_rec.c: Patch from sleepycat to fix problem with log files innobase/ibuf/Makefile.am: Don't let make do bk get innobase/include/Makefile.am: Don't let make do bk get man/Makefile.am: Don't let make do bk get myisam/mi_dbug.c: Print warning to debug log mysql-test/mysql-test-run.sh: Don't use innobase in replica mysql-test/r/null_key.result: Fix for new key lengths sql/ha_innobase.cc: Free hash cache at end sql/log.cc: Print full command name to log files sql/sql_table.cc: Convert table type to supported onces on ALTER TABLE
Diffstat (limited to 'bdb')
-rw-r--r--bdb/log/log_rec.c26
-rw-r--r--bdb/patches/log-corruption.patch62
2 files changed, 88 insertions, 0 deletions
diff --git a/bdb/log/log_rec.c b/bdb/log/log_rec.c
index a871848295e..ad6d9f7ead2 100644
--- a/bdb/log/log_rec.c
+++ b/bdb/log/log_rec.c
@@ -50,6 +50,7 @@ static const char revid[] = "$Id: log_rec.c,v 11.48 2001/01/11 18:19:53 bostic E
#include "db_am.h"
#include "log.h"
+static int __log_check_master __P((DB_ENV *, u_int8_t *, char *));
static int __log_do_open __P((DB_ENV *, DB_LOG *,
u_int8_t *, char *, DBTYPE, int32_t, db_pgno_t));
static int __log_open_file __P((DB_ENV *, DB_LOG *, __log_register_args *));
@@ -341,6 +342,9 @@ __log_do_open(dbenv, lp, uid, name, ftype, ndx, meta_pgno)
* Verify that we are opening the same file that we were
* referring to when we wrote this log record.
*/
+ if (meta_pgno != PGNO_BASE_MD &&
+ __log_check_master(dbenv, uid, name) != 0)
+ goto not_right;
if (memcmp(uid, dbp->fileid, DB_FILE_ID_LEN) != 0) {
memset(zeroid, 0, DB_FILE_ID_LEN);
if (memcmp(dbp->fileid, zeroid, DB_FILE_ID_LEN) != 0)
@@ -361,6 +365,28 @@ not_right:
return (ENOENT);
}
+static int
+__log_check_master(dbenv, uid, name)
+ DB_ENV *dbenv;
+ u_int8_t *uid;
+ char *name;
+{
+ DB *dbp;
+ int ret;
+
+ ret = 0;
+ if ((ret = db_create(&dbp, dbenv, 0)) != 0)
+ return (ret);
+ dbp->type = DB_BTREE;
+ ret = __db_dbopen(dbp, name, 0, __db_omode("rw----"), PGNO_BASE_MD);
+
+ if (ret == 0 && memcmp(uid, dbp->fileid, DB_FILE_ID_LEN) != 0)
+ ret = EINVAL;
+
+ (void) dbp->close(dbp, 0);
+ return (ret);
+}
+
/*
* __log_add_logid --
* Adds a DB entry to the log's DB entry table.
diff --git a/bdb/patches/log-corruption.patch b/bdb/patches/log-corruption.patch
new file mode 100644
index 00000000000..16c37ff7c06
--- /dev/null
+++ b/bdb/patches/log-corruption.patch
@@ -0,0 +1,62 @@
+# This patch fixes a bug caused mysqld to get a core dump while
+# bdb tries to resolve the log file after mysqld was killed with kill -9.
+#
+# Author: Michael Ubell, Sleepycat Software
+# Mon, 26 Feb 2001 12:56:23 -0500 (EST)
+#
+
+*** log/log_rec.c 2001/02/08 03:05:01 11.50
+--- log/log_rec.c 2001/02/24 00:42:46 11.51
+***************
+*** 50,55 ****
+--- 50,56 ----
+ #include "db_am.h"
+ #include "log.h"
+
++ static int __log_check_master __P((DB_ENV *, u_int8_t *, char *));
+ static int __log_do_open __P((DB_ENV *, DB_LOG *,
+ u_int8_t *, char *, DBTYPE, int32_t, db_pgno_t));
+ static int __log_open_file __P((DB_ENV *, DB_LOG *, __log_register_args *));
+***************
+*** 341,346 ****
+--- 342,350 ----
+ * Verify that we are opening the same file that we were
+ * referring to when we wrote this log record.
+ */
++ if (meta_pgno != PGNO_BASE_MD &&
++ __log_check_master(dbenv, uid, name) != 0)
++ goto not_right;
+ if (memcmp(uid, dbp->fileid, DB_FILE_ID_LEN) != 0) {
+ memset(zeroid, 0, DB_FILE_ID_LEN);
+ if (memcmp(dbp->fileid, zeroid, DB_FILE_ID_LEN) != 0)
+***************
+*** 359,364 ****
+--- 363,390 ----
+ (void)__log_add_logid(dbenv, lp, NULL, ndx);
+
+ return (ENOENT);
++ }
++
++ static int
++ __log_check_master(dbenv, uid, name)
++ DB_ENV *dbenv;
++ u_int8_t *uid;
++ char *name;
++ {
++ DB *dbp;
++ int ret;
++
++ ret = 0;
++ if ((ret = db_create(&dbp, dbenv, 0)) != 0)
++ return (ret);
++ dbp->type = DB_BTREE;
++ ret = __db_dbopen(dbp, name, 0, __db_omode("rw----"), PGNO_BASE_MD);
++
++ if (ret == 0 && memcmp(uid, dbp->fileid, DB_FILE_ID_LEN) != 0)
++ ret = EINVAL;
++
++ (void) dbp->close(dbp, 0);
++ return (ret);
+ }
+
+ /*