Skip to content

Commit d82aa33

Browse files
committed
Enable persistent cache for rocksdb-cloud.
Summary: The persistent-cache is a lookaside cache that can be used to store data from cloud storage on local disk. Test Plan: Added unit test Reviewers: hieu, haneeshr, kw, joe, igor Reviewed By: hieu, igor Subscribers: #platform Differential Revision: https://rockset.phacility.com/D6378
1 parent 32e77ec commit d82aa33

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

cloud/cloud_storage_provider.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ size_t CloudStorageReadableFileImpl::GetUniqueId(char* id,
109109
WalFileType log_type;
110110
ParseFileName(RemoveEpoch(basename(fname_)), &file_number, &file_type,
111111
&log_type);
112-
if (max_size < kMaxVarint64Length && file_number > 0) {
112+
if (max_size >= kMaxVarint64Length && file_number > 0) {
113113
char* rid = id;
114114
rid = EncodeVarint64(rid, file_number);
115115
return static_cast<size_t>(rid - id);

cloud/db_cloud_impl.cc

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "rocksdb/status.h"
2525
#include "rocksdb/table.h"
2626
#include "util/xxhash.h"
27+
#include "utilities/persistent_cache/block_cache_tier.h"
2728

2829
namespace rocksdb {
2930

@@ -140,11 +141,11 @@ Status DBCloud::Open(const Options& opt, const std::string& local_dbname,
140141
BlockBasedTableOptions* tableopt =
141142
static_cast<BlockBasedTableOptions*>(bopt);
142143
if (!tableopt->persistent_cache) {
143-
std::shared_ptr<PersistentCache> pcache;
144-
st =
145-
NewPersistentCache(options.env, persistent_cache_path,
146-
persistent_cache_size_gb * 1024L * 1024L * 1024L,
147-
options.info_log, false, &pcache);
144+
PersistentCacheConfig config(
145+
local_env, persistent_cache_path,
146+
persistent_cache_size_gb * 1024L * 1024L * 1024L, options.info_log);
147+
auto pcache = std::make_shared<BlockCacheTier>(config);
148+
st = pcache->Open();
148149
if (st.ok()) {
149150
tableopt->persistent_cache = pcache;
150151
Log(InfoLogLevel::INFO_LEVEL, options.info_log,

cloud/db_cloud_test.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1460,7 +1460,6 @@ TEST_F(CloudTest, CopyObjectTest) {
14601460
CloseDB();
14611461
}
14621462

1463-
#ifdef AWS_DO_NOT_RUN
14641463
//
14651464
// Verify that we can cache data from S3 in persistent cache.
14661465
//
@@ -1483,7 +1482,6 @@ TEST_F(CloudTest, PersistentCache) {
14831482
ASSERT_EQ(value, "World");
14841483
CloseDB();
14851484
}
1486-
#endif /* AWS_DO_NOT_RUN */
14871485

14881486
} // namespace rocksdb
14891487

0 commit comments

Comments
 (0)