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

feat: Use Velox fs for ssd cache checkpoint file #11783

Closed
wants to merge 1 commit into from

Conversation

zacw7
Copy link
Contributor

@zacw7 zacw7 commented Dec 6, 2024

Summary: Switch the ssd cache checkpoint file to use Velox filesystem for file r/w operations, so that more advanced testing can be built by leveraging features like fault injections.

Differential Revision: D66892136

@zacw7 zacw7 requested a review from majetideepak as a code owner December 6, 2024 23:20
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Dec 6, 2024
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D66892136

Copy link

netlify bot commented Dec 6, 2024

Deploy Preview for meta-velox canceled.

Name Link
🔨 Latest commit fd46b9b
🔍 Latest deploy log https://app.netlify.com/sites/meta-velox/deploys/675a87fa2d49050008415c4b

zacw7 added a commit to zacw7/velox that referenced this pull request Dec 7, 2024
…1783)

Summary:

Switch the ssd cache checkpoint file to use Velox filesystem for file r/w operations, so that more advanced testing can be built by leveraging features like fault injections.

Differential Revision: D66892136
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D66892136

Copy link
Contributor

@xiaoxmeng xiaoxmeng left a comment

Choose a reason for hiding this comment

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

@zacw7 thanks for change % comments

@@ -383,6 +383,8 @@ void LocalWriteFile::truncate(int64_t newSize) {
0,
"ftruncate failed in LocalWriteFile::truncate: {}.",
folly::errnoStr(errno));
// Reposition the file offset to the end of the file for append().
Copy link
Contributor

Choose a reason for hiding this comment

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

Why need this? thanks!

Copy link
Contributor Author

@zacw7 zacw7 Dec 7, 2024

Choose a reason for hiding this comment

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

Underline LocalWriteFile->append, it's ::write:

const uint64_t bytesWritten = ::write(fd_, data.data(), data.size());

The writing takes place at an inexplicit offset (https://man7.org/linux/man-pages/man2/write.2.html), which won't be reset automatically after truncate.

velox/common/caching/SsdFile.cpp Show resolved Hide resolved
velox/common/caching/SsdFile.cpp Outdated Show resolved Hide resolved
velox/common/caching/SsdFile.cpp Outdated Show resolved Hide resolved
velox/common/caching/SsdFile.cpp Outdated Show resolved Hide resolved
velox/common/caching/SsdFile.cpp Outdated Show resolved Hide resolved
velox/common/caching/SsdFile.cpp Show resolved Hide resolved
state.write(checkpointVersion().data(), sizeof(int32_t));
state.write(asChar(&maxRegions_), sizeof(maxRegions_));
state.write(asChar(&numRegions_), sizeof(numRegions_));
checkpointWriteFile_->append(checkpointVersion());
Copy link
Contributor

Choose a reason for hiding this comment

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

You can allocate 1MB buffer from cache pool for checkpointing buffer.

velox/common/caching/SsdFile.cpp Show resolved Hide resolved
}
}
checkpointWriteFile_->append(folly::IOBuf::copyBuffer(
Copy link
Contributor

Choose a reason for hiding this comment

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

We just need to sync data file right before write out kCheckpointEndMarker?

zacw7 added a commit to zacw7/velox that referenced this pull request Dec 10, 2024
…1783)

Summary:

Switch the ssd cache checkpoint file to use Velox filesystem for file r/w operations, so that more advanced testing can be built by leveraging features like fault injections.

Differential Revision: D66892136
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D66892136

@zacw7 zacw7 requested a review from xiaoxmeng December 10, 2024 01:10
Copy link
Contributor

@xiaoxmeng xiaoxmeng left a comment

Choose a reason for hiding this comment

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

@zacw7 overall looks good % minors.

velox/common/caching/SsdFile.h Outdated Show resolved Hide resolved
velox/common/caching/tests/SsdFileTest.cpp Outdated Show resolved Hide resolved
velox/common/caching/SsdFile.cpp Outdated Show resolved Hide resolved
velox/common/caching/SsdFile.cpp Outdated Show resolved Hide resolved
velox/common/caching/SsdFile.cpp Outdated Show resolved Hide resolved
zacw7 added a commit to zacw7/velox that referenced this pull request Dec 10, 2024
…1783)

Summary:

Switch the ssd cache checkpoint file to use Velox filesystem for file r/w operations, so that more advanced testing can be built by leveraging features like fault injections.

Differential Revision: D66892136
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D66892136

zacw7 added a commit to zacw7/velox that referenced this pull request Dec 11, 2024
…1783)

Summary:

