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

Add file operation callbacks to SequentialFileReader #8982

Closed
wants to merge 4 commits into from

Conversation

shrfb
Copy link
Contributor

@shrfb shrfb commented Sep 30, 2021

Summary:
This change adds File IO Notifications to the SequentialFileReader The SequentialFileReader is extended
with a listener parameter.

Test Plan:
A new test EventListenerTest::OnWALOperationTest has been added. The
test verifies that during restore the sequential file reader is called
and the notifications are fired.

Reviewers:
yanqin, rmanji

Subscribers:

Tasks:
T75121251

Tags:

Summary:
This change adds File IO Notifications to the SequentialFileReader and
ReadAheadSequentialFileReader. The SequentialFileReader is extended
with a listener parameter.

Test Plan:
A new test EventListenerTest::OnWALOperationTest has been added. The
test verifies that during restore the sequential file reader is called
and the notifications are fired.

Reviewers:
yanqin, rmanji

Subscribers:

Tasks:
T75121251

Tags:
@facebook-github-bot
Copy link
Contributor

@shrfb has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Summary:
.

Test Plan:
A new test EventListenerTest::OnWALOperationTest has been added. The
test verifies that during restore the sequential file reader is called
and the notifications are fired.

Reviewers:
yanqin, rmanji

Subscribers:

Tasks:
T75121251

Tags:
@facebook-github-bot
Copy link
Contributor

@shrfb has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Contributor

@shrfb has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Copy link
Contributor

@riversand963 riversand963 left a comment

Choose a reason for hiding this comment

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

Thanks @shrfb for the PR.
In the PR description, there is a mention of "ReadAheadSequentialFileReader", but I cannot find it in the PR. Are you referring to ReadaheadSequentialFile? For this PR, adding the change just for SequentialFileReader is totally fine.

db/listener_test.cc Outdated Show resolved Hide resolved
Comment on lines 1208 to 1209
ASSERT_OK(dbfull()->Flush(FlushOptions()));
ASSERT_OK(dbfull()->TEST_WaitForFlushMemTable());
Copy link
Contributor

Choose a reason for hiding this comment

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

By removing this Flush, we can test reading from WAL during recovery.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

ReadManifestAndWALOnRecovery.

Summary:
This changes the name of the OnWALOperationTest to
ReadManifestAndWALOnRecovery. It also removes the flush operation to
also test WAL reading.

Test Plan:
A new test EventListenerTest::OnWALOperationTest has been added. The
test verifies that during restore the sequential file reader is called
and the notifications are fired.

Reviewers:
yanqin, rmanji

Subscribers:

Tasks:
T75121251

Tags:
@facebook-github-bot
Copy link
Contributor

@shrfb has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Contributor

@shrfb has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Copy link
Contributor

@riversand963 riversand963 left a comment

Choose a reason for hiding this comment

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

Another pass. Can you also update the PR description and remove ReadaheadSequentialFileReader?

}
DestroyAndReopen(options);
ASSERT_OK(Put("foo", "aaa"));
ASSERT_OK(dbfull()->TEST_WaitForFlushMemTable());
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: this can also be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

#ifndef ROCKSDB_LITE
if (ShouldNotifyListeners()) {
auto finish_ts = FileOperationInfo::FinishNow();
size_t offset = offset_.fetch_add(n);
Copy link
Contributor

Choose a reason for hiding this comment

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

The above Read can return fewer bytes than n, thus I think we should increment offset_ by result->size().

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed.

Summary:
- Change ReadManifestAndWALOnRecovery to not use WaitForFlushMemTable.
- Use result size in updating the offset in the sequential reader.

Test Plan:
iClose popup and return
A new test EventListenerTest::ReadManifestAndWALOnRecovery has been added. The
test verifies that during restore the sequential file reader is called
and the notifications are fired.

Reviewers:
yanqin, rmanji

Subscribers:

Tasks:
T75121251

Tags:
@facebook-github-bot
Copy link
Contributor

@shrfb has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Contributor

@shrfb has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Copy link
Contributor

@riversand963 riversand963 left a comment

Choose a reason for hiding this comment

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

Thanks @shrfb for the PR.

yoori pushed a commit to yoori/rocksdb that referenced this pull request Nov 26, 2023
Summary:
This change adds File IO Notifications to the SequentialFileReader The SequentialFileReader is extended
with a listener parameter.

Pull Request resolved: facebook/rocksdb#8982

Test Plan:
A new test EventListenerTest::OnWALOperationTest has been added. The
test verifies that during restore the sequential file reader is called
and the notifications are fired.

Reviewed By: riversand963

Differential Revision: D31320844

Pulled By: shrfb

fbshipit-source-id: 040b24da7c010d7c14ebb5c6460fae9a19b8c168
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.

None yet

3 participants