You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by ph...@apache.org on 2017/10/18 19:44:45 UTC

[04/24] nifi-minifi-cpp git commit: MINIFI-372: Remove documentation and test utilities

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/d3a13a49/thirdparty/rocksdb/utilities/persistent_cache/persistent_cache_test.cc
----------------------------------------------------------------------
diff --git a/thirdparty/rocksdb/utilities/persistent_cache/persistent_cache_test.cc b/thirdparty/rocksdb/utilities/persistent_cache/persistent_cache_test.cc
deleted file mode 100644
index 5affc40..0000000
--- a/thirdparty/rocksdb/utilities/persistent_cache/persistent_cache_test.cc
+++ /dev/null
@@ -1,471 +0,0 @@
-//  Copyright (c) 2013, Facebook, Inc.  All rights reserved.
-//  This source code is licensed under both the GPLv2 (found in the
-//  COPYING file in the root directory) and Apache 2.0 License
-//  (found in the LICENSE.Apache file in the root directory).
-//
-// Copyright (c) 2011 The LevelDB Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file. See the AUTHORS file for names of contributors.
-#ifndef ROCKSDB_LITE
-
-#include "utilities/persistent_cache/persistent_cache_test.h"
-
-#include <functional>
-#include <memory>
-#include <thread>
-
-#include "utilities/persistent_cache/block_cache_tier.h"
-
-namespace rocksdb {
-
-static const double kStressFactor = .125;
-
-#ifdef OS_LINUX
-static void OnOpenForRead(void* arg) {
-  int* val = static_cast<int*>(arg);
-  *val &= ~O_DIRECT;
-  rocksdb::SyncPoint::GetInstance()->SetCallBack(
-      "NewRandomAccessFile:O_DIRECT",
-      std::bind(OnOpenForRead, std::placeholders::_1));
-}
-
-static void OnOpenForWrite(void* arg) {
-  int* val = static_cast<int*>(arg);
-  *val &= ~O_DIRECT;
-  rocksdb::SyncPoint::GetInstance()->SetCallBack(
-      "NewWritableFile:O_DIRECT",
-      std::bind(OnOpenForWrite, std::placeholders::_1));
-}
-#endif
-
-static void RemoveDirectory(const std::string& folder) {
-  std::vector<std::string> files;
-  Status status = Env::Default()->GetChildren(folder, &files);
-  if (!status.ok()) {
-    // we assume the directory does not exist
-    return;
-  }
-
-  // cleanup files with the patter :digi:.rc
-  for (auto file : files) {
-    if (file == "." || file == "..") {
-      continue;
-    }
-    status = Env::Default()->DeleteFile(folder + "/" + file);
-    assert(status.ok());
-  }
-
-  status = Env::Default()->DeleteDir(folder);
-  assert(status.ok());
-}
-
-static void OnDeleteDir(void* arg) {
-  char* dir = static_cast<char*>(arg);
-  RemoveDirectory(std::string(dir));
-}
-
-//
-// Simple logger that prints message on stdout
-//
-class ConsoleLogger : public Logger {
- public:
-  using Logger::Logv;
-  ConsoleLogger() : Logger(InfoLogLevel::ERROR_LEVEL) {}
-
-  void Logv(const char* format, va_list ap) override {
-    MutexLock _(&lock_);
-    vprintf(format, ap);
-    printf("\n");
-  }
-
-  port::Mutex lock_;
-};
-
-// construct a tiered RAM+Block cache
-std::unique_ptr<PersistentTieredCache> NewTieredCache(
-    const size_t mem_size, const PersistentCacheConfig& opt) {
-  std::unique_ptr<PersistentTieredCache> tcache(new PersistentTieredCache());
-  // create primary tier
-  assert(mem_size);
-  auto pcache = std::shared_ptr<PersistentCacheTier>(new VolatileCacheTier(
-      /*is_compressed*/ true, mem_size));
-  tcache->AddTier(pcache);
-  // create secondary tier
-  auto scache = std::shared_ptr<PersistentCacheTier>(new BlockCacheTier(opt));
-  tcache->AddTier(scache);
-
-  Status s = tcache->Open();
-  assert(s.ok());
-  return tcache;
-}
-
-// create block cache
-std::unique_ptr<PersistentCacheTier> NewBlockCache(
-    Env* env, const std::string& path,
-    const uint64_t max_size = std::numeric_limits<uint64_t>::max(),
-    const bool enable_direct_writes = false) {
-  const uint32_t max_file_size = static_cast<uint32_t>(12 * 1024 * 1024 * kStressFactor);
-  auto log = std::make_shared<ConsoleLogger>();
-  PersistentCacheConfig opt(env, path, max_size, log);
-  opt.cache_file_size = max_file_size;
-  opt.max_write_pipeline_backlog_size = std::numeric_limits<uint64_t>::max();
-  opt.enable_direct_writes = enable_direct_writes;
-  std::unique_ptr<PersistentCacheTier> scache(new BlockCacheTier(opt));
-  Status s = scache->Open();
-  assert(s.ok());
-  return scache;
-}
-
-// create a new cache tier
-std::unique_ptr<PersistentTieredCache> NewTieredCache(
-    Env* env, const std::string& path, const uint64_t max_volatile_cache_size,
-    const uint64_t max_block_cache_size =
-        std::numeric_limits<uint64_t>::max()) {
-  const uint32_t max_file_size = static_cast<uint32_t>(12 * 1024 * 1024 * kStressFactor);
-  auto log = std::make_shared<ConsoleLogger>();
-  auto opt = PersistentCacheConfig(env, path, max_block_cache_size, log);
-  opt.cache_file_size = max_file_size;
-  opt.max_write_pipeline_backlog_size = std::numeric_limits<uint64_t>::max();
-  // create tier out of the two caches
-  auto cache = NewTieredCache(max_volatile_cache_size, opt);
-  return cache;
-}
-
-PersistentCacheTierTest::PersistentCacheTierTest()
-    : path_(test::TmpDir(Env::Default()) + "/cache_test") {
-#ifdef OS_LINUX
-  rocksdb::SyncPoint::GetInstance()->EnableProcessing();
-  rocksdb::SyncPoint::GetInstance()->SetCallBack("NewRandomAccessFile:O_DIRECT",
-                                                 OnOpenForRead);
-  rocksdb::SyncPoint::GetInstance()->SetCallBack("NewWritableFile:O_DIRECT",
-                                                 OnOpenForWrite);
-#endif
-}
-
-// Block cache tests
-TEST_F(PersistentCacheTierTest, DISABLED_BlockCacheInsertWithFileCreateError) {
-  cache_ = NewBlockCache(Env::Default(), path_,
-                         /*size=*/std::numeric_limits<uint64_t>::max(),
-                         /*direct_writes=*/ false);
-  rocksdb::SyncPoint::GetInstance()->SetCallBack( 
-    "BlockCacheTier::NewCacheFile:DeleteDir", OnDeleteDir);
-
-  RunNegativeInsertTest(/*nthreads=*/ 1,
-                        /*max_keys*/
-                          static_cast<size_t>(10 * 1024 * kStressFactor));
-
-  rocksdb::SyncPoint::GetInstance()->ClearAllCallBacks();
-}
-
-#ifdef TRAVIS
-// Travis is unable to handle the normal version of the tests running out of
-// fds, out of space and timeouts. This is an easier version of the test
-// specifically written for Travis
-TEST_F(PersistentCacheTierTest, BasicTest) {
-  cache_ = std::make_shared<VolatileCacheTier>();
-  RunInsertTest(/*nthreads=*/1, /*max_keys=*/1024);
-
-  cache_ = NewBlockCache(Env::Default(), path_,
-                         /*size=*/std::numeric_limits<uint64_t>::max(),
-                         /*direct_writes=*/true);
-  RunInsertTest(/*nthreads=*/1, /*max_keys=*/1024);
-
-  cache_ = NewTieredCache(Env::Default(), path_,
-                          /*memory_size=*/static_cast<size_t>(1 * 1024 * 1024));
-  RunInsertTest(/*nthreads=*/1, /*max_keys=*/1024);
-}
-#else
-// Volatile cache tests
-TEST_F(PersistentCacheTierTest, VolatileCacheInsert) {
-  for (auto nthreads : {1, 5}) {
-    for (auto max_keys :
-         {10 * 1024 * kStressFactor, 1 * 1024 * 1024 * kStressFactor}) {
-      cache_ = std::make_shared<VolatileCacheTier>();
-      RunInsertTest(nthreads, static_cast<size_t>(max_keys));
-    }
-  }
-}
-
-TEST_F(PersistentCacheTierTest, VolatileCacheInsertWithEviction) {
-  for (auto nthreads : {1, 5}) {
-    for (auto max_keys : {1 * 1024 * 1024 * kStressFactor}) {
-      cache_ = std::make_shared<VolatileCacheTier>(
-          /*compressed=*/true, /*size=*/static_cast<size_t>(1 * 1024 * 1024 * kStressFactor));
-      RunInsertTestWithEviction(nthreads, static_cast<size_t>(max_keys));
-    }
-  }
-}
-
-// Block cache tests
-TEST_F(PersistentCacheTierTest, BlockCacheInsert) {
-  for (auto direct_writes : {true, false}) {
-    for (auto nthreads : {1, 5}) {
-      for (auto max_keys :
-           {10 * 1024 * kStressFactor, 1 * 1024 * 1024 * kStressFactor}) {
-        cache_ = NewBlockCache(Env::Default(), path_,
-                               /*size=*/std::numeric_limits<uint64_t>::max(),
-                               direct_writes);
-        RunInsertTest(nthreads, static_cast<size_t>(max_keys));
-      }
-    }
-  }
-}
-
-TEST_F(PersistentCacheTierTest, BlockCacheInsertWithEviction) {
-  for (auto nthreads : {1, 5}) {
-    for (auto max_keys : {1 * 1024 * 1024 * kStressFactor}) {
-      cache_ = NewBlockCache(Env::Default(), path_,
-                             /*max_size=*/static_cast<size_t>(200 * 1024 * 1024 * kStressFactor));
-      RunInsertTestWithEviction(nthreads, static_cast<size_t>(max_keys));
-    }
-  }
-}
-
-// Tiered cache tests
-TEST_F(PersistentCacheTierTest, TieredCacheInsert) {
-  for (auto nthreads : {1, 5}) {
-    for (auto max_keys :
-         {10 * 1024 * kStressFactor, 1 * 1024 * 1024 * kStressFactor}) {
-      cache_ = NewTieredCache(Env::Default(), path_,
-                              /*memory_size=*/static_cast<size_t>(1 * 1024 * 1024 * kStressFactor));
-      RunInsertTest(nthreads, static_cast<size_t>(max_keys));
-    }
-  }
-}
-
-// the tests causes a lot of file deletions which Travis limited testing
-// environment cannot handle
-TEST_F(PersistentCacheTierTest, TieredCacheInsertWithEviction) {
-  for (auto nthreads : {1, 5}) {
-    for (auto max_keys : {1 * 1024 * 1024 * kStressFactor}) {
-      cache_ = NewTieredCache(
-          Env::Default(), path_,
-          /*memory_size=*/static_cast<size_t>(1 * 1024 * 1024 * kStressFactor),
-          /*block_cache_size*/ static_cast<size_t>(200 * 1024 * 1024 * kStressFactor));
-      RunInsertTestWithEviction(nthreads, static_cast<size_t>(max_keys));
-    }
-  }
-}
-#endif
-
-std::shared_ptr<PersistentCacheTier> MakeVolatileCache(
-    const std::string& /*dbname*/) {
-  return std::make_shared<VolatileCacheTier>();
-}
-
-std::shared_ptr<PersistentCacheTier> MakeBlockCache(const std::string& dbname) {
-  return NewBlockCache(Env::Default(), dbname);
-}
-
-std::shared_ptr<PersistentCacheTier> MakeTieredCache(
-    const std::string& dbname) {
-  const auto memory_size = 1 * 1024 * 1024 * kStressFactor;
-  return NewTieredCache(Env::Default(), dbname, static_cast<size_t>(memory_size));
-}
-
-#ifdef OS_LINUX
-static void UniqueIdCallback(void* arg) {
-  int* result = reinterpret_cast<int*>(arg);
-  if (*result == -1) {
-    *result = 0;
-  }
-
-  rocksdb::SyncPoint::GetInstance()->ClearTrace();
-  rocksdb::SyncPoint::GetInstance()->SetCallBack(
-      "GetUniqueIdFromFile:FS_IOC_GETVERSION", UniqueIdCallback);
-}
-#endif
-
-TEST_F(PersistentCacheTierTest, FactoryTest) {
-  for (auto nvm_opt : {true, false}) {
-    ASSERT_FALSE(cache_);
-    auto log = std::make_shared<ConsoleLogger>();
-    std::shared_ptr<PersistentCache> cache;
-    ASSERT_OK(NewPersistentCache(Env::Default(), path_,
-                                 /*size=*/1 * 1024 * 1024 * 1024, log, nvm_opt,
-                                 &cache));
-    ASSERT_TRUE(cache);
-    ASSERT_EQ(cache->Stats().size(), 1);
-    ASSERT_TRUE(cache->Stats()[0].size());
-    cache.reset();
-  }
-}
-
-PersistentCacheDBTest::PersistentCacheDBTest() : DBTestBase("/cache_test") {
-#ifdef OS_LINUX
-  rocksdb::SyncPoint::GetInstance()->EnableProcessing();
-  rocksdb::SyncPoint::GetInstance()->SetCallBack(
-      "GetUniqueIdFromFile:FS_IOC_GETVERSION", UniqueIdCallback);
-  rocksdb::SyncPoint::GetInstance()->SetCallBack("NewRandomAccessFile:O_DIRECT",
-                                                 OnOpenForRead);
-#endif
-}
-
-// test template
-void PersistentCacheDBTest::RunTest(
-    const std::function<std::shared_ptr<PersistentCacheTier>(bool)>& new_pcache,
-    const size_t max_keys = 100 * 1024, const size_t max_usecase = 5) {
-  if (!Snappy_Supported()) {
-    return;
-  }
-
-  // number of insertion interations
-  int num_iter = static_cast<int>(max_keys * kStressFactor);
-
-  for (size_t iter = 0; iter < max_usecase; iter++) {
-    Options options;
-    options.write_buffer_size =
-      static_cast<size_t>(64 * 1024 * kStressFactor);  // small write buffer
-    options.statistics = rocksdb::CreateDBStatistics();
-    options = CurrentOptions(options);
-
-    // setup page cache
-    std::shared_ptr<PersistentCacheTier> pcache;
-    BlockBasedTableOptions table_options;
-    table_options.cache_index_and_filter_blocks = true;
-
-    const size_t size_max = std::numeric_limits<size_t>::max();
-
-    switch (iter) {
-      case 0:
-        // page cache, block cache, no-compressed cache
-        pcache = new_pcache(/*is_compressed=*/true);
-        table_options.persistent_cache = pcache;
-        table_options.block_cache = NewLRUCache(size_max);
-        table_options.block_cache_compressed = nullptr;
-        options.table_factory.reset(NewBlockBasedTableFactory(table_options));
-        break;
-      case 1:
-        // page cache, block cache, compressed cache
-        pcache = new_pcache(/*is_compressed=*/true);
-        table_options.persistent_cache = pcache;
-        table_options.block_cache = NewLRUCache(size_max);
-        table_options.block_cache_compressed = NewLRUCache(size_max);
-        options.table_factory.reset(NewBlockBasedTableFactory(table_options));
-        break;
-      case 2:
-        // page cache, block cache, compressed cache + KNoCompression
-        // both block cache and compressed cache, but DB is not compressed
-        // also, make block cache sizes bigger, to trigger block cache hits
-        pcache = new_pcache(/*is_compressed=*/true);
-        table_options.persistent_cache = pcache;
-        table_options.block_cache = NewLRUCache(size_max);
-        table_options.block_cache_compressed = NewLRUCache(size_max);
-        options.table_factory.reset(NewBlockBasedTableFactory(table_options));
-        options.compression = kNoCompression;
-        break;
-      case 3:
-        // page cache, no block cache, no compressed cache
-        pcache = new_pcache(/*is_compressed=*/false);
-        table_options.persistent_cache = pcache;
-        table_options.block_cache = nullptr;
-        table_options.block_cache_compressed = nullptr;
-        options.table_factory.reset(NewBlockBasedTableFactory(table_options));
-        break;
-      case 4:
-        // page cache, no block cache, no compressed cache
-        // Page cache caches compressed blocks
-        pcache = new_pcache(/*is_compressed=*/true);
-        table_options.persistent_cache = pcache;
-        table_options.block_cache = nullptr;
-        table_options.block_cache_compressed = nullptr;
-        options.table_factory.reset(NewBlockBasedTableFactory(table_options));
-        break;
-      default:
-        FAIL();
-    }
-
-    std::vector<std::string> values;
-    // insert data
-    Insert(options, table_options, num_iter, &values);
-    // flush all data in cache to device
-    pcache->TEST_Flush();
-    // verify data
-    Verify(num_iter, values);
-
-    auto block_miss = TestGetTickerCount(options, BLOCK_CACHE_MISS);
-    auto compressed_block_hit =
-        TestGetTickerCount(options, BLOCK_CACHE_COMPRESSED_HIT);
-    auto compressed_block_miss =
-        TestGetTickerCount(options, BLOCK_CACHE_COMPRESSED_MISS);
-    auto page_hit = TestGetTickerCount(options, PERSISTENT_CACHE_HIT);
-    auto page_miss = TestGetTickerCount(options, PERSISTENT_CACHE_MISS);
-
-    // check that we triggered the appropriate code paths in the cache
-    switch (iter) {
-      case 0:
-        // page cache, block cache, no-compressed cache
-        ASSERT_GT(page_miss, 0);
-        ASSERT_GT(page_hit, 0);
-        ASSERT_GT(block_miss, 0);
-        ASSERT_EQ(compressed_block_miss, 0);
-        ASSERT_EQ(compressed_block_hit, 0);
-        break;
-      case 1:
-        // page cache, block cache, compressed cache
-        ASSERT_GT(page_miss, 0);
-        ASSERT_GT(block_miss, 0);
-        ASSERT_GT(compressed_block_miss, 0);
-        break;
-      case 2:
-        // page cache, block cache, compressed cache + KNoCompression
-        ASSERT_GT(page_miss, 0);
-        ASSERT_GT(page_hit, 0);
-        ASSERT_GT(block_miss, 0);
-        ASSERT_GT(compressed_block_miss, 0);
-        // remember kNoCompression
-        ASSERT_EQ(compressed_block_hit, 0);
-        break;
-      case 3:
-      case 4:
-        // page cache, no block cache, no compressed cache
-        ASSERT_GT(page_miss, 0);
-        ASSERT_GT(page_hit, 0);
-        ASSERT_EQ(compressed_block_hit, 0);
-        ASSERT_EQ(compressed_block_miss, 0);
-        break;
-      default:
-        FAIL();
-    }
-
-    options.create_if_missing = true;
-    DestroyAndReopen(options);
-
-    pcache->Close();
-  }
-}
-
-#ifdef TRAVIS
-// Travis is unable to handle the normal version of the tests running out of
-// fds, out of space and timeouts. This is an easier version of the test
-// specifically written for Travis
-TEST_F(PersistentCacheDBTest, BasicTest) {
-  RunTest(std::bind(&MakeBlockCache, dbname_), /*max_keys=*/1024,
-          /*max_usecase=*/1);
-}
-#else
-// test table with block page cache
-TEST_F(PersistentCacheDBTest, BlockCacheTest) {
-  RunTest(std::bind(&MakeBlockCache, dbname_));
-}
-
-// test table with volatile page cache
-TEST_F(PersistentCacheDBTest, VolatileCacheTest) {
-  RunTest(std::bind(&MakeVolatileCache, dbname_));
-}
-
-// test table with tiered page cache
-TEST_F(PersistentCacheDBTest, TieredCacheTest) {
-  RunTest(std::bind(&MakeTieredCache, dbname_));
-}
-#endif
-
-}  // namespace rocksdb
-
-int main(int argc, char** argv) {
-  ::testing::InitGoogleTest(&argc, argv);
-  return RUN_ALL_TESTS();
-}
-#else
-int main() { return 0; }
-#endif

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/d3a13a49/thirdparty/rocksdb/utilities/persistent_cache/persistent_cache_test.h
----------------------------------------------------------------------
diff --git a/thirdparty/rocksdb/utilities/persistent_cache/persistent_cache_test.h b/thirdparty/rocksdb/utilities/persistent_cache/persistent_cache_test.h
deleted file mode 100644
index 77fd172..0000000
--- a/thirdparty/rocksdb/utilities/persistent_cache/persistent_cache_test.h
+++ /dev/null
@@ -1,285 +0,0 @@
-//  Copyright (c) 2013, Facebook, Inc.  All rights reserved.
-//  This source code is licensed under both the GPLv2 (found in the
-//  COPYING file in the root directory) and Apache 2.0 License
-//  (found in the LICENSE.Apache file in the root directory).
-//
-// Copyright (c) 2011 The LevelDB Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file. See the AUTHORS file for names of contributors.
-#pragma once
-
-#ifndef ROCKSDB_LITE
-
-#include <functional>
-#include <limits>
-#include <list>
-#include <memory>
-#include <string>
-#include <thread>
-#include <vector>
-
-#include "db/db_test_util.h"
-#include "rocksdb/cache.h"
-#include "table/block_builder.h"
-#include "port/port.h"
-#include "util/arena.h"
-#include "util/testharness.h"
-#include "utilities/persistent_cache/volatile_tier_impl.h"
-
-namespace rocksdb {
-
-//
-// Unit tests for testing PersistentCacheTier
-//
-class PersistentCacheTierTest : public testing::Test {
- public:
-  PersistentCacheTierTest();
-  virtual ~PersistentCacheTierTest() {
-    if (cache_) {
-      Status s = cache_->Close();
-      assert(s.ok());
-    }
-  }
-
- protected:
-  // Flush cache
-  void Flush() {
-    if (cache_) {
-      cache_->TEST_Flush();
-    }
-  }
-
-  // create threaded workload
-  template <class T>
-  std::list<port::Thread> SpawnThreads(const size_t n, const T& fn) {
-    std::list<port::Thread> threads;
-    for (size_t i = 0; i < n; i++) {
-      port::Thread th(fn);
-      threads.push_back(std::move(th));
-    }
-    return threads;
-  }
-
-  // Wait for threads to join
-  void Join(std::list<port::Thread>&& threads) {
-    for (auto& th : threads) {
-      th.join();
-    }
-    threads.clear();
-  }
-
-  // Run insert workload in threads
-  void Insert(const size_t nthreads, const size_t max_keys) {
-    key_ = 0;
-    max_keys_ = max_keys;
-    // spawn threads
-    auto fn = std::bind(&PersistentCacheTierTest::InsertImpl, this);
-    auto threads = SpawnThreads(nthreads, fn);
-    // join with threads
-    Join(std::move(threads));
-    // Flush cache
-    Flush();
-  }
-
-  // Run verification on the cache
-  void Verify(const size_t nthreads = 1, const bool eviction_enabled = false) {
-    stats_verify_hits_ = 0;
-    stats_verify_missed_ = 0;
-    key_ = 0;
-    // spawn threads
-    auto fn =
-        std::bind(&PersistentCacheTierTest::VerifyImpl, this, eviction_enabled);
-    auto threads = SpawnThreads(nthreads, fn);
-    // join with threads
-    Join(std::move(threads));
-  }
-
-  // pad 0 to numbers
-  std::string PaddedNumber(const size_t data, const size_t pad_size) {
-    assert(pad_size);
-    char* ret = new char[pad_size];
-    int pos = static_cast<int>(pad_size) - 1;
-    size_t count = 0;
-    size_t t = data;
-    // copy numbers
-    while (t) {
-      count++;
-      ret[pos--] = '0' + t % 10;
-      t = t / 10;
-    }
-    // copy 0s
-    while (pos >= 0) {
-      ret[pos--] = '0';
-    }
-    // post condition
-    assert(count <= pad_size);
-    assert(pos == -1);
-    std::string result(ret, pad_size);
-    delete[] ret;
-    return result;
-  }
-
-  // Insert workload implementation
-  void InsertImpl() {
-    const std::string prefix = "key_prefix_";
-
-    while (true) {
-      size_t i = key_++;
-      if (i >= max_keys_) {
-        break;
-      }
-
-      char data[4 * 1024];
-      memset(data, '0' + (i % 10), sizeof(data));
-      auto k = prefix + PaddedNumber(i, /*count=*/8);
-      Slice key(k);
-      while (true) {
-        Status status = cache_->Insert(key, data, sizeof(data));
-        if (status.ok()) {
-          break;
-        }
-        ASSERT_TRUE(status.IsTryAgain());
-        Env::Default()->SleepForMicroseconds(1 * 1000 * 1000);
-      }
-    }
-  }
-
-  // Verification implementation
-  void VerifyImpl(const bool eviction_enabled = false) {
-    const std::string prefix = "key_prefix_";
-    while (true) {
-      size_t i = key_++;
-      if (i >= max_keys_) {
-        break;
-      }
-
-      char edata[4 * 1024];
-      memset(edata, '0' + (i % 10), sizeof(edata));
-      auto k = prefix + PaddedNumber(i, /*count=*/8);
-      Slice key(k);
-      unique_ptr<char[]> block;
-      size_t block_size;
-
-      if (eviction_enabled) {
-        if (!cache_->Lookup(key, &block, &block_size).ok()) {
-          // assume that the key is evicted
-          stats_verify_missed_++;
-          continue;
-        }
-      }
-
-      ASSERT_OK(cache_->Lookup(key, &block, &block_size));
-      ASSERT_EQ(block_size, sizeof(edata));
-      ASSERT_EQ(memcmp(edata, block.get(), sizeof(edata)), 0);
-      stats_verify_hits_++;
-    }
-  }
-
-  // template for insert test
-  void RunInsertTest(const size_t nthreads, const size_t max_keys) {
-    Insert(nthreads, max_keys);
-    Verify(nthreads);
-    ASSERT_EQ(stats_verify_hits_, max_keys);
-    ASSERT_EQ(stats_verify_missed_, 0);
-
-    cache_->Close();
-    cache_.reset();
-  }
-
-  // template for negative insert test
-  void RunNegativeInsertTest(const size_t nthreads, const size_t max_keys) {
-    Insert(nthreads, max_keys);
-    Verify(nthreads, /*eviction_enabled=*/true);
-    ASSERT_LT(stats_verify_hits_, max_keys);
-    ASSERT_GT(stats_verify_missed_, 0);
-
-    cache_->Close();
-    cache_.reset();
-  }
-
-  // template for insert with eviction test
-  void RunInsertTestWithEviction(const size_t nthreads, const size_t max_keys) {
-    Insert(nthreads, max_keys);
-    Verify(nthreads, /*eviction_enabled=*/true);
-    ASSERT_EQ(stats_verify_hits_ + stats_verify_missed_, max_keys);
-    ASSERT_GT(stats_verify_hits_, 0);
-    ASSERT_GT(stats_verify_missed_, 0);
-
-    cache_->Close();
-    cache_.reset();
-  }
-
-  const std::string path_;
-  shared_ptr<Logger> log_;
-  std::shared_ptr<PersistentCacheTier> cache_;
-  std::atomic<size_t> key_{0};
-  size_t max_keys_ = 0;
-  std::atomic<size_t> stats_verify_hits_{0};
-  std::atomic<size_t> stats_verify_missed_{0};
-};
-
-//
-// RocksDB tests
-//
-class PersistentCacheDBTest : public DBTestBase {
- public:
-  PersistentCacheDBTest();
-
-  static uint64_t TestGetTickerCount(const Options& options,
-                                     Tickers ticker_type) {
-    return static_cast<uint32_t>(
-        options.statistics->getTickerCount(ticker_type));
-  }
-
-  // insert data to table
-  void Insert(const Options& options,
-              const BlockBasedTableOptions& table_options, const int num_iter,
-              std::vector<std::string>* values) {
-    CreateAndReopenWithCF({"pikachu"}, options);
-    // default column family doesn't have block cache
-    Options no_block_cache_opts;
-    no_block_cache_opts.statistics = options.statistics;
-    no_block_cache_opts = CurrentOptions(no_block_cache_opts);
-    BlockBasedTableOptions table_options_no_bc;
-    table_options_no_bc.no_block_cache = true;
-    no_block_cache_opts.table_factory.reset(
-        NewBlockBasedTableFactory(table_options_no_bc));
-    ReopenWithColumnFamilies(
-        {"default", "pikachu"},
-        std::vector<Options>({no_block_cache_opts, options}));
-
-    Random rnd(301);
-
-    // Write 8MB (80 values, each 100K)
-    ASSERT_EQ(NumTableFilesAtLevel(0, 1), 0);
-    std::string str;
-    for (int i = 0; i < num_iter; i++) {
-      if (i % 4 == 0) {  // high compression ratio
-        str = RandomString(&rnd, 1000);
-      }
-      values->push_back(str);
-      ASSERT_OK(Put(1, Key(i), (*values)[i]));
-    }
-
-    // flush all data from memtable so that reads are from block cache
-    ASSERT_OK(Flush(1));
-  }
-
-  // verify data
-  void Verify(const int num_iter, const std::vector<std::string>& values) {
-    for (int j = 0; j < 2; ++j) {
-      for (int i = 0; i < num_iter; i++) {
-        ASSERT_EQ(Get(1, Key(i)), values[i]);
-      }
-    }
-  }
-
-  // test template
-  void RunTest(const std::function<std::shared_ptr<PersistentCacheTier>(bool)>&
-                   new_pcache,
-               const size_t max_keys, const size_t max_usecase);
-};
-
-}  // namespace rocksdb
-
-#endif

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/d3a13a49/thirdparty/rocksdb/utilities/redis/redis_lists_test.cc
----------------------------------------------------------------------
diff --git a/thirdparty/rocksdb/utilities/redis/redis_lists_test.cc b/thirdparty/rocksdb/utilities/redis/redis_lists_test.cc
deleted file mode 100644
index 22acdff..0000000
--- a/thirdparty/rocksdb/utilities/redis/redis_lists_test.cc
+++ /dev/null
@@ -1,894 +0,0 @@
-//  Copyright (c) 2011-present, Facebook, Inc.  All rights reserved.
-//  This source code is licensed under both the GPLv2 (found in the
-//  COPYING file in the root directory) and Apache 2.0 License
-//  (found in the LICENSE.Apache file in the root directory).
-/**
- * A test harness for the Redis API built on rocksdb.
- *
- * USAGE: Build with: "make redis_test" (in rocksdb directory).
- *        Run unit tests with: "./redis_test"
- *        Manual/Interactive user testing: "./redis_test -m"
- *        Manual user testing + restart database: "./redis_test -m -d"
- *
- * TODO:  Add LARGE random test cases to verify efficiency and scalability
- *
- * @author Deon Nicholas (dnicholas@fb.com)
- */
-
-#ifndef ROCKSDB_LITE
-
-#include <iostream>
-#include <cctype>
-
-#include "redis_lists.h"
-#include "util/testharness.h"
-#include "util/random.h"
-
-using namespace rocksdb;
-
-namespace rocksdb {
-
-class RedisListsTest : public testing::Test {
- public:
-  static const std::string kDefaultDbName;
-  static Options options;
-
-  RedisListsTest() {
-    options.create_if_missing = true;
-  }
-};
-
-const std::string RedisListsTest::kDefaultDbName =
-    test::TmpDir() + "/redis_lists_test";
-Options RedisListsTest::options = Options();
-
-// operator== and operator<< are defined below for vectors (lists)
-// Needed for ASSERT_EQ
-
-namespace {
-void AssertListEq(const std::vector<std::string>& result,
-                  const std::vector<std::string>& expected_result) {
-  ASSERT_EQ(result.size(), expected_result.size());
-  for (size_t i = 0; i < result.size(); ++i) {
-    ASSERT_EQ(result[i], expected_result[i]);
-  }
-}
-}  // namespace
-
-// PushRight, Length, Index, Range
-TEST_F(RedisListsTest, SimpleTest) {
-  RedisLists redis(kDefaultDbName, options, true);   // Destructive
-
-  std::string tempv;  // Used below for all Index(), PopRight(), PopLeft()
-
-  // Simple PushRight (should return the new length each time)
-  ASSERT_EQ(redis.PushRight("k1", "v1"), 1);
-  ASSERT_EQ(redis.PushRight("k1", "v2"), 2);
-  ASSERT_EQ(redis.PushRight("k1", "v3"), 3);
-
-  // Check Length and Index() functions
-  ASSERT_EQ(redis.Length("k1"), 3);        // Check length
-  ASSERT_TRUE(redis.Index("k1", 0, &tempv));
-  ASSERT_EQ(tempv, "v1");   // Check valid indices
-  ASSERT_TRUE(redis.Index("k1", 1, &tempv));
-  ASSERT_EQ(tempv, "v2");
-  ASSERT_TRUE(redis.Index("k1", 2, &tempv));
-  ASSERT_EQ(tempv, "v3");
-
-  // Check range function and vectors
-  std::vector<std::string> result = redis.Range("k1", 0, 2);   // Get the list
-  std::vector<std::string> expected_result(3);
-  expected_result[0] = "v1";
-  expected_result[1] = "v2";
-  expected_result[2] = "v3";
-  AssertListEq(result, expected_result);
-}
-
-// PushLeft, Length, Index, Range
-TEST_F(RedisListsTest, SimpleTest2) {
-  RedisLists redis(kDefaultDbName, options, true);   // Destructive
-
-  std::string tempv;  // Used below for all Index(), PopRight(), PopLeft()
-
-  // Simple PushRight
-  ASSERT_EQ(redis.PushLeft("k1", "v3"), 1);
-  ASSERT_EQ(redis.PushLeft("k1", "v2"), 2);
-  ASSERT_EQ(redis.PushLeft("k1", "v1"), 3);
-
-  // Check Length and Index() functions
-  ASSERT_EQ(redis.Length("k1"), 3);        // Check length
-  ASSERT_TRUE(redis.Index("k1", 0, &tempv));
-  ASSERT_EQ(tempv, "v1");   // Check valid indices
-  ASSERT_TRUE(redis.Index("k1", 1, &tempv));
-  ASSERT_EQ(tempv, "v2");
-  ASSERT_TRUE(redis.Index("k1", 2, &tempv));
-  ASSERT_EQ(tempv, "v3");
-
-  // Check range function and vectors
-  std::vector<std::string> result = redis.Range("k1", 0, 2);   // Get the list
-  std::vector<std::string> expected_result(3);
-  expected_result[0] = "v1";
-  expected_result[1] = "v2";
-  expected_result[2] = "v3";
-  AssertListEq(result, expected_result);
-}
-
-// Exhaustive test of the Index() function
-TEST_F(RedisListsTest, IndexTest) {
-  RedisLists redis(kDefaultDbName, options, true);   // Destructive
-
-  std::string tempv;  // Used below for all Index(), PopRight(), PopLeft()
-
-  // Empty Index check (return empty and should not crash or edit tempv)
-  tempv = "yo";
-  ASSERT_TRUE(!redis.Index("k1", 0, &tempv));
-  ASSERT_EQ(tempv, "yo");
-  ASSERT_TRUE(!redis.Index("fda", 3, &tempv));
-  ASSERT_EQ(tempv, "yo");
-  ASSERT_TRUE(!redis.Index("random", -12391, &tempv));
-  ASSERT_EQ(tempv, "yo");
-
-  // Simple Pushes (will yield: [v6, v4, v4, v1, v2, v3]
-  redis.PushRight("k1", "v1");
-  redis.PushRight("k1", "v2");
-  redis.PushRight("k1", "v3");
-  redis.PushLeft("k1", "v4");
-  redis.PushLeft("k1", "v4");
-  redis.PushLeft("k1", "v6");
-
-  // Simple, non-negative indices
-  ASSERT_TRUE(redis.Index("k1", 0, &tempv));
-  ASSERT_EQ(tempv, "v6");
-  ASSERT_TRUE(redis.Index("k1", 1, &tempv));
-  ASSERT_EQ(tempv, "v4");
-  ASSERT_TRUE(redis.Index("k1", 2, &tempv));
-  ASSERT_EQ(tempv, "v4");
-  ASSERT_TRUE(redis.Index("k1", 3, &tempv));
-  ASSERT_EQ(tempv, "v1");
-  ASSERT_TRUE(redis.Index("k1", 4, &tempv));
-  ASSERT_EQ(tempv, "v2");
-  ASSERT_TRUE(redis.Index("k1", 5, &tempv));
-  ASSERT_EQ(tempv, "v3");
-
-  // Negative indices
-  ASSERT_TRUE(redis.Index("k1", -6, &tempv));
-  ASSERT_EQ(tempv, "v6");
-  ASSERT_TRUE(redis.Index("k1", -5, &tempv));
-  ASSERT_EQ(tempv, "v4");
-  ASSERT_TRUE(redis.Index("k1", -4, &tempv));
-  ASSERT_EQ(tempv, "v4");
-  ASSERT_TRUE(redis.Index("k1", -3, &tempv));
-  ASSERT_EQ(tempv, "v1");
-  ASSERT_TRUE(redis.Index("k1", -2, &tempv));
-  ASSERT_EQ(tempv, "v2");
-  ASSERT_TRUE(redis.Index("k1", -1, &tempv));
-  ASSERT_EQ(tempv, "v3");
-
-  // Out of bounds (return empty, no crash)
-  ASSERT_TRUE(!redis.Index("k1", 6, &tempv));
-  ASSERT_TRUE(!redis.Index("k1", 123219, &tempv));
-  ASSERT_TRUE(!redis.Index("k1", -7, &tempv));
-  ASSERT_TRUE(!redis.Index("k1", -129, &tempv));
-}
-
-
-// Exhaustive test of the Range() function
-TEST_F(RedisListsTest, RangeTest) {
-  RedisLists redis(kDefaultDbName, options, true);   // Destructive
-
-  std::string tempv;  // Used below for all Index(), PopRight(), PopLeft()
-
-  // Simple Pushes (will yield: [v6, v4, v4, v1, v2, v3])
-  redis.PushRight("k1", "v1");
-  redis.PushRight("k1", "v2");
-  redis.PushRight("k1", "v3");
-  redis.PushLeft("k1", "v4");
-  redis.PushLeft("k1", "v4");
-  redis.PushLeft("k1", "v6");
-
-  // Sanity check (check the length;  make sure it's 6)
-  ASSERT_EQ(redis.Length("k1"), 6);
-
-  // Simple range
-  std::vector<std::string> res = redis.Range("k1", 1, 4);
-  ASSERT_EQ((int)res.size(), 4);
-  ASSERT_EQ(res[0], "v4");
-  ASSERT_EQ(res[1], "v4");
-  ASSERT_EQ(res[2], "v1");
-  ASSERT_EQ(res[3], "v2");
-
-  // Negative indices (i.e.: measured from the end)
-  res = redis.Range("k1", 2, -1);
-  ASSERT_EQ((int)res.size(), 4);
-  ASSERT_EQ(res[0], "v4");
-  ASSERT_EQ(res[1], "v1");
-  ASSERT_EQ(res[2], "v2");
-  ASSERT_EQ(res[3], "v3");
-
-  res = redis.Range("k1", -6, -4);
-  ASSERT_EQ((int)res.size(), 3);
-  ASSERT_EQ(res[0], "v6");
-  ASSERT_EQ(res[1], "v4");
-  ASSERT_EQ(res[2], "v4");
-
-  res = redis.Range("k1", -1, 5);
-  ASSERT_EQ((int)res.size(), 1);
-  ASSERT_EQ(res[0], "v3");
-
-  // Partial / Broken indices
-  res = redis.Range("k1", -3, 1000000);
-  ASSERT_EQ((int)res.size(), 3);
-  ASSERT_EQ(res[0], "v1");
-  ASSERT_EQ(res[1], "v2");
-  ASSERT_EQ(res[2], "v3");
-
-  res = redis.Range("k1", -1000000, 1);
-  ASSERT_EQ((int)res.size(), 2);
-  ASSERT_EQ(res[0], "v6");
-  ASSERT_EQ(res[1], "v4");
-
-  // Invalid indices
-  res = redis.Range("k1", 7, 9);
-  ASSERT_EQ((int)res.size(), 0);
-
-  res = redis.Range("k1", -8, -7);
-  ASSERT_EQ((int)res.size(), 0);
-
-  res = redis.Range("k1", 3, 2);
-  ASSERT_EQ((int)res.size(), 0);
-
-  res = redis.Range("k1", 5, -2);
-  ASSERT_EQ((int)res.size(), 0);
-
-  // Range matches Index
-  res = redis.Range("k1", -6, -4);
-  ASSERT_TRUE(redis.Index("k1", -6, &tempv));
-  ASSERT_EQ(tempv, res[0]);
-  ASSERT_TRUE(redis.Index("k1", -5, &tempv));
-  ASSERT_EQ(tempv, res[1]);
-  ASSERT_TRUE(redis.Index("k1", -4, &tempv));
-  ASSERT_EQ(tempv, res[2]);
-
-  // Last check
-  res = redis.Range("k1", 0, -6);
-  ASSERT_EQ((int)res.size(), 1);
-  ASSERT_EQ(res[0], "v6");
-}
-
-// Exhaustive test for InsertBefore(), and InsertAfter()
-TEST_F(RedisListsTest, InsertTest) {
-  RedisLists redis(kDefaultDbName, options, true);
-
-  std::string tempv;  // Used below for all Index(), PopRight(), PopLeft()
-
-  // Insert on empty list (return 0, and do not crash)
-  ASSERT_EQ(redis.InsertBefore("k1", "non-exist", "a"), 0);
-  ASSERT_EQ(redis.InsertAfter("k1", "other-non-exist", "c"), 0);
-  ASSERT_EQ(redis.Length("k1"), 0);
-
-  // Push some preliminary stuff [g, f, e, d, c, b, a]
-  redis.PushLeft("k1", "a");
-  redis.PushLeft("k1", "b");
-  redis.PushLeft("k1", "c");
-  redis.PushLeft("k1", "d");
-  redis.PushLeft("k1", "e");
-  redis.PushLeft("k1", "f");
-  redis.PushLeft("k1", "g");
-  ASSERT_EQ(redis.Length("k1"), 7);
-
-  // Test InsertBefore
-  int newLength = redis.InsertBefore("k1", "e", "hello");
-  ASSERT_EQ(newLength, 8);
-  ASSERT_EQ(redis.Length("k1"), newLength);
-  ASSERT_TRUE(redis.Index("k1", 1, &tempv));
-  ASSERT_EQ(tempv, "f");
-  ASSERT_TRUE(redis.Index("k1", 3, &tempv));
-  ASSERT_EQ(tempv, "e");
-  ASSERT_TRUE(redis.Index("k1", 2, &tempv));
-  ASSERT_EQ(tempv, "hello");
-
-  // Test InsertAfter
-  newLength =  redis.InsertAfter("k1", "c", "bye");
-  ASSERT_EQ(newLength, 9);
-  ASSERT_EQ(redis.Length("k1"), newLength);
-  ASSERT_TRUE(redis.Index("k1", 6, &tempv));
-  ASSERT_EQ(tempv, "bye");
-
-  // Test bad value on InsertBefore
-  newLength = redis.InsertBefore("k1", "yo", "x");
-  ASSERT_EQ(newLength, 9);
-  ASSERT_EQ(redis.Length("k1"), newLength);
-
-  // Test bad value on InsertAfter
-  newLength = redis.InsertAfter("k1", "xxxx", "y");
-  ASSERT_EQ(newLength, 9);
-  ASSERT_EQ(redis.Length("k1"), newLength);
-
-  // Test InsertBefore beginning
-  newLength = redis.InsertBefore("k1", "g", "begggggggggggggggg");
-  ASSERT_EQ(newLength, 10);
-  ASSERT_EQ(redis.Length("k1"), newLength);
-
-  // Test InsertAfter end
-  newLength = redis.InsertAfter("k1", "a", "enddd");
-  ASSERT_EQ(newLength, 11);
-  ASSERT_EQ(redis.Length("k1"), newLength);
-
-  // Make sure nothing weird happened.
-  ASSERT_TRUE(redis.Index("k1", 0, &tempv));
-  ASSERT_EQ(tempv, "begggggggggggggggg");
-  ASSERT_TRUE(redis.Index("k1", 1, &tempv));
-  ASSERT_EQ(tempv, "g");
-  ASSERT_TRUE(redis.Index("k1", 2, &tempv));
-  ASSERT_EQ(tempv, "f");
-  ASSERT_TRUE(redis.Index("k1", 3, &tempv));
-  ASSERT_EQ(tempv, "hello");
-  ASSERT_TRUE(redis.Index("k1", 4, &tempv));
-  ASSERT_EQ(tempv, "e");
-  ASSERT_TRUE(redis.Index("k1", 5, &tempv));
-  ASSERT_EQ(tempv, "d");
-  ASSERT_TRUE(redis.Index("k1", 6, &tempv));
-  ASSERT_EQ(tempv, "c");
-  ASSERT_TRUE(redis.Index("k1", 7, &tempv));
-  ASSERT_EQ(tempv, "bye");
-  ASSERT_TRUE(redis.Index("k1", 8, &tempv));
-  ASSERT_EQ(tempv, "b");
-  ASSERT_TRUE(redis.Index("k1", 9, &tempv));
-  ASSERT_EQ(tempv, "a");
-  ASSERT_TRUE(redis.Index("k1", 10, &tempv));
-  ASSERT_EQ(tempv, "enddd");
-}
-
-// Exhaustive test of Set function
-TEST_F(RedisListsTest, SetTest) {
-  RedisLists redis(kDefaultDbName, options, true);
-
-  std::string tempv;  // Used below for all Index(), PopRight(), PopLeft()
-
-  // Set on empty list (return false, and do not crash)
-  ASSERT_EQ(redis.Set("k1", 7, "a"), false);
-  ASSERT_EQ(redis.Set("k1", 0, "a"), false);
-  ASSERT_EQ(redis.Set("k1", -49, "cx"), false);
-  ASSERT_EQ(redis.Length("k1"), 0);
-
-  // Push some preliminary stuff [g, f, e, d, c, b, a]
-  redis.PushLeft("k1", "a");
-  redis.PushLeft("k1", "b");
-  redis.PushLeft("k1", "c");
-  redis.PushLeft("k1", "d");
-  redis.PushLeft("k1", "e");
-  redis.PushLeft("k1", "f");
-  redis.PushLeft("k1", "g");
-  ASSERT_EQ(redis.Length("k1"), 7);
-
-  // Test Regular Set
-  ASSERT_TRUE(redis.Set("k1", 0, "0"));
-  ASSERT_TRUE(redis.Set("k1", 3, "3"));
-  ASSERT_TRUE(redis.Set("k1", 6, "6"));
-  ASSERT_TRUE(redis.Set("k1", 2, "2"));
-  ASSERT_TRUE(redis.Set("k1", 5, "5"));
-  ASSERT_TRUE(redis.Set("k1", 1, "1"));
-  ASSERT_TRUE(redis.Set("k1", 4, "4"));
-
-  ASSERT_EQ(redis.Length("k1"), 7); // Size should not change
-  ASSERT_TRUE(redis.Index("k1", 0, &tempv));
-  ASSERT_EQ(tempv, "0");
-  ASSERT_TRUE(redis.Index("k1", 1, &tempv));
-  ASSERT_EQ(tempv, "1");
-  ASSERT_TRUE(redis.Index("k1", 2, &tempv));
-  ASSERT_EQ(tempv, "2");
-  ASSERT_TRUE(redis.Index("k1", 3, &tempv));
-  ASSERT_EQ(tempv, "3");
-  ASSERT_TRUE(redis.Index("k1", 4, &tempv));
-  ASSERT_EQ(tempv, "4");
-  ASSERT_TRUE(redis.Index("k1", 5, &tempv));
-  ASSERT_EQ(tempv, "5");
-  ASSERT_TRUE(redis.Index("k1", 6, &tempv));
-  ASSERT_EQ(tempv, "6");
-
-  // Set with negative indices
-  ASSERT_TRUE(redis.Set("k1", -7, "a"));
-  ASSERT_TRUE(redis.Set("k1", -4, "d"));
-  ASSERT_TRUE(redis.Set("k1", -1, "g"));
-  ASSERT_TRUE(redis.Set("k1", -5, "c"));
-  ASSERT_TRUE(redis.Set("k1", -2, "f"));
-  ASSERT_TRUE(redis.Set("k1", -6, "b"));
-  ASSERT_TRUE(redis.Set("k1", -3, "e"));
-
-  ASSERT_EQ(redis.Length("k1"), 7); // Size should not change
-  ASSERT_TRUE(redis.Index("k1", 0, &tempv));
-  ASSERT_EQ(tempv, "a");
-  ASSERT_TRUE(redis.Index("k1", 1, &tempv));
-  ASSERT_EQ(tempv, "b");
-  ASSERT_TRUE(redis.Index("k1", 2, &tempv));
-  ASSERT_EQ(tempv, "c");
-  ASSERT_TRUE(redis.Index("k1", 3, &tempv));
-  ASSERT_EQ(tempv, "d");
-  ASSERT_TRUE(redis.Index("k1", 4, &tempv));
-  ASSERT_EQ(tempv, "e");
-  ASSERT_TRUE(redis.Index("k1", 5, &tempv));
-  ASSERT_EQ(tempv, "f");
-  ASSERT_TRUE(redis.Index("k1", 6, &tempv));
-  ASSERT_EQ(tempv, "g");
-
-  // Bad indices (just out-of-bounds / off-by-one check)
-  ASSERT_EQ(redis.Set("k1", -8, "off-by-one in negative index"), false);
-  ASSERT_EQ(redis.Set("k1", 7, "off-by-one-error in positive index"), false);
-  ASSERT_EQ(redis.Set("k1", 43892, "big random index should fail"), false);
-  ASSERT_EQ(redis.Set("k1", -21391, "large negative index should fail"), false);
-
-  // One last check (to make sure nothing weird happened)
-  ASSERT_EQ(redis.Length("k1"), 7); // Size should not change
-  ASSERT_TRUE(redis.Index("k1", 0, &tempv));
-  ASSERT_EQ(tempv, "a");
-  ASSERT_TRUE(redis.Index("k1", 1, &tempv));
-  ASSERT_EQ(tempv, "b");
-  ASSERT_TRUE(redis.Index("k1", 2, &tempv));
-  ASSERT_EQ(tempv, "c");
-  ASSERT_TRUE(redis.Index("k1", 3, &tempv));
-  ASSERT_EQ(tempv, "d");
-  ASSERT_TRUE(redis.Index("k1", 4, &tempv));
-  ASSERT_EQ(tempv, "e");
-  ASSERT_TRUE(redis.Index("k1", 5, &tempv));
-  ASSERT_EQ(tempv, "f");
-  ASSERT_TRUE(redis.Index("k1", 6, &tempv));
-  ASSERT_EQ(tempv, "g");
-}
-
-// Testing Insert, Push, and Set, in a mixed environment
-TEST_F(RedisListsTest, InsertPushSetTest) {
-  RedisLists redis(kDefaultDbName, options, true);   // Destructive
-
-  std::string tempv;  // Used below for all Index(), PopRight(), PopLeft()
-
-  // A series of pushes and insertions
-  // Will result in [newbegin, z, a, aftera, x, newend]
-  // Also, check the return value sometimes (should return length)
-  int lengthCheck;
-  lengthCheck = redis.PushLeft("k1", "a");
-  ASSERT_EQ(lengthCheck, 1);
-  redis.PushLeft("k1", "z");
-  redis.PushRight("k1", "x");
-  lengthCheck = redis.InsertAfter("k1", "a", "aftera");
-  ASSERT_EQ(lengthCheck , 4);
-  redis.InsertBefore("k1", "z", "newbegin");  // InsertBefore beginning of list
-  redis.InsertAfter("k1", "x", "newend");     // InsertAfter end of list
-
-  // Check
-  std::vector<std::string> res = redis.Range("k1", 0, -1); // Get the list
-  ASSERT_EQ((int)res.size(), 6);
-  ASSERT_EQ(res[0], "newbegin");
-  ASSERT_EQ(res[5], "newend");
-  ASSERT_EQ(res[3], "aftera");
-
-  // Testing duplicate values/pivots (multiple occurrences of 'a')
-  ASSERT_TRUE(redis.Set("k1", 0, "a"));     // [a, z, a, aftera, x, newend]
-  redis.InsertAfter("k1", "a", "happy");    // [a, happy, z, a, aftera, ...]
-  ASSERT_TRUE(redis.Index("k1", 1, &tempv));
-  ASSERT_EQ(tempv, "happy");
-  redis.InsertBefore("k1", "a", "sad");     // [sad, a, happy, z, a, aftera, ...]
-  ASSERT_TRUE(redis.Index("k1", 0, &tempv));
-  ASSERT_EQ(tempv, "sad");
-  ASSERT_TRUE(redis.Index("k1", 2, &tempv));
-  ASSERT_EQ(tempv, "happy");
-  ASSERT_TRUE(redis.Index("k1", 5, &tempv));
-  ASSERT_EQ(tempv, "aftera");
-  redis.InsertAfter("k1", "a", "zz");         // [sad, a, zz, happy, z, a, aftera, ...]
-  ASSERT_TRUE(redis.Index("k1", 2, &tempv));
-  ASSERT_EQ(tempv, "zz");
-  ASSERT_TRUE(redis.Index("k1", 6, &tempv));
-  ASSERT_EQ(tempv, "aftera");
-  ASSERT_TRUE(redis.Set("k1", 1, "nota"));    // [sad, nota, zz, happy, z, a, ...]
-  redis.InsertBefore("k1", "a", "ba");        // [sad, nota, zz, happy, z, ba, a, ...]
-  ASSERT_TRUE(redis.Index("k1", 4, &tempv));
-  ASSERT_EQ(tempv, "z");
-  ASSERT_TRUE(redis.Index("k1", 5, &tempv));
-  ASSERT_EQ(tempv, "ba");
-  ASSERT_TRUE(redis.Index("k1", 6, &tempv));
-  ASSERT_EQ(tempv, "a");
-
-  // We currently have: [sad, nota, zz, happy, z, ba, a, aftera, x, newend]
-  // redis.Print("k1");   // manually check
-
-  // Test Inserting before/after non-existent values
-  lengthCheck = redis.Length("k1"); // Ensure that the length doesn't change
-  ASSERT_EQ(lengthCheck, 10);
-  ASSERT_EQ(redis.InsertBefore("k1", "non-exist", "randval"), lengthCheck);
-  ASSERT_EQ(redis.InsertAfter("k1", "nothing", "a"), lengthCheck);
-  ASSERT_EQ(redis.InsertAfter("randKey", "randVal", "ranValue"), 0); // Empty
-  ASSERT_EQ(redis.Length("k1"), lengthCheck); // The length should not change
-
-  // Simply Test the Set() function
-  redis.Set("k1", 5, "ba2");
-  redis.InsertBefore("k1", "ba2", "beforeba2");
-  ASSERT_TRUE(redis.Index("k1", 4, &tempv));
-  ASSERT_EQ(tempv, "z");
-  ASSERT_TRUE(redis.Index("k1", 5, &tempv));
-  ASSERT_EQ(tempv, "beforeba2");
-  ASSERT_TRUE(redis.Index("k1", 6, &tempv));
-  ASSERT_EQ(tempv, "ba2");
-  ASSERT_TRUE(redis.Index("k1", 7, &tempv));
-  ASSERT_EQ(tempv, "a");
-
-  // We have: [sad, nota, zz, happy, z, beforeba2, ba2, a, aftera, x, newend]
-
-  // Set() with negative indices
-  redis.Set("k1", -1, "endprank");
-  ASSERT_TRUE(!redis.Index("k1", 11, &tempv));
-  ASSERT_TRUE(redis.Index("k1", 10, &tempv));
-  ASSERT_EQ(tempv, "endprank"); // Ensure Set worked correctly
-  redis.Set("k1", -11, "t");
-  ASSERT_TRUE(redis.Index("k1", 0, &tempv));
-  ASSERT_EQ(tempv, "t");
-
-  // Test out of bounds Set
-  ASSERT_EQ(redis.Set("k1", -12, "ssd"), false);
-  ASSERT_EQ(redis.Set("k1", 11, "sasd"), false);
-  ASSERT_EQ(redis.Set("k1", 1200, "big"), false);
-}
-
-// Testing Trim, Pop
-TEST_F(RedisListsTest, TrimPopTest) {
-  RedisLists redis(kDefaultDbName, options, true);   // Destructive
-
-  std::string tempv;  // Used below for all Index(), PopRight(), PopLeft()
-
-  // A series of pushes and insertions
-  // Will result in [newbegin, z, a, aftera, x, newend]
-  redis.PushLeft("k1", "a");
-  redis.PushLeft("k1", "z");
-  redis.PushRight("k1", "x");
-  redis.InsertBefore("k1", "z", "newbegin");    // InsertBefore start of list
-  redis.InsertAfter("k1", "x", "newend");       // InsertAfter end of list
-  redis.InsertAfter("k1", "a", "aftera");
-
-  // Simple PopLeft/Right test
-  ASSERT_TRUE(redis.PopLeft("k1", &tempv));
-  ASSERT_EQ(tempv, "newbegin");
-  ASSERT_EQ(redis.Length("k1"), 5);
-  ASSERT_TRUE(redis.Index("k1", 0, &tempv));
-  ASSERT_EQ(tempv, "z");
-  ASSERT_TRUE(redis.PopRight("k1", &tempv));
-  ASSERT_EQ(tempv, "newend");
-  ASSERT_EQ(redis.Length("k1"), 4);
-  ASSERT_TRUE(redis.Index("k1", -1, &tempv));
-  ASSERT_EQ(tempv, "x");
-
-  // Now have: [z, a, aftera, x]
-
-  // Test Trim
-  ASSERT_TRUE(redis.Trim("k1", 0, -1));       // [z, a, aftera, x] (do nothing)
-  ASSERT_EQ(redis.Length("k1"), 4);
-  ASSERT_TRUE(redis.Trim("k1", 0, 2));                     // [z, a, aftera]
-  ASSERT_EQ(redis.Length("k1"), 3);
-  ASSERT_TRUE(redis.Index("k1", -1, &tempv));
-  ASSERT_EQ(tempv, "aftera");
-  ASSERT_TRUE(redis.Trim("k1", 1, 1));                     // [a]
-  ASSERT_EQ(redis.Length("k1"), 1);
-  ASSERT_TRUE(redis.Index("k1", 0, &tempv));
-  ASSERT_EQ(tempv, "a");
-
-  // Test out of bounds (empty) trim
-  ASSERT_TRUE(redis.Trim("k1", 1, 0));
-  ASSERT_EQ(redis.Length("k1"), 0);
-
-  // Popping with empty list (return empty without error)
-  ASSERT_TRUE(!redis.PopLeft("k1", &tempv));
-  ASSERT_TRUE(!redis.PopRight("k1", &tempv));
-  ASSERT_TRUE(redis.Trim("k1", 0, 5));
-
-  // Exhaustive Trim test (negative and invalid indices)
-  // Will start in [newbegin, z, a, aftera, x, newend]
-  redis.PushLeft("k1", "a");
-  redis.PushLeft("k1", "z");
-  redis.PushRight("k1", "x");
-  redis.InsertBefore("k1", "z", "newbegin");    // InsertBefore start of list
-  redis.InsertAfter("k1", "x", "newend");       // InsertAfter end of list
-  redis.InsertAfter("k1", "a", "aftera");
-  ASSERT_TRUE(redis.Trim("k1", -6, -1));                     // Should do nothing
-  ASSERT_EQ(redis.Length("k1"), 6);
-  ASSERT_TRUE(redis.Trim("k1", 1, -2));
-  ASSERT_TRUE(redis.Index("k1", 0, &tempv));
-  ASSERT_EQ(tempv, "z");
-  ASSERT_TRUE(redis.Index("k1", 3, &tempv));
-  ASSERT_EQ(tempv, "x");
-  ASSERT_EQ(redis.Length("k1"), 4);
-  ASSERT_TRUE(redis.Trim("k1", -3, -2));
-  ASSERT_EQ(redis.Length("k1"), 2);
-}
-
-// Testing Remove, RemoveFirst, RemoveLast
-TEST_F(RedisListsTest, RemoveTest) {
-  RedisLists redis(kDefaultDbName, options, true);   // Destructive
-
-  std::string tempv;  // Used below for all Index(), PopRight(), PopLeft()
-
-  // A series of pushes and insertions
-  // Will result in [newbegin, z, a, aftera, x, newend, a, a]
-  redis.PushLeft("k1", "a");
-  redis.PushLeft("k1", "z");
-  redis.PushRight("k1", "x");
-  redis.InsertBefore("k1", "z", "newbegin");    // InsertBefore start of list
-  redis.InsertAfter("k1", "x", "newend");       // InsertAfter end of list
-  redis.InsertAfter("k1", "a", "aftera");
-  redis.PushRight("k1", "a");
-  redis.PushRight("k1", "a");
-
-  // Verify
-  ASSERT_TRUE(redis.Index("k1", 0, &tempv));
-  ASSERT_EQ(tempv, "newbegin");
-  ASSERT_TRUE(redis.Index("k1", -1, &tempv));
-  ASSERT_EQ(tempv, "a");
-
-  // Check RemoveFirst (Remove the first two 'a')
-  // Results in [newbegin, z, aftera, x, newend, a]
-  int numRemoved = redis.Remove("k1", 2, "a");
-  ASSERT_EQ(numRemoved, 2);
-  ASSERT_TRUE(redis.Index("k1", 0, &tempv));
-  ASSERT_EQ(tempv, "newbegin");
-  ASSERT_TRUE(redis.Index("k1", 1, &tempv));
-  ASSERT_EQ(tempv, "z");
-  ASSERT_TRUE(redis.Index("k1", 4, &tempv));
-  ASSERT_EQ(tempv, "newend");
-  ASSERT_TRUE(redis.Index("k1", 5, &tempv));
-  ASSERT_EQ(tempv, "a");
-  ASSERT_EQ(redis.Length("k1"), 6);
-
-  // Repopulate some stuff
-  // Results in: [x, x, x, x, x, newbegin, z, x, aftera, x, newend, a, x]
-  redis.PushLeft("k1", "x");
-  redis.PushLeft("k1", "x");
-  redis.PushLeft("k1", "x");
-  redis.PushLeft("k1", "x");
-  redis.PushLeft("k1", "x");
-  redis.PushRight("k1", "x");
-  redis.InsertAfter("k1", "z", "x");
-
-  // Test removal from end
-  numRemoved = redis.Remove("k1", -2, "x");
-  ASSERT_EQ(numRemoved, 2);
-  ASSERT_TRUE(redis.Index("k1", 8, &tempv));
-  ASSERT_EQ(tempv, "aftera");
-  ASSERT_TRUE(redis.Index("k1", 9, &tempv));
-  ASSERT_EQ(tempv, "newend");
-  ASSERT_TRUE(redis.Index("k1", 10, &tempv));
-  ASSERT_EQ(tempv, "a");
-  ASSERT_TRUE(!redis.Index("k1", 11, &tempv));
-  numRemoved = redis.Remove("k1", -2, "x");
-  ASSERT_EQ(numRemoved, 2);
-  ASSERT_TRUE(redis.Index("k1", 4, &tempv));
-  ASSERT_EQ(tempv, "newbegin");
-  ASSERT_TRUE(redis.Index("k1", 6, &tempv));
-  ASSERT_EQ(tempv, "aftera");
-
-  // We now have: [x, x, x, x, newbegin, z, aftera, newend, a]
-  ASSERT_EQ(redis.Length("k1"), 9);
-  ASSERT_TRUE(redis.Index("k1", -1, &tempv));
-  ASSERT_EQ(tempv, "a");
-  ASSERT_TRUE(redis.Index("k1", 0, &tempv));
-  ASSERT_EQ(tempv, "x");
-
-  // Test over-shooting (removing more than there exists)
-  numRemoved = redis.Remove("k1", -9000, "x");
-  ASSERT_EQ(numRemoved , 4);    // Only really removed 4
-  ASSERT_EQ(redis.Length("k1"), 5);
-  ASSERT_TRUE(redis.Index("k1", 0, &tempv));
-  ASSERT_EQ(tempv, "newbegin");
-  numRemoved = redis.Remove("k1", 1, "x");
-  ASSERT_EQ(numRemoved, 0);
-
-  // Try removing ALL!
-  numRemoved = redis.Remove("k1", 0, "newbegin");   // REMOVE 0 will remove all!
-  ASSERT_EQ(numRemoved, 1);
-
-  // Removal from an empty-list
-  ASSERT_TRUE(redis.Trim("k1", 1, 0));
-  numRemoved = redis.Remove("k1", 1, "z");
-  ASSERT_EQ(numRemoved, 0);
-}
-
-
-// Test Multiple keys and Persistence
-TEST_F(RedisListsTest, PersistenceMultiKeyTest) {
-  std::string tempv;  // Used below for all Index(), PopRight(), PopLeft()
-
-  // Block one: populate a single key in the database
-  {
-    RedisLists redis(kDefaultDbName, options, true);   // Destructive
-
-    // A series of pushes and insertions
-    // Will result in [newbegin, z, a, aftera, x, newend, a, a]
-    redis.PushLeft("k1", "a");
-    redis.PushLeft("k1", "z");
-    redis.PushRight("k1", "x");
-    redis.InsertBefore("k1", "z", "newbegin");    // InsertBefore start of list
-    redis.InsertAfter("k1", "x", "newend");       // InsertAfter end of list
-    redis.InsertAfter("k1", "a", "aftera");
-    redis.PushRight("k1", "a");
-    redis.PushRight("k1", "a");
-
-    ASSERT_TRUE(redis.Index("k1", 3, &tempv));
-    ASSERT_EQ(tempv, "aftera");
-  }
-
-  // Block two: make sure changes were saved and add some other key
-  {
-    RedisLists redis(kDefaultDbName, options, false); // Persistent, non-destructive
-
-    // Check
-    ASSERT_EQ(redis.Length("k1"), 8);
-    ASSERT_TRUE(redis.Index("k1", 3, &tempv));
-    ASSERT_EQ(tempv, "aftera");
-
-    redis.PushRight("k2", "randomkey");
-    redis.PushLeft("k2", "sas");
-
-    redis.PopLeft("k1", &tempv);
-  }
-
-  // Block three: Verify the changes from block 2
-  {
-    RedisLists redis(kDefaultDbName, options, false); // Persistent, non-destructive
-
-    // Check
-    ASSERT_EQ(redis.Length("k1"), 7);
-    ASSERT_EQ(redis.Length("k2"), 2);
-    ASSERT_TRUE(redis.Index("k1", 0, &tempv));
-    ASSERT_EQ(tempv, "z");
-    ASSERT_TRUE(redis.Index("k2", -2, &tempv));
-    ASSERT_EQ(tempv, "sas");
-  }
-}
-
-/// THE manual REDIS TEST begins here
-/// THIS WILL ONLY OCCUR IF YOU RUN: ./redis_test -m
-
-namespace {
-void MakeUpper(std::string* const s) {
-  int len = static_cast<int>(s->length());
-  for (int i = 0; i < len; ++i) {
-    (*s)[i] = toupper((*s)[i]);  // C-version defined in <ctype.h>
-  }
-}
-
-/// Allows the user to enter in REDIS commands into the command-line.
-/// This is useful for manual / interacticve testing / debugging.
-///  Use destructive=true to clean the database before use.
-///  Use destructive=false to remember the previous state (i.e.: persistent)
-/// Should be called from main function.
-int manual_redis_test(bool destructive){
-  RedisLists redis(RedisListsTest::kDefaultDbName,
-                   RedisListsTest::options,
-                   destructive);
-
-  // TODO: Right now, please use spaces to separate each word.
-  //  In actual redis, you can use quotes to specify compound values
-  //  Example: RPUSH mylist "this is a compound value"
-
-  std::string command;
-  while(true) {
-    std::cin >> command;
-    MakeUpper(&command);
-
-    if (command == "LINSERT") {
-      std::string k, t, p, v;
-      std::cin >> k >> t >> p >> v;
-      MakeUpper(&t);
-      if (t=="BEFORE") {
-        std::cout << redis.InsertBefore(k, p, v) << std::endl;
-      } else if (t=="AFTER") {
-        std::cout << redis.InsertAfter(k, p, v) << std::endl;
-      }
-    } else if (command == "LPUSH") {
-      std::string k, v;
-      std::cin >> k >> v;
-      redis.PushLeft(k, v);
-    } else if (command == "RPUSH") {
-      std::string k, v;
-      std::cin >> k >> v;
-      redis.PushRight(k, v);
-    } else if (command == "LPOP") {
-      std::string k;
-      std::cin >> k;
-      std::string res;
-      redis.PopLeft(k, &res);
-      std::cout << res << std::endl;
-    } else if (command == "RPOP") {
-      std::string k;
-      std::cin >> k;
-      std::string res;
-      redis.PopRight(k, &res);
-      std::cout << res << std::endl;
-    } else if (command == "LREM") {
-      std::string k;
-      int amt;
-      std::string v;
-
-      std::cin >> k >> amt >> v;
-      std::cout << redis.Remove(k, amt, v) << std::endl;
-    } else if (command == "LLEN") {
-      std::string k;
-      std::cin >> k;
-      std::cout << redis.Length(k) << std::endl;
-    } else if (command == "LRANGE") {
-      std::string k;
-      int i, j;
-      std::cin >> k >> i >> j;
-      std::vector<std::string> res = redis.Range(k, i, j);
-      for (auto it = res.begin(); it != res.end(); ++it) {
-        std::cout << " " << (*it);
-      }
-      std::cout << std::endl;
-    } else if (command == "LTRIM") {
-      std::string k;
-      int i, j;
-      std::cin >> k >> i >> j;
-      redis.Trim(k, i, j);
-    } else if (command == "LSET") {
-      std::string k;
-      int idx;
-      std::string v;
-      std::cin >> k >> idx >> v;
-      redis.Set(k, idx, v);
-    } else if (command == "LINDEX") {
-      std::string k;
-      int idx;
-      std::cin >> k >> idx;
-      std::string res;
-      redis.Index(k, idx, &res);
-      std::cout << res << std::endl;
-    } else if (command == "PRINT") {      // Added by Deon
-      std::string k;
-      std::cin >> k;
-      redis.Print(k);
-    } else if (command == "QUIT") {
-      return 0;
-    } else {
-      std::cout << "unknown command: " << command << std::endl;
-    }
-  }
-}
-}  // namespace
-
-} // namespace rocksdb
-
-
-// USAGE: "./redis_test" for default (unit tests)
-//        "./redis_test -m" for manual testing (redis command api)
-//        "./redis_test -m -d" for destructive manual test (erase db before use)
-
-
-namespace {
-// Check for "want" argument in the argument list
-bool found_arg(int argc, char* argv[], const char* want){
-  for(int i=1; i<argc; ++i){
-    if (strcmp(argv[i], want) == 0) {
-      return true;
-    }
-  }
-  return false;
-}
-}  // namespace
-
-// Will run unit tests.
-// However, if -m is specified, it will do user manual/interactive testing
-// -m -d is manual and destructive (will clear the database before use)
-int main(int argc, char* argv[]) {
-  ::testing::InitGoogleTest(&argc, argv);
-  if (found_arg(argc, argv, "-m")) {
-    bool destructive = found_arg(argc, argv, "-d");
-    return rocksdb::manual_redis_test(destructive);
-  } else {
-    return RUN_ALL_TESTS();
-  }
-}
-
-#else
-#include <stdio.h>
-
-int main(int argc, char* argv[]) {
-  fprintf(stderr, "SKIPPED as redis is not supported in ROCKSDB_LITE\n");
-  return 0;
-}
-
-#endif  // !ROCKSDB_LITE

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/d3a13a49/thirdparty/rocksdb/utilities/simulator_cache/sim_cache_test.cc
----------------------------------------------------------------------
diff --git a/thirdparty/rocksdb/utilities/simulator_cache/sim_cache_test.cc b/thirdparty/rocksdb/utilities/simulator_cache/sim_cache_test.cc
deleted file mode 100644
index 4c175c9..0000000
--- a/thirdparty/rocksdb/utilities/simulator_cache/sim_cache_test.cc
+++ /dev/null
@@ -1,218 +0,0 @@
-//  Copyright (c) 2011-present, Facebook, Inc.  All rights reserved.
-//  This source code is licensed under both the GPLv2 (found in the
-//  COPYING file in the root directory) and Apache 2.0 License
-//  (found in the LICENSE.Apache file in the root directory).
-
-#include "rocksdb/utilities/sim_cache.h"
-#include <cstdlib>
-#include "db/db_test_util.h"
-#include "port/stack_trace.h"
-
-namespace rocksdb {
-
-class SimCacheTest : public DBTestBase {
- private:
-  size_t miss_count_ = 0;
-  size_t hit_count_ = 0;
-  size_t insert_count_ = 0;
-  size_t failure_count_ = 0;
-
- public:
-  const size_t kNumBlocks = 5;
-  const size_t kValueSize = 1000;
-
-  SimCacheTest() : DBTestBase("/sim_cache_test") {}
-
-  BlockBasedTableOptions GetTableOptions() {
-    BlockBasedTableOptions table_options;
-    // Set a small enough block size so that each key-value get its own block.
-    table_options.block_size = 1;
-    return table_options;
-  }
-
-  Options GetOptions(const BlockBasedTableOptions& table_options) {
-    Options options = CurrentOptions();
-    options.create_if_missing = true;
-    // options.compression = kNoCompression;
-    options.statistics = rocksdb::CreateDBStatistics();
-    options.table_factory.reset(new BlockBasedTableFactory(table_options));
-    return options;
-  }
-
-  void InitTable(const Options& options) {
-    std::string value(kValueSize, 'a');
-    for (size_t i = 0; i < kNumBlocks * 2; i++) {
-      ASSERT_OK(Put(ToString(i), value.c_str()));
-    }
-  }
-
-  void RecordCacheCounters(const Options& options) {
-    miss_count_ = TestGetTickerCount(options, BLOCK_CACHE_MISS);
-    hit_count_ = TestGetTickerCount(options, BLOCK_CACHE_HIT);
-    insert_count_ = TestGetTickerCount(options, BLOCK_CACHE_ADD);
-    failure_count_ = TestGetTickerCount(options, BLOCK_CACHE_ADD_FAILURES);
-  }
-
-  void CheckCacheCounters(const Options& options, size_t expected_misses,
-                          size_t expected_hits, size_t expected_inserts,
-                          size_t expected_failures) {
-    size_t new_miss_count = TestGetTickerCount(options, BLOCK_CACHE_MISS);
-    size_t new_hit_count = TestGetTickerCount(options, BLOCK_CACHE_HIT);
-    size_t new_insert_count = TestGetTickerCount(options, BLOCK_CACHE_ADD);
-    size_t new_failure_count =
-        TestGetTickerCount(options, BLOCK_CACHE_ADD_FAILURES);
-    ASSERT_EQ(miss_count_ + expected_misses, new_miss_count);
-    ASSERT_EQ(hit_count_ + expected_hits, new_hit_count);
-    ASSERT_EQ(insert_count_ + expected_inserts, new_insert_count);
-    ASSERT_EQ(failure_count_ + expected_failures, new_failure_count);
-    miss_count_ = new_miss_count;
-    hit_count_ = new_hit_count;
-    insert_count_ = new_insert_count;
-    failure_count_ = new_failure_count;
-  }
-};
-
-TEST_F(SimCacheTest, SimCache) {
-  ReadOptions read_options;
-  auto table_options = GetTableOptions();
-  auto options = GetOptions(table_options);
-  InitTable(options);
-  std::shared_ptr<SimCache> simCache =
-      NewSimCache(NewLRUCache(0, 0, false), 20000, 0);
-  table_options.block_cache = simCache;
-  options.table_factory.reset(new BlockBasedTableFactory(table_options));
-  Reopen(options);
-  RecordCacheCounters(options);
-
-  std::vector<std::unique_ptr<Iterator>> iterators(kNumBlocks);
-  Iterator* iter = nullptr;
-
-  // Load blocks into cache.
-  for (size_t i = 0; i < kNumBlocks; i++) {
-    iter = db_->NewIterator(read_options);
-    iter->Seek(ToString(i));
-    ASSERT_OK(iter->status());
-    CheckCacheCounters(options, 1, 0, 1, 0);
-    iterators[i].reset(iter);
-  }
-  ASSERT_EQ(kNumBlocks,
-            simCache->get_hit_counter() + simCache->get_miss_counter());
-  ASSERT_EQ(0, simCache->get_hit_counter());
-  size_t usage = simCache->GetUsage();
-  ASSERT_LT(0, usage);
-  ASSERT_EQ(usage, simCache->GetSimUsage());
-  simCache->SetCapacity(usage);
-  ASSERT_EQ(usage, simCache->GetPinnedUsage());
-
-  // Test with strict capacity limit.
-  simCache->SetStrictCapacityLimit(true);
-  iter = db_->NewIterator(read_options);
-  iter->Seek(ToString(kNumBlocks * 2 - 1));
-  ASSERT_TRUE(iter->status().IsIncomplete());
-  CheckCacheCounters(options, 1, 0, 0, 1);
-  delete iter;
-  iter = nullptr;
-
-  // Release iterators and access cache again.
-  for (size_t i = 0; i < kNumBlocks; i++) {
-    iterators[i].reset();
-    CheckCacheCounters(options, 0, 0, 0, 0);
-  }
-  // Add kNumBlocks again
-  for (size_t i = 0; i < kNumBlocks; i++) {
-    std::unique_ptr<Iterator> it(db_->NewIterator(read_options));
-    it->Seek(ToString(i));
-    ASSERT_OK(it->status());
-    CheckCacheCounters(options, 0, 1, 0, 0);
-  }
-  ASSERT_EQ(5, simCache->get_hit_counter());
-  for (size_t i = kNumBlocks; i < kNumBlocks * 2; i++) {
-    std::unique_ptr<Iterator> it(db_->NewIterator(read_options));
-    it->Seek(ToString(i));
-    ASSERT_OK(it->status());
-    CheckCacheCounters(options, 1, 0, 1, 0);
-  }
-  ASSERT_EQ(0, simCache->GetPinnedUsage());
-  ASSERT_EQ(3 * kNumBlocks + 1,
-            simCache->get_hit_counter() + simCache->get_miss_counter());
-  ASSERT_EQ(6, simCache->get_hit_counter());
-}
-
-TEST_F(SimCacheTest, SimCacheLogging) {
-  auto table_options = GetTableOptions();
-  auto options = GetOptions(table_options);
-  options.disable_auto_compactions = true;
-  std::shared_ptr<SimCache> sim_cache =
-      NewSimCache(NewLRUCache(1024 * 1024), 20000, 0);
-  table_options.block_cache = sim_cache;
-  options.table_factory.reset(new BlockBasedTableFactory(table_options));
-  Reopen(options);
-
-  int num_block_entries = 20;
-  for (int i = 0; i < num_block_entries; i++) {
-    Put(Key(i), "val");
-    Flush();
-  }
-
-  std::string log_file = test::TmpDir(env_) + "/cache_log.txt";
-  ASSERT_OK(sim_cache->StartActivityLogging(log_file, env_));
-  for (int i = 0; i < num_block_entries; i++) {
-    ASSERT_EQ(Get(Key(i)), "val");
-  }
-  for (int i = 0; i < num_block_entries; i++) {
-    ASSERT_EQ(Get(Key(i)), "val");
-  }
-  sim_cache->StopActivityLogging();
-  ASSERT_OK(sim_cache->GetActivityLoggingStatus());
-
-  std::string file_contents = "";
-  ReadFileToString(env_, log_file, &file_contents);
-
-  int lookup_num = 0;
-  int add_num = 0;
-  std::string::size_type pos;
-
-  // count number of lookups
-  pos = 0;
-  while ((pos = file_contents.find("LOOKUP -", pos)) != std::string::npos) {
-    ++lookup_num;
-    pos += 1;
-  }
-
-  // count number of additions
-  pos = 0;
-  while ((pos = file_contents.find("ADD -", pos)) != std::string::npos) {
-    ++add_num;
-    pos += 1;
-  }
-
-  // We asked for every block twice
-  ASSERT_EQ(lookup_num, num_block_entries * 2);
-
-  // We added every block only once, since the cache can hold all blocks
-  ASSERT_EQ(add_num, num_block_entries);
-
-  // Log things again but stop logging automatically after reaching 512 bytes
-	int max_size = 512;
-  ASSERT_OK(sim_cache->StartActivityLogging(log_file, env_, max_size));
-  for (int it = 0; it < 10; it++) {
-    for (int i = 0; i < num_block_entries; i++) {
-      ASSERT_EQ(Get(Key(i)), "val");
-    }
-  }
-  ASSERT_OK(sim_cache->GetActivityLoggingStatus());
-
-  uint64_t fsize = 0;
-  ASSERT_OK(env_->GetFileSize(log_file, &fsize));
-	// error margin of 100 bytes
-  ASSERT_LT(fsize, max_size + 100);
-	ASSERT_GT(fsize, max_size - 100);
-}
-
-}  // namespace rocksdb
-
-int main(int argc, char** argv) {
-  rocksdb::port::InstallStackTraceHandler();
-  ::testing::InitGoogleTest(&argc, argv);
-  return RUN_ALL_TESTS();
-}

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/d3a13a49/thirdparty/rocksdb/utilities/spatialdb/spatial_db_test.cc
----------------------------------------------------------------------
diff --git a/thirdparty/rocksdb/utilities/spatialdb/spatial_db_test.cc b/thirdparty/rocksdb/utilities/spatialdb/spatial_db_test.cc
deleted file mode 100644
index 7e0d674..0000000
--- a/thirdparty/rocksdb/utilities/spatialdb/spatial_db_test.cc
+++ /dev/null
@@ -1,307 +0,0 @@
-//  Copyright (c) 2011-present, Facebook, Inc.  All rights reserved.
-//  This source code is licensed under both the GPLv2 (found in the
-//  COPYING file in the root directory) and Apache 2.0 License
-//  (found in the LICENSE.Apache file in the root directory).
-
-#ifndef ROCKSDB_LITE
-
-#include <vector>
-#include <string>
-#include <set>
-
-#include "rocksdb/utilities/spatial_db.h"
-#include "util/compression.h"
-#include "util/testharness.h"
-#include "util/testutil.h"
-#include "util/random.h"
-
-namespace rocksdb {
-namespace spatial {
-
-class SpatialDBTest : public testing::Test {
- public:
-  SpatialDBTest() {
-    dbname_ = test::TmpDir() + "/spatial_db_test";
-    DestroyDB(dbname_, Options());
-  }
-
-  void AssertCursorResults(BoundingBox<double> bbox, const std::string& index,
-                           const std::vector<std::string>& blobs) {
-    Cursor* c = db_->Query(ReadOptions(), bbox, index);
-    ASSERT_OK(c->status());
-    std::multiset<std::string> b;
-    for (auto x : blobs) {
-      b.insert(x);
-    }
-
-    while (c->Valid()) {
-      auto itr = b.find(c->blob().ToString());
-      ASSERT_TRUE(itr != b.end());
-      b.erase(itr);
-      c->Next();
-    }
-    ASSERT_EQ(b.size(), 0U);
-    ASSERT_OK(c->status());
-    delete c;
-  }
-
-  std::string dbname_;
-  SpatialDB* db_;
-};
-
-TEST_F(SpatialDBTest, FeatureSetSerializeTest) {
-  if (!LZ4_Supported()) {
-    return;
-  }
-  FeatureSet fs;
-
-  fs.Set("a", std::string("b"));
-  fs.Set("x", static_cast<uint64_t>(3));
-  fs.Set("y", false);
-  fs.Set("n", Variant());  // null
-  fs.Set("m", 3.25);
-
-  ASSERT_TRUE(fs.Find("w") == fs.end());
-  ASSERT_TRUE(fs.Find("x") != fs.end());
-  ASSERT_TRUE((*fs.Find("x")).second == Variant(static_cast<uint64_t>(3)));
-  ASSERT_TRUE((*fs.Find("y")).second != Variant(true));
-  std::set<std::string> keys({"a", "x", "y", "n", "m"});
-  for (const auto& x : fs) {
-    ASSERT_TRUE(keys.find(x.first) != keys.end());
-    keys.erase(x.first);
-  }
-  ASSERT_EQ(keys.size(), 0U);
-
-  std::string serialized;
-  fs.Serialize(&serialized);
-
-  FeatureSet deserialized;
-  ASSERT_TRUE(deserialized.Deserialize(serialized));
-
-  ASSERT_TRUE(deserialized.Contains("a"));
-  ASSERT_EQ(deserialized.Get("a").type(), Variant::kString);
-  ASSERT_EQ(deserialized.Get("a").get_string(), "b");
-  ASSERT_TRUE(deserialized.Contains("x"));
-  ASSERT_EQ(deserialized.Get("x").type(), Variant::kInt);
-  ASSERT_EQ(deserialized.Get("x").get_int(), static_cast<uint64_t>(3));
-  ASSERT_TRUE(deserialized.Contains("y"));
-  ASSERT_EQ(deserialized.Get("y").type(), Variant::kBool);
-  ASSERT_EQ(deserialized.Get("y").get_bool(), false);
-  ASSERT_TRUE(deserialized.Contains("n"));
-  ASSERT_EQ(deserialized.Get("n").type(), Variant::kNull);
-  ASSERT_TRUE(deserialized.Contains("m"));
-  ASSERT_EQ(deserialized.Get("m").type(), Variant::kDouble);
-  ASSERT_EQ(deserialized.Get("m").get_double(), 3.25);
-
-  // corrupted serialization
-  serialized = serialized.substr(0, serialized.size() - 4);
-  deserialized.Clear();
-  ASSERT_TRUE(!deserialized.Deserialize(serialized));
-}
-
-TEST_F(SpatialDBTest, TestNextID) {
-  if (!LZ4_Supported()) {
-    return;
-  }
-  ASSERT_OK(SpatialDB::Create(
-      SpatialDBOptions(), dbname_,
-      {SpatialIndexOptions("simple", BoundingBox<double>(0, 0, 100, 100), 2)}));
-
-  ASSERT_OK(SpatialDB::Open(SpatialDBOptions(), dbname_, &db_));
-  ASSERT_OK(db_->Insert(WriteOptions(), BoundingBox<double>(5, 5, 10, 10),
-                        "one", FeatureSet(), {"simple"}));
-  ASSERT_OK(db_->Insert(WriteOptions(), BoundingBox<double>(10, 10, 15, 15),
-                        "two", FeatureSet(), {"simple"}));
-  delete db_;
-  db_ = nullptr;
-
-  ASSERT_OK(SpatialDB::Open(SpatialDBOptions(), dbname_, &db_));
-  assert(db_ != nullptr);
-  ASSERT_OK(db_->Insert(WriteOptions(), BoundingBox<double>(55, 55, 65, 65),
-                        "three", FeatureSet(), {"simple"}));
-  delete db_;
-
-  ASSERT_OK(SpatialDB::Open(SpatialDBOptions(), dbname_, &db_));
-  AssertCursorResults(BoundingBox<double>(0, 0, 100, 100), "simple",
-                      {"one", "two", "three"});
-  delete db_;
-}
-
-TEST_F(SpatialDBTest, FeatureSetTest) {
-  if (!LZ4_Supported()) {
-    return;
-  }
-  ASSERT_OK(SpatialDB::Create(
-      SpatialDBOptions(), dbname_,
-      {SpatialIndexOptions("simple", BoundingBox<double>(0, 0, 100, 100), 2)}));
-  ASSERT_OK(SpatialDB::Open(SpatialDBOptions(), dbname_, &db_));
-
-  FeatureSet fs;
-  fs.Set("a", std::string("b"));
-  fs.Set("c", std::string("d"));
-
-  ASSERT_OK(db_->Insert(WriteOptions(), BoundingBox<double>(5, 5, 10, 10),
-                        "one", fs, {"simple"}));
-
-  Cursor* c =
-      db_->Query(ReadOptions(), BoundingBox<double>(5, 5, 10, 10), "simple");
-
-  ASSERT_TRUE(c->Valid());
-  ASSERT_EQ(c->blob().compare("one"), 0);
-  FeatureSet returned = c->feature_set();
-  ASSERT_TRUE(returned.Contains("a"));
-  ASSERT_TRUE(!returned.Contains("b"));
-  ASSERT_TRUE(returned.Contains("c"));
-  ASSERT_EQ(returned.Get("a").type(), Variant::kString);
-  ASSERT_EQ(returned.Get("a").get_string(), "b");
-  ASSERT_EQ(returned.Get("c").type(), Variant::kString);
-  ASSERT_EQ(returned.Get("c").get_string(), "d");
-
-  c->Next();
-  ASSERT_TRUE(!c->Valid());
-
-  delete c;
-  delete db_;
-}
-
-TEST_F(SpatialDBTest, SimpleTest) {
-  if (!LZ4_Supported()) {
-    return;
-  }
-  // iter 0 -- not read only
-  // iter 1 -- read only
-  for (int iter = 0; iter < 2; ++iter) {
-    DestroyDB(dbname_, Options());
-    ASSERT_OK(SpatialDB::Create(
-        SpatialDBOptions(), dbname_,
-        {SpatialIndexOptions("index", BoundingBox<double>(0, 0, 128, 128),
-                             3)}));
-    ASSERT_OK(SpatialDB::Open(SpatialDBOptions(), dbname_, &db_));
-    assert(db_ != nullptr);
-
-    ASSERT_OK(db_->Insert(WriteOptions(), BoundingBox<double>(33, 17, 63, 79),
-                          "one", FeatureSet(), {"index"}));
-    ASSERT_OK(db_->Insert(WriteOptions(), BoundingBox<double>(65, 65, 111, 111),
-                          "two", FeatureSet(), {"index"}));
-    ASSERT_OK(db_->Insert(WriteOptions(), BoundingBox<double>(1, 49, 127, 63),
-                          "three", FeatureSet(), {"index"}));
-    ASSERT_OK(db_->Insert(WriteOptions(), BoundingBox<double>(20, 100, 21, 101),
-                          "four", FeatureSet(), {"index"}));
-    ASSERT_OK(db_->Insert(WriteOptions(), BoundingBox<double>(81, 33, 127, 63),
-                          "five", FeatureSet(), {"index"}));
-    ASSERT_OK(db_->Insert(WriteOptions(), BoundingBox<double>(1, 65, 47, 95),
-                          "six", FeatureSet(), {"index"}));
-
-    if (iter == 1) {
-      delete db_;
-      db_ = nullptr;
-      ASSERT_OK(SpatialDB::Open(SpatialDBOptions(), dbname_, &db_, true));
-    }
-
-    AssertCursorResults(BoundingBox<double>(33, 17, 47, 31), "index", {"one"});
-    AssertCursorResults(BoundingBox<double>(17, 33, 79, 63), "index",
-                        {"one", "three"});
-    AssertCursorResults(BoundingBox<double>(17, 81, 63, 111), "index",
-                        {"four", "six"});
-    AssertCursorResults(BoundingBox<double>(85, 86, 85, 86), "index", {"two"});
-    AssertCursorResults(BoundingBox<double>(33, 1, 127, 111), "index",
-                        {"one", "two", "three", "five", "six"});
-    // even though the bounding box doesn't intersect, we got "four" back
-    // because
-    // it's in the same tile
-    AssertCursorResults(BoundingBox<double>(18, 98, 19, 99), "index", {"four"});
-    AssertCursorResults(BoundingBox<double>(130, 130, 131, 131), "index", {});
-    AssertCursorResults(BoundingBox<double>(81, 17, 127, 31), "index", {});
-    AssertCursorResults(BoundingBox<double>(90, 50, 91, 51), "index",
-                        {"three", "five"});
-
-    delete db_;
-    db_ = nullptr;
-  }
-}
-
-namespace {
-std::string RandomStr(Random* rnd) {
-  std::string r;
-  for (int k = 0; k < 10; ++k) {
-    r.push_back(rnd->Uniform(26) + 'a');
-  }
-  return r;
-}
-
-BoundingBox<int> RandomBoundingBox(int limit, Random* rnd, int max_size) {
-  BoundingBox<int> r;
-  r.min_x = rnd->Uniform(limit - 1);
-  r.min_y = rnd->Uniform(limit - 1);
-  r.max_x = r.min_x + rnd->Uniform(std::min(limit - 1 - r.min_x, max_size)) + 1;
-  r.max_y = r.min_y + rnd->Uniform(std::min(limit - 1 - r.min_y, max_size)) + 1;
-  return r;
-}
-
-BoundingBox<double> ScaleBB(BoundingBox<int> b, double step) {
-  return BoundingBox<double>(b.min_x * step + 1, b.min_y * step + 1,
-                             (b.max_x + 1) * step - 1,
-                             (b.max_y + 1) * step - 1);
-}
-
-}  // namespace
-
-TEST_F(SpatialDBTest, RandomizedTest) {
-  if (!LZ4_Supported()) {
-    return;
-  }
-  Random rnd(301);
-  std::vector<std::pair<std::string, BoundingBox<int>>> elements;
-
-  BoundingBox<double> spatial_index_bounds(0, 0, (1LL << 32), (1LL << 32));
-  ASSERT_OK(SpatialDB::Create(
-      SpatialDBOptions(), dbname_,
-      {SpatialIndexOptions("index", spatial_index_bounds, 7)}));
-  ASSERT_OK(SpatialDB::Open(SpatialDBOptions(), dbname_, &db_));
-  double step = (1LL << 32) / (1 << 7);
-
-  for (int i = 0; i < 1000; ++i) {
-    std::string blob = RandomStr(&rnd);
-    BoundingBox<int> bbox = RandomBoundingBox(128, &rnd, 10);
-    ASSERT_OK(db_->Insert(WriteOptions(), ScaleBB(bbox, step), blob,
-                          FeatureSet(), {"index"}));
-    elements.push_back(make_pair(blob, bbox));
-  }
-
-  // parallel
-  db_->Compact(2);
-  // serial
-  db_->Compact(1);
-
-  for (int i = 0; i < 1000; ++i) {
-    BoundingBox<int> int_bbox = RandomBoundingBox(128, &rnd, 10);
-    BoundingBox<double> double_bbox = ScaleBB(int_bbox, step);
-    std::vector<std::string> blobs;
-    for (auto e : elements) {
-      if (e.second.Intersects(int_bbox)) {
-        blobs.push_back(e.first);
-      }
-    }
-    AssertCursorResults(double_bbox, "index", blobs);
-  }
-
-  delete db_;
-}
-
-}  // namespace spatial
-}  // namespace rocksdb
-
-int main(int argc, char** argv) {
-  ::testing::InitGoogleTest(&argc, argv);
-  return RUN_ALL_TESTS();
-}
-
-#else
-#include <stdio.h>
-
-int main(int argc, char** argv) {
-  fprintf(stderr, "SKIPPED as SpatialDB is not supported in ROCKSDB_LITE\n");
-  return 0;
-}
-
-#endif  // !ROCKSDB_LITE

