Commit 8afaad47 authored by Rich Prohaska's avatar Rich Prohaska

search in a BRT with duplicate keys is equivalent to a DB_SET cursor get.

Addresses #19



git-svn-id: file:///svn/tokudb@748 c7de825b-a66e-492c-adef-691d508d4ae1
parent 5b3c3eb4
......@@ -1491,6 +1491,11 @@ int brt_set_flags(BRT brt, int flags) {
return 0;
}
int brt_get_flags(BRT brt, int *flags) {
*flags = brt->flags;
return 0;
}
int brt_set_nodesize(BRT brt, int nodesize) {
brt->nodesize = nodesize;
return 0;
......
......@@ -13,6 +13,7 @@ int open_brt (const char *fname, const char *dbname, int is_create, BRT *, int n
int brt_create(BRT *);
int brt_set_flags(BRT, int flags);
int brt_get_flags(BRT, int *flags);
int brt_set_nodesize(BRT, int nodesize);
int brt_set_bt_compare(BRT, int (*bt_compare)(DB *, const DBT*, const DBT*));
int brt_set_dup_compare(BRT, int (*dup_compare)(DB *, const DBT*, const DBT*));
......
......@@ -556,7 +556,18 @@ int __toku_db_del(DB * db, DB_TXN * txn __attribute__ ((unused)), DBT * key, u_i
int __toku_db_get(DB * db, DB_TXN * txn __attribute__ ((unused)), DBT * key, DBT * data, u_int32_t flags) {
assert(flags == 0);
int r = brt_lookup(db->i->brt, key, data, db);
int r;
int brtflags;
brt_get_flags(db->i->brt, &brtflags);
if (brtflags & TOKU_DB_DUPSORT) {
DBC *dbc;
r = db->cursor(db, txn, &dbc, 0);
if (r == 0) {
r = dbc->c_get(dbc, key, data, DB_SET);
dbc->c_close(dbc);
}
} else
r = brt_lookup(db->i->brt, key, data, db);
return r;
}
......
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