Skip to content

Conversation

anand1976
Copy link
Contributor

Return a failure status for multi scan if Prepare fails, or if the scan options are unsupported, instead of falling back on a regular scan. This PR also fixes a bug in LevelIterator that caused max_prefetch_size to be ignored.

Test plan:
Add new test in db_iterator_test and table_test

@xingbowang
Copy link

I suspect the failed tests are caused by the conflict in this change. #13970. You might have to merge.

Copy link

@xingbowang xingbowang left a comment

Choose a reason for hiding this comment

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

Still need to go through the tests.

Copy link

@xingbowang xingbowang left a comment

Choose a reason for hiding this comment

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

done with tests.

Comment on lines +8350 to +8359
// Set up the user-defined index factory
auto user_defined_index_factory =
std::make_shared<TestUserDefinedIndexFactory>();
table_options.user_defined_index_factory = user_defined_index_factory;

// Set up custom flush block policy that flushes every 3 keys
table_options.flush_block_policy_factory =
std::make_shared<CustomFlushBlockPolicyFactory>();

options.table_factory.reset(NewBlockBasedTableFactory(table_options));

Choose a reason for hiding this comment

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

It might be worth to dedup this code with other UDI unit tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let me defer it to a follow-on PR. I'm trying to land this before the release branch cut.

@facebook-github-bot
Copy link
Contributor

@anand1976 has imported this pull request. If you are a Meta employee, you can view this in D82843944.

@cbi42
Copy link
Member

cbi42 commented Sep 19, 2025

Stress test can fail now whenever we abort Prepare()?

@anand1976
Copy link
Contributor Author

Stress test can fail now whenever we abort Prepare()?

It could. Do you see an issue with it? I think db_stress generates the ranges in order with valid upper bounds, so Prepare() shouldn't fail in the normal course.

@cbi42
Copy link
Member

cbi42 commented Sep 19, 2025

It could. Do you see an issue with it? I think db_stress generates the ranges in order with valid upper bounds, so Prepare() shouldn't fail in the normal course.

I think L0 file may not work properly as discussed offline. DB iter internal reseeks or range deletion reseeks may also fail the iterator.

@facebook-github-bot
Copy link
Contributor

@anand1976 has imported this pull request. If you are a Meta employee, you can view this in D82843944.

for (auto i = fstart; i <= fend; i++) {
if (i < flevel_->num_files) {
auto args = GetMultiScanArgForFile(i);
auto& args = GetMultiScanArgForFile(i);

Choose a reason for hiding this comment

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

Thanks for fixing the bug.

@facebook-github-bot
Copy link
Contributor

@anand1976 has imported this pull request. If you are a Meta employee, you can view this in D82843944.

@facebook-github-bot
Copy link
Contributor

@anand1976 merged this pull request in afbbc90.

cbi42 pushed a commit that referenced this pull request Sep 23, 2025
Summary:
Return a failure status for multi scan if Prepare fails, or if the scan options are unsupported, instead of falling back on a regular scan. This PR also fixes a bug in LevelIterator that caused max_prefetch_size to be ignored.

Pull Request resolved: #13974

Test Plan: Add new test in db_iterator_test and table_test

Reviewed By: xingbowang

Differential Revision: D82843944

Pulled By: anand1976

fbshipit-source-id: f12756c40ebd38d8d4e4425e97438b6e766a4663
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants