]> git-server-git.apps.pok.os.sepia.ceph.com Git - rocksdb.git/commitdiff
Remove sst_file_manager option from LITE
authorIslam AbdelRahman <tec@fb.com>
Thu, 22 Dec 2016 01:35:00 +0000 (17:35 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Thu, 22 Dec 2016 01:54:21 +0000 (17:54 -0800)
Summary:
Remove sst_file_manager option from LITE
Closes https://github.com/facebook/rocksdb/pull/1690

Differential Revision: D4341331

Pulled By: IslamAbdelRahman

fbshipit-source-id: 9f9328d

db/compaction_job.cc
db/db_impl.cc
db/db_sst_test.cc
util/delete_scheduler.cc
util/delete_scheduler.h
util/delete_scheduler_test.cc
util/file_util.cc
util/sst_file_manager_impl.cc
util/sst_file_manager_impl.h

index 4e3a5ecbb225a9adf6db98d18ca849c1e2c07957..42f32936cd672e25c4da0fd5c06b5dd27869404b 100644 (file)
@@ -1086,6 +1086,7 @@ Status CompactionJob::FinishCompactionOutputFile(
       event_logger_, cfd->ioptions()->listeners, dbname_, cfd->GetName(), fname,
       job_id_, meta->fd, tp, TableFileCreationReason::kCompaction, s);
 
+#ifndef ROCKSDB_LITE
   // Report new file to SstFileManagerImpl
   auto sfm =
       static_cast<SstFileManagerImpl*>(db_options_.sst_file_manager.get());
@@ -1103,6 +1104,7 @@ Status CompactionJob::FinishCompactionOutputFile(
       }
     }
   }
+#endif
 
   sub_compact->builder.reset();
   sub_compact->current_output_file_size = 0;
index b70ee32816d3ff2d74054f27edfb9b460622e9dc..e18599a0247694abbf0c037b4e1abd1f4e7d75a9 100644 (file)
@@ -1928,7 +1928,6 @@ Status DBImpl::FlushMemTableToOutputFile(
     // may temporarily unlock and lock the mutex.
     NotifyOnFlushCompleted(cfd, &file_meta, mutable_cf_options,
                            job_context->job_id, flush_job.GetTableProperties());
-#endif  // ROCKSDB_LITE
     auto sfm = static_cast<SstFileManagerImpl*>(
         immutable_db_options_.sst_file_manager.get());
     if (sfm) {
@@ -1942,6 +1941,7 @@ Status DBImpl::FlushMemTableToOutputFile(
             "DBImpl::FlushMemTableToOutputFile:MaxAllowedSpaceReached");
       }
     }
+#endif  // ROCKSDB_LITE
   }
   return s;
 }
@@ -6054,6 +6054,7 @@ Status DB::Open(const DBOptions& db_options, const std::string& dbname,
   }
   impl->mutex_.Unlock();
 
+#ifndef ROCKSDB_LITE
   auto sfm = static_cast<SstFileManagerImpl*>(
       impl->immutable_db_options_.sst_file_manager.get());
   if (s.ok() && sfm) {
@@ -6072,6 +6073,7 @@ Status DB::Open(const DBOptions& db_options, const std::string& dbname,
       }
     }
   }
