Commit 1c918c44 authored by Yoni Fogel's avatar Yoni Fogel

addresses #180

Support DB_GET_BOTH for dbs without DUPSORT.
Also modified test_db_assert_einval to validate the changes.

git-svn-id: file:///svn/tokudb@1164 c7de825b-a66e-492c-adef-691d508d4ae1
parent daaf8751
......@@ -79,12 +79,12 @@ typedef struct {
PUT_TEST put_tests[] = {
{0, 0, DB_NODUPDATA, EINVAL},
{1, DB_DUP|DB_DUPSORT, DB_NODUPDATA, EINVAL}, //Might need to be removed later.
{1, DB_DUP|DB_DUPSORT, DB_NODUPDATA, EINVAL}, //r_expect must change to 0, and don't skip with BDB once implemented.
};
const int num_put = sizeof(put_tests) / sizeof(put_tests[0]);
GET_TEST get_tests[] = {
{{1, 0, 0, 0}, DB_GET_BOTH, EINVAL},
{{0, 0, 0, 0}, DB_GET_BOTH, 0},
{{0, DB_DUP|DB_DUPSORT, 0, 0}, DB_GET_BOTH, 0},
{{0, 0, 0, 0}, DB_RMW, EINVAL},
{{0, DB_DUP|DB_DUPSORT, 0, 0}, DB_RMW, EINVAL},
......
......@@ -835,7 +835,7 @@ static int toku_db_get_noassociate(DB * db, DB_TXN * txn, DBT * key, DBT * data,
unsigned int brtflags;
toku_brt_get_flags(db->i->brt, &brtflags);
if (brtflags & TOKU_DB_DUPSORT) {
if ((brtflags & TOKU_DB_DUPSORT) || flags == DB_GET_BOTH) {
if (flags != 0 && flags != DB_GET_BOTH) return EINVAL;
// We aren't ready to handle flags such as DB_READ_COMMITTED or DB_READ_UNCOMMITTED or DB_RMW
......
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