From ac5164b8f15f49f43291be7879fd1509e9862aaf Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 22 Nov 2005 16:44:57 -0800 Subject: [PATCH] Add --bdb-data-direct and --bdb-log-direct server options. (Bug #14880) sql/ha_berkeley.cc: Export DB_DIRECT_* constants sql/ha_berkeley.h: Declare new constants sql/mysqld.cc: Add bdb-data-direct and bdb-log-direct options --- sql/ha_berkeley.cc | 2 ++ sql/ha_berkeley.h | 2 ++ sql/mysqld.cc | 18 ++++++++++++++++-- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc index 30d63f1d6f6..4d2bec347bb 100644 --- a/sql/ha_berkeley.cc +++ b/sql/ha_berkeley.cc @@ -74,6 +74,8 @@ const u_int32_t bdb_DB_TXN_NOSYNC= DB_TXN_NOSYNC; const u_int32_t bdb_DB_RECOVER= DB_RECOVER; const u_int32_t bdb_DB_PRIVATE= DB_PRIVATE; +const u_int32_t bdb_DB_DIRECT_DB= DB_DIRECT_DB; +const u_int32_t bdb_DB_DIRECT_LOG= DB_DIRECT_LOG; const char *ha_berkeley_ext=".db"; bool berkeley_shared_data=0; u_int32_t berkeley_init_flags= DB_PRIVATE | DB_RECOVER, berkeley_env_flags=0, diff --git a/sql/ha_berkeley.h b/sql/ha_berkeley.h index 25e6c31cb9e..f7cffa37b3d 100644 --- a/sql/ha_berkeley.h +++ b/sql/ha_berkeley.h @@ -160,6 +160,8 @@ class ha_berkeley: public handler extern const u_int32_t bdb_DB_TXN_NOSYNC; extern const u_int32_t bdb_DB_RECOVER; extern const u_int32_t bdb_DB_PRIVATE; +extern const u_int32_t bdb_DB_DIRECT_DB; +extern const u_int32_t bdb_DB_DIRECT_LOG; extern bool berkeley_shared_data; extern u_int32_t berkeley_init_flags,berkeley_env_flags, berkeley_lock_type, berkeley_lock_types[]; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 477c20f390a..0535c0debac 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -390,7 +390,8 @@ extern ulong srv_commit_concurrency; } #endif #ifdef WITH_BERKELEY_STORAGE_ENGINE -extern const u_int32_t bdb_DB_TXN_NOSYNC, bdb_DB_RECOVER, bdb_DB_PRIVATE; +extern const u_int32_t bdb_DB_TXN_NOSYNC, bdb_DB_RECOVER, bdb_DB_PRIVATE, + bdb_DB_DIRECT_DB, bdb_DB_DIRECT_LOG; extern bool berkeley_shared_data; extern u_int32_t berkeley_init_flags,berkeley_env_flags, berkeley_lock_type, berkeley_lock_types[]; @@ -4469,7 +4470,8 @@ enum options_mysqld OPT_BDB_HOME, OPT_BDB_LOG, OPT_BDB_TMP, OPT_BDB_SYNC, OPT_BDB_LOCK, OPT_BDB, - OPT_BDB_NO_RECOVER, OPT_BDB_SHARED, + OPT_BDB_NO_RECOVER, OPT_BDB_SHARED, + OPT_BDB_DATA_DIRECT, OPT_BDB_LOG_DIRECT, OPT_MASTER_HOST, OPT_MASTER_USER, OPT_MASTER_PASSWORD, OPT_MASTER_PORT, OPT_MASTER_INFO_FILE, OPT_MASTER_CONNECT_RETRY, @@ -4673,6 +4675,9 @@ Disable with --skip-bdb (will save memory).", (gptr*) &opt_bdb, (gptr*) &opt_bdb, 0, GET_BOOL, NO_ARG, OPT_BDB_DEFAULT, 0, 0, 0, 0, 0}, #ifdef WITH_BERKELEY_STORAGE_ENGINE + {"bdb-data-direct", OPT_BDB_DATA_DIRECT, + "Turn off system buffering of BDB database files to avoid double caching.", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"bdb-home", OPT_BDB_HOME, "Berkeley home directory.", (gptr*) &berkeley_home, (gptr*) &berkeley_home, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"bdb-lock-detect", OPT_BDB_LOCK, @@ -4681,6 +4686,9 @@ Disable with --skip-bdb (will save memory).", {"bdb-logdir", OPT_BDB_LOG, "Berkeley DB log file directory.", (gptr*) &berkeley_logdir, (gptr*) &berkeley_logdir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"bdb-log-direct", OPT_BDB_LOG_DIRECT, + "Turn off system buffering of BDB log files to avoid double caching.", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"bdb-no-recover", OPT_BDB_NO_RECOVER, "Don't try to recover Berkeley DB tables on start.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, @@ -6837,6 +6845,12 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), else berkeley_env_flags&= ~bdb_DB_TXN_NOSYNC; break; + case OPT_BDB_LOG_DIRECT: + berkeley_env_flags|= bdb_DB_DIRECT_DB; + break; + case OPT_BDB_DATA_DIRECT: + berkeley_env_flags|= bdb_DB_DIRECT_LOG; + break; case OPT_BDB_NO_RECOVER: berkeley_init_flags&= ~(bdb_DB_RECOVER); break;