Skip to content

Commit

Permalink
Deprecate old ssd cache constructor (facebookincubator#10003)
Browse files Browse the repository at this point in the history
Summary: Pull Request resolved: facebookincubator#10003

Reviewed By: xiaoxmeng, amitkdutta

Differential Revision: D58049856

Pulled By: zacw7

fbshipit-source-id: a36b3c9f86edf01cd88cb0a8d8791c77dbec58e6
  • Loading branch information
zacw7 authored and facebook-github-bot committed Jun 3, 2024
1 parent 45b421d commit 5efcaa4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 37 deletions.
36 changes: 9 additions & 27 deletions velox/common/caching/SsdCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,29 +30,10 @@ using facebook::velox::common::testutil::TestValue;
namespace facebook::velox::cache {

SsdCache::SsdCache(const Config& config)
: SsdCache(
config.filePrefix,
config.maxBytes,
config.numShards,
config.executor,
config.checkpointIntervalBytes,
config.disableFileCow,
config.checksumEnabled,
config.checksumReadVerificationEnabled) {}

SsdCache::SsdCache(
std::string_view filePrefix,
uint64_t maxBytes,
int32_t numShards,
folly::Executor* executor,
uint64_t checkpointIntervalBytes,
bool disableFileCow,
bool checksumEnabled,
bool checksumReadVerificationEnabled)
: filePrefix_(filePrefix),
numShards_(numShards),
: filePrefix_(config.filePrefix),
numShards_(config.numShards),
groupStats_(std::make_unique<FileGroupStats>()),
executor_(executor) {
executor_(config.executor) {
// Make sure the given path of Ssd files has the prefix for local file system.
// Local file system would be derived based on the prefix.
VELOX_CHECK(
Expand All @@ -61,7 +42,8 @@ SsdCache::SsdCache(
filePrefix_);
VELOX_CHECK_NOT_NULL(executor_);

if (checksumReadVerificationEnabled && !checksumEnabled) {
auto checksumReadVerificationEnabled = config.checksumReadVerificationEnabled;
if (config.checksumReadVerificationEnabled && !config.checksumEnabled) {
VELOX_SSD_CACHE_LOG(WARNING)
<< "Checksum read has been disabled as checksum is not enabled.";
checksumReadVerificationEnabled = false;
Expand All @@ -74,15 +56,15 @@ SsdCache::SsdCache(
// size.
const uint64_t sizeQuantum = numShards_ * SsdFile::kRegionSize;
const int32_t fileMaxRegions =
bits::roundUp(maxBytes, sizeQuantum) / sizeQuantum;
bits::roundUp(config.maxBytes, sizeQuantum) / sizeQuantum;
for (auto i = 0; i < numShards_; ++i) {
const auto fileConfig = SsdFile::Config(
fmt::format("{}{}", filePrefix_, i),
i,
fileMaxRegions,
checkpointIntervalBytes / numShards,
disableFileCow,
checksumEnabled,
config.checkpointIntervalBytes / config.numShards,
config.disableFileCow,
config.checksumEnabled,
checksumReadVerificationEnabled,
executor_);
files_.push_back(std::make_unique<SsdFile>(fileConfig));
Expand Down
10 changes: 0 additions & 10 deletions velox/common/caching/SsdCache.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,6 @@ class SsdCache {
/// 'maxBytes' limit and stop working.
SsdCache(const Config& config);

SsdCache(
std::string_view filePrefix,
uint64_t maxBytes,
int32_t numShards,
folly::Executor* executor,
uint64_t checkpointIntervalBytes = 0,
bool disableFileCow = false,
bool checksumEnabled = false,
bool checksumReadVerificationEnabled = false);

/// Returns the shard corresponding to 'fileId'. 'fileId' is a file id from
/// e.g. FileCacheKey.
SsdFile& file(uint64_t fileId);
Expand Down

0 comments on commit 5efcaa4

Please sign in to comment.