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-11634 Provide optimized versions of set_key/value for MongoDB index use cases #10549

Closed
wants to merge 4 commits into from

Conversation

raviprakashgiri29
Copy link
Contributor

@raviprakashgiri29 raviprakashgiri29 commented May 2, 2024

The changes include the following:.

  • Added new API void __wt_cursor_set_raw_key_value(WT_CURSOR *cursor, WT_ITEM *key, WT_ITEM *value) and void_wt_cursor_set_raw_key_value_notsup(WT_CURSOR *cursor, WT_ITEM *key, WT_ITEM *value)
  • Added a cppsuite unittest to test the API's
  • Added a csuite test wt11634_get_set_key_value/main.c to test the API's

WT_SESSION_IMPL *session;

CURSOR_API_CALL(cursor, session, ret, set_raw_key_value, NULL);
WT_ERR(__cursor_copy_release(cursor));
Copy link
Member

Choose a reason for hiding this comment

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

Did you consider refactoring and using set_raw_key and set_raw_value internally? I know we are chasing performance here, but the duplication of complex and subtle code worries me.

There also doesn't seem to be enough checking to make sure the API is used as expected. I'd expect that to be present in at least diagnostic builds, and preferably everywhere: This is a primary mechanism for applications to give context to WiredTiger, which it will operate on. Ensuring the data is in an expected state/format on entry is necessary to limit how much further checking/safety we need inside the library.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @agorrod , as I understand it, part of the challenge here is that __wt_cursor_set_raw_key and __wt_cursor_set_raw_value call set_key and set_value respectively, and those functions take va args parameters. Removing the va args usage (and perf cost) is a main benefit from this proposed change.
Obviously, if there are opportunities to refactor the code and/or take a simpler approach then we should do so.

@@ -0,0 +1,154 @@
/*-
Copy link
Contributor

Choose a reason for hiding this comment

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

Hi Ravi, do we need this new test file? I'd consider performing similar tests using the Catch2 framework instead, and adding them to those you have added in test_cursor_set_raw_key_value.cpp.

@raviprakashgiri29 raviprakashgiri29 marked this pull request as draft May 14, 2024 23:28
Copy link

Test coverage is too low, this change probably shouldn't be merged as-is.

Metric (for added/changed code) Coverage
Line coverage 68% (27/40)
Branch coverage 33% (22/66)

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