Commit ed406ad9 authored by Yoni Fogel's avatar Yoni Fogel

Modifications for c_put and test_db_get_put_flags

to support 'flags==0 returns EINVAL for put on a dupsort db'
Addresses #180
Addresses #15
Addresses #194

git-svn-id: file:///svn/tokudb@1282 c7de825b-a66e-492c-adef-691d508d4ae1
parent db2b5195
...@@ -137,7 +137,7 @@ PUT_TEST put_tests[] = { ...@@ -137,7 +137,7 @@ PUT_TEST put_tests[] = {
{0, 0, DB_NOOVERWRITE, 0, 0, 0}, {0, 0, DB_NOOVERWRITE, 0, 0, 0},
{0, DB_DUP|DB_DUPSORT, DB_NOOVERWRITE, 0, 0, 0}, {0, DB_DUP|DB_DUPSORT, DB_NOOVERWRITE, 0, 0, 0},
{0, 0, 0, 0, 0, 0}, //r_expect must change to EINVAL when/if we no longer accept 0 as flags for put {0, 0, 0, 0, 0, 0}, //r_expect must change to EINVAL when/if we no longer accept 0 as flags for put
{0, DB_DUP|DB_DUPSORT, 0, 0, 0, 0}, //r_expect must change to EINVAL when/if we no longer accept 0 as flags for put {1, DB_DUP|DB_DUPSORT, 0, EINVAL, 0, 0},
}; };
const int num_put = sizeof(put_tests) / sizeof(put_tests[0]); const int num_put = sizeof(put_tests) / sizeof(put_tests[0]);
...@@ -160,13 +160,13 @@ CPUT_TEST cput_tests[] = { ...@@ -160,13 +160,13 @@ CPUT_TEST cput_tests[] = {
const int num_cput = sizeof(cput_tests) / sizeof(cput_tests[0]); const int num_cput = sizeof(cput_tests) / sizeof(cput_tests[0]);
GET_TEST get_tests[] = { GET_TEST get_tests[] = {
{{0, 0, 0, 0, 0, 0}, DB_GET_BOTH, 0, 0, 0}, {{0, 0, DB_YESOVERWRITE, 0, 0, 0}, DB_GET_BOTH, 0, 0, 0},
{{0, 0, 0, 0, 0, 0}, DB_GET_BOTH, 0, 0, 0}, {{0, 0, DB_YESOVERWRITE, 0, 0, 0}, DB_GET_BOTH, 0, 0, 0},
{{0, 0, 0, 0, 0, 0}, DB_GET_BOTH, DB_NOTFOUND, 0, 1}, {{0, 0, DB_YESOVERWRITE, 0, 0, 0}, DB_GET_BOTH, DB_NOTFOUND, 0, 1},
{{0, DB_DUP|DB_DUPSORT, 0, 0, 0, 0}, DB_GET_BOTH, 0, 0, 0}, {{0, DB_DUP|DB_DUPSORT, DB_YESOVERWRITE, 0, 0, 0}, DB_GET_BOTH, 0, 0, 0},
{{0, DB_DUP|DB_DUPSORT, 0, 0, 0, 0}, DB_GET_BOTH, DB_NOTFOUND, 0, 1}, {{0, DB_DUP|DB_DUPSORT, DB_YESOVERWRITE, 0, 0, 0}, DB_GET_BOTH, DB_NOTFOUND, 0, 1},
{{0, 0, 0, 0, 0, 0}, DB_RMW, EINVAL, 0, 0}, {{0, 0, DB_YESOVERWRITE, 0, 0, 0}, DB_RMW, EINVAL, 0, 0},
{{0, DB_DUP|DB_DUPSORT, 0, 0, 0, 0}, DB_RMW, EINVAL, 0, 0}, {{0, DB_DUP|DB_DUPSORT, DB_YESOVERWRITE, 0, 0, 0}, DB_RMW, EINVAL, 0, 0},
}; };
const int num_get = sizeof(get_tests) / sizeof(get_tests[0]); const int num_get = sizeof(get_tests) / sizeof(get_tests[0]);
......
...@@ -1016,7 +1016,7 @@ static int toku_c_put(DBC *dbc, DBT *key, DBT *data, u_int32_t flags) { ...@@ -1016,7 +1016,7 @@ static int toku_c_put(DBC *dbc, DBT *key, DBT *data, u_int32_t flags) {
else return EINVAL; else return EINVAL;
finish: finish:
//Insert new data with the key we got from c_get. //Insert new data with the key we got from c_get.
r = db->put(db, dbc->i->txn, put_key, put_data, 0); r = db->put(db, dbc->i->txn, put_key, put_data, DB_YESOVERWRITE);
if (r!=0) goto cleanup; if (r!=0) goto cleanup;
r = toku_c_get(dbc, get_key, get_data, DB_GET_BOTH); r = toku_c_get(dbc, get_key, get_data, DB_GET_BOTH);
goto cleanup; goto cleanup;
......
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