Commit 6b2f1c61 authored by Bradley C. Kuszmaul's avatar Bradley C. Kuszmaul

Rename a bunch of symbols to toku_symbols. Addresses #8.

git-svn-id: file:///svn/tokudb@822 c7de825b-a66e-492c-adef-691d508d4ae1
parent a0db3628
...@@ -33,7 +33,7 @@ BRT t; ...@@ -33,7 +33,7 @@ BRT t;
void setup (void) { void setup (void) {
int r; int r;
unlink(fname); unlink(fname);
r = brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0); r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0);
r = open_brt(fname, 0, 1, &t, nodesize, ct, NULL_TXN, toku_default_compare_fun, (DB*)0); assert(r==0); r = open_brt(fname, 0, 1, &t, nodesize, ct, NULL_TXN, toku_default_compare_fun, (DB*)0); assert(r==0);
} }
......
...@@ -147,33 +147,33 @@ struct brt_cursor { ...@@ -147,33 +147,33 @@ struct brt_cursor {
}; };
/* print the cursor path */ /* print the cursor path */
void brt_cursor_print(BRT_CURSOR cursor); void toku_brt_cursor_print(BRT_CURSOR cursor);
/* is the cursor path empty? */ /* is the cursor path empty? */
static inline int brt_cursor_path_empty(BRT_CURSOR cursor) { static inline int toku_brt_cursor_path_empty(BRT_CURSOR cursor) {
return cursor->path_len == 0; return cursor->path_len == 0;
} }
/*is the cursor path full? */ /*is the cursor path full? */
static inline int brt_cursor_path_full(BRT_CURSOR cursor) { static inline int toku_brt_cursor_path_full(BRT_CURSOR cursor) {
return cursor->path_len == CURSOR_PATHLEN_LIMIT; return cursor->path_len == CURSOR_PATHLEN_LIMIT;
} }
static inline int brt_cursor_active(BRT_CURSOR cursor) { static inline int toku_brt_cursor_active(BRT_CURSOR cursor) {
return cursor->path_len > 0; return cursor->path_len > 0;
} }
/* brt has a new root. add the root to this cursor. */ /* brt has a new root. add the root to this cursor. */
void brt_cursor_new_root(BRT_CURSOR cursor, BRT t, BRTNODE newroot, BRTNODE left, BRTNODE right); void toku_brt_cursor_new_root(BRT_CURSOR cursor, BRT t, BRTNODE newroot, BRTNODE left, BRTNODE right);
/* a brt leaf has split. modify this cursor if it includes the old node in its path. */ /* a brt leaf has split. modify this cursor if it includes the old node in its path. */
void brt_cursor_leaf_split(BRT_CURSOR cursor, BRT t, BRTNODE oldnode, BRTNODE left, BRTNODE right); void toku_brt_cursor_leaf_split(BRT_CURSOR cursor, BRT t, BRTNODE oldnode, BRTNODE left, BRTNODE right);
/* a brt internal node has expanded. modify this cursor if it includes the old node in its path. */ /* a brt internal node has expanded. modify this cursor if it includes the old node in its path. */
void brt_cursor_nonleaf_expand(BRT_CURSOR cursor, BRT t, BRTNODE oldnode, int childnum, BRTNODE left, BRTNODE right); void toku_brt_cursor_nonleaf_expand(BRT_CURSOR cursor, BRT t, BRTNODE oldnode, int childnum, BRTNODE left, BRTNODE right);
/* a brt internal node has split. modify this cursor if it includes the old node in its path. */ /* a brt internal node has split. modify this cursor if it includes the old node in its path. */
void brt_cursor_nonleaf_split(BRT_CURSOR cursor, BRT t, BRTNODE oldnode, BRTNODE left, BRTNODE right); void toku_brt_cursor_nonleaf_split(BRT_CURSOR cursor, BRT t, BRTNODE oldnode, BRTNODE left, BRTNODE right);
void brt_update_cursors_new_root(BRT t, BRTNODE newroot, BRTNODE left, BRTNODE right); void brt_update_cursors_new_root(BRT t, BRTNODE newroot, BRTNODE left, BRTNODE right);
void brt_update_cursors_leaf_split(BRT t, BRTNODE oldnode, BRTNODE left, BRTNODE right); void brt_update_cursors_leaf_split(BRT t, BRTNODE oldnode, BRTNODE left, BRTNODE right);
......
...@@ -27,7 +27,7 @@ static void test0 (void) { ...@@ -27,7 +27,7 @@ static void test0 (void) {
printf("%s:%d test0\n", __FILE__, __LINE__); printf("%s:%d test0\n", __FILE__, __LINE__);
memory_check=1; memory_check=1;
memory_check_all_free(); memory_check_all_free();
r = brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER);
assert(r==0); assert(r==0);
printf("%s:%d test0\n", __FILE__, __LINE__); printf("%s:%d test0\n", __FILE__, __LINE__);
unlink(fname); unlink(fname);
...@@ -50,7 +50,7 @@ static void test1 (void) { ...@@ -50,7 +50,7 @@ static void test1 (void) {
DBT k,v; DBT k,v;
memory_check=1; memory_check=1;
memory_check_all_free(); memory_check_all_free();
r = brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER);
assert(r==0); assert(r==0);
unlink(fname); unlink(fname);
r = open_brt(fname, 0, 1, &t, 1024, ct, null_txn, toku_default_compare_fun, null_db); r = open_brt(fname, 0, 1, &t, 1024, ct, null_txn, toku_default_compare_fun, null_db);
...@@ -77,7 +77,7 @@ static void test2 (int memcheck) { ...@@ -77,7 +77,7 @@ static void test2 (int memcheck) {
memory_check=memcheck; memory_check=memcheck;
printf("%s:%d checking\n", __FILE__, __LINE__); printf("%s:%d checking\n", __FILE__, __LINE__);
memory_check_all_free(); memory_check_all_free();
r = brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0); r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0);
unlink(fname); unlink(fname);
r = open_brt(fname, 0, 1, &t, 1024, ct, null_txn, toku_default_compare_fun, null_db); r = open_brt(fname, 0, 1, &t, 1024, ct, null_txn, toku_default_compare_fun, null_db);
printf("%s:%d did setup\n", __FILE__, __LINE__); printf("%s:%d did setup\n", __FILE__, __LINE__);
...@@ -115,7 +115,7 @@ static void test3 (int nodesize, int count, int memcheck) { ...@@ -115,7 +115,7 @@ static void test3 (int nodesize, int count, int memcheck) {
char fname[]="testbrt.brt"; char fname[]="testbrt.brt";
memory_check=memcheck; memory_check=memcheck;
memory_check_all_free(); memory_check_all_free();
r = brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0); r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0);
gettimeofday(&t0, 0); gettimeofday(&t0, 0);
unlink(fname); unlink(fname);
r = open_brt(fname, 0, 1, &t, nodesize, ct, null_txn, toku_default_compare_fun, null_db); r = open_brt(fname, 0, 1, &t, nodesize, ct, null_txn, toku_default_compare_fun, null_db);
...@@ -148,7 +148,7 @@ static void test4 (int nodesize, int count, int memcheck) { ...@@ -148,7 +148,7 @@ static void test4 (int nodesize, int count, int memcheck) {
unlink(fname); unlink(fname);
memory_check=memcheck; memory_check=memcheck;
memory_check_all_free(); memory_check_all_free();
r = brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0); r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0);
r = open_brt(fname, 0, 1, &t, nodesize, ct, null_txn, toku_default_compare_fun, null_db); assert(r==0); r = open_brt(fname, 0, 1, &t, nodesize, ct, null_txn, toku_default_compare_fun, null_db); assert(r==0);
for (i=0; i<count; i++) { for (i=0; i<count; i++) {
char key[100],val[100]; char key[100],val[100];
...@@ -180,7 +180,7 @@ static void test5 (void) { ...@@ -180,7 +180,7 @@ static void test5 (void) {
MALLOC_N(limit,values); MALLOC_N(limit,values);
for (i=0; i<limit; i++) values[i]=-1; for (i=0; i<limit; i++) values[i]=-1;
unlink(fname); unlink(fname);
r = brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0); r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0);
r = open_brt(fname, 0, 1, &t, 1<<12, ct, null_txn, toku_default_compare_fun, null_db); assert(r==0); r = open_brt(fname, 0, 1, &t, 1<<12, ct, null_txn, toku_default_compare_fun, null_db); assert(r==0);
for (i=0; i<limit/2; i++) { for (i=0; i<limit/2; i++) {
char key[100],val[100]; char key[100],val[100];
...@@ -221,7 +221,7 @@ static void test_dump_empty_db (void) { ...@@ -221,7 +221,7 @@ static void test_dump_empty_db (void) {
int r; int r;
char fname[]="testbrt.brt"; char fname[]="testbrt.brt";
memory_check=1; memory_check=1;
r = brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER);
assert(r==0); assert(r==0);
unlink(fname); unlink(fname);
r = open_brt(fname, 0, 1, &t, 1024, ct, null_txn, toku_default_compare_fun, null_db); r = open_brt(fname, 0, 1, &t, 1024, ct, null_txn, toku_default_compare_fun, null_db);
...@@ -243,7 +243,7 @@ static void test_multiple_files_of_size (int size) { ...@@ -243,7 +243,7 @@ static void test_multiple_files_of_size (int size) {
unlink(n0); unlink(n0);
unlink(n1); unlink(n1);
memory_check_all_free(); memory_check_all_free();
r = brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0); r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0);
r = open_brt(n0, 0, 1, &t0, size, ct, null_txn, toku_default_compare_fun, null_db); assert(r==0); r = open_brt(n0, 0, 1, &t0, size, ct, null_txn, toku_default_compare_fun, null_db); assert(r==0);
r = open_brt(n1, 0, 1, &t1, size, ct, null_txn, toku_default_compare_fun, null_db); assert(r==0); r = open_brt(n1, 0, 1, &t1, size, ct, null_txn, toku_default_compare_fun, null_db); assert(r==0);
for (i=0; i<10000; i++) { for (i=0; i<10000; i++) {
...@@ -267,7 +267,7 @@ static void test_multiple_files_of_size (int size) { ...@@ -267,7 +267,7 @@ static void test_multiple_files_of_size (int size) {
memory_check_all_free(); memory_check_all_free();
/* Now see if the data is all there. */ /* Now see if the data is all there. */
r = brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0); r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0);
r = open_brt(n0, 0, 0, &t0, 1<<12, ct, null_txn, toku_default_compare_fun, null_db); r = open_brt(n0, 0, 0, &t0, 1<<12, ct, null_txn, toku_default_compare_fun, null_db);
printf("%s:%d r=%d\n", __FILE__, __LINE__,r); printf("%s:%d r=%d\n", __FILE__, __LINE__,r);
assert(r==0); assert(r==0);
...@@ -312,7 +312,7 @@ static void test_named_db (void) { ...@@ -312,7 +312,7 @@ static void test_named_db (void) {
unlink(n0); unlink(n0);
unlink(n1); unlink(n1);
memory_check_all_free(); memory_check_all_free();
r = brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0); r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0);
r = open_brt(n0, "db1", 1, &t0, 1<<12, ct, null_txn, toku_default_compare_fun, null_db); assert(r==0); r = open_brt(n0, "db1", 1, &t0, 1<<12, ct, null_txn, toku_default_compare_fun, null_db); assert(r==0);
...@@ -323,7 +323,7 @@ static void test_named_db (void) { ...@@ -323,7 +323,7 @@ static void test_named_db (void) {
memory_check_all_free(); memory_check_all_free();
memory_check_all_free(); memory_check_all_free();
r = brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0); r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0);
r = open_brt(n0, "db1", 0, &t0, 1<<12, ct, null_txn, toku_default_compare_fun, null_db); assert(r==0); r = open_brt(n0, "db1", 0, &t0, 1<<12, ct, null_txn, toku_default_compare_fun, null_db); assert(r==0);
{ {
...@@ -349,7 +349,7 @@ static void test_multiple_dbs (void) { ...@@ -349,7 +349,7 @@ static void test_multiple_dbs (void) {
unlink(n0); unlink(n0);
unlink(n1); unlink(n1);
memory_check_all_free(); memory_check_all_free();
r = brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0); r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0);
r = open_brt(n0, "db1", 1, &t0, 1<<12, ct, null_txn, toku_default_compare_fun, null_db); assert(r==0); r = open_brt(n0, "db1", 1, &t0, 1<<12, ct, null_txn, toku_default_compare_fun, null_db); assert(r==0);
r = open_brt(n1, "db2", 1, &t1, 1<<12, ct, null_txn, toku_default_compare_fun, null_db); assert(r==0); r = open_brt(n1, "db2", 1, &t1, 1<<12, ct, null_txn, toku_default_compare_fun, null_db); assert(r==0);
...@@ -362,7 +362,7 @@ static void test_multiple_dbs (void) { ...@@ -362,7 +362,7 @@ static void test_multiple_dbs (void) {
memory_check_all_free(); memory_check_all_free();
r = brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0); r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0);
r = open_brt(n0, "db1", 0, &t0, 1<<12, ct, null_txn, toku_default_compare_fun, null_db); assert(r==0); r = open_brt(n0, "db1", 0, &t0, 1<<12, ct, null_txn, toku_default_compare_fun, null_db); assert(r==0);
r = open_brt(n1, "db2", 0, &t1, 1<<12, ct, null_txn, toku_default_compare_fun, null_db); assert(r==0); r = open_brt(n1, "db2", 0, &t1, 1<<12, ct, null_txn, toku_default_compare_fun, null_db); assert(r==0);
...@@ -402,7 +402,7 @@ static void test_multiple_dbs_many (void) { ...@@ -402,7 +402,7 @@ static void test_multiple_dbs_many (void) {
printf("test_multiple_dbs_many:\n"); printf("test_multiple_dbs_many:\n");
memory_check_all_free(); memory_check_all_free();
unlink(name); unlink(name);
r = brt_create_cachetable(&ct, MANYN+4, ZERO_LSN, NULL_LOGGER); assert(r==0); r = toku_brt_create_cachetable(&ct, MANYN+4, ZERO_LSN, NULL_LOGGER); assert(r==0);
for (i=0; i<MANYN; i++) { for (i=0; i<MANYN; i++) {
char dbname[20]; char dbname[20];
snprintf(dbname, 20, "db%d", i); snprintf(dbname, 20, "db%d", i);
...@@ -433,7 +433,7 @@ static void test_multiple_brts_one_db_one_file (void) { ...@@ -433,7 +433,7 @@ static void test_multiple_brts_one_db_one_file (void) {
printf("test_multiple_brts_one_db_one_file:"); printf("test_multiple_brts_one_db_one_file:");
memory_check_all_free(); memory_check_all_free();
unlink(name); unlink(name);
r = brt_create_cachetable(&ct, 32, ZERO_LSN, NULL_LOGGER); assert(r==0); r = toku_brt_create_cachetable(&ct, 32, ZERO_LSN, NULL_LOGGER); assert(r==0);
for (i=0; i<MANYN; i++) { for (i=0; i<MANYN; i++) {
r = open_brt(name, 0, (i==0), &trees[i], 1<<12, ct, null_txn, toku_default_compare_fun, null_db); r = open_brt(name, 0, (i==0), &trees[i], 1<<12, ct, null_txn, toku_default_compare_fun, null_db);
assert(r==0); assert(r==0);
...@@ -477,7 +477,7 @@ static void test_read_what_was_written (void) { ...@@ -477,7 +477,7 @@ static void test_read_what_was_written (void) {
unlink(n); unlink(n);
memory_check_all_free(); memory_check_all_free();
r = brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0); r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0);
r = open_brt(n, 0, 1, &brt, 1<<12, ct, null_txn, toku_default_compare_fun, null_db); assert(r==0); r = open_brt(n, 0, 1, &brt, 1<<12, ct, null_txn, toku_default_compare_fun, null_db); assert(r==0);
r = close_brt(brt); assert(r==0); r = close_brt(brt); assert(r==0);
r = toku_cachetable_close(&ct); assert(r==0); r = toku_cachetable_close(&ct); assert(r==0);
...@@ -485,7 +485,7 @@ static void test_read_what_was_written (void) { ...@@ -485,7 +485,7 @@ static void test_read_what_was_written (void) {
memory_check_all_free(); memory_check_all_free();
/* Now see if we can read an empty tree in. */ /* Now see if we can read an empty tree in. */
r = brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0); r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0);
r = open_brt(n, 0, 0, &brt, 1<<12, ct, null_txn, toku_default_compare_fun, null_db); assert(r==0); r = open_brt(n, 0, 0, &brt, 1<<12, ct, null_txn, toku_default_compare_fun, null_db); assert(r==0);
/* See if we can put something in it. */ /* See if we can put something in it. */
...@@ -500,7 +500,7 @@ static void test_read_what_was_written (void) { ...@@ -500,7 +500,7 @@ static void test_read_what_was_written (void) {
memory_check_all_free(); memory_check_all_free();
/* Now see if we can read it in and get the value. */ /* Now see if we can read it in and get the value. */
r = brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0); r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0);
r = open_brt(n, 0, 0, &brt, 1<<12, ct, null_txn, toku_default_compare_fun, null_db); assert(r==0); r = open_brt(n, 0, 0, &brt, 1<<12, ct, null_txn, toku_default_compare_fun, null_db); assert(r==0);
{ {
...@@ -576,7 +576,7 @@ static void test_read_what_was_written (void) { ...@@ -576,7 +576,7 @@ static void test_read_what_was_written (void) {
memory_check_all_free(); memory_check_all_free();
r = brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0); r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0);
r = open_brt(n, 0, 0, &brt, 1<<12, ct, null_txn, toku_default_compare_fun, null_db); assert(r==0); r = open_brt(n, 0, 0, &brt, 1<<12, ct, null_txn, toku_default_compare_fun, null_db); assert(r==0);
{ {
...@@ -623,19 +623,19 @@ void test_cursor_last_empty(void) { ...@@ -623,19 +623,19 @@ void test_cursor_last_empty(void) {
unlink(n); unlink(n);
memory_check_all_free(); memory_check_all_free();
//printf("%s:%d %d alloced\n", __FILE__, __LINE__, get_n_items_malloced()); print_malloced_items(); //printf("%s:%d %d alloced\n", __FILE__, __LINE__, get_n_items_malloced()); print_malloced_items();
r = brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0); r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0);
//printf("%s:%d %d alloced\n", __FILE__, __LINE__, get_n_items_malloced()); print_malloced_items(); //printf("%s:%d %d alloced\n", __FILE__, __LINE__, get_n_items_malloced()); print_malloced_items();
r = open_brt(n, 0, 1, &brt, 1<<12, ct, null_txn, toku_default_compare_fun, null_db); assert(r==0); r = open_brt(n, 0, 1, &brt, 1<<12, ct, null_txn, toku_default_compare_fun, null_db); assert(r==0);
//printf("%s:%d %d alloced\n", __FILE__, __LINE__, get_n_items_malloced()); print_malloced_items(); //printf("%s:%d %d alloced\n", __FILE__, __LINE__, get_n_items_malloced()); print_malloced_items();
r = brt_cursor(brt, &cursor); assert(r==0); r = toku_brt_cursor(brt, &cursor); assert(r==0);
init_dbt(&kbt); init_dbt(&kbt);
//printf("%s:%d %d alloced\n", __FILE__, __LINE__, get_n_items_malloced()); print_malloced_items(); //printf("%s:%d %d alloced\n", __FILE__, __LINE__, get_n_items_malloced()); print_malloced_items();
init_dbt(&vbt); init_dbt(&vbt);
//printf("%s:%d %d alloced\n", __FILE__, __LINE__, get_n_items_malloced()); print_malloced_items(); //printf("%s:%d %d alloced\n", __FILE__, __LINE__, get_n_items_malloced()); print_malloced_items();
r = brt_cursor_get(cursor, &kbt, &vbt, DB_LAST, null_txn); r = toku_brt_cursor_get(cursor, &kbt, &vbt, DB_LAST, null_txn);
//printf("%s:%d %d alloced\n", __FILE__, __LINE__, get_n_items_malloced()); print_malloced_items(); //printf("%s:%d %d alloced\n", __FILE__, __LINE__, get_n_items_malloced()); print_malloced_items();
assert(r==DB_NOTFOUND); assert(r==DB_NOTFOUND);
r = brt_cursor_get(cursor, &kbt, &vbt, DB_FIRST, null_txn); r = toku_brt_cursor_get(cursor, &kbt, &vbt, DB_FIRST, null_txn);
//printf("%s:%d %d alloced\n", __FILE__, __LINE__, get_n_items_malloced()); print_malloced_items(); //printf("%s:%d %d alloced\n", __FILE__, __LINE__, get_n_items_malloced()); print_malloced_items();
assert(r==DB_NOTFOUND); assert(r==DB_NOTFOUND);
r = close_brt(brt); r = close_brt(brt);
...@@ -655,22 +655,22 @@ void test_cursor_next (void) { ...@@ -655,22 +655,22 @@ void test_cursor_next (void) {
unlink(n); unlink(n);
memory_check_all_free(); memory_check_all_free();
r = brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0); r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0);
//printf("%s:%d %d alloced\n", __FILE__, __LINE__, get_n_items_malloced()); print_malloced_items(); //printf("%s:%d %d alloced\n", __FILE__, __LINE__, get_n_items_malloced()); print_malloced_items();
r = open_brt(n, 0, 1, &brt, 1<<12, ct, null_txn, toku_default_compare_fun, null_db); assert(r==0); r = open_brt(n, 0, 1, &brt, 1<<12, ct, null_txn, toku_default_compare_fun, null_db); assert(r==0);
//printf("%s:%d %d alloced\n", __FILE__, __LINE__, get_n_items_malloced()); print_malloced_items(); //printf("%s:%d %d alloced\n", __FILE__, __LINE__, get_n_items_malloced()); print_malloced_items();
r = brt_insert(brt, fill_dbt(&kbt, "hello", 6), fill_dbt(&vbt, "there", 6), null_txn); r = brt_insert(brt, fill_dbt(&kbt, "hello", 6), fill_dbt(&vbt, "there", 6), null_txn);
r = brt_insert(brt, fill_dbt(&kbt, "byebye", 7), fill_dbt(&vbt, "byenow", 7), null_txn); r = brt_insert(brt, fill_dbt(&kbt, "byebye", 7), fill_dbt(&vbt, "byenow", 7), null_txn);
printf("%s:%d calling brt_cursor(...)\n", __FILE__, __LINE__); printf("%s:%d calling toku_brt_cursor(...)\n", __FILE__, __LINE__);
r = brt_cursor(brt, &cursor); assert(r==0); r = toku_brt_cursor(brt, &cursor); assert(r==0);
init_dbt(&kbt); init_dbt(&kbt);
//printf("%s:%d %d alloced\n", __FILE__, __LINE__, get_n_items_malloced()); print_malloced_items(); //printf("%s:%d %d alloced\n", __FILE__, __LINE__, get_n_items_malloced()); print_malloced_items();
init_dbt(&vbt); init_dbt(&vbt);
//printf("%s:%d %d alloced\n", __FILE__, __LINE__, get_n_items_malloced()); print_malloced_items(); //printf("%s:%d %d alloced\n", __FILE__, __LINE__, get_n_items_malloced()); print_malloced_items();
printf("%s:%d calling brt_cursor_get(...)\n", __FILE__, __LINE__); printf("%s:%d calling toku_brt_cursor_get(...)\n", __FILE__, __LINE__);
r = brt_cursor_get(cursor, &kbt, &vbt, DB_NEXT, null_txn); r = toku_brt_cursor_get(cursor, &kbt, &vbt, DB_NEXT, null_txn);
printf("%s:%d called brt_cursor_get(...)\n", __FILE__, __LINE__); printf("%s:%d called toku_brt_cursor_get(...)\n", __FILE__, __LINE__);
//printf("%s:%d %d alloced\n", __FILE__, __LINE__, get_n_items_malloced()); print_malloced_items(); //printf("%s:%d %d alloced\n", __FILE__, __LINE__, get_n_items_malloced()); print_malloced_items();
assert(r==0); assert(r==0);
assert(kbt.size==7); assert(kbt.size==7);
...@@ -678,14 +678,14 @@ void test_cursor_next (void) { ...@@ -678,14 +678,14 @@ void test_cursor_next (void) {
assert(vbt.size==7); assert(vbt.size==7);
assert(memcmp(vbt.data, "byenow", 7)==0); assert(memcmp(vbt.data, "byenow", 7)==0);
r = brt_cursor_get(cursor, &kbt, &vbt, DB_NEXT, null_txn); r = toku_brt_cursor_get(cursor, &kbt, &vbt, DB_NEXT, null_txn);
assert(r==0); assert(r==0);
assert(kbt.size==6); assert(kbt.size==6);
assert(memcmp(kbt.data, "hello", 6)==0); assert(memcmp(kbt.data, "hello", 6)==0);
assert(vbt.size==6); assert(vbt.size==6);
assert(memcmp(vbt.data, "there", 6)==0); assert(memcmp(vbt.data, "there", 6)==0);
r = brt_cursor_get(cursor, &kbt, &vbt, DB_NEXT, null_txn); r = toku_brt_cursor_get(cursor, &kbt, &vbt, DB_NEXT, null_txn);
assert(r==DB_NOTFOUND); assert(r==DB_NOTFOUND);
r = close_brt(brt); r = close_brt(brt);
...@@ -733,7 +733,7 @@ static void test_wrongendian_compare (int wrong_p, unsigned int N) { ...@@ -733,7 +733,7 @@ static void test_wrongendian_compare (int wrong_p, unsigned int N) {
assert(wrong_compare_fun(&nonce_db, fill_dbt(&at, b, 4), fill_dbt(&bt, a, 4))<0); assert(wrong_compare_fun(&nonce_db, fill_dbt(&at, b, 4), fill_dbt(&bt, a, 4))<0);
} }
r = brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0); r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0);
//printf("%s:%d WRONG=%d\n", __FILE__, __LINE__, wrong_p); //printf("%s:%d WRONG=%d\n", __FILE__, __LINE__, wrong_p);
if (0) { // ???? Why is this commented out? if (0) { // ???? Why is this commented out?
...@@ -752,11 +752,11 @@ static void test_wrongendian_compare (int wrong_p, unsigned int N) { ...@@ -752,11 +752,11 @@ static void test_wrongendian_compare (int wrong_p, unsigned int N) {
r = brt_insert(brt, &kbt, &vbt, null_txn); r = brt_insert(brt, &kbt, &vbt, null_txn);
assert(r==0); assert(r==0);
} }
r = brt_cursor(brt, &cursor); assert(r==0); r = toku_brt_cursor(brt, &cursor); assert(r==0);
for (i=0; i<2; i++) { for (i=0; i<2; i++) {
init_dbt(&kbt); init_dbt(&vbt); init_dbt(&kbt); init_dbt(&vbt);
r = brt_cursor_get(cursor, &kbt, &vbt, DB_NEXT, null_txn); r = toku_brt_cursor_get(cursor, &kbt, &vbt, DB_NEXT, null_txn);
assert(r==0); assert(r==0);
assert(kbt.size==4 && vbt.size==4); assert(kbt.size==4 && vbt.size==4);
printf("%s:%d %02x%02x%02x%02x -> %02x%02x%02x%02x\n", __FILE__, __LINE__, printf("%s:%d %02x%02x%02x%02x -> %02x%02x%02x%02x\n", __FILE__, __LINE__,
...@@ -788,13 +788,13 @@ static void test_wrongendian_compare (int wrong_p, unsigned int N) { ...@@ -788,13 +788,13 @@ static void test_wrongendian_compare (int wrong_p, unsigned int N) {
assert(r==0); assert(r==0);
toku_cachetable_verify(ct); toku_cachetable_verify(ct);
} }
r = brt_cursor(brt, &cursor); assert(r==0); r = toku_brt_cursor(brt, &cursor); assert(r==0);
int prev=-1; int prev=-1;
for (i=0; i<N; i++) { for (i=0; i<N; i++) {
int this; int this;
init_dbt(&kbt); init_dbt(&vbt); init_dbt(&kbt); init_dbt(&vbt);
r = brt_cursor_get(cursor, &kbt, &vbt, DB_NEXT, null_txn); r = toku_brt_cursor_get(cursor, &kbt, &vbt, DB_NEXT, null_txn);
assert(r==0); assert(r==0);
assert(kbt.size==4 && vbt.size==4); assert(kbt.size==4 && vbt.size==4);
if (0) printf("%s:%d %02x%02x%02x%02x -> %02x%02x%02x%02x\n", __FILE__, __LINE__, if (0) printf("%s:%d %02x%02x%02x%02x -> %02x%02x%02x%02x\n", __FILE__, __LINE__,
...@@ -827,15 +827,15 @@ void assert_cursor_notfound(BRT brt, int position) { ...@@ -827,15 +827,15 @@ void assert_cursor_notfound(BRT brt, int position) {
int r; int r;
DBT kbt, vbt; DBT kbt, vbt;
r = brt_cursor(brt, &cursor); r = toku_brt_cursor(brt, &cursor);
assert(r==0); assert(r==0);
init_dbt(&kbt); kbt.flags = DB_DBT_MALLOC; init_dbt(&kbt); kbt.flags = DB_DBT_MALLOC;
init_dbt(&vbt); vbt.flags = DB_DBT_MALLOC; init_dbt(&vbt); vbt.flags = DB_DBT_MALLOC;
r = brt_cursor_get(cursor, &kbt, &vbt, position, null_txn); r = toku_brt_cursor_get(cursor, &kbt, &vbt, position, null_txn);
assert(r == DB_NOTFOUND); assert(r == DB_NOTFOUND);
r = brt_cursor_close(cursor); r = toku_brt_cursor_close(cursor);
assert(r==0); assert(r==0);
} }
...@@ -845,13 +845,13 @@ void assert_cursor_value(BRT brt, int position, long long value) { ...@@ -845,13 +845,13 @@ void assert_cursor_value(BRT brt, int position, long long value) {
DBT kbt, vbt; DBT kbt, vbt;
long long v; long long v;
r = brt_cursor(brt, &cursor); r = toku_brt_cursor(brt, &cursor);
assert(r==0); assert(r==0);
if (test_cursor_debug) printf("key: "); if (test_cursor_debug) printf("key: ");
init_dbt(&kbt); kbt.flags = DB_DBT_MALLOC; init_dbt(&kbt); kbt.flags = DB_DBT_MALLOC;
init_dbt(&vbt); vbt.flags = DB_DBT_MALLOC; init_dbt(&vbt); vbt.flags = DB_DBT_MALLOC;
r = brt_cursor_get(cursor, &kbt, &vbt, position, null_txn); r = toku_brt_cursor_get(cursor, &kbt, &vbt, position, null_txn);
assert(r == 0); assert(r == 0);
if (test_cursor_debug) printf("%s ", (char*)kbt.data); if (test_cursor_debug) printf("%s ", (char*)kbt.data);
assert(vbt.size == sizeof v); assert(vbt.size == sizeof v);
...@@ -861,7 +861,7 @@ void assert_cursor_value(BRT brt, int position, long long value) { ...@@ -861,7 +861,7 @@ void assert_cursor_value(BRT brt, int position, long long value) {
toku_free(vbt.data); toku_free(vbt.data);
if (test_cursor_debug) printf("\n"); if (test_cursor_debug) printf("\n");
r = brt_cursor_close(cursor); r = toku_brt_cursor_close(cursor);
assert(r==0); assert(r==0);
} }
...@@ -871,13 +871,13 @@ void assert_cursor_first_last(BRT brt, long long firstv, long long lastv) { ...@@ -871,13 +871,13 @@ void assert_cursor_first_last(BRT brt, long long firstv, long long lastv) {
DBT kbt, vbt; DBT kbt, vbt;
long long v; long long v;
r = brt_cursor(brt, &cursor); r = toku_brt_cursor(brt, &cursor);
assert(r==0); assert(r==0);
if (test_cursor_debug) printf("first key: "); if (test_cursor_debug) printf("first key: ");
init_dbt(&kbt); kbt.flags = DB_DBT_MALLOC; init_dbt(&kbt); kbt.flags = DB_DBT_MALLOC;
init_dbt(&vbt); vbt.flags = DB_DBT_MALLOC; init_dbt(&vbt); vbt.flags = DB_DBT_MALLOC;
r = brt_cursor_get(cursor, &kbt, &vbt, DB_FIRST, null_txn); r = toku_brt_cursor_get(cursor, &kbt, &vbt, DB_FIRST, null_txn);
assert(r == 0); assert(r == 0);
if (test_cursor_debug) printf("%s ", (char*)kbt.data); if (test_cursor_debug) printf("%s ", (char*)kbt.data);
assert(vbt.size == sizeof v); assert(vbt.size == sizeof v);
...@@ -890,7 +890,7 @@ void assert_cursor_first_last(BRT brt, long long firstv, long long lastv) { ...@@ -890,7 +890,7 @@ void assert_cursor_first_last(BRT brt, long long firstv, long long lastv) {
if (test_cursor_debug) printf("last key:"); if (test_cursor_debug) printf("last key:");
init_dbt(&kbt); kbt.flags = DB_DBT_MALLOC; init_dbt(&kbt); kbt.flags = DB_DBT_MALLOC;
init_dbt(&vbt); vbt.flags = DB_DBT_MALLOC; init_dbt(&vbt); vbt.flags = DB_DBT_MALLOC;
r = brt_cursor_get(cursor, &kbt, &vbt, DB_LAST, null_txn); r = toku_brt_cursor_get(cursor, &kbt, &vbt, DB_LAST, null_txn);
assert(r == 0); assert(r == 0);
if (test_cursor_debug)printf("%s ", (char*)kbt.data); if (test_cursor_debug)printf("%s ", (char*)kbt.data);
assert(vbt.size == sizeof v); assert(vbt.size == sizeof v);
...@@ -900,7 +900,7 @@ void assert_cursor_first_last(BRT brt, long long firstv, long long lastv) { ...@@ -900,7 +900,7 @@ void assert_cursor_first_last(BRT brt, long long firstv, long long lastv) {
toku_free(vbt.data); toku_free(vbt.data);
if (test_cursor_debug) printf("\n"); if (test_cursor_debug) printf("\n");
r = brt_cursor_close(cursor); r = toku_brt_cursor_close(cursor);
assert(r==0); assert(r==0);
} }
...@@ -915,7 +915,7 @@ void test_brt_cursor_first(int n, DB *db) { ...@@ -915,7 +915,7 @@ void test_brt_cursor_first(int n, DB *db) {
unlink(fname); unlink(fname);
r = brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER);
assert(r==0); assert(r==0);
r = open_brt(fname, 0, 1, &brt, 1<<12, ct, null_txn, test_brt_cursor_keycompare, db); r = open_brt(fname, 0, 1, &brt, 1<<12, ct, null_txn, test_brt_cursor_keycompare, db);
...@@ -957,7 +957,7 @@ void test_brt_cursor_last(int n, DB *db) { ...@@ -957,7 +957,7 @@ void test_brt_cursor_last(int n, DB *db) {
unlink(fname); unlink(fname);
r = brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER);
assert(r==0); assert(r==0);
r = open_brt(fname, 0, 1, &brt, 1<<12, ct, null_txn, test_brt_cursor_keycompare, db); r = open_brt(fname, 0, 1, &brt, 1<<12, ct, null_txn, test_brt_cursor_keycompare, db);
...@@ -999,7 +999,7 @@ void test_brt_cursor_first_last(int n, DB *db) { ...@@ -999,7 +999,7 @@ void test_brt_cursor_first_last(int n, DB *db) {
unlink(fname); unlink(fname);
r = brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER);
assert(r==0); assert(r==0);
r = open_brt(fname, 0, 1, &brt, 1<<12, ct, null_txn, test_brt_cursor_keycompare, db); r = open_brt(fname, 0, 1, &brt, 1<<12, ct, null_txn, test_brt_cursor_keycompare, db);
...@@ -1045,7 +1045,7 @@ void test_brt_cursor_rfirst(int n, DB *db) { ...@@ -1045,7 +1045,7 @@ void test_brt_cursor_rfirst(int n, DB *db) {
unlink(fname); unlink(fname);
r = brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER);
assert(r==0); assert(r==0);
r = open_brt(fname, 0, 1, &brt, 1<<12, ct, null_txn, test_brt_cursor_keycompare, db); r = open_brt(fname, 0, 1, &brt, 1<<12, ct, null_txn, test_brt_cursor_keycompare, db);
...@@ -1082,7 +1082,7 @@ void assert_cursor_walk(BRT brt, int n) { ...@@ -1082,7 +1082,7 @@ void assert_cursor_walk(BRT brt, int n) {
int i; int i;
int r; int r;
r = brt_cursor(brt, &cursor); r = toku_brt_cursor(brt, &cursor);
assert(r==0); assert(r==0);
if (test_cursor_debug) printf("key: "); if (test_cursor_debug) printf("key: ");
...@@ -1092,7 +1092,7 @@ void assert_cursor_walk(BRT brt, int n) { ...@@ -1092,7 +1092,7 @@ void assert_cursor_walk(BRT brt, int n) {
init_dbt(&kbt); kbt.flags = DB_DBT_MALLOC; init_dbt(&kbt); kbt.flags = DB_DBT_MALLOC;
init_dbt(&vbt); vbt.flags = DB_DBT_MALLOC; init_dbt(&vbt); vbt.flags = DB_DBT_MALLOC;
r = brt_cursor_get(cursor, &kbt, &vbt, DB_NEXT, null_txn); r = toku_brt_cursor_get(cursor, &kbt, &vbt, DB_NEXT, null_txn);
if (r != 0) if (r != 0)
break; break;
if (test_cursor_debug) printf("%s ", (char*)kbt.data); if (test_cursor_debug) printf("%s ", (char*)kbt.data);
...@@ -1105,7 +1105,7 @@ void assert_cursor_walk(BRT brt, int n) { ...@@ -1105,7 +1105,7 @@ void assert_cursor_walk(BRT brt, int n) {
if (test_cursor_debug) printf("\n"); if (test_cursor_debug) printf("\n");
assert(i == n); assert(i == n);
r = brt_cursor_close(cursor); r = toku_brt_cursor_close(cursor);
assert(r==0); assert(r==0);
} }
...@@ -1120,7 +1120,7 @@ void test_brt_cursor_walk(int n, DB *db) { ...@@ -1120,7 +1120,7 @@ void test_brt_cursor_walk(int n, DB *db) {
unlink(fname); unlink(fname);
r = brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER);
assert(r==0); assert(r==0);
r = open_brt(fname, 0, 1, &brt, 1<<12, ct, null_txn, test_brt_cursor_keycompare, db); r = open_brt(fname, 0, 1, &brt, 1<<12, ct, null_txn, test_brt_cursor_keycompare, db);
...@@ -1155,7 +1155,7 @@ void assert_cursor_rwalk(BRT brt, int n) { ...@@ -1155,7 +1155,7 @@ void assert_cursor_rwalk(BRT brt, int n) {
int i; int i;
int r; int r;
r = brt_cursor(brt, &cursor); r = toku_brt_cursor(brt, &cursor);
assert(r==0); assert(r==0);
if (test_cursor_debug) printf("key: "); if (test_cursor_debug) printf("key: ");
...@@ -1165,7 +1165,7 @@ void assert_cursor_rwalk(BRT brt, int n) { ...@@ -1165,7 +1165,7 @@ void assert_cursor_rwalk(BRT brt, int n) {
init_dbt(&kbt); kbt.flags = DB_DBT_MALLOC; init_dbt(&kbt); kbt.flags = DB_DBT_MALLOC;
init_dbt(&vbt); vbt.flags = DB_DBT_MALLOC; init_dbt(&vbt); vbt.flags = DB_DBT_MALLOC;
r = brt_cursor_get(cursor, &kbt, &vbt, DB_PREV, null_txn); r = toku_brt_cursor_get(cursor, &kbt, &vbt, DB_PREV, null_txn);
if (r != 0) if (r != 0)
break; break;
if (test_cursor_debug) printf("%s ", (char*)kbt.data); if (test_cursor_debug) printf("%s ", (char*)kbt.data);
...@@ -1178,7 +1178,7 @@ void assert_cursor_rwalk(BRT brt, int n) { ...@@ -1178,7 +1178,7 @@ void assert_cursor_rwalk(BRT brt, int n) {
if (test_cursor_debug) printf("\n"); if (test_cursor_debug) printf("\n");
assert(i == -1); assert(i == -1);
r = brt_cursor_close(cursor); r = toku_brt_cursor_close(cursor);
assert(r==0); assert(r==0);
} }
...@@ -1193,7 +1193,7 @@ void test_brt_cursor_rwalk(int n, DB *db) { ...@@ -1193,7 +1193,7 @@ void test_brt_cursor_rwalk(int n, DB *db) {
unlink(fname); unlink(fname);
r = brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER);
assert(r==0); assert(r==0);
r = open_brt(fname, 0, 1, &brt, 1<<12, ct, null_txn, test_brt_cursor_keycompare, db); r = open_brt(fname, 0, 1, &brt, 1<<12, ct, null_txn, test_brt_cursor_keycompare, db);
...@@ -1229,7 +1229,7 @@ void assert_cursor_walk_inorder(BRT brt, int n) { ...@@ -1229,7 +1229,7 @@ void assert_cursor_walk_inorder(BRT brt, int n) {
int r; int r;
char *prevkey; char *prevkey;
r = brt_cursor(brt, &cursor); r = toku_brt_cursor(brt, &cursor);
assert(r==0); assert(r==0);
prevkey = 0; prevkey = 0;
...@@ -1240,7 +1240,7 @@ void assert_cursor_walk_inorder(BRT brt, int n) { ...@@ -1240,7 +1240,7 @@ void assert_cursor_walk_inorder(BRT brt, int n) {
init_dbt(&kbt); kbt.flags = DB_DBT_MALLOC; init_dbt(&kbt); kbt.flags = DB_DBT_MALLOC;
init_dbt(&vbt); vbt.flags = DB_DBT_MALLOC; init_dbt(&vbt); vbt.flags = DB_DBT_MALLOC;
r = brt_cursor_get(cursor, &kbt, &vbt, DB_NEXT, null_txn); r = toku_brt_cursor_get(cursor, &kbt, &vbt, DB_NEXT, null_txn);
if (r != 0) if (r != 0)
break; break;
if (test_cursor_debug) printf("%s ", (char*)kbt.data); if (test_cursor_debug) printf("%s ", (char*)kbt.data);
...@@ -1257,7 +1257,7 @@ void assert_cursor_walk_inorder(BRT brt, int n) { ...@@ -1257,7 +1257,7 @@ void assert_cursor_walk_inorder(BRT brt, int n) {
if (test_cursor_debug) printf("\n"); if (test_cursor_debug) printf("\n");
assert(i == n); assert(i == n);
r = brt_cursor_close(cursor); r = toku_brt_cursor_close(cursor);
assert(r==0); assert(r==0);
} }
...@@ -1272,7 +1272,7 @@ void test_brt_cursor_rand(int n, DB *db) { ...@@ -1272,7 +1272,7 @@ void test_brt_cursor_rand(int n, DB *db) {
unlink(fname); unlink(fname);
r = brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER);
assert(r==0); assert(r==0);
r = open_brt(fname, 0, 1, &brt, 1<<12, ct, null_txn, test_brt_cursor_keycompare, db); r = open_brt(fname, 0, 1, &brt, 1<<12, ct, null_txn, test_brt_cursor_keycompare, db);
...@@ -1325,7 +1325,7 @@ void test_brt_cursor_split(int n, DB *db) { ...@@ -1325,7 +1325,7 @@ void test_brt_cursor_split(int n, DB *db) {
unlink(fname); unlink(fname);
r = brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER);
assert(r==0); assert(r==0);
r = open_brt(fname, 0, 1, &brt, 1<<12, ct, null_txn, test_brt_cursor_keycompare, db); r = open_brt(fname, 0, 1, &brt, 1<<12, ct, null_txn, test_brt_cursor_keycompare, db);
...@@ -1343,14 +1343,14 @@ void test_brt_cursor_split(int n, DB *db) { ...@@ -1343,14 +1343,14 @@ void test_brt_cursor_split(int n, DB *db) {
assert(r==0); assert(r==0);
} }
r = brt_cursor(brt, &cursor); r = toku_brt_cursor(brt, &cursor);
assert(r==0); assert(r==0);
if (test_cursor_debug) printf("key: "); if (test_cursor_debug) printf("key: ");
for (i=0; i<n/2; i++) { for (i=0; i<n/2; i++) {
init_dbt(&kbt); kbt.flags = DB_DBT_MALLOC; init_dbt(&kbt); kbt.flags = DB_DBT_MALLOC;
init_dbt(&vbt); vbt.flags = DB_DBT_MALLOC; init_dbt(&vbt); vbt.flags = DB_DBT_MALLOC;
r = brt_cursor_get(cursor, &kbt, &vbt, DB_NEXT, null_txn); r = toku_brt_cursor_get(cursor, &kbt, &vbt, DB_NEXT, null_txn);
assert(r==0); assert(r==0);
if (test_cursor_debug) printf("%s ", (char*)kbt.data); if (test_cursor_debug) printf("%s ", (char*)kbt.data);
toku_free(kbt.data); toku_free(kbt.data);
...@@ -1373,7 +1373,7 @@ void test_brt_cursor_split(int n, DB *db) { ...@@ -1373,7 +1373,7 @@ void test_brt_cursor_split(int n, DB *db) {
for (;;) { for (;;) {
init_dbt(&kbt); kbt.flags = DB_DBT_MALLOC; init_dbt(&kbt); kbt.flags = DB_DBT_MALLOC;
init_dbt(&vbt); vbt.flags = DB_DBT_MALLOC; init_dbt(&vbt); vbt.flags = DB_DBT_MALLOC;
r = brt_cursor_get(cursor, &kbt, &vbt, DB_NEXT, null_txn); r = toku_brt_cursor_get(cursor, &kbt, &vbt, DB_NEXT, null_txn);
if (r != 0) if (r != 0)
break; break;
if (test_cursor_debug) printf("%s ", (char*)kbt.data); if (test_cursor_debug) printf("%s ", (char*)kbt.data);
...@@ -1382,7 +1382,7 @@ void test_brt_cursor_split(int n, DB *db) { ...@@ -1382,7 +1382,7 @@ void test_brt_cursor_split(int n, DB *db) {
} }
if (test_cursor_debug) printf("\n"); if (test_cursor_debug) printf("\n");
r = brt_cursor_close(cursor); r = toku_brt_cursor_close(cursor);
assert(r==0); assert(r==0);
r = close_brt(brt); r = close_brt(brt);
...@@ -1403,7 +1403,7 @@ void test_multiple_brt_cursors(int n, DB *db) { ...@@ -1403,7 +1403,7 @@ void test_multiple_brt_cursors(int n, DB *db) {
unlink(fname); unlink(fname);
r = brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER);
assert(r==0); assert(r==0);
r = open_brt(fname, 0, 1, &brt, 1<<12, ct, null_txn, test_brt_cursor_keycompare, db); r = open_brt(fname, 0, 1, &brt, 1<<12, ct, null_txn, test_brt_cursor_keycompare, db);
...@@ -1411,12 +1411,12 @@ void test_multiple_brt_cursors(int n, DB *db) { ...@@ -1411,12 +1411,12 @@ void test_multiple_brt_cursors(int n, DB *db) {
int i; int i;
for (i=0; i<n; i++) { for (i=0; i<n; i++) {
r = brt_cursor(brt, &cursors[i]); r = toku_brt_cursor(brt, &cursors[i]);
assert(r == 0); assert(r == 0);
} }
for (i=0; i<n; i++) { for (i=0; i<n; i++) {
r = brt_cursor_close(cursors[i]); r = toku_brt_cursor_close(cursors[i]);
assert(r == 0); assert(r == 0);
} }
...@@ -1453,7 +1453,7 @@ void test_multiple_brt_cursor_walk(int n, DB *db) { ...@@ -1453,7 +1453,7 @@ void test_multiple_brt_cursor_walk(int n, DB *db) {
int nodesize = 1<<12; int nodesize = 1<<12;
int h = log16(n); int h = log16(n);
int cachesize = 2 * h * ncursors * nodesize; int cachesize = 2 * h * ncursors * nodesize;
r = brt_create_cachetable(&ct, cachesize, ZERO_LSN, NULL_LOGGER); r = toku_brt_create_cachetable(&ct, cachesize, ZERO_LSN, NULL_LOGGER);
assert(r==0); assert(r==0);
r = open_brt(fname, 0, 1, &brt, 1<<12, ct, null_txn, test_brt_cursor_keycompare, db); r = open_brt(fname, 0, 1, &brt, 1<<12, ct, null_txn, test_brt_cursor_keycompare, db);
...@@ -1462,7 +1462,7 @@ void test_multiple_brt_cursor_walk(int n, DB *db) { ...@@ -1462,7 +1462,7 @@ void test_multiple_brt_cursor_walk(int n, DB *db) {
int c; int c;
/* create the cursors */ /* create the cursors */
for (c=0; c<ncursors; c++) { for (c=0; c<ncursors; c++) {
r = brt_cursor(brt, &cursors[c]); r = toku_brt_cursor(brt, &cursors[c]);
assert(r == 0); assert(r == 0);
} }
...@@ -1484,7 +1484,7 @@ void test_multiple_brt_cursor_walk(int n, DB *db) { ...@@ -1484,7 +1484,7 @@ void test_multiple_brt_cursor_walk(int n, DB *db) {
c = i / cursor_gap; c = i / cursor_gap;
init_dbt(&key); key.flags = DB_DBT_MALLOC; init_dbt(&key); key.flags = DB_DBT_MALLOC;
init_dbt(&val); val.flags = DB_DBT_MALLOC; init_dbt(&val); val.flags = DB_DBT_MALLOC;
r = brt_cursor_get(cursors[c], &key, &val, DB_LAST, null_txn); r = toku_brt_cursor_get(cursors[c], &key, &val, DB_LAST, null_txn);
assert(r == 0); assert(r == 0);
toku_free(key.data); toku_free(key.data);
toku_free(val.data); toku_free(val.data);
...@@ -1496,7 +1496,7 @@ void test_multiple_brt_cursor_walk(int n, DB *db) { ...@@ -1496,7 +1496,7 @@ void test_multiple_brt_cursor_walk(int n, DB *db) {
for (c=0; c<ncursors; c++) { for (c=0; c<ncursors; c++) {
init_dbt(&key); key.flags = DB_DBT_MALLOC; init_dbt(&key); key.flags = DB_DBT_MALLOC;
init_dbt(&val); val.flags = DB_DBT_MALLOC; init_dbt(&val); val.flags = DB_DBT_MALLOC;
r = brt_cursor_get(cursors[c], &key, &val, DB_NEXT, null_txn); r = toku_brt_cursor_get(cursors[c], &key, &val, DB_NEXT, null_txn);
if (r == DB_NOTFOUND) { if (r == DB_NOTFOUND) {
/* we already consumed 1 previously */ /* we already consumed 1 previously */
assert(i == cursor_gap-1); assert(i == cursor_gap-1);
...@@ -1513,7 +1513,7 @@ void test_multiple_brt_cursor_walk(int n, DB *db) { ...@@ -1513,7 +1513,7 @@ void test_multiple_brt_cursor_walk(int n, DB *db) {
} }
for (i=0; i<ncursors; i++) { for (i=0; i<ncursors; i++) {
r = brt_cursor_close(cursors[i]); r = toku_brt_cursor_close(cursors[i]);
assert(r == 0); assert(r == 0);
} }
...@@ -1535,7 +1535,7 @@ void test_brt_cursor_set(int n, int cursor_op, DB *db) { ...@@ -1535,7 +1535,7 @@ void test_brt_cursor_set(int n, int cursor_op, DB *db) {
unlink(fname); unlink(fname);
r = brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER);
assert(r==0); assert(r==0);
r = open_brt(fname, 0, 1, &brt, 1<<12, ct, null_txn, test_brt_cursor_keycompare, db); r = open_brt(fname, 0, 1, &brt, 1<<12, ct, null_txn, test_brt_cursor_keycompare, db);
...@@ -1555,7 +1555,7 @@ void test_brt_cursor_set(int n, int cursor_op, DB *db) { ...@@ -1555,7 +1555,7 @@ void test_brt_cursor_set(int n, int cursor_op, DB *db) {
assert(r == 0); assert(r == 0);
} }
r = brt_cursor(brt, &cursor); r = toku_brt_cursor(brt, &cursor);
assert(r==0); assert(r==0);
/* set cursor to random keys in set { 0, 10, 20, .. 10*(n-1) } */ /* set cursor to random keys in set { 0, 10, 20, .. 10*(n-1) } */
...@@ -1566,7 +1566,7 @@ void test_brt_cursor_set(int n, int cursor_op, DB *db) { ...@@ -1566,7 +1566,7 @@ void test_brt_cursor_set(int n, int cursor_op, DB *db) {
k = htonl(v); k = htonl(v);
fill_dbt(&key, &k, sizeof k); fill_dbt(&key, &k, sizeof k);
init_dbt(&val); val.flags = DB_DBT_MALLOC; init_dbt(&val); val.flags = DB_DBT_MALLOC;
r = brt_cursor_get(cursor, &key, &val, cursor_op, null_txn); r = toku_brt_cursor_get(cursor, &key, &val, cursor_op, null_txn);
assert(r == 0); assert(r == 0);
assert(val.size == sizeof vv); assert(val.size == sizeof vv);
memcpy(&vv, val.data, val.size); memcpy(&vv, val.data, val.size);
...@@ -1582,12 +1582,12 @@ void test_brt_cursor_set(int n, int cursor_op, DB *db) { ...@@ -1582,12 +1582,12 @@ void test_brt_cursor_set(int n, int cursor_op, DB *db) {
k = htonl(i); k = htonl(i);
fill_dbt(&key, &k, sizeof k); fill_dbt(&key, &k, sizeof k);
init_dbt(&val); val.flags = DB_DBT_MALLOC; init_dbt(&val); val.flags = DB_DBT_MALLOC;
r = brt_cursor_get(cursor, &key, &val, DB_SET, null_txn); r = toku_brt_cursor_get(cursor, &key, &val, DB_SET, null_txn);
assert(r == DB_NOTFOUND); assert(r == DB_NOTFOUND);
assert(key.data == &k); assert(key.data == &k);
} }
r = brt_cursor_close(cursor); r = toku_brt_cursor_close(cursor);
assert(r==0); assert(r==0);
r = close_brt(brt); r = close_brt(brt);
...@@ -1608,7 +1608,7 @@ void test_brt_cursor_set_range(int n, DB *db) { ...@@ -1608,7 +1608,7 @@ void test_brt_cursor_set_range(int n, DB *db) {
unlink(fname); unlink(fname);
r = brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER);
assert(r==0); assert(r==0);
r = open_brt(fname, 0, 1, &brt, 1<<12, ct, null_txn, test_brt_cursor_keycompare, db); r = open_brt(fname, 0, 1, &brt, 1<<12, ct, null_txn, test_brt_cursor_keycompare, db);
...@@ -1629,7 +1629,7 @@ void test_brt_cursor_set_range(int n, DB *db) { ...@@ -1629,7 +1629,7 @@ void test_brt_cursor_set_range(int n, DB *db) {
assert(r == 0); assert(r == 0);
} }
r = brt_cursor(brt, &cursor); r = toku_brt_cursor(brt, &cursor);
assert(r==0); assert(r==0);
/* pick random keys v in 0 <= v < 10*n, the cursor should point /* pick random keys v in 0 <= v < 10*n, the cursor should point
...@@ -1641,7 +1641,7 @@ void test_brt_cursor_set_range(int n, DB *db) { ...@@ -1641,7 +1641,7 @@ void test_brt_cursor_set_range(int n, DB *db) {
k = htonl(v); k = htonl(v);
fill_dbt(&key, &k, sizeof k); fill_dbt(&key, &k, sizeof k);
init_dbt(&val); val.flags = DB_DBT_MALLOC; init_dbt(&val); val.flags = DB_DBT_MALLOC;
r = brt_cursor_get(cursor, &key, &val, DB_SET_RANGE, null_txn); r = toku_brt_cursor_get(cursor, &key, &val, DB_SET_RANGE, null_txn);
if (v > max_key) if (v > max_key)
/* there is no smallest key if v > the max key */ /* there is no smallest key if v > the max key */
assert(r == DB_NOTFOUND); assert(r == DB_NOTFOUND);
...@@ -1654,7 +1654,7 @@ void test_brt_cursor_set_range(int n, DB *db) { ...@@ -1654,7 +1654,7 @@ void test_brt_cursor_set_range(int n, DB *db) {
} }
} }
r = brt_cursor_close(cursor); r = toku_brt_cursor_close(cursor);
assert(r==0); assert(r==0);
r = close_brt(brt); r = close_brt(brt);
...@@ -1675,13 +1675,13 @@ void test_brt_cursor_delete(int n, DB *db) { ...@@ -1675,13 +1675,13 @@ void test_brt_cursor_delete(int n, DB *db) {
unlink(fname); unlink(fname);
error = brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); error = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER);
assert(error == 0); assert(error == 0);
error = open_brt(fname, 0, 1, &brt, 1<<12, ct, null_txn, test_brt_cursor_keycompare, db); error = open_brt(fname, 0, 1, &brt, 1<<12, ct, null_txn, test_brt_cursor_keycompare, db);
assert(error == 0); assert(error == 0);
error = brt_cursor(brt, &cursor); error = toku_brt_cursor(brt, &cursor);
assert(error == 0); assert(error == 0);
DBT key, val; DBT key, val;
...@@ -1702,21 +1702,21 @@ void test_brt_cursor_delete(int n, DB *db) { ...@@ -1702,21 +1702,21 @@ void test_brt_cursor_delete(int n, DB *db) {
for (;;) { for (;;) {
init_dbt(&key); key.flags = DB_DBT_MALLOC; init_dbt(&key); key.flags = DB_DBT_MALLOC;
init_dbt(&val); val.flags = DB_DBT_MALLOC; init_dbt(&val); val.flags = DB_DBT_MALLOC;
error = brt_cursor_get(cursor, &key, &val, DB_NEXT, null_txn); error = toku_brt_cursor_get(cursor, &key, &val, DB_NEXT, null_txn);
if (error == DB_NOTFOUND) if (error == DB_NOTFOUND)
break; break;
assert(error == 0); assert(error == 0);
toku_free(key.data); toku_free(key.data);
toku_free(val.data); toku_free(val.data);
error = brt_cursor_delete(cursor, 0); error = toku_brt_cursor_delete(cursor, 0);
assert(error == 0); assert(error == 0);
} }
error = brt_cursor_delete(cursor, 0); error = toku_brt_cursor_delete(cursor, 0);
assert(error != 0); assert(error != 0);
error = brt_cursor_close(cursor); error = toku_brt_cursor_close(cursor);
assert(error == 0); assert(error == 0);
error = close_brt(brt); error = close_brt(brt);
...@@ -1737,13 +1737,13 @@ void test_brt_cursor_get_both(int n, DB *db) { ...@@ -1737,13 +1737,13 @@ void test_brt_cursor_get_both(int n, DB *db) {
unlink(fname); unlink(fname);
error = brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); error = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER);
assert(error == 0); assert(error == 0);
error = open_brt(fname, 0, 1, &brt, 1<<12, ct, null_txn, test_brt_cursor_keycompare, db); error = open_brt(fname, 0, 1, &brt, 1<<12, ct, null_txn, test_brt_cursor_keycompare, db);
assert(error == 0); assert(error == 0);
error = brt_cursor(brt, &cursor); error = toku_brt_cursor(brt, &cursor);
assert(error == 0); assert(error == 0);
DBT key, val; DBT key, val;
...@@ -1754,7 +1754,7 @@ void test_brt_cursor_get_both(int n, DB *db) { ...@@ -1754,7 +1754,7 @@ void test_brt_cursor_get_both(int n, DB *db) {
v = n+1; v = n+1;
fill_dbt(&key, &k, sizeof k); fill_dbt(&key, &k, sizeof k);
fill_dbt(&val, &v, sizeof v); fill_dbt(&val, &v, sizeof v);
error = brt_cursor_get(cursor, &key, &val, DB_GET_BOTH, null_txn); error = toku_brt_cursor_get(cursor, &key, &val, DB_GET_BOTH, null_txn);
assert(error == DB_NOTFOUND); assert(error == DB_NOTFOUND);
int i; int i;
...@@ -1773,7 +1773,7 @@ void test_brt_cursor_get_both(int n, DB *db) { ...@@ -1773,7 +1773,7 @@ void test_brt_cursor_get_both(int n, DB *db) {
v = n-1; v = n-1;
fill_dbt(&key, &k, sizeof k); fill_dbt(&key, &k, sizeof k);
fill_dbt(&val, &v, sizeof v); fill_dbt(&val, &v, sizeof v);
error = brt_cursor_get(cursor, &key, &val, DB_GET_BOTH, null_txn); error = toku_brt_cursor_get(cursor, &key, &val, DB_GET_BOTH, null_txn);
assert(error == DB_NOTFOUND); assert(error == DB_NOTFOUND);
/* verify that key match but data mismatch fails */ /* verify that key match but data mismatch fails */
...@@ -1782,7 +1782,7 @@ void test_brt_cursor_get_both(int n, DB *db) { ...@@ -1782,7 +1782,7 @@ void test_brt_cursor_get_both(int n, DB *db) {
v = i+1; v = i+1;
fill_dbt(&key, &k, sizeof k); fill_dbt(&key, &k, sizeof k);
fill_dbt(&val, &v, sizeof v); fill_dbt(&val, &v, sizeof v);
error = brt_cursor_get(cursor, &key, &val, DB_GET_BOTH, null_txn); error = toku_brt_cursor_get(cursor, &key, &val, DB_GET_BOTH, null_txn);
assert(error == DB_NOTFOUND); assert(error == DB_NOTFOUND);
} }
...@@ -1792,12 +1792,12 @@ void test_brt_cursor_get_both(int n, DB *db) { ...@@ -1792,12 +1792,12 @@ void test_brt_cursor_get_both(int n, DB *db) {
v = i; v = i;
fill_dbt(&key, &k, sizeof k); fill_dbt(&key, &k, sizeof k);
fill_dbt(&val, &v, sizeof v); fill_dbt(&val, &v, sizeof v);
error = brt_cursor_get(cursor, &key, &val, DB_GET_BOTH, null_txn); error = toku_brt_cursor_get(cursor, &key, &val, DB_GET_BOTH, null_txn);
assert(error == 0); assert(error == 0);
#ifdef DB_CURRENT #ifdef DB_CURRENT
init_dbt(&key); key.flags = DB_DBT_MALLOC; init_dbt(&key); key.flags = DB_DBT_MALLOC;
init_dbt(&val); val.flags = DB_DBT_MALLOC; init_dbt(&val); val.flags = DB_DBT_MALLOC;
error = brt_cursor_get(cursor, &key, &val, DB_CURRENT, 0); error = toku_brt_cursor_get(cursor, &key, &val, DB_CURRENT, 0);
assert(error == 0); assert(error == 0);
int vv; int vv;
assert(val.size == sizeof vv); assert(val.size == sizeof vv);
...@@ -1806,21 +1806,21 @@ void test_brt_cursor_get_both(int n, DB *db) { ...@@ -1806,21 +1806,21 @@ void test_brt_cursor_get_both(int n, DB *db) {
toku_free(key.data); toku_free(key.data);
toku_free(val.data); toku_free(val.data);
#endif #endif
error = brt_cursor_delete(cursor, 0); error = toku_brt_cursor_delete(cursor, 0);
assert(error == 0); assert(error == 0);
k = htonl(i); k = htonl(i);
v = i; v = i;
fill_dbt(&key, &k, sizeof k); fill_dbt(&key, &k, sizeof k);
fill_dbt(&val, &v, sizeof v); fill_dbt(&val, &v, sizeof v);
error = brt_cursor_get(cursor, &key, &val, DB_GET_BOTH, null_txn); error = toku_brt_cursor_get(cursor, &key, &val, DB_GET_BOTH, null_txn);
assert(error == DB_NOTFOUND); assert(error == DB_NOTFOUND);
} }
error = brt_cursor_delete(cursor, 0); error = toku_brt_cursor_delete(cursor, 0);
assert(error != 0); assert(error != 0);
error = brt_cursor_close(cursor); error = toku_brt_cursor_close(cursor);
assert(error == 0); assert(error == 0);
error = close_brt(brt); error = close_brt(brt);
...@@ -1887,7 +1887,7 @@ void test_large_kv(int bsize, int ksize, int vsize) { ...@@ -1887,7 +1887,7 @@ void test_large_kv(int bsize, int ksize, int vsize) {
printf("test_large_kv: %d %d %d\n", bsize, ksize, vsize); printf("test_large_kv: %d %d %d\n", bsize, ksize, vsize);
r = brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER);
assert(r==0); assert(r==0);
unlink(fname); unlink(fname);
r = open_brt(fname, 0, 1, &t, bsize, ct, null_txn, toku_default_compare_fun, null_db); r = open_brt(fname, 0, 1, &t, bsize, ct, null_txn, toku_default_compare_fun, null_db);
...@@ -1934,7 +1934,7 @@ void test_brt_delete_empty() { ...@@ -1934,7 +1934,7 @@ void test_brt_delete_empty() {
CACHETABLE ct; CACHETABLE ct;
char fname[]="testbrt.brt"; char fname[]="testbrt.brt";
r = brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER);
assert(r==0); assert(r==0);
unlink(fname); unlink(fname);
r = open_brt(fname, 0, 1, &t, 4096, ct, null_txn, toku_default_compare_fun, null_db); r = open_brt(fname, 0, 1, &t, 4096, ct, null_txn, toku_default_compare_fun, null_db);
...@@ -1963,7 +1963,7 @@ void test_brt_delete_present(int n) { ...@@ -1963,7 +1963,7 @@ void test_brt_delete_present(int n) {
char fname[]="testbrt.brt"; char fname[]="testbrt.brt";
int i; int i;
r = brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER);
assert(r==0); assert(r==0);
unlink(fname); unlink(fname);
r = open_brt(fname, 0, 1, &t, 4096, ct, null_txn, toku_default_compare_fun, null_db); r = open_brt(fname, 0, 1, &t, 4096, ct, null_txn, toku_default_compare_fun, null_db);
...@@ -2001,15 +2001,15 @@ void test_brt_delete_present(int n) { ...@@ -2001,15 +2001,15 @@ void test_brt_delete_present(int n) {
/* cursor should not find anything */ /* cursor should not find anything */
BRT_CURSOR cursor; BRT_CURSOR cursor;
r = brt_cursor(t, &cursor); r = toku_brt_cursor(t, &cursor);
assert(r == 0); assert(r == 0);
init_dbt(&key); key.flags = DB_DBT_MALLOC; init_dbt(&key); key.flags = DB_DBT_MALLOC;
init_dbt(&val); val.flags = DB_DBT_MALLOC; init_dbt(&val); val.flags = DB_DBT_MALLOC;
r = brt_cursor_get(cursor, &key, &val, DB_FIRST, null_txn); r = toku_brt_cursor_get(cursor, &key, &val, DB_FIRST, null_txn);
assert(r != 0); assert(r != 0);
r = brt_cursor_close(cursor); r = toku_brt_cursor_close(cursor);
assert(r == 0); assert(r == 0);
r = close_brt(t); assert(r==0); r = close_brt(t); assert(r==0);
...@@ -2025,7 +2025,7 @@ void test_brt_delete_not_present(int n) { ...@@ -2025,7 +2025,7 @@ void test_brt_delete_not_present(int n) {
char fname[]="testbrt.brt"; char fname[]="testbrt.brt";
int i; int i;
r = brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER);
assert(r==0); assert(r==0);
unlink(fname); unlink(fname);
r = open_brt(fname, 0, 1, &t, 4096, ct, null_txn, toku_default_compare_fun, null_db); r = open_brt(fname, 0, 1, &t, 4096, ct, null_txn, toku_default_compare_fun, null_db);
...@@ -2072,7 +2072,7 @@ void test_brt_delete_cursor_first(int n) { ...@@ -2072,7 +2072,7 @@ void test_brt_delete_cursor_first(int n) {
char fname[]="testbrt.brt"; char fname[]="testbrt.brt";
int i; int i;
r = brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER);
assert(r==0); assert(r==0);
unlink(fname); unlink(fname);
r = open_brt(fname, 0, 1, &t, 4096, ct, null_txn, toku_default_compare_fun, null_db); r = open_brt(fname, 0, 1, &t, 4096, ct, null_txn, toku_default_compare_fun, null_db);
...@@ -2128,12 +2128,12 @@ void test_brt_delete_cursor_first(int n) { ...@@ -2128,12 +2128,12 @@ void test_brt_delete_cursor_first(int n) {
/* cursor should find the last key: n-1 */ /* cursor should find the last key: n-1 */
BRT_CURSOR cursor; BRT_CURSOR cursor;
r = brt_cursor(t, &cursor); r = toku_brt_cursor(t, &cursor);
assert(r == 0); assert(r == 0);
init_dbt(&key); key.flags = DB_DBT_MALLOC; init_dbt(&key); key.flags = DB_DBT_MALLOC;
init_dbt(&val); val.flags = DB_DBT_MALLOC; init_dbt(&val); val.flags = DB_DBT_MALLOC;
r = brt_cursor_get(cursor, &key, &val, DB_FIRST, null_txn); r = toku_brt_cursor_get(cursor, &key, &val, DB_FIRST, null_txn);
assert(r == 0); assert(r == 0);
int vv; int vv;
assert(val.size == sizeof vv); assert(val.size == sizeof vv);
...@@ -2142,7 +2142,7 @@ void test_brt_delete_cursor_first(int n) { ...@@ -2142,7 +2142,7 @@ void test_brt_delete_cursor_first(int n) {
toku_free(key.data); toku_free(key.data);
toku_free(val.data); toku_free(val.data);
r = brt_cursor_close(cursor); r = toku_brt_cursor_close(cursor);
assert(r == 0); assert(r == 0);
r = close_brt(t); assert(r==0); r = close_brt(t); assert(r==0);
...@@ -2164,7 +2164,7 @@ void test_insert_delete_lookup(int n) { ...@@ -2164,7 +2164,7 @@ void test_insert_delete_lookup(int n) {
char fname[]="testbrt.brt"; char fname[]="testbrt.brt";
int i; int i;
r = brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER);
assert(r==0); assert(r==0);
unlink(fname); unlink(fname);
r = open_brt(fname, 0, 1, &t, 4096, ct, null_txn, toku_default_compare_fun, null_db); r = open_brt(fname, 0, 1, &t, 4096, ct, null_txn, toku_default_compare_fun, null_db);
......
...@@ -561,7 +561,7 @@ static int push_brt_cmd_down_only_if_it_wont_push_more_else_put_here (BRT t, BRT ...@@ -561,7 +561,7 @@ static int push_brt_cmd_down_only_if_it_wont_push_more_else_put_here (BRT t, BRT
DBT *k = cmd->u.id.key; DBT *k = cmd->u.id.key;
DBT *v = cmd->u.id.val; DBT *v = cmd->u.id.val;
int to_child=toku_serialize_brtnode_size(child)+k->size+v->size+KEY_VALUE_OVERHEAD <= child->nodesize; int to_child=toku_serialize_brtnode_size(child)+k->size+v->size+KEY_VALUE_OVERHEAD <= child->nodesize;
if (brt_debug_mode) { if (toku_brt_debug_mode) {
printf("%s:%d pushing %s to %s %d", __FILE__, __LINE__, (char*)k->data, to_child? "child" : "hash", childnum_of_node); printf("%s:%d pushing %s to %s %d", __FILE__, __LINE__, (char*)k->data, to_child? "child" : "hash", childnum_of_node);
if (childnum_of_node+1<node->u.n.n_children) { if (childnum_of_node+1<node->u.n.n_children) {
DBT k2; DBT k2;
...@@ -653,7 +653,7 @@ static int handle_split_of_child (BRT t, BRTNODE node, int childnum, ...@@ -653,7 +653,7 @@ static int handle_split_of_child (BRT t, BRTNODE node, int childnum,
int r; int r;
assert(node->u.n.n_children<=TREE_FANOUT); assert(node->u.n.n_children<=TREE_FANOUT);
if (brt_debug_mode) { if (toku_brt_debug_mode) {
int i; int i;
printf("%s:%d Child %d did split on %s\n", __FILE__, __LINE__, childnum, (char*)childsplitk->data); printf("%s:%d Child %d did split on %s\n", __FILE__, __LINE__, childnum, (char*)childsplitk->data);
printf("%s:%d oldsplitkeys:", __FILE__, __LINE__); printf("%s:%d oldsplitkeys:", __FILE__, __LINE__);
...@@ -700,7 +700,7 @@ static int handle_split_of_child (BRT t, BRTNODE node, int childnum, ...@@ -700,7 +700,7 @@ static int handle_split_of_child (BRT t, BRTNODE node, int childnum,
brt_update_cursors_nonleaf_expand(t, node, childnum, childa, childb); brt_update_cursors_nonleaf_expand(t, node, childnum, childa, childb);
if (brt_debug_mode) { if (toku_brt_debug_mode) {
int i; int i;
printf("%s:%d splitkeys:", __FILE__, __LINE__); printf("%s:%d splitkeys:", __FILE__, __LINE__);
for(i=0; i<node->u.n.n_children-1; i++) printf(" %s", (char*)node->u.n.childkeys[i]); for(i=0; i<node->u.n.n_children-1; i++) printf(" %s", (char*)node->u.n.childkeys[i]);
...@@ -1415,7 +1415,7 @@ static int brtnode_put_cmd (BRT t, BRTNODE node, BRT_CMD *cmd, ...@@ -1415,7 +1415,7 @@ static int brtnode_put_cmd (BRT t, BRTNODE node, BRT_CMD *cmd,
return r; return r;
} }
int brt_create_cachetable(CACHETABLE *ct, long cachesize, LSN initial_lsn, TOKULOGGER logger) { int toku_brt_create_cachetable(CACHETABLE *ct, long cachesize, LSN initial_lsn, TOKULOGGER logger) {
if (cachesize == 0) if (cachesize == 0)
cachesize = 128*1024*1024; cachesize = 128*1024*1024;
return toku_create_cachetable(ct, cachesize, initial_lsn, logger); return toku_create_cachetable(ct, cachesize, initial_lsn, logger);
...@@ -1465,7 +1465,7 @@ static int setup_brt_root_node (BRT t, DISKOFF offset, TOKUTXN txn) { ...@@ -1465,7 +1465,7 @@ static int setup_brt_root_node (BRT t, DISKOFF offset, TOKUTXN txn) {
#define WHEN_BRTTRACE(x) ((void)0) #define WHEN_BRTTRACE(x) ((void)0)
#endif #endif
int brt_create(BRT *brt_ptr) { int toku_brt_create(BRT *brt_ptr) {
BRT brt = toku_malloc(sizeof *brt); BRT brt = toku_malloc(sizeof *brt);
if (brt == 0) if (brt == 0)
return ENOMEM; return ENOMEM;
...@@ -1686,7 +1686,7 @@ int open_brt (const char *fname, const char *dbname, int is_create, BRT *newbrt, ...@@ -1686,7 +1686,7 @@ int open_brt (const char *fname, const char *dbname, int is_create, BRT *newbrt,
int r; int r;
int only_create = 0; int only_create = 0;
r = brt_create(&brt); r = toku_brt_create(&brt);
if (r != 0) if (r != 0)
return r; return r;
brt_set_nodesize(brt, nodesize); brt_set_nodesize(brt, nodesize);
...@@ -1706,7 +1706,7 @@ int close_brt (BRT brt) { ...@@ -1706,7 +1706,7 @@ int close_brt (BRT brt) {
int r; int r;
while (brt->cursors_head) { while (brt->cursors_head) {
BRT_CURSOR c = brt->cursors_head; BRT_CURSOR c = brt->cursors_head;
r=brt_cursor_close(c); r=toku_brt_cursor_close(c);
if (r!=0) return r; if (r!=0) return r;
} }
if (brt->cf) { if (brt->cf) {
...@@ -1721,7 +1721,7 @@ int close_brt (BRT brt) { ...@@ -1721,7 +1721,7 @@ int close_brt (BRT brt) {
return 0; return 0;
} }
int brt_debug_mode = 0;//strcmp(key,"hello387")==0; int toku_brt_debug_mode = 0;//strcmp(key,"hello387")==0;
CACHEKEY* toku_calculate_root_offset_pointer (BRT brt) { CACHEKEY* toku_calculate_root_offset_pointer (BRT brt) {
if (brt->database_name==0) { if (brt->database_name==0) {
...@@ -1783,7 +1783,7 @@ static int brt_root_put_cmd(BRT brt, BRT_CMD *cmd, TOKUTXN txn) { ...@@ -1783,7 +1783,7 @@ static int brt_root_put_cmd(BRT brt, BRT_CMD *cmd, TOKUTXN txn) {
int r; int r;
int did_split; BRTNODE nodea=0, nodeb=0; int did_split; BRTNODE nodea=0, nodeb=0;
DBT splitk; DBT splitk;
int debug = brt_debug_mode;//strcmp(key,"hello387")==0; int debug = toku_brt_debug_mode;//strcmp(key,"hello387")==0;
//assert(0==toku_cachetable_assert_all_unpinned(brt->cachetable)); //assert(0==toku_cachetable_assert_all_unpinned(brt->cachetable));
if ((r = toku_read_and_pin_brt_header(brt->cf, &brt->h))) { if ((r = toku_read_and_pin_brt_header(brt->cf, &brt->h))) {
if (0) { died0: toku_unpin_brt_header(brt); } if (0) { died0: toku_unpin_brt_header(brt); }
...@@ -1949,7 +1949,7 @@ int brt_delete(BRT brt, DBT *key) { ...@@ -1949,7 +1949,7 @@ int brt_delete(BRT brt, DBT *key) {
int toku_verify_brtnode (BRT brt, DISKOFF off, bytevec lorange, ITEMLEN lolen, bytevec hirange, ITEMLEN hilen, int recurse, BRTNODE parent_brtnode); int toku_verify_brtnode (BRT brt, DISKOFF off, bytevec lorange, ITEMLEN lolen, bytevec hirange, ITEMLEN hilen, int recurse, BRTNODE parent_brtnode);
int dump_brtnode (BRT brt, DISKOFF off, int depth, bytevec lorange, ITEMLEN lolen, bytevec hirange, ITEMLEN hilen, BRTNODE parent_brtnode) { int toku_dump_brtnode (BRT brt, DISKOFF off, int depth, bytevec lorange, ITEMLEN lolen, bytevec hirange, ITEMLEN hilen, BRTNODE parent_brtnode) {
int result=0; int result=0;
BRTNODE node; BRTNODE node;
void *node_v; void *node_v;
...@@ -1981,7 +1981,7 @@ int dump_brtnode (BRT brt, DISKOFF off, int depth, bytevec lorange, ITEMLEN lole ...@@ -1981,7 +1981,7 @@ int dump_brtnode (BRT brt, DISKOFF off, int depth, bytevec lorange, ITEMLEN lole
if (i>0) { if (i>0) {
printf("%*spivot %d=%s\n", depth+1, "", i-1, (char*)node->u.n.childkeys[i-1]); printf("%*spivot %d=%s\n", depth+1, "", i-1, (char*)node->u.n.childkeys[i-1]);
} }
dump_brtnode(brt, node->u.n.children[i], depth+4, toku_dump_brtnode(brt, node->u.n.children[i], depth+4,
(i==0) ? lorange : node->u.n.childkeys[i-1], (i==0) ? lorange : node->u.n.childkeys[i-1],
(i==0) ? lolen : node->u.n.childkeylens[i-1], (i==0) ? lolen : node->u.n.childkeylens[i-1],
(i==node->u.n.n_children-1) ? hirange : node->u.n.childkeys[i], (i==node->u.n.n_children-1) ? hirange : node->u.n.childkeys[i],
...@@ -2011,7 +2011,7 @@ int dump_brt (BRT brt) { ...@@ -2011,7 +2011,7 @@ int dump_brt (BRT brt) {
} }
rootp = toku_calculate_root_offset_pointer(brt); rootp = toku_calculate_root_offset_pointer(brt);
printf("split_count=%d\n", split_count); printf("split_count=%d\n", split_count);
if ((r = dump_brtnode(brt, *rootp, 0, 0, 0, 0, 0, null_brtnode))) goto died0; if ((r = toku_dump_brtnode(brt, *rootp, 0, 0, 0, 0, 0, null_brtnode))) goto died0;
if ((r = toku_unpin_brt_header(brt))!=0) return r; if ((r = toku_unpin_brt_header(brt))!=0) return r;
return 0; return 0;
} }
...@@ -2072,7 +2072,7 @@ void brt_flush_child(BRT t, BRTNODE node, int childnum, BRT_CURSOR cursor, TOKUT ...@@ -2072,7 +2072,7 @@ void brt_flush_child(BRT t, BRTNODE node, int childnum, BRT_CURSOR cursor, TOKUT
if (brt_flush_debug) { if (brt_flush_debug) {
printf("brt_flush_child %lld %d\n", node->thisnodename, childnum); printf("brt_flush_child %lld %d\n", node->thisnodename, childnum);
brt_cursor_print(cursor); toku_brt_cursor_print(cursor);
} }
init_dbt(&child_splitk); init_dbt(&child_splitk);
...@@ -2081,7 +2081,7 @@ void brt_flush_child(BRT t, BRTNODE node, int childnum, BRT_CURSOR cursor, TOKUT ...@@ -2081,7 +2081,7 @@ void brt_flush_child(BRT t, BRTNODE node, int childnum, BRT_CURSOR cursor, TOKUT
assert(r == 0); assert(r == 0);
if (brt_flush_debug) { if (brt_flush_debug) {
printf("brt_flush_child done %lld %d\n", node->thisnodename, childnum); printf("brt_flush_child done %lld %d\n", node->thisnodename, childnum);
brt_cursor_print(cursor); toku_brt_cursor_print(cursor);
} }
if (child_did_split) { if (child_did_split) {
int i; int i;
...@@ -2147,8 +2147,8 @@ void brt_update_cursors_new_root(BRT t, BRTNODE newroot, BRTNODE left, BRTNODE r ...@@ -2147,8 +2147,8 @@ void brt_update_cursors_new_root(BRT t, BRTNODE newroot, BRTNODE left, BRTNODE r
if (brt_update_debug) printf("brt_update_cursors_new_root %lld %lld %lld\n", newroot->thisnodename, if (brt_update_debug) printf("brt_update_cursors_new_root %lld %lld %lld\n", newroot->thisnodename,
left->thisnodename, right->thisnodename); left->thisnodename, right->thisnodename);
for (cursor = t->cursors_head; cursor; cursor = cursor->next) { for (cursor = t->cursors_head; cursor; cursor = cursor->next) {
if (brt_cursor_active(cursor)) { if (toku_brt_cursor_active(cursor)) {
brt_cursor_new_root(cursor, t, newroot, left, right); toku_brt_cursor_new_root(cursor, t, newroot, left, right);
} }
} }
} }
...@@ -2159,8 +2159,8 @@ void brt_update_cursors_leaf_split(BRT t, BRTNODE oldnode, BRTNODE left, BRTNODE ...@@ -2159,8 +2159,8 @@ void brt_update_cursors_leaf_split(BRT t, BRTNODE oldnode, BRTNODE left, BRTNODE
if (brt_update_debug) printf("brt_update_cursors_leaf_split %lld %lld %lld\n", oldnode->thisnodename, if (brt_update_debug) printf("brt_update_cursors_leaf_split %lld %lld %lld\n", oldnode->thisnodename,
left->thisnodename, right->thisnodename); left->thisnodename, right->thisnodename);
for (cursor = t->cursors_head; cursor; cursor = cursor->next) { for (cursor = t->cursors_head; cursor; cursor = cursor->next) {
if (brt_cursor_active(cursor)) { if (toku_brt_cursor_active(cursor)) {
brt_cursor_leaf_split(cursor, t, oldnode, left, right); toku_brt_cursor_leaf_split(cursor, t, oldnode, left, right);
} }
} }
} }
...@@ -2171,8 +2171,8 @@ void brt_update_cursors_nonleaf_expand(BRT t, BRTNODE node, int childnum, BRTNOD ...@@ -2171,8 +2171,8 @@ void brt_update_cursors_nonleaf_expand(BRT t, BRTNODE node, int childnum, BRTNOD
if (brt_update_debug) printf("brt_update_cursors_nonleaf_expand %lld h=%d c=%d nc=%d %lld %lld\n", node->thisnodename, node->height, childnum, if (brt_update_debug) printf("brt_update_cursors_nonleaf_expand %lld h=%d c=%d nc=%d %lld %lld\n", node->thisnodename, node->height, childnum,
node->u.n.n_children, left->thisnodename, right->thisnodename); node->u.n.n_children, left->thisnodename, right->thisnodename);
for (cursor = t->cursors_head; cursor; cursor = cursor->next) { for (cursor = t->cursors_head; cursor; cursor = cursor->next) {
if (brt_cursor_active(cursor)) { if (toku_brt_cursor_active(cursor)) {
brt_cursor_nonleaf_expand(cursor, t, node, childnum, left, right); toku_brt_cursor_nonleaf_expand(cursor, t, node, childnum, left, right);
} }
} }
} }
...@@ -2183,21 +2183,21 @@ void brt_update_cursors_nonleaf_split(BRT t, BRTNODE oldnode, BRTNODE left, BRTN ...@@ -2183,21 +2183,21 @@ void brt_update_cursors_nonleaf_split(BRT t, BRTNODE oldnode, BRTNODE left, BRTN
if (brt_update_debug) printf("brt_update_cursors_nonleaf_split %lld %lld %lld\n", oldnode->thisnodename, if (brt_update_debug) printf("brt_update_cursors_nonleaf_split %lld %lld %lld\n", oldnode->thisnodename,
left->thisnodename, right->thisnodename); left->thisnodename, right->thisnodename);
for (cursor = t->cursors_head; cursor; cursor = cursor->next) { for (cursor = t->cursors_head; cursor; cursor = cursor->next) {
if (brt_cursor_active(cursor)) { if (toku_brt_cursor_active(cursor)) {
brt_cursor_nonleaf_split(cursor, t, oldnode, left, right); toku_brt_cursor_nonleaf_split(cursor, t, oldnode, left, right);
} }
} }
} }
void brt_cursor_new_root(BRT_CURSOR cursor, BRT t, BRTNODE newroot, BRTNODE left, BRTNODE right) { void toku_brt_cursor_new_root(BRT_CURSOR cursor, BRT t, BRTNODE newroot, BRTNODE left, BRTNODE right) {
int i; int i;
int childnum; int childnum;
int r; int r;
void *v; void *v;
assert(!brt_cursor_path_full(cursor)); assert(!toku_brt_cursor_path_full(cursor));
if (0) printf("brt_cursor_new_root %p %lld newroot %lld\n", cursor, cursor->path[0]->thisnodename, newroot->thisnodename); if (0) printf("toku_brt_cursor_new_root %p %lld newroot %lld\n", cursor, cursor->path[0]->thisnodename, newroot->thisnodename);
assert(cursor->path[0] == left || cursor->path[0] == right); assert(cursor->path[0] == left || cursor->path[0] == right);
...@@ -2217,7 +2217,7 @@ void brt_cursor_new_root(BRT_CURSOR cursor, BRT t, BRTNODE newroot, BRTNODE left ...@@ -2217,7 +2217,7 @@ void brt_cursor_new_root(BRT_CURSOR cursor, BRT t, BRTNODE newroot, BRTNODE left
brt_node_add_cursor(newroot, childnum, cursor); brt_node_add_cursor(newroot, childnum, cursor);
} }
void brt_cursor_leaf_split(BRT_CURSOR cursor, BRT t, BRTNODE oldnode, BRTNODE left, BRTNODE right) { void toku_brt_cursor_leaf_split(BRT_CURSOR cursor, BRT t, BRTNODE oldnode, BRTNODE left, BRTNODE right) {
int r; int r;
BRTNODE newnode; BRTNODE newnode;
PMA pma; PMA pma;
...@@ -2237,7 +2237,7 @@ void brt_cursor_leaf_split(BRT_CURSOR cursor, BRT t, BRTNODE oldnode, BRTNODE le ...@@ -2237,7 +2237,7 @@ void brt_cursor_leaf_split(BRT_CURSOR cursor, BRT t, BRTNODE oldnode, BRTNODE le
newnode = 0; newnode = 0;
assert(newnode); assert(newnode);
if (0) printf("brt_cursor_leaf_split %p oldnode %lld newnode %lld\n", cursor, if (0) printf("toku_brt_cursor_leaf_split %p oldnode %lld newnode %lld\n", cursor,
oldnode->thisnodename, newnode->thisnodename); oldnode->thisnodename, newnode->thisnodename);
//verify_local_fingerprint_nonleaf(oldnode); //verify_local_fingerprint_nonleaf(oldnode);
...@@ -2249,7 +2249,7 @@ void brt_cursor_leaf_split(BRT_CURSOR cursor, BRT t, BRTNODE oldnode, BRTNODE le ...@@ -2249,7 +2249,7 @@ void brt_cursor_leaf_split(BRT_CURSOR cursor, BRT t, BRTNODE oldnode, BRTNODE le
} }
} }
void brt_cursor_nonleaf_expand(BRT_CURSOR cursor, BRT t __attribute__((unused)), BRTNODE node, int childnum, BRTNODE left, BRTNODE right) { void toku_brt_cursor_nonleaf_expand(BRT_CURSOR cursor, BRT t __attribute__((unused)), BRTNODE node, int childnum, BRTNODE left, BRTNODE right) {
int i; int i;
int oldchildnum, newchildnum; int oldchildnum, newchildnum;
...@@ -2260,7 +2260,7 @@ void brt_cursor_nonleaf_expand(BRT_CURSOR cursor, BRT t __attribute__((unused)), ...@@ -2260,7 +2260,7 @@ void brt_cursor_nonleaf_expand(BRT_CURSOR cursor, BRT t __attribute__((unused)),
// i = cursor->path_len - 1; // i = cursor->path_len - 1;
// if (i >= 0 && cursor->path[i] == node) { // if (i >= 0 && cursor->path[i] == node) {
// } // }
if (0) brt_cursor_print(cursor); if (0) toku_brt_cursor_print(cursor);
for (i = 0; i < cursor->path_len; i++) for (i = 0; i < cursor->path_len; i++)
if (cursor->path[i] == node) if (cursor->path[i] == node)
break; break;
...@@ -2288,7 +2288,7 @@ void brt_cursor_nonleaf_expand(BRT_CURSOR cursor, BRT t __attribute__((unused)), ...@@ -2288,7 +2288,7 @@ void brt_cursor_nonleaf_expand(BRT_CURSOR cursor, BRT t __attribute__((unused)),
} }
} }
void brt_cursor_nonleaf_split(BRT_CURSOR cursor, BRT t, BRTNODE oldnode, BRTNODE left, BRTNODE right) { void toku_brt_cursor_nonleaf_split(BRT_CURSOR cursor, BRT t, BRTNODE oldnode, BRTNODE left, BRTNODE right) {
int i; int i;
BRTNODE newnode; BRTNODE newnode;
int r; int r;
...@@ -2313,7 +2313,7 @@ void brt_cursor_nonleaf_split(BRT_CURSOR cursor, BRT t, BRTNODE oldnode, BRTNODE ...@@ -2313,7 +2313,7 @@ void brt_cursor_nonleaf_split(BRT_CURSOR cursor, BRT t, BRTNODE oldnode, BRTNODE
childnum -= left->u.n.n_children; childnum -= left->u.n.n_children;
} }
if (0) printf("brt_cursor_nonleaf_split %p oldnode %lld newnode %lld\n", if (0) printf("toku_brt_cursor_nonleaf_split %p oldnode %lld newnode %lld\n",
cursor, oldnode->thisnodename, newnode->thisnodename); cursor, oldnode->thisnodename, newnode->thisnodename);
// The oldnode is probably dead. But we say it is dirty? ??? // The oldnode is probably dead. But we say it is dirty? ???
...@@ -2327,7 +2327,7 @@ void brt_cursor_nonleaf_split(BRT_CURSOR cursor, BRT t, BRTNODE oldnode, BRTNODE ...@@ -2327,7 +2327,7 @@ void brt_cursor_nonleaf_split(BRT_CURSOR cursor, BRT t, BRTNODE oldnode, BRTNODE
} }
} }
int brt_cursor (BRT brt, BRT_CURSOR*cursor) { int toku_brt_cursor (BRT brt, BRT_CURSOR*cursor) {
BRT_CURSOR MALLOC(result); BRT_CURSOR MALLOC(result);
assert(result); assert(result);
result->brt = brt; result->brt = brt;
...@@ -2349,7 +2349,7 @@ int brt_cursor (BRT brt, BRT_CURSOR*cursor) { ...@@ -2349,7 +2349,7 @@ int brt_cursor (BRT brt, BRT_CURSOR*cursor) {
static int unpin_cursor(BRT_CURSOR); static int unpin_cursor(BRT_CURSOR);
int brt_cursor_close (BRT_CURSOR curs) { int toku_brt_cursor_close (BRT_CURSOR curs) {
BRT brt = curs->brt; BRT brt = curs->brt;
int r=unpin_cursor(curs); int r=unpin_cursor(curs);
if (curs->prev==0) { if (curs->prev==0) {
...@@ -2375,7 +2375,7 @@ int brt_cursor_close (BRT_CURSOR curs) { ...@@ -2375,7 +2375,7 @@ int brt_cursor_close (BRT_CURSOR curs) {
/* /*
* Print the path of a cursor * Print the path of a cursor
*/ */
void brt_cursor_print(BRT_CURSOR cursor) { void toku_brt_cursor_print(BRT_CURSOR cursor) {
int i; int i;
printf("cursor %p: ", cursor); printf("cursor %p: ", cursor);
...@@ -2529,7 +2529,7 @@ int brtcurs_set_position_next2(BRT_CURSOR cursor, DBT *key, TOKUTXN txn) { ...@@ -2529,7 +2529,7 @@ int brtcurs_set_position_next2(BRT_CURSOR cursor, DBT *key, TOKUTXN txn) {
//verify_local_fingerprint_nonleaf(node); //verify_local_fingerprint_nonleaf(node);
toku_cachetable_unpin(cursor->brt->cf, node->thisnodename, node->dirty, brtnode_size(node)); toku_cachetable_unpin(cursor->brt->cf, node->thisnodename, node->dirty, brtnode_size(node));
if (brt_cursor_path_empty(cursor)) if (toku_brt_cursor_path_empty(cursor))
return DB_NOTFOUND; return DB_NOTFOUND;
/* set position first in the next right tree */ /* set position first in the next right tree */
...@@ -2590,7 +2590,7 @@ int brtcurs_set_position_prev2(BRT_CURSOR cursor, DBT *key, TOKUTXN txn) { ...@@ -2590,7 +2590,7 @@ int brtcurs_set_position_prev2(BRT_CURSOR cursor, DBT *key, TOKUTXN txn) {
//verify_local_fingerprint_nonleaf(node); //verify_local_fingerprint_nonleaf(node);
toku_cachetable_unpin(cursor->brt->cf, node->thisnodename, node->dirty, brtnode_size(node)); toku_cachetable_unpin(cursor->brt->cf, node->thisnodename, node->dirty, brtnode_size(node));
if (brt_cursor_path_empty(cursor)) if (toku_brt_cursor_path_empty(cursor))
return DB_NOTFOUND; return DB_NOTFOUND;
/* set position last in the next left tree */ /* set position last in the next left tree */
...@@ -2797,7 +2797,7 @@ static void assert_cursor_path(BRT_CURSOR cursor) { ...@@ -2797,7 +2797,7 @@ static void assert_cursor_path(BRT_CURSOR cursor) {
assert(node->height == 0); assert(node->height == 0);
} }
int brt_cursor_get (BRT_CURSOR cursor, DBT *kbt, DBT *vbt, int flags, TOKUTXN txn) { int toku_brt_cursor_get (BRT_CURSOR cursor, DBT *kbt, DBT *vbt, int flags, TOKUTXN txn) {
int do_rmw=0; int do_rmw=0;
int r; int r;
CACHEKEY *rootp; CACHEKEY *rootp;
...@@ -2877,7 +2877,7 @@ int brt_cursor_get (BRT_CURSOR cursor, DBT *kbt, DBT *vbt, int flags, TOKUTXN tx ...@@ -2877,7 +2877,7 @@ int brt_cursor_get (BRT_CURSOR cursor, DBT *kbt, DBT *vbt, int flags, TOKUTXN tx
} }
/* delete the key and value under the cursor */ /* delete the key and value under the cursor */
int brt_cursor_delete(BRT_CURSOR cursor, int flags __attribute__((__unused__))) { int toku_brt_cursor_delete(BRT_CURSOR cursor, int flags __attribute__((__unused__))) {
int r; int r;
if (cursor->path_len > 0) { if (cursor->path_len > 0) {
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
int open_brt (const char *fname, const char *dbname, int is_create, BRT *, int nodesize, CACHETABLE, TOKUTXN, int(*)(DB*,const DBT*,const DBT*), DB*); int open_brt (const char *fname, const char *dbname, int is_create, BRT *, int nodesize, CACHETABLE, TOKUTXN, int(*)(DB*,const DBT*,const DBT*), DB*);
int brt_create(BRT *); int toku_brt_create(BRT *);
int brt_set_flags(BRT, int flags); int brt_set_flags(BRT, int flags);
int brt_get_flags(BRT, int *flags); int brt_get_flags(BRT, int *flags);
int brt_set_nodesize(BRT, int nodesize); int brt_set_nodesize(BRT, int nodesize);
...@@ -36,18 +36,18 @@ void brt_flush (BRT); /* fsync and clear the caches. */ ...@@ -36,18 +36,18 @@ void brt_flush (BRT); /* fsync and clear the caches. */
cachesize is the upper limit on the size of the size of the values in the table cachesize is the upper limit on the size of the size of the values in the table
pass 0 if you want the default */ pass 0 if you want the default */
int brt_create_cachetable(CACHETABLE *t, long cachesize, LSN initial_lsn, TOKULOGGER); int toku_brt_create_cachetable(CACHETABLE *t, long cachesize, LSN initial_lsn, TOKULOGGER);
extern int brt_debug_mode; extern int toku_brt_debug_mode;
int toku_verify_brt (BRT brt); int toku_verify_brt (BRT brt);
//int show_brt_blocknumbers(BRT); //int show_brt_blocknumbers(BRT);
typedef struct brt_cursor *BRT_CURSOR; typedef struct brt_cursor *BRT_CURSOR;
int brt_cursor (BRT, BRT_CURSOR*); int toku_brt_cursor (BRT, BRT_CURSOR*);
int brt_cursor_get (BRT_CURSOR cursor, DBT *kbt, DBT *vbt, int brtc_flags, TOKUTXN); int toku_brt_cursor_get (BRT_CURSOR cursor, DBT *kbt, DBT *vbt, int brtc_flags, TOKUTXN);
int brt_cursor_delete(BRT_CURSOR cursor, int flags); int toku_brt_cursor_delete(BRT_CURSOR cursor, int flags);
int brt_cursor_close (BRT_CURSOR curs); int toku_brt_cursor_close (BRT_CURSOR curs);
typedef struct brtenv *BRTENV; typedef struct brtenv *BRTENV;
int brtenv_checkpoint (BRTENV env); int brtenv_checkpoint (BRTENV env);
......
...@@ -279,7 +279,7 @@ static int toku_db_env_open(DB_ENV * env, const char *home, u_int32_t flags, int ...@@ -279,7 +279,7 @@ static int toku_db_env_open(DB_ENV * env, const char *home, u_int32_t flags, int
} }
} }
r = brt_create_cachetable(&env->i->cachetable, env->i->cachetable_size, ZERO_LSN, env->i->logger); r = toku_brt_create_cachetable(&env->i->cachetable, env->i->cachetable_size, ZERO_LSN, env->i->logger);
if (r!=0) goto died2; if (r!=0) goto died2;
return 0; return 0;
} }
...@@ -522,19 +522,19 @@ struct __toku_dbc_internal { ...@@ -522,19 +522,19 @@ struct __toku_dbc_internal {
}; };
static int toku_c_get(DBC * c, DBT * key, DBT * data, u_int32_t flag) { static int toku_c_get(DBC * c, DBT * key, DBT * data, u_int32_t flag) {
int r = brt_cursor_get(c->i->c, key, data, flag, c->i->txn ? c->i->txn->i->tokutxn : 0); int r = toku_brt_cursor_get(c->i->c, key, data, flag, c->i->txn ? c->i->txn->i->tokutxn : 0);
return r; return r;
} }
static int toku_c_close(DBC * c) { static int toku_c_close(DBC * c) {
int r = brt_cursor_close(c->i->c); int r = toku_brt_cursor_close(c->i->c);
toku_free(c->i); toku_free(c->i);
toku_free(c); toku_free(c);
return r; return r;
} }
static int toku_c_del(DBC * c, u_int32_t flags) { static int toku_c_del(DBC * c, u_int32_t flags) {
int r = brt_cursor_delete(c->i->c, flags); int r = toku_brt_cursor_delete(c->i->c, flags);
return r; return r;
} }
...@@ -550,7 +550,7 @@ static int toku_db_cursor(DB * db, DB_TXN * txn, DBC ** c, u_int32_t flags) { ...@@ -550,7 +550,7 @@ static int toku_db_cursor(DB * db, DB_TXN * txn, DBC ** c, u_int32_t flags) {
assert(result->i); assert(result->i);
result->i->db = db; result->i->db = db;
result->i->txn = txn; result->i->txn = txn;
int r = brt_cursor(db->i->brt, &result->i->c); int r = toku_brt_cursor(db->i->brt, &result->i->c);
assert(r == 0); assert(r == 0);
*c = result; *c = result;
return 0; return 0;
...@@ -845,7 +845,7 @@ int db_create(DB ** db, DB_ENV * env, u_int32_t flags) { ...@@ -845,7 +845,7 @@ int db_create(DB ** db, DB_ENV * env, u_int32_t flags) {
list_init(&result->i->associated); list_init(&result->i->associated);
result->i->primary = 0; result->i->primary = 0;
result->i->associate_callback = 0; result->i->associate_callback = 0;
r = brt_create(&result->i->brt); r = toku_brt_create(&result->i->brt);
if (r != 0) { if (r != 0) {
toku_free(result->i); toku_free(result->i);
toku_free(result); toku_free(result);
......
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