Switch the ssd cache checkpoint file to use Velox filesystem for file r/w operations, so that more advanced testing can be built by leveraging features like fault injections.

Differential Revision: D66892136
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D66892136

Copy link
Contributor

@xiaoxmeng xiaoxmeng left a comment

Choose a reason for hiding this comment

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

@zacw7 thanks for the update!

velox/common/caching/SsdFile.h Outdated Show resolved Hide resolved
velox/common/caching/SsdFile.h Outdated Show resolved Hide resolved
velox/common/caching/SsdFile.h Outdated Show resolved Hide resolved
velox/common/caching/SsdFile.cpp Outdated Show resolved Hide resolved
velox/common/caching/SsdFile.cpp Outdated Show resolved Hide resolved
velox/common/caching/SsdFile.cpp Outdated Show resolved Hide resolved
velox/common/caching/SsdFile.cpp Outdated Show resolved Hide resolved
velox/common/caching/SsdFile.cpp Show resolved Hide resolved
}

std::string readString(common::FileInputStream* stream, int32_t length) {
std::string data;
Copy link
Contributor

Choose a reason for hiding this comment

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

std::string data(length);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This requires a second arg. I'll put it as std::string data(length, '\0')

velox/common/caching/SsdFile.cpp Outdated Show resolved Hide resolved
zacw7 added a commit to zacw7/velox that referenced this pull request Dec 11, 2024
…1783)

Summary:

Switch the ssd cache checkpoint file to use Velox filesystem for file r/w operations, so that more advanced testing can be built by leveraging features like fault injections.

Differential Revision: D66892136
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D66892136

zacw7 added a commit to zacw7/velox that referenced this pull request Dec 11, 2024
…1783)

Summary:

Switch the ssd cache checkpoint file to use Velox filesystem for file r/w operations, so that more advanced testing can be built by leveraging features like fault injections.

Differential Revision: D66892136
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D66892136

Copy link
Contributor

@xiaoxmeng xiaoxmeng left a comment

Choose a reason for hiding this comment

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

@zacw7 LGTM % minors. Thanks!

velox/common/caching/SsdFile.h Outdated Show resolved Hide resolved
velox/common/caching/SsdFile.h Outdated Show resolved Hide resolved
velox/common/caching/SsdFile.h Outdated Show resolved Hide resolved
velox/common/caching/SsdFile.h Outdated Show resolved Hide resolved
velox/common/caching/SsdFile.h Outdated Show resolved Hide resolved
velox/common/caching/SsdFile.h Outdated Show resolved Hide resolved
velox/common/caching/SsdFile.cpp Outdated Show resolved Hide resolved
velox/common/caching/SsdFile.cpp Outdated Show resolved Hide resolved
velox/common/caching/SsdFile.cpp Show resolved Hide resolved
velox/common/caching/SsdFile.cpp Outdated Show resolved Hide resolved
zacw7 added a commit to zacw7/velox that referenced this pull request Dec 12, 2024
…1783)

Summary:

Switch the ssd cache checkpoint file to use Velox filesystem for file r/w operations, so that more advanced testing can be built by leveraging features like fault injections.

Differential Revision: D66892136
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D66892136

Copy link
Contributor

@xiaoxmeng xiaoxmeng left a comment

Choose a reason for hiding this comment

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

@zacw7 thanks for the update!

velox/common/caching/SsdFile.cpp Show resolved Hide resolved
velox/common/caching/SsdFile.cpp Show resolved Hide resolved
velox/common/caching/SsdFile.cpp Outdated Show resolved Hide resolved
velox/common/caching/SsdFile.h Outdated Show resolved Hide resolved
velox/common/caching/SsdFile.cpp Outdated Show resolved Hide resolved
velox/common/caching/SsdFile.h Outdated Show resolved Hide resolved
…1783)

Summary:

Switch the ssd cache checkpoint file to use Velox filesystem for file r/w operations, so that more advanced testing can be built by leveraging features like fault injections.

Reviewed By: xiaoxmeng

Differential Revision: D66892136
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D66892136

@facebook-github-bot
Copy link
Contributor

This pull request has been merged in ac13440.

@zacw7 zacw7 deleted the export-D66892136 branch December 12, 2024 19:25
athmaja-n pushed a commit to athmaja-n/velox that referenced this pull request Jan 10, 2025
…1783)

Summary:
Pull Request resolved: facebookincubator#11783

Switch the ssd cache checkpoint file to use Velox filesystem for file r/w operations, so that more advanced testing can be built by leveraging features like fault injections.

Reviewed By: xiaoxmeng

Differential Revision: D66892136

fbshipit-source-id: d4da2df1f5da976b0a71c4a1a087a2c0ba569328
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants