ltagliamonte-dd commented on code in PR #2845:
URL: https://github.com/apache/kvrocks/pull/2845#discussion_r2048195635
##########
src/storage/storage.cc:
##########
@@ -769,6 +770,90 @@ rocksdb::Status Storage::FlushScripts(engine::Context
&ctx, const rocksdb::Write
return Write(ctx, options, batch->GetWriteBatch());
}
+StatusOr<int> Storage::IngestSST(const std::string &sst_dir, const
rocksdb::IngestExternalFileOptions &ingest_options) {
+ std::vector<std::string> sst_files;
+ auto s = env_->GetChildren(sst_dir, &sst_files);
+ if (!s.ok()) {
+ return {Status::NotOK, "Failed to open directory " + sst_dir + ": " +
s.ToString()};
+ }
+
+ std::vector<std::string> filtered_files;
+ for (const auto &filename : sst_files) {
+ if (filename.length() >= 4 && filename.substr(filename.length() - 4) ==
".sst") {
+ filtered_files.push_back(sst_dir + "/" + filename);
+ }
+ }
+ sst_files = std::move(filtered_files);
+
+ if (sst_files.empty()) {
+ LOG(WARNING) << "No SST files found in " << sst_dir;
+ return 0;
+ }
+
+ std::unordered_map<std::string_view, std::vector<std::string>> cf_files;
+ std::vector<std::string> cf_names;
+ for (const auto &cf : ColumnFamilyConfigs::ListAllColumnFamilies()) {
+ cf_names.emplace_back(cf.Name());
+ }
+ for (const auto &cf_name : cf_names) {
+ cf_files[cf_name] = std::vector<std::string>();
+ }
Review Comment:
addressed via b2e04e802c979355a76cadd322e06890821b9a60
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]