Commit 0860425e authored by Barry Perlman's avatar Barry Perlman Committed by Yoni Fogel

Addresses #1987 refs[t:1987] API and implementation of broadcast commit (all xids) message.

Cleaned up BRT_CMD vs BRT_MSG, removed logger from query path.

git-svn-id: file:///svn/toku/tokudb@14376 c7de825b-a66e-492c-adef-691d508d4ae1
parent aa5f3c85
......@@ -303,7 +303,7 @@ struct cmd_leafval_heaviside_extra {
};
int toku_cmd_leafval_heaviside (OMTVALUE leafentry, void *extra);
int toku_brt_root_put_cmd(BRT brt, BRT_MSG cmd, TOKULOGGER logger);
int toku_brt_root_put_cmd(BRT brt, BRT_MSG cmd);
void *mempool_malloc_from_omt(OMT omt, struct mempool *mp, size_t size, void **maybe_free);
// Effect: Allocate a new object of size SIZE in MP. If MP runs out of space, allocate new a new mempool space, and copy all the items
......
This diff is collapsed.
......@@ -50,6 +50,7 @@ int toku_brt_open(BRT, const char *fname, const char *fname_in_env, int is_creat
int toku_brt_remove_subdb(BRT brt, const char *dbname, u_int32_t flags);
int toku_brt_broadcast_commit_all (BRT brt);
int toku_brt_insert (BRT, DBT *, DBT *, TOKUTXN);
int toku_brt_lookup (BRT brt, DBT *k, DBT *v, BRT_GET_CALLBACK_FUNCTION getf, void *getf_v);
int toku_brt_delete (BRT brt, DBT *k, TOKUTXN);
......@@ -89,23 +90,23 @@ typedef struct brt_cursor *BRT_CURSOR;
int toku_brt_cursor (BRT, BRT_CURSOR*, TOKULOGGER);
// get is deprecated in favor of the individual functions below
int toku_brt_cursor_get (BRT_CURSOR cursor, DBT *key, DBT *val, BRT_GET_CALLBACK_FUNCTION getf, void *getf_v, int get_flags, TOKUTXN txn);
int toku_brt_cursor_get (BRT_CURSOR cursor, DBT *key, DBT *val, BRT_GET_CALLBACK_FUNCTION getf, void *getf_v, int get_flags);
int toku_brt_flatten(BRT, TOKULOGGER logger);
int toku_brt_cursor_first(BRT_CURSOR cursor, BRT_GET_CALLBACK_FUNCTION getf, void *getf_v, TOKULOGGER logger);
int toku_brt_cursor_last(BRT_CURSOR cursor, BRT_GET_CALLBACK_FUNCTION getf, void *getf_v, TOKULOGGER logger);
int toku_brt_cursor_next(BRT_CURSOR cursor, BRT_GET_CALLBACK_FUNCTION getf, void *getf_v, TOKULOGGER logger);
int toku_brt_cursor_next_nodup(BRT_CURSOR cursor, BRT_GET_CALLBACK_FUNCTION getf, void *getf_v, TOKULOGGER logger);
int toku_brt_cursor_next_dup(BRT_CURSOR cursor, BRT_GET_CALLBACK_FUNCTION getf, void *getf_v, TOKULOGGER logger);
int toku_brt_cursor_prev(BRT_CURSOR cursor, BRT_GET_CALLBACK_FUNCTION getf, void *getf_v, TOKULOGGER logger);
int toku_brt_cursor_prev_nodup(BRT_CURSOR cursor, BRT_GET_CALLBACK_FUNCTION getf, void *getf_v, TOKULOGGER logger);
int toku_brt_cursor_prev_dup(BRT_CURSOR cursor, BRT_GET_CALLBACK_FUNCTION getf, void *getf_v, TOKULOGGER logger);
int toku_brt_cursor_current(BRT_CURSOR cursor, int op, BRT_GET_CALLBACK_FUNCTION getf, void *getf_v, TOKULOGGER logger);
int toku_brt_cursor_set(BRT_CURSOR cursor, DBT *key, DBT *val, BRT_GET_CALLBACK_FUNCTION getf, void *getf_v, TOKULOGGER logger);
int toku_brt_cursor_set_range(BRT_CURSOR cursor, DBT *key, BRT_GET_CALLBACK_FUNCTION getf, void *getf_v, TOKULOGGER logger);
int toku_brt_cursor_set_range_reverse(BRT_CURSOR cursor, DBT *key, BRT_GET_CALLBACK_FUNCTION getf, void *getf_v, TOKULOGGER logger);
int toku_brt_cursor_get_both_range(BRT_CURSOR cursor, DBT *key, DBT *val, BRT_GET_CALLBACK_FUNCTION getf, void *getf_v, TOKULOGGER logger);
int toku_brt_cursor_get_both_range_reverse(BRT_CURSOR cursor, DBT *key, DBT *val, BRT_GET_CALLBACK_FUNCTION getf, void *getf_v, TOKULOGGER logger);
int toku_brt_cursor_first(BRT_CURSOR cursor, BRT_GET_CALLBACK_FUNCTION getf, void *getf_v);
int toku_brt_cursor_last(BRT_CURSOR cursor, BRT_GET_CALLBACK_FUNCTION getf, void *getf_v);
int toku_brt_cursor_next(BRT_CURSOR cursor, BRT_GET_CALLBACK_FUNCTION getf, void *getf_v);
int toku_brt_cursor_next_nodup(BRT_CURSOR cursor, BRT_GET_CALLBACK_FUNCTION getf, void *getf_v);
int toku_brt_cursor_next_dup(BRT_CURSOR cursor, BRT_GET_CALLBACK_FUNCTION getf, void *getf_v);
int toku_brt_cursor_prev(BRT_CURSOR cursor, BRT_GET_CALLBACK_FUNCTION getf, void *getf_v);
int toku_brt_cursor_prev_nodup(BRT_CURSOR cursor, BRT_GET_CALLBACK_FUNCTION getf, void *getf_v);
int toku_brt_cursor_prev_dup(BRT_CURSOR cursor, BRT_GET_CALLBACK_FUNCTION getf, void *getf_v);
int toku_brt_cursor_current(BRT_CURSOR cursor, int op, BRT_GET_CALLBACK_FUNCTION getf, void *getf_v);
int toku_brt_cursor_set(BRT_CURSOR cursor, DBT *key, DBT *val, BRT_GET_CALLBACK_FUNCTION getf, void *getf_v);
int toku_brt_cursor_set_range(BRT_CURSOR cursor, DBT *key, BRT_GET_CALLBACK_FUNCTION getf, void *getf_v);
int toku_brt_cursor_set_range_reverse(BRT_CURSOR cursor, DBT *key, BRT_GET_CALLBACK_FUNCTION getf, void *getf_v);
int toku_brt_cursor_get_both_range(BRT_CURSOR cursor, DBT *key, DBT *val, BRT_GET_CALLBACK_FUNCTION getf, void *getf_v);
int toku_brt_cursor_get_both_range_reverse(BRT_CURSOR cursor, DBT *key, DBT *val, BRT_GET_CALLBACK_FUNCTION getf, void *getf_v);
typedef struct {
......@@ -114,7 +115,7 @@ typedef struct {
int r_h;
int direction;
} *HEAVI_WRAPPER, HEAVI_WRAPPER_S;
int toku_brt_cursor_heaviside(BRT_CURSOR cursor, BRT_GET_STRADDLE_CALLBACK_FUNCTION getf, void *getf_v, TOKULOGGER logger, HEAVI_WRAPPER wrapper);
int toku_brt_cursor_heaviside(BRT_CURSOR cursor, BRT_GET_STRADDLE_CALLBACK_FUNCTION getf, void *getf_v, HEAVI_WRAPPER wrapper);
int toku_brt_cursor_delete(BRT_CURSOR cursor, int flags, TOKUTXN);
int toku_brt_cursor_close (BRT_CURSOR curs);
BOOL toku_brt_cursor_uninitialized(BRT_CURSOR c);
......
......@@ -112,6 +112,7 @@ dump_node (int f, BLOCKNUM blocknum, struct brt_header *h) {
case BRT_ABORT_BOTH: printf("ABORT_BOTH"); goto ok;
case BRT_COMMIT_ANY: printf("COMMIT_ANY"); goto ok;
case BRT_COMMIT_BOTH: printf("COMMIT_BOTH"); goto ok;
case BRT_COMMIT_BROADCAST_ALL: printf("COMMIT_BROADCAST_ALL"); goto ok;
}
printf("HUH?");
ok:
......
......@@ -90,7 +90,8 @@ enum brt_msg_type {
BRT_ABORT_ANY = 4, // Abort any commands on any matching key.
BRT_ABORT_BOTH = 5, // Abort commands that match both the key and the value
BRT_COMMIT_ANY = 6,
BRT_COMMIT_BOTH = 7
BRT_COMMIT_BOTH = 7,
BRT_COMMIT_BROADCAST_ALL = 8 // Broadcast to all leafentries, (commit all transactions).
};
typedef struct xids_t *XIDS;
......
......@@ -77,7 +77,7 @@ static int do_insertion (enum brt_msg_type type, FILENUM filenum, BYTESTRING key
assert(r==0);
BRT brt = brtv;
r = toku_brt_root_put_cmd(brt, &brtcmd, txn->logger);
r = toku_brt_root_put_cmd(brt, &brtcmd);
return r;
}
......
......@@ -57,7 +57,7 @@ static void test_sub_block(int n) {
int k = htonl(i);
int v = i;
struct check_pair pair = {sizeof k, &k, sizeof v, &v, 0};
error = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_NEXT, null_txn);
error = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_NEXT);
if (error != 0) {
assert(pair.call_count==0);
break;
......
......@@ -65,8 +65,7 @@ static void test_multiple_brt_cursor_dbts(int n, DB *db) {
toku_init_dbt(&vbt),
save_data,
&ptrs[i],
DB_SET,
null_txn);
DB_SET);
assert(r == 0);
}
......
......@@ -23,7 +23,7 @@ static void assert_cursor_notfound(BRT brt, int position) {
assert(r==0);
struct check_pair pair = {0,0,0,0,0};
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, position, null_txn);
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, position);
assert(r == DB_NOTFOUND);
assert(pair.call_count==0);
......@@ -40,7 +40,7 @@ static void assert_cursor_value(BRT brt, int position, long long value) {
if (test_cursor_debug && verbose) printf("key: ");
struct check_pair pair = {len_ignore, 0, sizeof(value), &value, 0};
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, position, null_txn);
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, position);
assert(r == 0);
assert(pair.call_count==1);
......@@ -58,7 +58,7 @@ static void assert_cursor_first_last(BRT brt, long long firstv, long long lastv)
if (test_cursor_debug && verbose) printf("first key: ");
{
struct check_pair pair = {len_ignore, 0, sizeof(firstv), &firstv, 0};
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_FIRST, null_txn);
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_FIRST);
assert(r == 0);
assert(pair.call_count==1);
}
......@@ -66,7 +66,7 @@ static void assert_cursor_first_last(BRT brt, long long firstv, long long lastv)
if (test_cursor_debug && verbose) printf("last key:");
{
struct check_pair pair = {len_ignore, 0, sizeof(lastv), &lastv, 0};
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_LAST, null_txn);
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_LAST);
assert(r == 0);
assert(pair.call_count==1);
}
......@@ -257,7 +257,7 @@ static void assert_cursor_walk(BRT brt, int n) {
for (i=0; ; i++) {
long long v = i;
struct check_pair pair = {len_ignore, 0, sizeof(v), &v, 0};
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_NEXT, null_txn);
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_NEXT);
if (r != 0) {
assert(pair.call_count==0);
break;
......@@ -323,7 +323,7 @@ static void assert_cursor_rwalk(BRT brt, int n) {
for (i=n-1; ; i--) {
long long v = i;
struct check_pair pair = {len_ignore, 0, sizeof v, &v, 0};
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_PREV, null_txn);
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_PREV);
if (r != 0) {
assert(pair.call_count==0);
break;
......@@ -407,7 +407,7 @@ static void assert_cursor_walk_inorder(BRT brt, int n) {
if (test_cursor_debug && verbose) printf("key: ");
for (i=0; ; i++) {
r = toku_brt_cursor_get(cursor, NULL, NULL, ascending_key_string_checkf, &prevkey, DB_NEXT, null_txn);
r = toku_brt_cursor_get(cursor, NULL, NULL, ascending_key_string_checkf, &prevkey, DB_NEXT);
if (r != 0) {
break;
}
......@@ -510,7 +510,7 @@ static void test_brt_cursor_split(int n, DB *db) {
if (test_cursor_debug && verbose) printf("key: ");
for (i=0; i<n/2; i++) {
struct check_pair pair = {len_ignore, 0, len_ignore, 0, 0};
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_NEXT, null_txn);
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_NEXT);
assert(r==0);
assert(pair.call_count==1);
}
......@@ -532,7 +532,7 @@ static void test_brt_cursor_split(int n, DB *db) {
// Just loop through the cursor
for (;;) {
struct check_pair pair = {len_ignore, 0, len_ignore, 0, 0};
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_NEXT, null_txn);
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_NEXT);
if (r != 0) {
assert(pair.call_count==0);
break;
......@@ -642,7 +642,7 @@ static void test_multiple_brt_cursor_walk(int n, DB *db) {
if ((i % cursor_gap) == 0) {
c = i / cursor_gap;
struct check_pair pair = {len_ignore, 0, len_ignore, 0, 0};
r = toku_brt_cursor_get(cursors[c], NULL, NULL, lookup_checkf, &pair, DB_LAST, null_txn);
r = toku_brt_cursor_get(cursors[c], NULL, NULL, lookup_checkf, &pair, DB_LAST);
assert(r == 0);
assert(pair.call_count==1);
}
......@@ -653,7 +653,7 @@ static void test_multiple_brt_cursor_walk(int n, DB *db) {
for (c=0; c<ncursors; c++) {
int vv = c*cursor_gap + i + 1;
struct check_pair pair = {len_ignore, 0, sizeof vv, &vv, 0};
r = toku_brt_cursor_get(cursors[c], NULL, NULL, lookup_checkf, &pair, DB_NEXT, null_txn);
r = toku_brt_cursor_get(cursors[c], NULL, NULL, lookup_checkf, &pair, DB_NEXT);
if (r == DB_NOTFOUND) {
/* we already consumed 1 previously */
assert(pair.call_count==0);
......@@ -719,7 +719,7 @@ static void test_brt_cursor_set(int n, int cursor_op, DB *db) {
toku_fill_dbt(&key, &k, sizeof k);
struct check_pair pair = {sizeof k, 0, sizeof vv, &v, 0};
if (cursor_op == DB_SET) pair.key = &k; // if it is a set operation, make sure that the result we get is the right one.
r = toku_brt_cursor_get(cursor, &key, NULL, lookup_checkf, &pair, cursor_op, null_txn);
r = toku_brt_cursor_get(cursor, &key, NULL, lookup_checkf, &pair, cursor_op);
assert(r == 0);
assert(pair.call_count==1);
}
......@@ -732,7 +732,7 @@ static void test_brt_cursor_set(int n, int cursor_op, DB *db) {
DBT key;
toku_fill_dbt(&key, &k, sizeof k);
struct check_pair pair = {0, 0, 0, 0, 0};
r = toku_brt_cursor_get(cursor, &key, NULL, lookup_checkf, &pair, DB_SET, null_txn);
r = toku_brt_cursor_get(cursor, &key, NULL, lookup_checkf, &pair, DB_SET);
CKERR2(r,DB_NOTFOUND);
assert(pair.call_count==0);
assert(key.data == &k); // make sure that no side effect happened on key
......@@ -792,7 +792,7 @@ static void test_brt_cursor_set_range(int n, DB *db) {
toku_fill_dbt(&key, &k, sizeof k);
int vv = ((v+9)/10)*10;
struct check_pair pair = {sizeof k, 0, sizeof vv, &vv, 0};
r = toku_brt_cursor_get(cursor, &key, NULL, lookup_checkf, &pair, DB_SET_RANGE, null_txn);
r = toku_brt_cursor_get(cursor, &key, NULL, lookup_checkf, &pair, DB_SET_RANGE);
if (v > max_key) {
/* there is no smallest key if v > the max key */
assert(r == DB_NOTFOUND);
......@@ -849,7 +849,7 @@ static void test_brt_cursor_delete(int n, DB *db) {
/* walk the tree and delete under the cursor */
for (;;) {
struct check_pair pair = {len_ignore, 0, len_ignore, 0, 0};
error = toku_brt_cursor_get(cursor, &key, &val, lookup_checkf, &pair, DB_NEXT, null_txn);
error = toku_brt_cursor_get(cursor, &key, &val, lookup_checkf, &pair, DB_NEXT);
if (error == DB_NOTFOUND) {
assert(pair.call_count==0);
break;
......@@ -901,7 +901,7 @@ static void test_brt_cursor_get_both(int n, DB *db) {
toku_fill_dbt(&key, &k, sizeof k);
toku_fill_dbt(&val, &v, sizeof v);
struct check_pair pair = {0,0,0,0,0};
error = toku_brt_cursor_get(cursor, &key, &val, lookup_checkf, &pair, DB_GET_BOTH, null_txn);
error = toku_brt_cursor_get(cursor, &key, &val, lookup_checkf, &pair, DB_GET_BOTH);
assert(error == DB_NOTFOUND);
assert(pair.call_count==0);
}
......@@ -927,7 +927,7 @@ static void test_brt_cursor_get_both(int n, DB *db) {
toku_fill_dbt(&key, &k, sizeof k);
toku_fill_dbt(&val, &v, sizeof v);
struct check_pair pair = {0,0,0,0,0};
error = toku_brt_cursor_get(cursor, &key, &val, lookup_checkf, &pair, DB_GET_BOTH, null_txn);
error = toku_brt_cursor_get(cursor, &key, &val, lookup_checkf, &pair, DB_GET_BOTH);
assert(error == DB_NOTFOUND);
assert(pair.call_count==0);
}
......@@ -940,7 +940,7 @@ static void test_brt_cursor_get_both(int n, DB *db) {
toku_fill_dbt(&key, &k, sizeof k);
toku_fill_dbt(&val, &v, sizeof v);
struct check_pair pair = {0,0,0,0,0};
error = toku_brt_cursor_get(cursor, &key, &val, lookup_checkf, &pair, DB_GET_BOTH, null_txn);
error = toku_brt_cursor_get(cursor, &key, &val, lookup_checkf, &pair, DB_GET_BOTH);
assert(error == DB_NOTFOUND);
assert(pair.call_count==0);
}
......@@ -954,7 +954,7 @@ static void test_brt_cursor_get_both(int n, DB *db) {
toku_fill_dbt(&key, &k, sizeof k);
toku_fill_dbt(&val, &v, sizeof v);
struct check_pair pair = {len_ignore,0,len_ignore,0,0};
error = toku_brt_cursor_get(cursor, &key, &val, lookup_checkf, &pair, DB_GET_BOTH, null_txn);
error = toku_brt_cursor_get(cursor, &key, &val, lookup_checkf, &pair, DB_GET_BOTH);
assert(error == 0);
assert(pair.call_count==1);
}
......@@ -962,7 +962,7 @@ static void test_brt_cursor_get_both(int n, DB *db) {
{
int vv = i;
struct check_pair pair = {len_ignore, 0, sizeof vv, &vv, 0};
error = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_CURRENT, 0);
error = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_CURRENT);
assert(error == 0);
assert(pair.call_count==1);
}
......@@ -976,7 +976,7 @@ static void test_brt_cursor_get_both(int n, DB *db) {
toku_fill_dbt(&key, &k, sizeof k);
toku_fill_dbt(&val, &v, sizeof v);
struct check_pair pair = {0,0,0,0,0};
error = toku_brt_cursor_get(cursor, &key, &val, lookup_checkf, &pair, DB_GET_BOTH, null_txn);
error = toku_brt_cursor_get(cursor, &key, &val, lookup_checkf, &pair, DB_GET_BOTH);
assert(error == DB_NOTFOUND);
assert(pair.call_count==0);
}
......
......@@ -258,13 +258,13 @@ static void test_cursor_last_empty(void) {
r = toku_brt_cursor(brt, &cursor, NULL); assert(r==0);
{
struct check_pair pair = {0,0,0,0,0};
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_LAST, null_txn);
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_LAST);
assert(pair.call_count==0);
assert(r==DB_NOTFOUND);
}
{
struct check_pair pair = {0,0,0,0,0};
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_FIRST, null_txn);
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_FIRST);
assert(pair.call_count==0);
assert(r==DB_NOTFOUND);
}
......@@ -300,7 +300,7 @@ static void test_cursor_next (void) {
if (verbose) printf("%s:%d calling toku_brt_cursor_get(...)\n", __FILE__, __LINE__);
{
struct check_pair pair = {7, "byebye", 7, "byenow", 0};
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_NEXT, null_txn);
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_NEXT);
if (verbose) printf("%s:%d called toku_brt_cursor_get(...)\n", __FILE__, __LINE__);
assert(r==0);
assert(pair.call_count==1);
......@@ -308,13 +308,13 @@ static void test_cursor_next (void) {
{
struct check_pair pair = {6, "hello", 6, "there", 0};
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_NEXT, null_txn);
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_NEXT);
assert(r==0);
assert(pair.call_count==1);
}
{
struct check_pair pair = {0, 0, 0, 0, 0};
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_NEXT, null_txn);
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_NEXT);
assert(r==DB_NOTFOUND);
assert(pair.call_count==0);
}
......@@ -392,7 +392,7 @@ static void test_wrongendian_compare (int wrong_p, unsigned int N) {
b[2] = a[1] = (unsigned char)((i>>8)&255);
b[1] = a[2] = (unsigned char)((i>>16)&255);
b[0] = a[3] = (unsigned char)((i>>24)&255);
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_NEXT, null_txn);
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_NEXT);
assert(r==0);
assert(pair.call_count==1);
}
......@@ -432,7 +432,7 @@ static void test_wrongendian_compare (int wrong_p, unsigned int N) {
b[2] = a[1] = (unsigned char)((i>>8)&255);
b[1] = a[2] = (unsigned char)((i>>16)&255);
b[0] = a[3] = (unsigned char)((i>>24)&255);
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_NEXT, null_txn);
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_NEXT);
assert(r==0);
assert(pair.call_count==1);
toku_cachetable_verify(ct);
......@@ -572,7 +572,7 @@ static void test_brt_delete_present(int n) {
{
struct check_pair pair = {0,0,0,0,0};
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_FIRST, null_txn);
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_FIRST);
assert(r != 0);
assert(pair.call_count==0);
}
......@@ -705,7 +705,7 @@ static void test_brt_delete_cursor_first(int n) {
int kv = toku_htonl(n-1);
int vv = n-1;
struct check_pair pair = {sizeof kv, &kv, sizeof vv, &vv, 0};
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_FIRST, null_txn);
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_FIRST);
assert(r == 0);
assert(pair.call_count==1);
}
......@@ -826,7 +826,7 @@ static void test_brt_delete_both(int n) {
int kv = toku_htonl(0);
int vv = toku_htonl(i);
struct check_pair pair = {sizeof kv, &kv, sizeof vv, &vv, 0};
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_NEXT, null_txn);
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_NEXT);
if (r != 0) {
assert(pair.call_count==0);
break;
......@@ -910,7 +910,7 @@ static void test_new_brt_cursor_first(int n, int dup_mode) {
int kv = toku_htonl(i);
int vv = toku_htonl(i);
struct check_pair pair = {sizeof kv, &kv, sizeof vv, &vv, 0};
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_FIRST, null_txn);
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_FIRST);
if (r != 0) {
assert(pair.call_count==0);
break;
......@@ -963,7 +963,7 @@ static void test_new_brt_cursor_last(int n, int dup_mode) {
int kk = toku_htonl(i);
int vv = toku_htonl(i);
struct check_pair pair = {sizeof kk, &kk, sizeof vv, &vv, 0};
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_LAST, null_txn);
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_LAST);
if (r != 0) {
assert(pair.call_count==0);
break;
......@@ -1013,7 +1013,7 @@ static void test_new_brt_cursor_next(int n, int dup_mode) {
int kk = toku_htonl(i);
int vv = toku_htonl(i);
struct check_pair pair = {sizeof kk, &kk, sizeof vv, &vv, 0};
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_NEXT, null_txn);
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_NEXT);
if (r != 0) {
assert(pair.call_count ==0);
break;
......@@ -1057,7 +1057,7 @@ static void test_new_brt_cursor_prev(int n, int dup_mode) {
int kk = toku_htonl(i);
int vv = toku_htonl(i);
struct check_pair pair = {sizeof kk, &kk, sizeof vv, &vv, 0};
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_PREV, null_txn);
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_PREV);
if (r != 0) {
assert(pair.call_count==0);
break;
......@@ -1102,7 +1102,7 @@ static void test_new_brt_cursor_current(int n, int dup_mode) {
int kk = toku_htonl(i);
int vv = toku_htonl(i);
struct check_pair pair = {sizeof kk, &kk, sizeof vv, &vv, 0};
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_FIRST, null_txn);
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_FIRST);
if (r != 0) {
assert(pair.call_count==0);
break;
......@@ -1113,7 +1113,7 @@ static void test_new_brt_cursor_current(int n, int dup_mode) {
int kk = toku_htonl(i);
int vv = toku_htonl(i);
struct check_pair pair = {sizeof kk, &kk, sizeof vv, &vv, 0};
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_CURRENT, null_txn);
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_CURRENT);
assert(r == 0);
assert(pair.call_count==1);
}
......@@ -1122,7 +1122,7 @@ static void test_new_brt_cursor_current(int n, int dup_mode) {
int kk = toku_htonl(i);
int vv = toku_htonl(i);
struct check_pair pair = {sizeof kk, &kk, sizeof vv, &vv, 0};
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_CURRENT_BINDING, null_txn);
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_CURRENT_BINDING);
assert(r == 0);
assert(pair.call_count==1);
}
......@@ -1133,7 +1133,7 @@ static void test_new_brt_cursor_current(int n, int dup_mode) {
static int count=0;
count++;
struct check_pair pair = {0,0,0,0,0};
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_CURRENT, null_txn);
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_CURRENT);
CKERR2(r,DB_NOTFOUND); // previous DB_KEYEMPTY
assert(pair.call_count==0);
}
......@@ -1142,7 +1142,7 @@ static void test_new_brt_cursor_current(int n, int dup_mode) {
int kk = toku_htonl(i);
int vv = toku_htonl(i);
struct check_pair pair = {sizeof kk, &kk, sizeof vv, &vv, 0};
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_CURRENT_BINDING, null_txn);
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_CURRENT_BINDING);
assert(r == 0);
assert(pair.call_count==1);
}
......@@ -1196,7 +1196,7 @@ static void test_new_brt_cursor_set_range(int n, int dup_mode) {
struct check_pair pair = {sizeof k, NULL, // NULL data means don't check it
sizeof vv, &vv,
0};
r = toku_brt_cursor_get(cursor, &key, &val, lookup_checkf, &pair, DB_SET_RANGE, null_txn);
r = toku_brt_cursor_get(cursor, &key, &val, lookup_checkf, &pair, DB_SET_RANGE);
if (v > max_key) {
/* there is no smallest key if v > the max key */
assert(r == DB_NOTFOUND);
......@@ -1247,7 +1247,7 @@ static void test_new_brt_cursor_set(int n, int cursor_op, DB *db) {
int k = toku_htonl(v);
DBT key = {.size=sizeof k, .data=&k};
struct check_pair pair = {sizeof k, &k, sizeof v, &v, 0};
r = toku_brt_cursor_get(cursor, &key, NULL, lookup_checkf, &pair, cursor_op, null_txn);
r = toku_brt_cursor_get(cursor, &key, NULL, lookup_checkf, &pair, cursor_op);
assert(r == 0);
assert(pair.call_count==1);
if (cursor_op == DB_SET) assert(key.data == &k);
......@@ -1260,7 +1260,7 @@ static void test_new_brt_cursor_set(int n, int cursor_op, DB *db) {
int k = toku_htonl(i);
DBT key = {.size=sizeof k, .data=&k};
struct check_pair pair = {0,0,0,0,0};
r = toku_brt_cursor_get(cursor, &key, NULL, lookup_checkf, &pair, DB_SET, null_txn);
r = toku_brt_cursor_get(cursor, &key, NULL, lookup_checkf, &pair, DB_SET);
assert(r == DB_NOTFOUND);
assert(pair.call_count==0);
assert(key.data == &k);
......
......@@ -34,11 +34,11 @@ test_main (int argc __attribute__((__unused__)), const char *argv[] __attribute
{
struct check_pair pair = {5, "0000", 5, "0000", 0};
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_NEXT, null_txn); assert(r==0); assert(pair.call_count==1);
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_NEXT); assert(r==0); assert(pair.call_count==1);
}
{
struct check_pair pair = {5, "0001", 5, "0001", 0};
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_NEXT, null_txn); assert(r==0); assert(pair.call_count==1);
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_NEXT); assert(r==0); assert(pair.call_count==1);
}
// This will invalidate due to the root counter bumping, but the OMT itself will still be valid.
......@@ -49,7 +49,7 @@ test_main (int argc __attribute__((__unused__)), const char *argv[] __attribute
{
struct check_pair pair = {5, "0002", 5, "0002", 0};
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_NEXT, null_txn); assert(r==0); assert(pair.call_count==1);
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_NEXT); assert(r==0); assert(pair.call_count==1);
}
r = toku_brt_cursor_close(cursor); assert(r==0);
......
This diff is collapsed.
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