[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.6 BDB or BerkeleyDB Tables


7.6.1 Overview of BDB Tables

BerkeleyDB, available at http://www.sleepycat.com/ has provided MySQL with a transactional storage engine. Support for this storage engine is included in the MySQL source distribution starting from version 3.23.34 and is activated in the MySQL-Max binary. This storage engine is typically called BDB for short.

BDB tables may have a greater chance of surviving crashes and are also capable of COMMIT and ROLLBACK operations on transactions. The MySQL source distribution comes with a BDB distribution that has a couple of small patches to make it work more smoothly with MySQL. You can't use a non-patched BDB version with MySQL.

We at MySQL AB are working in close cooperation with Sleepycat to keep the quality of the MySQL/BDB interface high.

When it comes to supporting BDB tables, we are committed to help our users to locate the problem and help creating a reproducible test case for any problems involving BDB tables. Any such test case will be forwarded to Sleepycat who in turn will help us find and fix the problem. As this is a two-stage operation, any problems with BDB tables may take a little longer for us to fix than for other storage engines. However, as the BerkeleyDB code itself has been used by many other applications than MySQL, we don't envision any big problems with this. See section Support Offered by MySQL AB.


7.6.2 Installing BDB

If you have downloaded a binary version of MySQL that includes support for BerkeleyDB, simply follow the instructions for installing a binary version of MySQL. See section Installing a MySQL Binary Distribution. See section mysqld-max.

To compile MySQL with Berkeley DB support, download MySQL Version 3.23.34 or newer and configure MySQL with the --with-berkeley-db option. See section Installing a MySQL Source Distribution.

 
cd /path/to/source/of/mysql-3.23.34
./configure --with-berkeley-db

Please refer to the manual provided with the BDB distribution for more updated information.

Even though Berkeley DB is in itself very tested and reliable, the MySQL interface is still considered gamma quality. We are actively improving and optimising it to get it stable very soon.


7.6.3 BDB startup options

If you are running with AUTOCOMMIT=0 then your changes in BDB tables will not be updated until you execute COMMIT. Instead of commit you can execute ROLLBACK to forget your changes. See section START TRANSACTION, COMMIT, and ROLLBACK Syntax.

If you are running with AUTOCOMMIT=1 (the default), your changes will be committed immediately. You can start an extended transaction with the BEGIN WORK SQL command, after which your changes will not be committed until you execute COMMIT (or decide to ROLLBACK the changes).

The following options to mysqld can be used to change the behaviour of BDB tables:

Option

Description

--bdb-home=directory

Base directory for BDB tables. This should be the same directory you use for --datadir.

--bdb-lock-detect=#

Berkeley lock detect. One of (DEFAULT, OLDEST, RANDOM, or YOUNGEST).

--bdb-logdir=directory

Berkeley DB log file directory.

--bdb-no-sync

Don't synchronously flush logs.

--bdb-no-recover

Don't start Berkeley DB in recover mode.

--bdb-shared-data

Start Berkeley DB in multi-process mode (Don't use DB_PRIVATE when initialising Berkeley DB)

--bdb-tmpdir=directory

Berkeley DB temporary file directory.

--skip-bdb

Disable usage of BDB tables.

-O bdb_max_lock=1000

Set the maximum number of locks possible. See section bdb_max_lock.

If you use --skip-bdb, MySQL will not initialise the Berkeley DB library and this will save a lot of memory. Of course, you cannot use BDB tables if you are using this option. If you try to create a BDB table, MySQL will instead create a MyISAM table.

Normally you should start mysqld without --bdb-no-recover if you intend to use BDB tables. This may, however, give you problems when you try to start mysqld if the BDB log files are corrupted. See section Problems Starting the MySQL Server.

With bdb_max_lock you can specify the maximum number of locks (10000 by default) you can have active on a BDB table. You should increase this if you get errors of type bdb: Lock table is out of available locks or Got error 12 from ... when you have do long transactions or when mysqld has to examine a lot of rows to calculate the query.

You may also want to change binlog_cache_size and max_binlog_cache_size if you are using big multi-line transactions. See section COMMIT.


7.6.4 Characteristics of BDB tables:


7.6.5 Things we need to fix for BDB in the near future:


7.6.6 Operating systems supported by BDB

Currently we know that the BDB storage engine works with the following operating systems:

It doesn't work with the following operating systems:

Note: The above list is not complete; we will update it as we receive more information.

If you build MySQL with support for BDB tables and get the following error in the log file when you start mysqld:

 
bdb: architecture lacks fast mutexes: applications cannot be threaded
Can't init databases

This means that BDB tables are not supported for your architecture. In this case you must rebuild MySQL without BDB table support.


7.6.7 Restrictions on BDB Tables

Here follows the restrictions you have when using BDB tables:


7.6.8 Errors That May Occur When Using BDB Tables


[ < ] [ > ]   [ << ] [ Up ] [ >> ]


Hosting by: Hurra Communications Ltd.
Generated: 2007-01-26 17:58:46