mirror of
https://github.com/MariaDB/server.git
synced 2025-11-30 05:23:50 +03:00
add exceptions to dbc.cpp. Addresses #215.
git-svn-id: file:///svn/tokudb@1316 c7de825b-a66e-492c-adef-691d508d4ae1
This commit is contained in:
@@ -232,8 +232,9 @@ struct __toku_db_txn_stat {
|
||||
char __toku_dummy4[8]; /* Padding at the end */
|
||||
};
|
||||
struct __toku_dbc {
|
||||
DB *dbp; /* 32-bit offset=0 size=4, 64=bit offset=0 size=8 */
|
||||
struct __toku_dbc_internal *i;
|
||||
void* __toku_dummy0[20];
|
||||
void* __toku_dummy0[19];
|
||||
char __toku_dummy1[104];
|
||||
int (*c_close) (DBC *); /* 32-bit offset=188 size=4, 64=bit offset=272 size=8 */
|
||||
void* __toku_dummy2[1];
|
||||
|
||||
@@ -3,11 +3,13 @@
|
||||
int Dbc::close (void) {
|
||||
DBC *dbc = this;
|
||||
int ret = dbc->c_close(dbc);
|
||||
return ret;
|
||||
DbEnv *env = (DbEnv*)dbc->dbp->api_internal;
|
||||
return env->maybe_throw_error(ret);
|
||||
}
|
||||
|
||||
int Dbc::get(Dbt* key, Dbt *data, u_int32_t flags) {
|
||||
DBC *dbc = this;
|
||||
int ret = dbc->c_get(dbc, key, data, flags);
|
||||
return ret;
|
||||
DbEnv *env = (DbEnv*)dbc->dbp->api_internal;
|
||||
return env->maybe_throw_error(ret);
|
||||
}
|
||||
|
||||
@@ -13,3 +13,7 @@ $(DBCXX):
|
||||
|
||||
clean:
|
||||
rm -rf $(TARGETS)
|
||||
|
||||
check: $(TARGETS)
|
||||
./test1
|
||||
./test1e
|
||||
|
||||
@@ -232,8 +232,9 @@ struct __toku_db_txn_stat {
|
||||
char __toku_dummy4[8]; /* Padding at the end */
|
||||
};
|
||||
struct __toku_dbc {
|
||||
DB *dbp; /* 32-bit offset=0 size=4, 64=bit offset=0 size=8 */
|
||||
struct __toku_dbc_internal *i;
|
||||
void* __toku_dummy0[20];
|
||||
void* __toku_dummy0[19];
|
||||
char __toku_dummy1[104];
|
||||
int (*c_close) (DBC *); /* 32-bit offset=188 size=4, 64=bit offset=272 size=8 */
|
||||
void* __toku_dummy2[1];
|
||||
|
||||
@@ -116,6 +116,7 @@ class Db {
|
||||
|
||||
class DbEnv {
|
||||
friend class Db;
|
||||
friend class Dbc;
|
||||
public:
|
||||
DbEnv(u_int32_t flags);
|
||||
|
||||
@@ -167,5 +168,4 @@ class Dbc : protected DBC
|
||||
public:
|
||||
int close(void);
|
||||
int get(Dbt*, Dbt *, u_int32_t);
|
||||
|
||||
};
|
||||
|
||||
13
src/ydb.c
13
src/ydb.c
@@ -690,7 +690,6 @@ static int toku_db_close(DB * db, u_int32_t flags) {
|
||||
|
||||
struct __toku_dbc_internal {
|
||||
BRT_CURSOR c;
|
||||
DB *db;
|
||||
DB_TXN *txn;
|
||||
};
|
||||
|
||||
@@ -770,7 +769,7 @@ static int toku_c_pget(DBC * c, DBT *key, DBT *pkey, DBT *data, u_int32_t flag)
|
||||
int r;
|
||||
int r2;
|
||||
int r3;
|
||||
DB *db = c->i->db;
|
||||
DB *db = c->dbp;
|
||||
DB *pdb = db->i->primary;
|
||||
|
||||
|
||||
@@ -851,7 +850,7 @@ delete_silently_and_retry:
|
||||
}
|
||||
|
||||
static int toku_c_get(DBC * c, DBT * key, DBT * data, u_int32_t flag) {
|
||||
DB *db = c->i->db;
|
||||
DB *db = c->dbp;
|
||||
int r;
|
||||
|
||||
if (db->i->primary==0) r = toku_c_get_noassociate(c, key, data, flag);
|
||||
@@ -954,7 +953,7 @@ cleanup:
|
||||
|
||||
static int toku_c_del(DBC * c, u_int32_t flags) {
|
||||
int r;
|
||||
DB* db = c->i->db;
|
||||
DB* db = c->dbp;
|
||||
|
||||
//It is a primary with secondaries, or is a secondary.
|
||||
if (db->i->primary != 0 || !list_empty(&db->i->associated)) {
|
||||
@@ -995,7 +994,7 @@ static int toku_c_del(DBC * c, u_int32_t flags) {
|
||||
}
|
||||
|
||||
static int toku_c_put(DBC *dbc, DBT *key, DBT *data, u_int32_t flags) {
|
||||
DB* db = dbc->i->db;
|
||||
DB* db = dbc->dbp;
|
||||
unsigned int brtflags;
|
||||
int r;
|
||||
DBT* put_key = key;
|
||||
@@ -1073,7 +1072,7 @@ static int toku_db_cursor(DB * db, DB_TXN * txn, DBC ** c, u_int32_t flags) {
|
||||
result->c_del = toku_c_del;
|
||||
MALLOC(result->i);
|
||||
assert(result->i);
|
||||
result->i->db = db;
|
||||
result->dbp = db;
|
||||
result->i->txn = txn;
|
||||
int r = toku_brt_cursor(db->i->brt, &result->i->c);
|
||||
assert(r == 0);
|
||||
@@ -1234,7 +1233,7 @@ static char *construct_full_name(const char *dir, const char *fname) {
|
||||
}
|
||||
}
|
||||
|
||||
int find_db_file(DB_ENV* dbenv, const char *fname, char** full_name_out) {
|
||||
static int find_db_file(DB_ENV* dbenv, const char *fname, char** full_name_out) {
|
||||
u_int32_t i;
|
||||
int r;
|
||||
struct stat statbuf;
|
||||
|
||||
Reference in New Issue
Block a user