Commit 03211c6f authored by John Esmet's avatar John Esmet Committed by Yoni Fogel

refs #5490 dup/nodup artifacts


git-svn-id: file:///svn/toku/tokudb@48246 c7de825b-a66e-492c-adef-691d508d4ae1
parent eaabd3e0
......@@ -489,7 +489,6 @@ static void print_db_txn_stat_struct (void) {
static void print_dbc_struct (void) {
field_counter=0;
STRUCT_SETUP(DBC, c_close, "int (*%s) (DBC *)");
STRUCT_SETUP(DBC, c_count, "int (*%s) (DBC *, db_recno_t *, uint32_t)");
//STRUCT_SETUP(DBC, c_del, "int (*%s) (DBC *, uint32_t)"); // c_del was removed. See #4576.
STRUCT_SETUP(DBC, c_get, "int (*%s) (DBC *, DBT *, DBT *, uint32_t)");
STRUCT_SETUP(DBC, dbp, "DB *%s");
......@@ -499,8 +498,6 @@ static void print_dbc_struct (void) {
"int (*c_getf_next)(DBC *, uint32_t, YDB_CALLBACK_FUNCTION, void *)",
"int (*c_getf_prev)(DBC *, uint32_t, YDB_CALLBACK_FUNCTION, void *)",
"int (*c_getf_current)(DBC *, uint32_t, YDB_CALLBACK_FUNCTION, void *)",
"int (*c_getf_current_binding)(DBC *, uint32_t, YDB_CALLBACK_FUNCTION, void *)",
"int (*c_getf_set)(DBC *, uint32_t, DBT *, YDB_CALLBACK_FUNCTION, void *)",
"int (*c_getf_set_range)(DBC *, uint32_t, DBT *, YDB_CALLBACK_FUNCTION, void *)",
"int (*c_getf_set_range_reverse)(DBC *, uint32_t, DBT *, YDB_CALLBACK_FUNCTION, void *)",
......
......@@ -41,9 +41,6 @@ ydb_c_layer_get_status(YDB_C_LAYER_STATUS statp) {
}
/* lightweight cursor methods. */
static int toku_c_getf_current_binding(DBC *c, uint32_t flag, YDB_CALLBACK_FUNCTION f, void *extra);
//Get the main portion of a cursor flag (excluding the bitwise or'd components).
static int
get_main_cursor_flag(uint32_t flags) {
......@@ -84,15 +81,6 @@ c_get_wrapper_callback(DBT const *key, DBT const *val, void *extra) {
return r;
}
static int
toku_c_get_current_unconditional(DBC* c, uint32_t flags, DBT* key, DBT* val) {
int r;
QUERY_CONTEXT_WRAPPED_S context;
query_context_wrapped_init(&context, c, key, val);
r = toku_c_getf_current_binding(c, flags, c_get_wrapper_callback, &context);
return r;
}
static inline uint32_t
get_cursor_prelocked_flags(uint32_t flags, DBC* dbc) {
uint32_t lock_flags = flags & (DB_PRELOCKED | DB_PRELOCKED_WRITE);
......@@ -439,19 +427,6 @@ c_getf_current_callback(ITEMLEN keylen, bytevec key, ITEMLEN vallen, bytevec val
return r;
}
static int
toku_c_getf_current_binding(DBC *c, uint32_t flag, YDB_CALLBACK_FUNCTION f, void *extra) {
HANDLE_PANICKED_DB(c->dbp);
HANDLE_CURSOR_ILLEGAL_WORKING_PARENT_TXN(c);
QUERY_CONTEXT_S context; //Describes the context of this query.
c_query_context_init(&context, c, flag, f, extra);
//toku_ft_cursor_current will call c_getf_current_callback(..., context) (if query is successful)
int r = toku_ft_cursor_current(dbc_struct_i(c)->c, DB_CURRENT_BINDING, c_getf_current_callback, &context);
c_query_context_destroy(&context);
return r;
}
static int c_getf_set_callback(ITEMLEN keylen, bytevec key, ITEMLEN vallen, bytevec val, void *extra, bool);
int
......@@ -627,14 +602,6 @@ toku_c_close(DBC * c) {
return 0;
}
// these next two static functions are defined
// both here and ydb.c. We should find a good
// place for them.
static int
ydb_getf_do_nothing(DBT const* UU(key), DBT const* UU(val), void* UU(extra)) {
return 0;
}
static inline DBT*
init_dbt_realloc(DBT *dbt) {
memset(dbt, 0, sizeof(*dbt));
......@@ -642,50 +609,6 @@ init_dbt_realloc(DBT *dbt) {
return dbt;
}
// Return the number of entries whose key matches the key currently
// pointed to by the brt cursor.
static int
toku_c_count(DBC *cursor, db_recno_t *count, uint32_t flags) {
HANDLE_PANICKED_DB(cursor->dbp);
HANDLE_CURSOR_ILLEGAL_WORKING_PARENT_TXN(cursor);
int r;
DBC *count_cursor = 0;
DBT currentkey;
init_dbt_realloc(&currentkey);
uint32_t lock_flags = get_cursor_prelocked_flags(flags, cursor);
flags &= ~lock_flags;
if (flags != 0) {
r = EINVAL; goto finish;
}
r = toku_c_get_current_unconditional(cursor, lock_flags, &currentkey, NULL);
if (r != 0) goto finish;
//TODO: Optimization
//if (do_locking) {
// do a lock from currentkey,-infinity to currentkey,infinity
// lock_flags |= DB_PRELOCKED
//}
r = toku_db_cursor_internal(cursor->dbp, dbc_struct_i(cursor)->txn, &count_cursor, DBC_DISABLE_PREFETCHING, 0);
if (r != 0) goto finish;
r = toku_c_getf_set(count_cursor, lock_flags, &currentkey, ydb_getf_do_nothing, NULL);
if (r==0) {
*count = 1; // there is a key, so the count is one (since we don't have DUP dbs anymore, the only answers are 0 or 1.
} else {
*count = 0;
}
r = 0;
finish:
if (currentkey.data) toku_free(currentkey.data);
if (count_cursor) {
int rr = toku_c_close(count_cursor); assert(rr == 0);
}
return r;
}
static int
toku_c_pre_acquire_range_lock(DBC *dbc, const DBT *key_left, const DBT *key_right) {
DB *db = dbc->dbp;
......@@ -751,11 +674,6 @@ toku_c_get(DBC* c, DBT* key, DBT* val, uint32_t flag) {
query_context_wrapped_init(&context, c, key, val);
r = toku_c_getf_current(c, remaining_flags, c_get_wrapper_callback, &context);
break;
case (DB_CURRENT_BINDING):
query_context_wrapped_init(&context, c, key, val);
r = toku_c_getf_current_binding(c, remaining_flags, c_get_wrapper_callback, &context);
break;
case (DB_SET):
query_context_wrapped_init(&context, c, NULL, val);
r = toku_c_getf_set(c, remaining_flags, key, c_get_wrapper_callback, &context);
......@@ -798,13 +716,11 @@ toku_db_cursor_internal(DB * db, DB_TXN * txn, DBC ** c, uint32_t flags, int is_
// these methods DO NOT grab the ydb lock
#define SCRS(name) result->name = toku_ ## name
SCRS(c_get);
SCRS(c_count);
SCRS(c_getf_first);
SCRS(c_getf_last);
SCRS(c_getf_next);
SCRS(c_getf_prev);
SCRS(c_getf_current);
SCRS(c_getf_current_binding);
SCRS(c_getf_set);
SCRS(c_getf_set_range);
SCRS(c_getf_set_range_reverse);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment