mirror of
https://github.com/MariaDB/server.git
synced 2025-01-22 14:54:20 +01:00
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
This commit is contained in:
parent
c81c914777
commit
88378bda52
3 changed files with 18 additions and 1 deletions
|
@ -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*));
|
||||
|
|
13
src/ydb.c
13
src/ydb.c
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue