Commit b06ce33a authored by Rich Prohaska's avatar Rich Prohaska

use a cursor set to replace the brt_lookup function. addresses #252

git-svn-id: file:///svn/tokudb@1542 c7de825b-a66e-492c-adef-691d508d4ae1
parent 6b44475a
......@@ -1840,6 +1840,8 @@ int toku_brt_insert (BRT brt, DBT *key, DBT *val, TOKUTXN txn) {
return r;
}
#if 0
static int brt_lookup_node (BRT brt, DISKOFF off, DBT *k, DBT *v) {
int result;
void *node_v;
......@@ -1907,8 +1909,10 @@ static int brt_lookup_node (BRT brt, DISKOFF off, DBT *k, DBT *v) {
return result;
}
#endif
int toku_brt_lookup (BRT brt, DBT *k, DBT *v) {
#if 0
int r;
CACHEKEY *rootp;
//assert(0==toku_cachefile_count_pinned(brt->cf, 1)); // That assertion isn't right. An open cursor could cause things to be pinned.
......@@ -1928,7 +1932,22 @@ int toku_brt_lookup (BRT brt, DBT *k, DBT *v) {
if ((r = toku_unpin_brt_header(brt))!=0) return r;
//assert(0==toku_cachefile_count_pinned(brt->cf, 1)); // That assertion isn't right. An open cursor could cause things to be pinned.
return 0;
#else
int r, rr;
BRT_CURSOR cursor;
rr = toku_brt_cursor(brt, &cursor);
if (rr != 0) return rr;
int op = brt->flags & TOKU_DB_DUPSORT ? DB_GET_BOTH : DB_SET;
r = toku_brt_cursor_get(cursor, k, v, op, 0);
rr = toku_brt_cursor_close(cursor); assert(rr == 0);
return r;
#endif
}
int toku_brt_delete(BRT brt, DBT *key) {
int r;
......@@ -2728,7 +2747,7 @@ static int brtcurs_set_search(BRT_CURSOR cursor, DISKOFF off, int op, DBT *key,
if (r != 0) {
cursor->path_len -= 1;
//verify_local_fingerprint_nonleaf(node);
toku_cachetable_unpin(brt->cf, off, node->dirty, brtnode_size(node));
toku_cachetable_unpin(brt->cf, node->thisnodename, node->dirty, brtnode_size(node));
}
return r;
}
......
......@@ -754,8 +754,14 @@ int toku_pma_cursor_get_current(PMA_CURSOR c, DBT *key, DBT *val, int even_delet
if (!kv_pair_inuse(pair) || (kv_pair_deleted(pair) && !even_deleted))
return DB_KEYEMPTY;
pair = kv_pair_ptr(pair);
if (key) toku_dbt_set_value(key, kv_pair_key(pair), kv_pair_keylen(pair), c->sskey);
if (val) toku_dbt_set_value(val, kv_pair_val(pair), kv_pair_vallen(pair), c->ssval);
if (key) {
int r = toku_dbt_set_value(key, kv_pair_key(pair), kv_pair_keylen(pair), c->sskey);
if (r != 0) return r;
}
if (val) {
int r = toku_dbt_set_value(val, kv_pair_val(pair), kv_pair_vallen(pair), c->ssval);
if (r != 0) return r;
}
return 0;
}
......
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