ltagliamonte-dd commented on code in PR #2845:
URL: https://github.com/apache/kvrocks/pull/2845#discussion_r2029180945
##########
src/storage/storage.cc:
##########
@@ -769,6 +775,65 @@ rocksdb::Status Storage::FlushScripts(engine::Context
&ctx, const rocksdb::Write
return Write(ctx, options, batch->GetWriteBatch());
}
+rocksdb::Status Storage::IngestSST(const std::string &sst_dir, int*
files_loaded) {
+ std::vector<std::string> sst_files;
+ DIR *dir = opendir(sst_dir.c_str());
+ if (!dir) {
+ return rocksdb::Status::IOError("Failed to open directory " + sst_dir);
+ }
+
+ struct dirent *entry;
+ while ((entry = readdir(dir)) != nullptr) {
+ std::string filename = entry->d_name;
+ if (filename.length() >= 4 && filename.substr(filename.length() - 4) ==
".sst") {
+ sst_files.push_back(sst_dir + "/" + filename);
+ }
+ }
+ closedir(dir);
+
+ if (sst_files.empty()) {
+ LOG(WARNING) << "No SST files found in " << sst_dir;
+ return rocksdb::Status::OK();
+ }
+
+ std::vector<std::string> default_files;
+ std::vector<std::string> metadata_files;
+
+ // Sort files into appropriate vectors based on filename
+ for (const auto &file : sst_files) {
+ if (file.find("metadata") != std::string::npos) {
+ metadata_files.push_back(file);
+ } else {
+ default_files.push_back(file);
+ }
+ }
Review Comment:
addressed this via 0ca11358751c7748ca4a0d5228ec4e620bc609aa
please let me know if you have any other feedbacks
--
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]