summaryrefslogtreecommitdiff
path: root/bdb
diff options
context:
space:
mode:
authorunknown <ram@mysql.r18.ru>2002-12-19 12:38:32 +0400
committerunknown <ram@mysql.r18.ru>2002-12-19 12:38:32 +0400
commitde539bf30adc10a93759729531622dd10ac42155 (patch)
tree98eee4f316172c3c9c047e0cdfcf87f3457f927d /bdb
parent2cae041aa8724c443208693053c488caa5499421 (diff)
downloadmariadb-git-de539bf30adc10a93759729531622dd10ac42155.tar.gz
patches from sleepycat.com have been applied (SCRUM)
ha_berkeley::rename_table() has been added (SCRUM) bdb/db/db_open.c: patches from sleepycat.com have been applied bdb/log/log_put.c: patches from sleepycat.com have been applied bdb/mp/mp_fopen.c: patches from sleepycat.com have been applied bdb/rep/rep_record.c: patches from sleepycat.com have been applied bdb/txn/txn.c: patches from sleepycat.com have been applied sql/ha_berkeley.cc: ha_berkeley::rename_table() has been added sql/ha_berkeley.h: ha_berkeley::rename_table() has been added
Diffstat (limited to 'bdb')
-rw-r--r--bdb/db/db_open.c6
-rw-r--r--bdb/log/log_put.c2
-rw-r--r--bdb/mp/mp_fopen.c35
-rw-r--r--bdb/rep/rep_record.c3
-rw-r--r--bdb/txn/txn.c46
5 files changed, 60 insertions, 32 deletions
diff --git a/bdb/db/db_open.c b/bdb/db/db_open.c
index f6f96cda547..8352525361f 100644
--- a/bdb/db/db_open.c
+++ b/bdb/db/db_open.c
@@ -536,11 +536,9 @@ swap_retry:
* and even a checksum error isn't a reason to panic the environment.
*/
if ((ret = __db_chk_meta(dbenv, dbp, meta, do_metachk)) != 0) {
- if (ret == -1) {
+ if (ret == -1)
__db_err(dbenv,
"%s: metadata page checksum error", name);
- ret = EINVAL;
- }
goto bad_format;
}
@@ -577,7 +575,7 @@ swap_retry:
bad_format:
__db_err(dbenv, "%s: unexpected file type or format", name);
- return (ret);
+ return (ret == 0 ? EINVAL : ret);
}
/*
diff --git a/bdb/log/log_put.c b/bdb/log/log_put.c
index bf6de2b0f7b..64276fa8315 100644
--- a/bdb/log/log_put.c
+++ b/bdb/log/log_put.c
@@ -268,6 +268,8 @@ __log_txn_lsn(dbenv, lsnp, mbytesp, bytesp)
if (mbytesp != NULL) {
*mbytesp = lp->stat.st_wc_mbytes;
*bytesp = (u_int32_t)(lp->stat.st_wc_bytes + lp->b_off);
+
+ lp->stat.st_wc_mbytes = lp->stat.st_wc_bytes = 0;
}
R_UNLOCK(dbenv, &dblp->reginfo);
diff --git a/bdb/mp/mp_fopen.c b/bdb/mp/mp_fopen.c
index a91bf264652..8fdefb0f5e9 100644
--- a/bdb/mp/mp_fopen.c
+++ b/bdb/mp/mp_fopen.c
@@ -345,6 +345,23 @@ __memp_fopen_int(dbmfp, mfp, path, flags, mode, pagesize)
}
/*
+ * Figure out the file's size.
+ *
+ * !!!
+ * We can't use off_t's here, or in any code in the mainline library
+ * for that matter. (We have to use them in the os stubs, of course,
+ * as there are system calls that take them as arguments.) The reason
+ * is some customers build in environments where an off_t is 32-bits,
+ * but still run where offsets are 64-bits, and they pay us a lot of
+ * money.
+ */
+ if ((ret = __os_ioinfo(
+ dbenv, rpath, dbmfp->fhp, &mbytes, &bytes, NULL)) != 0) {
+ __db_err(dbenv, "%s: %s", rpath, db_strerror(ret));
+ goto err;
+ }
+
+ /*
* Get the file id if we weren't given one. Generated file id's
* don't use timestamps, otherwise there'd be no chance of any
* other process joining the party.
@@ -470,6 +487,7 @@ alloc: /* Allocate and initialize a new MPOOLFILE. */
F_SET(mfp, MP_DIRECT);
if (LF_ISSET(DB_EXTENT))
F_SET(mfp, MP_EXTENT);
+ F_SET(mfp, MP_CAN_MMAP);
if (path == NULL)
F_SET(mfp, MP_TEMP);
@@ -479,21 +497,6 @@ alloc: /* Allocate and initialize a new MPOOLFILE. */
* and find the number of the last page in the file, all the
* time being careful not to overflow 32 bits.
*
- * !!!
- * We can't use off_t's here, or in any code in the mainline
- * library for that matter. (We have to use them in the os
- * stubs, of course, as there are system calls that take them
- * as arguments.) The reason is that some customers build in
- * environments where an off_t is 32-bits, but still run where
- * offsets are 64-bits, and they pay us a lot of money.
- */
- if ((ret = __os_ioinfo(
- dbenv, rpath, dbmfp->fhp, &mbytes, &bytes, NULL)) != 0) {
- __db_err(dbenv, "%s: %s", rpath, db_strerror(ret));
- goto err;
- }
-
- /*
* During verify or recovery, we might have to cope with a
* truncated file; if the file size is not a multiple of the
* page size, round down to a page, we'll take care of the
@@ -582,7 +585,7 @@ check_map:
* compiler will perpetrate, doing the comparison in a portable way is
* flatly impossible. Hope that mmap fails if the file is too large.
*/
-#define DB_MAXMMAPSIZE (10 * 1024 * 1024) /* 10 Mb. */
+#define DB_MAXMMAPSIZE (10 * 1024 * 1024) /* 10 MB. */
if (F_ISSET(mfp, MP_CAN_MMAP)) {
if (path == NULL)
F_CLR(mfp, MP_CAN_MMAP);
diff --git a/bdb/rep/rep_record.c b/bdb/rep/rep_record.c
index e725008786c..d3619f509b4 100644
--- a/bdb/rep/rep_record.c
+++ b/bdb/rep/rep_record.c
@@ -1198,6 +1198,9 @@ gap_check: lp->wait_recs = 0;
* replica get flushed now and again.
*/
ret = dbenv->log_flush(dbenv, &ckp_lsn);
+ /* Update the last_ckp in the txn region. */
+ if (ret == 0)
+ __txn_updateckp(dbenv, &rp->lsn);
break;
case DB___txn_regop:
if (!F_ISSET(dbenv, DB_ENV_REP_LOGSONLY))
diff --git a/bdb/txn/txn.c b/bdb/txn/txn.c
index 06fc8264afd..78c54791d06 100644
--- a/bdb/txn/txn.c
+++ b/bdb/txn/txn.c
@@ -1209,18 +1209,7 @@ do_ckp: /* Look through the active transactions for the lowest begin LSN. */
return (ret);
}
- /*
- * We want to make sure last_ckp only moves forward; since
- * we drop locks above and in log_put, it's possible
- * for two calls to __txn_ckp_log to finish in a different
- * order from how they were called.
- */
- R_LOCK(dbenv, &mgr->reginfo);
- if (log_compare(&region->last_ckp, &ckp_lsn) < 0) {
- region->last_ckp = ckp_lsn;
- (void)time(&region->time_ckp);
- }
- R_UNLOCK(dbenv, &mgr->reginfo);
+ __txn_updateckp(dbenv, &ckp_lsn);
}
return (0);
}
@@ -1404,3 +1393,36 @@ __txn_reset(dbenv)
return (__txn_recycle_log(dbenv,
NULL, &scrap, 0, TXN_MINIMUM, TXN_MAXIMUM));
}
+
+/*
+ * __txn_updateckp --
+ * Update the last_ckp field in the transaction region. This happens
+ * at the end of a normal checkpoint and also when a replication client
+ * receives a checkpoint record.
+ *
+ * PUBLIC: void __txn_updateckp __P((DB_ENV *, DB_LSN *));
+ */
+void
+__txn_updateckp(dbenv, lsnp)
+ DB_ENV *dbenv;
+ DB_LSN *lsnp;
+{
+ DB_TXNMGR *mgr;
+ DB_TXNREGION *region;
+
+ mgr = dbenv->tx_handle;
+ region = mgr->reginfo.primary;
+
+ /*
+ * We want to make sure last_ckp only moves forward; since
+ * we drop locks above and in log_put, it's possible
+ * for two calls to __txn_ckp_log to finish in a different
+ * order from how they were called.
+ */
+ R_LOCK(dbenv, &mgr->reginfo);
+ if (log_compare(&region->last_ckp, lsnp) < 0) {
+ region->last_ckp = *lsnp;
+ (void)time(&region->time_ckp);
+ }
+ R_UNLOCK(dbenv, &mgr->reginfo);
+}