diff options
author | unknown <jimw@mysql.com> | 2005-07-20 18:08:13 -0700 |
---|---|---|
committer | unknown <jimw@mysql.com> | 2005-07-20 18:08:13 -0700 |
commit | 3c7def8e5056053e46d367f4f8b10979f8c39078 (patch) | |
tree | 324ddb9f3128cf72e57743bc3bbe099a7636e4cc /sql/ha_berkeley.cc | |
parent | 47d10d0ecaf0123676676d4cf480e8f2e35b1b1d (diff) | |
download | mariadb-git-3c7def8e5056053e46d367f4f8b10979f8c39078.tar.gz |
Update ha_berkeley.cc to handle BDB 4.3.28, and re-add two features to
BDB that we require.
sql/ha_berkeley.cc:
Update to BDB 4.3.28 API
storage/bdb/dbinc/db.in:
Add app_private to DBT struct
Add noticecall callback
storage/bdb/env/env_method.c:
Handle setting noticecall callback
storage/bdb/log/log_put.c:
Call noticecall callback when logfile changed
Diffstat (limited to 'sql/ha_berkeley.cc')
-rw-r--r-- | sql/ha_berkeley.cc | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc index 3b9cdbe29f7..5d3e1ad90cb 100644 --- a/sql/ha_berkeley.cc +++ b/sql/ha_berkeley.cc @@ -93,7 +93,8 @@ u_int32_t berkeley_lock_types[]= TYPELIB berkeley_lock_typelib= {array_elements(berkeley_lock_names)-1,"", berkeley_lock_names, NULL}; -static void berkeley_print_error(const char *db_errpfx, char *buffer); +static void berkeley_print_error(const DB_ENV *db_env, const char *db_errpfx, + const char *buffer); static byte* bdb_get_key(BDB_SHARE *share,uint *length, my_bool not_used __attribute__((unused))); static BDB_SHARE *get_share(const char *table_name, TABLE *table); @@ -173,7 +174,7 @@ handlerton *berkeley_init(void) if (opt_endinfo) db_env->set_verbose(db_env, - DB_VERB_CHKPOINT | DB_VERB_DEADLOCK | DB_VERB_RECOVERY, + DB_VERB_DEADLOCK | DB_VERB_RECOVERY, 1); db_env->set_cachesize(db_env, 0, berkeley_cache_size, 0); @@ -245,7 +246,7 @@ static int berkeley_commit(THD *thd, bool all) DBUG_PRINT("trans",("ending transaction %s", all ? "all" : "stmt")); berkeley_trx_data *trx=(berkeley_trx_data *)thd->ha_data[berkeley_hton.slot]; DB_TXN **txn= all ? &trx->all : &trx->stmt; - int error=txn_commit(*txn,0); + int error= (*txn)->commit(*txn,0); *txn=0; #ifndef DBUG_OFF if (error) @@ -260,7 +261,7 @@ static int berkeley_rollback(THD *thd, bool all) DBUG_PRINT("trans",("aborting transaction %s", all ? "all" : "stmt")); berkeley_trx_data *trx=(berkeley_trx_data *)thd->ha_data[berkeley_hton.slot]; DB_TXN **txn= all ? &trx->all : &trx->stmt; - int error=txn_abort(*txn); + int error= (*txn)->abort(*txn); *txn=0; DBUG_RETURN(error); } @@ -318,7 +319,8 @@ err: } -static void berkeley_print_error(const char *db_errpfx, char *buffer) +static void berkeley_print_error(const DB_ENV *db_env, const char *db_errpfx, + const char *buffer) { sql_print_error("%s: %s",db_errpfx,buffer); /* purecov: tested */ } @@ -609,7 +611,7 @@ int ha_berkeley::open(const char *name, int mode, uint test_if_locked) berkeley_cmp_packed_key)); if (!hidden_primary_key) file->app_private= (void*) (table->key_info + table_share->primary_key); - if ((error= txn_begin(db_env, 0, (DB_TXN**) &transaction, 0)) || + if ((error= db_env->txn_begin(db_env, NULL, (DB_TXN**) &transaction, 0)) || (error= (file->open(file, transaction, fn_format(name_buff, name, "", ha_berkeley_ext, 2 | 4), @@ -648,7 +650,8 @@ int ha_berkeley::open(const char *name, int mode, uint test_if_locked) DBUG_PRINT("bdb",("Setting DB_DUP for key %u", i)); (*ptr)->set_flags(*ptr, DB_DUP); } - if ((error= txn_begin(db_env, 0, (DB_TXN**) &transaction, 0)) || + if ((error= db_env->txn_begin(db_env, NULL, (DB_TXN**) &transaction, + 0)) || (error=((*ptr)->open(*ptr, transaction, name_buff, part, DB_BTREE, open_mode, 0))) || (error= transaction->commit(transaction, 0))) @@ -1849,7 +1852,7 @@ int ha_berkeley::external_lock(THD *thd, int lock_type) /* We have to start a master transaction */ DBUG_PRINT("trans",("starting transaction all: options: 0x%lx", (ulong) thd->options)); - if ((error=txn_begin(db_env, 0, &trx->all, 0))) + if ((error= db_env->txn_begin(db_env, NULL, &trx->all, 0))) { trx->bdb_lock_count--; // We didn't get the lock DBUG_RETURN(error); @@ -1859,7 +1862,7 @@ int ha_berkeley::external_lock(THD *thd, int lock_type) DBUG_RETURN(0); // Don't create stmt trans } DBUG_PRINT("trans",("starting transaction stmt")); - if ((error=txn_begin(db_env, trx->all, &trx->stmt, 0))) + if ((error= db_env->txn_begin(db_env, trx->all, &trx->stmt, 0))) { /* We leave the possible master transaction open */ trx->bdb_lock_count--; // We didn't get the lock @@ -1884,7 +1887,7 @@ int ha_berkeley::external_lock(THD *thd, int lock_type) We must in this case commit the work to keep the row locks */ DBUG_PRINT("trans",("commiting non-updating transaction")); - error= txn_commit(trx->stmt,0); + error= trx->stmt->commit(trx->stmt,0); trx->stmt= transaction= 0; } } @@ -1913,7 +1916,7 @@ int ha_berkeley::start_stmt(THD *thd) if (!trx->stmt) { DBUG_PRINT("trans",("starting transaction stmt")); - error=txn_begin(db_env, trx->all, &trx->stmt, 0); + error= db_env->txn_begin(db_env, trx->all, &trx->stmt, 0); trans_register_ha(thd, FALSE, &berkeley_hton); } transaction= trx->stmt; @@ -2294,7 +2297,7 @@ int ha_berkeley::analyze(THD* thd, HA_CHECK_OPT* check_opt) free(stat); stat=0; } - if ((key_file[i]->stat)(key_file[i], (void*) &stat, 0)) + if ((key_file[i]->stat)(key_file[i], NULL, (void*) &stat, 0)) goto err; /* purecov: inspected */ share->rec_per_key[i]= (stat->bt_ndata / (stat->bt_nkeys ? stat->bt_nkeys : 1)); @@ -2307,7 +2310,7 @@ int ha_berkeley::analyze(THD* thd, HA_CHECK_OPT* check_opt) free(stat); stat=0; } - if ((file->stat)(file, (void*) &stat, 0)) + if ((file->stat)(file, NULL, (void*) &stat, 0)) goto err; /* purecov: inspected */ } pthread_mutex_lock(&share->mutex); |