Browse Source

Forgot to dirty the root block when allocating a disk block. Addresses #1131, #1080, #1000.

git-svn-id: file:///svn/tokudb.1131b+1080a@6038 c7de825b-a66e-492c-adef-691d508d4ae1
pull/73/head
Bradley C. Kuszmaul 13 years ago
committed by Yoni Fogel
parent
commit
5ff7b0c746
  1. 4
      newbrt/brt-serialize.c
  2. 1
      newbrt/brt.c

4
newbrt/brt-serialize.c

@ -630,7 +630,6 @@ int deserialize_brtheader_7_or_later(u_int32_t size, int fd, DISKOFF off, struct
h->free_blocks = rbuf_blocknum(&rc);
h->unused_blocks = rbuf_blocknum(&rc);
h->n_named_roots = rbuf_int(&rc);
h->free_blocks = make_blocknum(-1);
if (h->n_named_roots>=0) {
int i;
int n_to_malloc = (h->n_named_roots == 0) ? 1 : h->n_named_roots;
@ -702,6 +701,7 @@ unsigned int toku_brtnode_pivot_key_len (BRTNODE node, struct kv_pair *pk) {
// we might not be able to allocate a large enough buffer to hold everything,
// and it would be more complex to batch up several writes.
int toku_serialize_fifo_at (int fd, off_t freeoff, FIFO fifo) {
//printf("%s:%d Serializing fifo at %" PRId64 " (count=%d)\n", __FILE__, __LINE__, freeoff, toku_fifo_n_entries(fifo));
{
int size=4;
char buf[size];
@ -765,7 +765,7 @@ int read_nbytes (int fd, off_t *at, char **data, u_int32_t len) {
char *result = toku_malloc(len);
if (result==0) return errno;
ssize_t r = pread(fd, result, len, *at);
//printf("%s:%d read %d bytes, which are %s\n", __FILE__, __LINE__, len, result);
//printf("%s:%d read %d bytes at %" PRId64 ", which are %s\n", __FILE__, __LINE__, len, *at, result);
if (r<0) return errno;
assert(r==(ssize_t)len);
(*at)+=len;

1
newbrt/brt.c

@ -281,6 +281,7 @@ int allocate_diskblocknumber (BLOCKNUM *res, BRT brt, TOKULOGGER logger __attrib
assert(brt->h->free_blocks.b == -1); // no blocks in the free list
BLOCKNUM result = brt->h->unused_blocks;
brt->h->unused_blocks.b++;
brt->h->dirty = 1;
*res = result;
return 0;
}

Loading…
Cancel
Save