http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/d3a13a49/thirdparty/rocksdb/utilities/table_properties_collectors/compact_on_deletion_collector_test.cc
----------------------------------------------------------------------
diff --git a/thirdparty/rocksdb/utilities/table_properties_collectors/compact_on_deletion_collector_test.cc b/thirdparty/rocksdb/utilities/table_properties_collectors/compact_on_deletion_collector_test.cc
deleted file mode 100644
index 3c946bf..0000000
--- a/thirdparty/rocksdb/utilities/table_properties_collectors/compact_on_deletion_collector_test.cc
+++ /dev/null
@@ -1,178 +0,0 @@
-//  Copyright (c) 2011-present, Facebook, Inc.  All rights reserved.
-//  This source code is licensed under both the GPLv2 (found in the
-//  COPYING file in the root directory) and Apache 2.0 License
-//  (found in the LICENSE.Apache file in the root directory).
-//
-// Copyright (c) 2011 The LevelDB Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file. See the AUTHORS file for names of contributors.
-
-#include <stdio.h>
-
-#ifndef ROCKSDB_LITE
-#include <algorithm>
-#include <cmath>
-#include <vector>
-
-#include "rocksdb/table.h"
-#include "rocksdb/table_properties.h"
-#include "rocksdb/utilities/table_properties_collectors.h"
-#include "util/random.h"
-#include "utilities/table_properties_collectors/compact_on_deletion_collector.h"
-
-int main(int argc, char** argv) {
-  const int kWindowSizes[] =
-      {1000, 10000, 10000, 127, 128, 129, 255, 256, 257, 2, 10000};
-  const int kDeletionTriggers[] =
-      {500, 9500, 4323, 47, 61, 128, 250, 250, 250, 2, 2};
-  rocksdb::TablePropertiesCollectorFactory::Context context;
-  context.column_family_id =
-      rocksdb::TablePropertiesCollectorFactory::Context::kUnknownColumnFamily;
-
-  std::vector<int> window_sizes;
-  std::vector<int> deletion_triggers;
-  // deterministic tests
-  for (int test = 0; test < 9; ++test) {
-    window_sizes.emplace_back(kWindowSizes[test]);
-    deletion_triggers.emplace_back(kDeletionTriggers[test]);
-  }
-
-  // randomize tests
-  rocksdb::Random rnd(301);
-  const int kMaxTestSize = 100000l;
-  for (int random_test = 0; random_test < 100; random_test++) {
-    int window_size = rnd.Uniform(kMaxTestSize) + 1;
-    int deletion_trigger = rnd.Uniform(window_size);
-    window_sizes.emplace_back(window_size);
-    deletion_triggers.emplace_back(deletion_trigger);
-  }
-
-  assert(window_sizes.size() == deletion_triggers.size());
-
-  for (size_t test = 0; test < window_sizes.size(); ++test) {
-    const int kBucketSize = 128;
-    const int kWindowSize = window_sizes[test];
-    const int kPaddedWindowSize =
-        kBucketSize * ((window_sizes[test] + kBucketSize - 1) / kBucketSize);
-    const int kNumDeletionTrigger = deletion_triggers[test];
-    const int kBias = (kNumDeletionTrigger + kBucketSize - 1) / kBucketSize;
-    // Simple test
-    {
-      std::unique_ptr<rocksdb::TablePropertiesCollector> collector;
-      auto factory = rocksdb::NewCompactOnDeletionCollectorFactory(
-          kWindowSize, kNumDeletionTrigger);
-      collector.reset(factory->CreateTablePropertiesCollector(context));
-      const int kSample = 10;
-      for (int delete_rate = 0; delete_rate <= kSample; ++delete_rate) {
-        int deletions = 0;
-        for (int i = 0; i < kPaddedWindowSize; ++i) {
-          if (i % kSample < delete_rate) {
-            collector->AddUserKey("hello", "rocksdb",
-                                  rocksdb::kEntryDelete, 0, 0);
-            deletions++;
-          } else {
-            collector->AddUserKey("hello", "rocksdb",
-                                  rocksdb::kEntryPut, 0, 0);
-          }
-        }
-        if (collector->NeedCompact() !=
-            (deletions >= kNumDeletionTrigger) &&
-            std::abs(deletions - kNumDeletionTrigger) > kBias) {
-          fprintf(stderr, "[Error] collector->NeedCompact() != (%d >= %d)"
-                  " with kWindowSize = %d and kNumDeletionTrigger = %d\n",
-                  deletions, kNumDeletionTrigger,
-                  kWindowSize, kNumDeletionTrigger);
-          assert(false);
-        }
-        collector->Finish(nullptr);
-      }
-    }
-
-    // Only one section of a file satisfies the compaction trigger
-    {
-      std::unique_ptr<rocksdb::TablePropertiesCollector> collector;
-      auto factory = rocksdb::NewCompactOnDeletionCollectorFactory(
-          kWindowSize, kNumDeletionTrigger);
-      collector.reset(factory->CreateTablePropertiesCollector(context));
-      const int kSample = 10;
-      for (int delete_rate = 0; delete_rate <= kSample; ++delete_rate) {
-        int deletions = 0;
-        for (int section = 0; section < 5; ++section) {
-          int initial_entries = rnd.Uniform(kWindowSize) + kWindowSize;
-          for (int i = 0; i < initial_entries; ++i) {
-            collector->AddUserKey("hello", "rocksdb",
-                                  rocksdb::kEntryPut, 0, 0);
-          }
-        }
-        for (int i = 0; i < kPaddedWindowSize; ++i) {
-          if (i % kSample < delete_rate) {
-            collector->AddUserKey("hello", "rocksdb",
-                                  rocksdb::kEntryDelete, 0, 0);
-            deletions++;
-          } else {
-            collector->AddUserKey("hello", "rocksdb",
-                                  rocksdb::kEntryPut, 0, 0);
-          }
-        }
-        for (int section = 0; section < 5; ++section) {
-          int ending_entries = rnd.Uniform(kWindowSize) + kWindowSize;
-          for (int i = 0; i < ending_entries; ++i) {
-            collector->AddUserKey("hello", "rocksdb",
-                                  rocksdb::kEntryPut, 0, 0);
-          }
-        }
-        if (collector->NeedCompact() != (deletions >= kNumDeletionTrigger) &&
-            std::abs(deletions - kNumDeletionTrigger) > kBias) {
-          fprintf(stderr, "[Error] collector->NeedCompact() %d != (%d >= %d)"
-                  " with kWindowSize = %d, kNumDeletionTrigger = %d\n",
-                  collector->NeedCompact(),
-                  deletions, kNumDeletionTrigger, kWindowSize,
-                  kNumDeletionTrigger);
-          assert(false);
-        }
-        collector->Finish(nullptr);
-      }
-    }
-
-    // TEST 3:  Issues a lots of deletes, but their density is not
-    // high enough to trigger compaction.
-    {
-      std::unique_ptr<rocksdb::TablePropertiesCollector> collector;
-      auto factory = rocksdb::NewCompactOnDeletionCollectorFactory(
-          kWindowSize, kNumDeletionTrigger);
-      collector.reset(factory->CreateTablePropertiesCollector(context));
-      assert(collector->NeedCompact() == false);
-      // Insert "kNumDeletionTrigger * 0.95" deletions for every
-      // "kWindowSize" and verify compaction is not needed.
-      const int kDeletionsPerSection = kNumDeletionTrigger * 95 / 100;
-      if (kDeletionsPerSection >= 0) {
-        for (int section = 0; section < 200; ++section) {
-          for (int i = 0; i < kPaddedWindowSize; ++i) {
-            if (i < kDeletionsPerSection) {
-              collector->AddUserKey("hello", "rocksdb",
-                                    rocksdb::kEntryDelete, 0, 0);
-            } else {
-              collector->AddUserKey("hello", "rocksdb",
-                                    rocksdb::kEntryPut, 0, 0);
-            }
-          }
-        }
-        if (collector->NeedCompact() &&
-            std::abs(kDeletionsPerSection - kNumDeletionTrigger) > kBias) {
-          fprintf(stderr, "[Error] collector->NeedCompact() != false"
-                  " with kWindowSize = %d and kNumDeletionTrigger = %d\n",
-                  kWindowSize, kNumDeletionTrigger);
-          assert(false);
-        }
-        collector->Finish(nullptr);
-      }
-    }
-  }
-  fprintf(stderr, "PASSED\n");
-}
-#else
-int main(int argc, char** argv) {
-  fprintf(stderr, "SKIPPED as RocksDBLite does not include utilities.\n");
-  return 0;
-}
-#endif  // !ROCKSDB_LITE