Commit f35926ad authored by Bradley C. Kuszmaul's avatar Bradley C. Kuszmaul Committed by Yoni Fogel

brt-test runs for a much longer time before barfing. Addresse #1000, #1080, #1131.

git-svn-id: file:///svn/tokudb.1131b+1080a@6130 c7de825b-a66e-492c-adef-691d508d4ae1
parent 7ba939a0
...@@ -76,6 +76,7 @@ grow_blocks_array (BLOCK_ALLOCATOR ba) { ...@@ -76,6 +76,7 @@ grow_blocks_array (BLOCK_ALLOCATOR ba) {
void void
block_allocator_alloc_block_at (BLOCK_ALLOCATOR ba, u_int64_t size, u_int64_t offset) { block_allocator_alloc_block_at (BLOCK_ALLOCATOR ba, u_int64_t size, u_int64_t offset) {
u_int64_t i; u_int64_t i;
assert(offset >= ba->reserve_at_beginning);
grow_blocks_array(ba); grow_blocks_array(ba);
// Just do a linear search for the block // Just do a linear search for the block
for (i=0; i<ba->n_blocks; i++) { for (i=0; i<ba->n_blocks; i++) {
......
...@@ -664,7 +664,6 @@ int toku_serialize_brt_header_to (int fd, struct brt_header *h) { ...@@ -664,7 +664,6 @@ int toku_serialize_brt_header_to (int fd, struct brt_header *h) {
wbuf_ulonglong(&w, h->block_translation[i].size); wbuf_ulonglong(&w, h->block_translation[i].size);
} }
u_int32_t checksum = x1764_finish(&w.checksum); u_int32_t checksum = x1764_finish(&w.checksum);
printf("%s:%d writing to %d\n", __FILE__, __LINE__, checksum);
wbuf_int(&w, checksum); wbuf_int(&w, checksum);
ssize_t nwrote = pwrite(fd, w.buf, size, h->block_translation_address_on_disk); ssize_t nwrote = pwrite(fd, w.buf, size, h->block_translation_address_on_disk);
assert(nwrote==(ssize_t)size); assert(nwrote==(ssize_t)size);
...@@ -706,7 +705,7 @@ int deserialize_brtheader (u_int32_t size, int fd, DISKOFF off, struct brt_heade ...@@ -706,7 +705,7 @@ int deserialize_brtheader (u_int32_t size, int fd, DISKOFF off, struct brt_heade
if (h->block_translation_address_on_disk == 0) { if (h->block_translation_address_on_disk == 0) {
h->block_translation = 0; h->block_translation = 0;
} else { } else {
block_allocator_alloc_block_at(h->block_allocator, h->block_translation_address_on_disk, h->block_translation_size_on_disk); block_allocator_alloc_block_at(h->block_allocator, h->block_translation_size_on_disk, h->block_translation_address_on_disk);
XMALLOC_N(h->translated_blocknum_limit, h->block_translation); XMALLOC_N(h->translated_blocknum_limit, h->block_translation);
unsigned char *XMALLOC_N(h->block_translation_size_on_disk, tbuf); unsigned char *XMALLOC_N(h->block_translation_size_on_disk, tbuf);
{ {
...@@ -731,7 +730,8 @@ int deserialize_brtheader (u_int32_t size, int fd, DISKOFF off, struct brt_heade ...@@ -731,7 +730,8 @@ int deserialize_brtheader (u_int32_t size, int fd, DISKOFF off, struct brt_heade
for (i=0; i<h->translated_blocknum_limit; i++) { for (i=0; i<h->translated_blocknum_limit; i++) {
h->block_translation[i].diskoff = rbuf_diskoff(&rt); h->block_translation[i].diskoff = rbuf_diskoff(&rt);
h->block_translation[i].size = rbuf_diskoff(&rt); h->block_translation[i].size = rbuf_diskoff(&rt);
block_allocator_alloc_block_at(h->block_allocator, h->block_translation[i].diskoff, h->block_translation[i].size); if (h->block_translation[i].size > 0)
block_allocator_alloc_block_at(h->block_allocator, h->block_translation[i].size, h->block_translation[i].diskoff);
} }
toku_free(tbuf); toku_free(tbuf);
} }
......
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