+#endif  // !ROCKSDB_LITE
 
   if (s.ok()) {
     Log(InfoLogLevel::INFO_LEVEL, impl->immutable_db_options_.info_log,
index 06d140f75fef59820f484fcc107db6161ad41802..fd430437930cd8a4cc9b545f842999ee68e472c5 100644 (file)
@@ -221,8 +221,6 @@ TEST_F(DBSSTTest, DeleteObsoleteFilesPendingOutputs) {
   listener->VerifyMatchedCount(1);
 }
 
-#endif  // ROCKSDB_LITE
-
 TEST_F(DBSSTTest, DBWithSstFileManager) {
   std::shared_ptr<SstFileManager> sst_file_manager(NewSstFileManager(env_));
   auto sfm = static_cast<SstFileManagerImpl*>(sst_file_manager.get());
@@ -287,7 +285,6 @@ TEST_F(DBSSTTest, DBWithSstFileManager) {
   rocksdb::SyncPoint::GetInstance()->DisableProcessing();
 }
 
-#ifndef ROCKSDB_LITE
 TEST_F(DBSSTTest, RateLimitedDelete) {
   Destroy(last_options_);
   rocksdb::SyncPoint::GetInstance()->LoadDependency({
@@ -482,7 +479,6 @@ TEST_F(DBSSTTest, DestroyDBWithRateLimitedDelete) {
   // We have deleted the 4 sst files in the delete_scheduler
   ASSERT_EQ(bg_delete_file, 4);
 }
-#endif  // ROCKSDB_LITE
 
 TEST_F(DBSSTTest, DBWithMaxSpaceAllowed) {
   std::shared_ptr<SstFileManager> sst_file_manager(NewSstFileManager(env_));
@@ -580,7 +576,6 @@ TEST_F(DBSSTTest, DBWithMaxSpaceAllowedRandomized) {
   ASSERT_GT(reached_max_space_on_compaction, 0);
 }
 
-#ifndef ROCKSDB_LITE
 TEST_F(DBSSTTest, OpenDBWithInfiniteMaxOpenFiles) {
   // Open DB with infinite max open files
   //  - First iteration use 1 thread to open files
index 3a83f124bb1253c7483bdeb9c7687027da7bcc49..e4779ad057bbff235de92e16d5b4995c685d9918 100644 (file)
@@ -3,6 +3,8 @@
 //  LICENSE file in the root directory of this source tree. An additional grant
 //  of patent rights can be found in the PATENTS file in the same directory.
 
+#ifndef ROCKSDB_LITE
+
 #include "util/delete_scheduler.h"
 
 #include <thread>
@@ -211,3 +213,5 @@ void DeleteScheduler::WaitForEmptyTrash() {
 }
 
 }  // namespace rocksdb
+
+#endif  // ROCKSDB_LITE
index 331507da4db28808306130799f10cc242e10d12a..6b373033065120a465d9730687f02fa16f19a6d8 100644 (file)
@@ -5,6 +5,8 @@
 
 #pragma once
 
+#ifndef ROCKSDB_LITE
+
 #include <map>
 #include <queue>
 #include <string>
@@ -88,3 +90,5 @@ class DeleteScheduler {
 };
 
 }  // namespace rocksdb
+
+#endif  // ROCKSDB_LITE
index 845c7ef1dd3a0167d22c22bcd44a33c22dcf0495..b1b5fae8a3cd100c6ef5d12bc987ad2feccc51d8 100644 (file)
@@ -20,6 +20,8 @@
 #include "util/testharness.h"
 #include "util/testutil.h"
 
+#ifndef ROCKSDB_LITE
+
 namespace rocksdb {
 
 class DeleteSchedulerTest : public testing::Test {
@@ -426,3 +428,10 @@ int main(int argc, char** argv) {
   ::testing::InitGoogleTest(&argc, argv);
   return RUN_ALL_TESTS();
 }
+
+#else
+int main(int argc, char** argv) {
+  printf("DeleteScheduler is not supported in ROCKSDB_LITE\n");
+  return 0;
+}
+#endif  // ROCKSDB_LITE
index 29a84555aa39f0f3900b58ab912fa300ab243bce..42b3dc1f38dccc74d4e5dac297b5f81a688ccc6a 100644 (file)
@@ -84,6 +84,7 @@ Status CreateFile(Env* env, const std::string& destination,
 Status DeleteSSTFile(const ImmutableDBOptions* db_options,
                      const std::string& fname, uint32_t path_id) {
   // TODO(tec): support sst_file_manager for multiple path_ids
+#ifndef ROCKSDB_LITE
   auto sfm =
       static_cast<SstFileManagerImpl*>(db_options->sst_file_manager.get());
   if (sfm && path_id == 0) {
@@ -91,6 +92,10 @@ Status DeleteSSTFile(const ImmutableDBOptions* db_options,
   } else {
     return db_options->env->DeleteFile(fname);
   }
+#else
+  // SstFileManager is not supported in ROCKSDB_LITE
+  return db_options->env->DeleteFile(fname);
+#endif
 }
 
 }  // namespace rocksdb
index bbf240cad60616114fe8503a650928f70a19439a..cff9a738901df21a15a1a4600e95e248a0a7e11a 100644 (file)
@@ -9,11 +9,13 @@
 
 #include "port/port.h"
 #include "rocksdb/env.h"
+#include "rocksdb/sst_file_manager.h"
 #include "util/mutexlock.h"
 #include "util/sync_point.h"
 
 namespace rocksdb {
 
+#ifndef ROCKSDB_LITE
 SstFileManagerImpl::SstFileManagerImpl(Env* env, std::shared_ptr<Logger> logger,
                                        const std::string& trash_dir,
                                        int64_t rate_bytes_per_sec)
@@ -154,4 +156,20 @@ SstFileManager* NewSstFileManager(Env* env, std::shared_ptr<Logger> info_log,
   return res;
 }
 
+#else
+
+SstFileManager* NewSstFileManager(Env* env, std::shared_ptr<Logger> info_log,
+                                  std::string trash_dir,
+                                  int64_t rate_bytes_per_sec,
+                                  bool delete_exisitng_trash, Status* status) {
+  if (status) {
+    *status =
+        Status::NotSupported("SstFileManager is not supported in ROCKSDB_LITE");
+  }
+  return nullptr;
+}
+
+#endif  // ROCKSDB_LITE
+
 }  // namespace rocksdb
+
index ca9ddedba8587a9a04d91a51a1e94405ea7627e9..543c9d95a1a6261edfa493fe4e8c68fdacb7d036 100644 (file)
@@ -5,6 +5,8 @@
 
 #pragma once
 
+#ifndef ROCKSDB_LITE
+
 #include <string>
 
 #include "port/port.h"
@@ -93,3 +95,5 @@ class SstFileManagerImpl : public SstFileManager {
 };
 
 }  // namespace rocksdb
+
+#endif  // ROCKSDB_LITE