Commit bd7a05ed authored by Yoni Fogel's avatar Yoni Fogel

Additional tests for c_put

Show that the key parameter is not only ignored, but never accessed nor written to
when flags == DB_CURRENT
Closes #15

Removed comments asking for this test.

git-svn-id: file:///svn/tokudb@1183 c7de825b-a66e-492c-adef-691d508d4ae1
parent ab7a7ff4
......@@ -98,6 +98,9 @@ void get_bad_flags(u_int32_t flags, int r_expect, int keyint, int dataint) {
dbt_init(&data,&dataint,sizeof(dataint));
r = dbp->get(dbp, null_txn, &key, &data, flags);
CKERR2(r, r_expect);
//Verify things don't change.
assert(*(int*)key.data == keyint);
assert(*(int*)data.data == dataint);
}
void cinsert_test(TEST tests[4]) {
......@@ -145,6 +148,8 @@ CPUT_TEST cput_tests[] = {
{0, DB_DUP|DB_DUPSORT, {{TPUT, DB_KEYFIRST, 0, 0, 1}, {TGET, DB_GET_BOTH, 0, 0, 1}, {TPUT, DB_CURRENT, EINVAL, 0, 2}, {TGET, DB_GET_BOTH, 0, 0, 1}}},
{0, 0, {{TPUT, DB_KEYLAST, 0, 0, 1}, {TGET, DB_GET_BOTH, 0, 0, 1}, {TPUT, DB_CURRENT, 0, 0, 2}, {TGET, DB_GET_BOTH, DB_NOTFOUND, 0, 1}}},
{0, DB_DUP|DB_DUPSORT, {{TPUT, DB_KEYLAST, 0, 0, 1}, {TGET, DB_GET_BOTH, 0, 0, 1}, {TPUT, DB_CURRENT, EINVAL, 0, 2}, {TGET, DB_GET_BOTH, 0, 0, 1}}},
{0, DB_DUP|DB_DUPSORT, {{TPUT, DB_KEYLAST, 0, 0, 1}, {TGET, DB_GET_BOTH, 0, 0, 1}, {TPUT, DB_CURRENT, 0, 1, 1}, {TGET, DB_GET_BOTH, DB_NOTFOUND, 1, 1}}},
{0, DB_DUP|DB_DUPSORT, {{TPUT, DB_KEYLAST, 0, 0, 1}, {TGET, DB_GET_BOTH, 0, 0, 1}, {TPUT, DB_CURRENT, 0, 1, 1}, {TGET, DB_GET_BOTH, 0, 0, 1}}},
{0, 0, {{TPUT, DB_CURRENT, EINVAL, 0, 1}, {TGET, DB_GET_BOTH, DB_NOTFOUND, 0, 1}, {NONE, }, }},
{0, DB_DUP|DB_DUPSORT, {{TPUT, DB_CURRENT, EINVAL, 0, 1}, {TGET, DB_GET_BOTH, DB_NOTFOUND, 0, 1}, {NONE, }, }},
{0, 0, {{TPUT, DB_NODUPDATA, EINVAL, 0, 1}, {TGET, DB_GET_BOTH, DB_NOTFOUND, 0, 1}, {NONE, }, }},
......
......@@ -985,11 +985,6 @@ static int toku_c_put(DBC *dbc, DBT *key, DBT *data, u_int32_t flags) {
r = toku_c_del(dbc, 0);
if (r!=0) goto cleanup;
get_key = put_key = &key_local;
//TEST: We ignore key entirely (do not return data in it either).
//Should we copy the data we eventually get in get_key over into the key DBT?
//If so, just use
//r = toku_brt_dbt_set_key(db->i->brt, key, &key_local, key_local.size);
//to copy at some point.
goto finish;
}
else if (flags==DB_KEYFIRST || flags==DB_KEYLAST) {
......
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