Skip to content
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-10807 Skip in-memory deleted pages as part of the tree walk (6.0 backport) #10588

Merged
merged 2 commits into from
May 22, 2024

Conversation

kommiharibabu
Copy link
Contributor

Traversing an in-memory page that contains all the deleted values that are visible to the current transaction, leading to an increase in latency due
to the time spent skipping these deleted values.

By saving the aggregated timestamp information in the ref when the page has all deleted values, this aggregated information can be validated against the transaction snapshot to skip traversing the page completely and improve the latency when there are many deleted pages.

The downside of this approach is that the in-memory size of each ref is increased by 8 more bytes, but this increase shouldn't cause any problem.

(cherry picked from commit d121cca) (cherry picked from commit eed05eb)

Traversing an in-memory page that contains all the deleted values that
are visible to the current transaction, leading to an increase in
latency due
to the time spent skipping these deleted values.

By saving the aggregated timestamp information in the ref when the page
has all deleted values, this aggregated information can be validated
against the transaction snapshot to skip traversing the page completely
and improve the latency when there are many deleted pages.

The downside of this approach is that the in-memory size of each ref is
increased by 8 more bytes, but this increase shouldn't cause any
problem.

(cherry picked from commit d121cca)
(cherry picked from commit eed05eb)
* could potentially skip pages. The skip function looks at the aggregated timestamp
* information to determine if something is visible on the page. If nothing is, the page is
* skipped.
* If we are running with snapshot isolation, have a snapshot, and are not interested in
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this comment was missed on 7.0

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is the only change required in 6.0 due to the checkpoint cursors that are not supported, but there exists so many tests that test checkpoint cursors.

*/
if (!F_ISSET(&cbt->iface, WT_CURSTD_KEY_ONLY) &&
session->txn->isolation == WT_ISO_SNAPSHOT &&
F_ISSET(session->txn, WT_TXN_HAS_SNAPSHOT) &&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this was missed on 7.0

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is the only change required in 6.0 due to the checkpoint cursors that are not supported, but there exists so many tests that test checkpoint cursors.

__wt_ref_addr_copy(session, ref, &addr) && addr.ta.newest_stop_txn != WT_TXN_MAX &&
addr.ta.newest_stop_ts != WT_TS_MAX &&

if (previous_state == WT_REF_MEM && !__wt_page_is_modified(ref->page))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was this more in 7.0 when the ref is deleted:

        walk_skip_stats->total_del_pages_skipped++;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, those code changes are due to the fast truncate data format changes. As those conditions are not possible in 6.0, we do not need it.

Copy link
Contributor

@etienneptl etienneptl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for addressing my different concerns regarding the differences with the 7.0 backport. LGTM!

Copy link
Contributor

@korteland korteland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a challenging backport, so I've reviewed it super carefully. It looks good - nice work!

@kommiharibabu kommiharibabu merged commit 42488a4 into mongodb-6.0 May 22, 2024
6 checks passed
@kommiharibabu kommiharibabu deleted the wt-10807-v6.0-backport-2 branch May 22, 2024 04:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants