Commit cb428d20 authored by Yoni Fogel's avatar Yoni Fogel

[t:2506] [t:2507] Fix metadata (size writing) during write_pair_for_checkpoint

Also initialize the work item in the pair even if we actually are writing it.
Fix crash in getting size of empty FILENUMS

git-svn-id: file:///svn/toku/tokudb@19200 c7de825b-a66e-492c-adef-691d508d4ae1
parent 48cf4694
...@@ -1356,9 +1356,12 @@ write_pair_for_checkpoint (CACHETABLE ct, PAIR p) ...@@ -1356,9 +1356,12 @@ write_pair_for_checkpoint (CACHETABLE ct, PAIR p)
assert(ct->size_writing>=0); assert(ct->size_writing>=0);
p->write_me = TRUE; p->write_me = TRUE;
p->remove_me = FALSE; p->remove_me = FALSE;
workitem_init(&p->asyncwork, NULL, p);
cachetable_write_pair(ct, p); // releases the write lock on the pair cachetable_write_pair(ct, p); // releases the write lock on the pair
} }
else if (p->cq) { else if (p->cq) {
assert(ct->size_writing>=0);
ct->size_writing += p->size; //cachetable_complete_write_pair will reduce by p->size
workitem_init(&p->asyncwork, NULL, p); workitem_init(&p->asyncwork, NULL, p);
workqueue_enq(p->cq, &p->asyncwork, 1); workqueue_enq(p->cq, &p->asyncwork, 1);
} }
......
...@@ -177,7 +177,8 @@ static inline int toku_logsizeof_TXNID (TXNID txnid __attribute__((__unused__))) ...@@ -177,7 +177,8 @@ static inline int toku_logsizeof_TXNID (TXNID txnid __attribute__((__unused__)))
} }
static inline int toku_logsizeof_FILENUMS (FILENUMS fs) { static inline int toku_logsizeof_FILENUMS (FILENUMS fs) {
return 4 + fs.num * toku_logsizeof_FILENUM(fs.filenums[0]); static const FILENUM f; //fs could have .num==0 and then we cannot dereference
return 4 + fs.num * toku_logsizeof_FILENUM(f);
} }
static inline int toku_logsizeof_BYTESTRING (BYTESTRING bs) { static inline int toku_logsizeof_BYTESTRING (BYTESTRING bs) {
......
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