New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WT-10862 Support read-only fast-truncate data format change in MongoDB 6.0 release #9396
Changes from all commits
2aa9fe6
f03a570
8f4e900
386006b
7adba88
e3bba69
3096cb1
67bfbb2
20f851a
427c7d0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -670,6 +670,7 @@ __wt_cell_unpack_safe(WT_SESSION_IMPL *session, const WT_PAGE_HEADER *dsk, WT_CE | |
WT_TIME_WINDOW tw; | ||
} copy; | ||
WT_CELL_UNPACK_COMMON *unpack; | ||
WT_PAGE_DELETED page_del; | ||
WT_TIME_AGGREGATE *ta; | ||
WT_TIME_WINDOW *tw; | ||
uint64_t v; | ||
|
@@ -767,6 +768,7 @@ __wt_cell_unpack_safe(WT_SESSION_IMPL *session, const WT_PAGE_HEADER *dsk, WT_CE | |
if ((cell->__chunk[0] & WT_CELL_SECOND_DESC) == 0) | ||
break; | ||
flags = *p++; /* skip second descriptor byte */ | ||
WT_CELL_LEN_CHK(p, 0); | ||
|
||
if (LF_ISSET(WT_CELL_PREPARE)) | ||
ta->prepare = 1; | ||
|
@@ -810,6 +812,7 @@ __wt_cell_unpack_safe(WT_SESSION_IMPL *session, const WT_PAGE_HEADER *dsk, WT_CE | |
if ((cell->__chunk[0] & WT_CELL_SECOND_DESC) == 0) | ||
break; | ||
flags = *p++; /* skip second descriptor byte */ | ||
WT_CELL_LEN_CHK(p, 0); | ||
|
||
if (LF_ISSET(WT_CELL_PREPARE)) | ||
tw->prepare = 1; | ||
|
@@ -845,6 +848,21 @@ __wt_cell_unpack_safe(WT_SESSION_IMPL *session, const WT_PAGE_HEADER *dsk, WT_CE | |
break; | ||
} | ||
|
||
/* | ||
* Unpack any fast-truncate information. Note that there is no way to write fast-truncate | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this just skip the fast truncate information, rather than unpacking it? I guess it's a question of whether information that was generated by a newer release should be parsed out and maybe, therefore, alter decisions made at runtime. It feels as though it is going to be hard to test that combination (i.e: run with a newer version, generate fast truncate information, downgrade, read fast truncate information, ensure correct decisions are being made). So, I'd be inclined towards ignoring the information as early as possible, rather than using it to populate data structures. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree with Alex, but I believe we need to unpack it, otherwise, we may get the problem. Instead of saving the unpacked data into the unpack_addr, just save them into a local variable and ignore them. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I don't believe it's possible to simply skip the information - I think it could disrupt other information that is being unpacked as it would affect the position of the pointer. I can definitely unpack it into a local WT_PAGE_DELETED structure rather than into a structure inside the unpack_addr. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we move this logic into a dedicated function? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @quchenhao Would there be any specific advantages of having a separate function for this? We're only unpacking the information once. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just to make the code cleaner. |
||
* information to disk in versions before 6.1, but this information may still exist in the | ||
* database files if we are downgrading from newer versions. If the fast-truncate information is | ||
* present, it needs to be unpacked but we will ignore these values. Ignoring these values is | ||
* equivalent to writing out truncated content that is not associated with any visibility. | ||
*/ | ||
if (unpack->raw == WT_CELL_ADDR_DEL && F_ISSET(dsk, WT_PAGE_FT_UPDATE)) { | ||
WT_RET( | ||
__wt_vunpack_uint(&p, end == NULL ? 0 : WT_PTRDIFF(end, p), (uint64_t *)&page_del.txnid)); | ||
WT_RET(__wt_vunpack_uint(&p, end == NULL ? 0 : WT_PTRDIFF(end, p), &page_del.timestamp)); | ||
WT_RET( | ||
__wt_vunpack_uint(&p, end == NULL ? 0 : WT_PTRDIFF(end, p), &page_del.durable_timestamp)); | ||
} | ||
|
||
/* | ||
* Check for an RLE count or record number that optionally follows the cell descriptor byte on | ||
* column-store variable-length pages. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch - do we need to be concerned about this? It looks like a bug regardless of the backport here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it looks like a typo that I decided to just fix here. I think it's actually ok because
WT_TS_NONE
andWT_TXN_NONE
are actually the same value in the codebase, so I don't know if we should call it a bug. It's just confusing to read in the condition.