Commit df1c7a93 authored by Yoni Fogel's avatar Yoni Fogel

Addresses #903

Created function that peeks at both key and value at the same time
(to avoid repeated OMT calls).
This was worth 4-5% performance in scanscan --lwc --prelock --prelockflag


git-svn-id: file:///svn/tokudb@5386 c7de825b-a66e-492c-adef-691d508d4ae1
parent b5d3b778
......@@ -3198,6 +3198,15 @@ DBT *brt_cursor_peek_prev_val(BRT_CURSOR cursor)
return &cursor->prevval;
}
void brt_cursor_peek_current(BRT_CURSOR cursor, const DBT **pkey, const DBT **pval)
// Effect: Retrieves a pointer to the DBTs for the current key and value.
// Requires: The caller may not modify the DBTs or the memory at which they points.
{
if (cursor->current_in_omt) load_dbts_from_omt(cursor, &cursor->key, &cursor->val);
*pkey = &cursor->key;
*pval = &cursor->val;
}
DBT *brt_cursor_peek_current_key(BRT_CURSOR cursor)
// Effect: Return a pointer to a DBT for the current key.
// Requires: The caller may not modify that DBT or the memory at which it points.
......
......@@ -84,6 +84,7 @@ DBT *brt_cursor_peek_prev_key(BRT_CURSOR cursor);
DBT *brt_cursor_peek_prev_val(BRT_CURSOR cursor);
DBT *brt_cursor_peek_current_key(BRT_CURSOR cursor);
DBT *brt_cursor_peek_current_val(BRT_CURSOR cursor);
void brt_cursor_peek_current(BRT_CURSOR cursor, const DBT **pkey, const DBT **pval);
void brt_cursor_restore_state_from_prev(BRT_CURSOR cursor);
typedef struct brtenv *BRTENV;
......
......@@ -1801,10 +1801,7 @@ static int toku_c_getf_next(DBC *c, u_int32_t flag, void(*f)(DBT const *key, DBT
txn);
if (c_get_result!=0 && c_get_result!=DB_NOTFOUND) { r = c_get_result; goto cleanup; }
int found = c_get_result==0;
if (found) {
pkey = brt_cursor_peek_current_key(c->i->c);
pval = brt_cursor_peek_current_val(c->i->c);
}
if (found) brt_cursor_peek_current(c->i->c, &pkey, &pval);
if (do_locking) {
DBT *prevkey = found ? brt_cursor_peek_prev_key(c->i->c) : brt_cursor_peek_current_key(c->i->c);
......
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