Commit 00edc914 authored by Rich Prohaska's avatar Rich Prohaska Committed by Yoni Fogel

move the root_put_counter to the brt_header. closes #1054

git-svn-id: file:///svn/tokudb.1131b+1080a@6279 c7de825b-a66e-492c-adef-691d508d4ae1
parent 2adbbe6d
...@@ -127,13 +127,15 @@ struct brt_header { ...@@ -127,13 +127,15 @@ struct brt_header {
int layout_version; int layout_version;
unsigned int nodesize; unsigned int nodesize;
int n_named_roots; /* -1 if the only one is unnamed */ int n_named_roots; /* -1 if the only one is unnamed */
char **names; // an array of names. NULL if subdatabases are not allowed. char **names; // an array of names. NULL if subdatabases are not allowed.
BLOCKNUM *roots; // An array of the roots of the various dictionaries. Element 0 holds the element if no subdatabases allowed. BLOCKNUM *roots; // An array of the roots of the various dictionaries. Element 0 holds the element if no subdatabases allowed.
struct remembered_hash *root_hashes; // an array of hashes of the root offsets. struct remembered_hash *root_hashes; // an array of hashes of the root offsets.
unsigned int *flags_array; // an array of flags. Element 0 holds the element if no subdatabases allowed. unsigned int *flags_array; // an array of flags. Element 0 holds the element if no subdatabases allowed.
FIFO fifo; // all the abort and commit commands. If the header gets flushed to disk, we write the fifo contents beyond the unused_memory. FIFO fifo; // all the abort and commit commands. If the header gets flushed to disk, we write the fifo contents beyond the unused_memory.
u_int64_t root_put_counter; // the generation number of the brt
// This is the map from block numbers to offsets // This is the map from block numbers to offsets
//int n_blocks, n_blocks_array_size; //int n_blocks, n_blocks_array_size;
//struct block_descriptor *blocks; //struct block_descriptor *blocks;
...@@ -173,7 +175,6 @@ struct brt { ...@@ -173,7 +175,6 @@ struct brt {
OMT txns; // transactions that are using this OMT (note that the transaction checks the cf also) OMT txns; // transactions that are using this OMT (note that the transaction checks the cf also)
u_int64_t txn_that_created; // which txn created it. Use 0 if no such txn. u_int64_t txn_that_created; // which txn created it. Use 0 if no such txn.
u_int64_t root_put_counter;
}; };
......
...@@ -2166,7 +2166,7 @@ static int brt_alloc_init_header(BRT t, const char *dbname, TOKUTXN txn) { ...@@ -2166,7 +2166,7 @@ static int brt_alloc_init_header(BRT t, const char *dbname, TOKUTXN txn) {
// printf("%s:%d translated_blocknum_limit=%ld, block_translation_address_on_disk=%ld\n", __FILE__, __LINE__, t->h->translated_blocknum_limit, t->h->block_translation_address_on_disk); // printf("%s:%d translated_blocknum_limit=%ld, block_translation_address_on_disk=%ld\n", __FILE__, __LINE__, t->h->translated_blocknum_limit, t->h->block_translation_address_on_disk);
create_block_allocator(&t->h->block_allocator, t->nodesize, BLOCK_ALLOCATOR_ALIGNMENT); create_block_allocator(&t->h->block_allocator, t->nodesize, BLOCK_ALLOCATOR_ALIGNMENT);
toku_fifo_create(&t->h->fifo); toku_fifo_create(&t->h->fifo);
t->root_put_counter = global_root_put_counter++; t->h->root_put_counter = global_root_put_counter++;
if (dbname) { if (dbname) {
t->h->n_named_roots = 1; t->h->n_named_roots = 1;
if ((MALLOC_N(1, t->h->names))==0) { assert(errno==ENOMEM); r=ENOMEM; if (0) { died4: if (dbname) toku_free(t->h->names); } goto died3; } if ((MALLOC_N(1, t->h->names))==0) { assert(errno==ENOMEM); r=ENOMEM; if (0) { died4: if (dbname) toku_free(t->h->names); } goto died3; }
...@@ -2589,7 +2589,7 @@ int toku_brt_root_put_cmd(BRT brt, BRT_CMD cmd, TOKULOGGER logger) { ...@@ -2589,7 +2589,7 @@ int toku_brt_root_put_cmd(BRT brt, BRT_CMD cmd, TOKULOGGER logger) {
//assert(0==toku_cachetable_assert_all_unpinned(brt->cachetable)); //assert(0==toku_cachetable_assert_all_unpinned(brt->cachetable));
assert(brt->h); assert(brt->h);
brt->root_put_counter = global_root_put_counter++; brt->h->root_put_counter = global_root_put_counter++;
u_int32_t fullhash; u_int32_t fullhash;
rootp = toku_calculate_root_offset_pointer(brt, &fullhash); rootp = toku_calculate_root_offset_pointer(brt, &fullhash);
//assert(fullhash==toku_cachetable_hash(brt->cf, *rootp)); //assert(fullhash==toku_cachetable_hash(brt->cf, *rootp));
...@@ -3005,7 +3005,7 @@ int toku_brt_search(BRT brt, brt_search_t *search, DBT *newkey, DBT *newval, TOK ...@@ -3005,7 +3005,7 @@ int toku_brt_search(BRT brt, brt_search_t *search, DBT *newkey, DBT *newval, TOK
assert(brt->h); assert(brt->h);
*root_put_counter = brt->root_put_counter; *root_put_counter = brt->h->root_put_counter;
u_int32_t fullhash; u_int32_t fullhash;
CACHEKEY *rootp = toku_calculate_root_offset_pointer(brt, &fullhash); CACHEKEY *rootp = toku_calculate_root_offset_pointer(brt, &fullhash);
...@@ -3368,7 +3368,7 @@ static int brt_cursor_next_shortcut (BRT_CURSOR cursor, DBT *outkey, DBT *outval ...@@ -3368,7 +3368,7 @@ static int brt_cursor_next_shortcut (BRT_CURSOR cursor, DBT *outkey, DBT *outval
{ {
if (toku_omt_cursor_is_valid(cursor->omtcursor)) { if (toku_omt_cursor_is_valid(cursor->omtcursor)) {
{ {
u_int64_t h_counter = cursor->brt->root_put_counter; u_int64_t h_counter = cursor->brt->h->root_put_counter;
if (h_counter != cursor->root_put_counter) return -1; if (h_counter != cursor->root_put_counter) return -1;
} }
OMTVALUE le; OMTVALUE le;
...@@ -3406,7 +3406,7 @@ int toku_brt_cursor_peek_prev(BRT_CURSOR cursor, DBT *outkey, DBT *outval) { ...@@ -3406,7 +3406,7 @@ int toku_brt_cursor_peek_prev(BRT_CURSOR cursor, DBT *outkey, DBT *outval) {
if (toku_omt_cursor_is_valid(cursor->omtcursor)) { if (toku_omt_cursor_is_valid(cursor->omtcursor)) {
{ {
assert(cursor->brt->h); assert(cursor->brt->h);
u_int64_t h_counter = cursor->brt->root_put_counter; u_int64_t h_counter = cursor->brt->h->root_put_counter;
if (h_counter != cursor->root_put_counter) return -1; if (h_counter != cursor->root_put_counter) return -1;
} }
OMTVALUE le; OMTVALUE le;
...@@ -3432,7 +3432,7 @@ int toku_brt_cursor_peek_next(BRT_CURSOR cursor, DBT *outkey, DBT *outval) { ...@@ -3432,7 +3432,7 @@ int toku_brt_cursor_peek_next(BRT_CURSOR cursor, DBT *outkey, DBT *outval) {
if (toku_omt_cursor_is_valid(cursor->omtcursor)) { if (toku_omt_cursor_is_valid(cursor->omtcursor)) {
{ {
assert(cursor->brt->h); assert(cursor->brt->h);
u_int64_t h_counter = cursor->brt->root_put_counter; u_int64_t h_counter = cursor->brt->h->root_put_counter;
if (h_counter != cursor->root_put_counter) return -1; if (h_counter != cursor->root_put_counter) return -1;
} }
OMTVALUE le; OMTVALUE le;
...@@ -3521,7 +3521,7 @@ static int brt_cursor_prev_shortcut (BRT_CURSOR cursor, DBT *outkey, DBT *outval ...@@ -3521,7 +3521,7 @@ static int brt_cursor_prev_shortcut (BRT_CURSOR cursor, DBT *outkey, DBT *outval
{ {
if (toku_omt_cursor_is_valid(cursor->omtcursor)) { if (toku_omt_cursor_is_valid(cursor->omtcursor)) {
{ {
u_int64_t h_counter = cursor->brt->root_put_counter; u_int64_t h_counter = cursor->brt->h->root_put_counter;
if (h_counter != cursor->root_put_counter) return -1; if (h_counter != cursor->root_put_counter) return -1;
} }
OMTVALUE le; OMTVALUE le;
......
...@@ -24,3 +24,11 @@ ...@@ -24,3 +24,11 @@
fun:deflate fun:deflate
fun:compress2 fun:compress2
} }
{
compress_is_not_valgrind_clean3_32
Memcheck:Cond
obj:/usr/lib/libz.so.1.2.3
obj:/usr/lib/libz.so.1.2.3
fun:deflate
fun:compress2
}
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