void sync() {
metadata.flags = F_SYNC | F_LASTVALID;
metadata.lastRecordOffset = s[client].woffset;
+ /* rend is now no longer the end of the page */
+ if (s[client].rpage == s[client].wpage)
+ s[client].rend = s[client].woffset;
wmetadataStart();
}
would end on the last byte of the last page, as this would mean that
we would not sync the last page, breaking the log volume
invariant */
- if (s[client].wpos % vlen >= vlen - len)
+ if ((s[client].wpos - PAGE_SIZE) % vlen >= vlen - len)
sync();
else
{