├── .DS_Store ├── AUTHORS ├── CMakeLists.txt ├── CONTRIBUTING.md ├── COPYING ├── DEFAULT_OPTIONS_HISTORY.md ├── DUMP_FORMAT.md ├── INSTALL.md ├── LANGUAGE-BINDINGS.md ├── LICENSE.Apache ├── LICENSE.leveldb ├── Makefile ├── README.md ├── ROCKSDB_LITE.md ├── TARGETS ├── USERS.md ├── Vagrantfile ├── WINDOWS_PORT.md ├── appveyor.yml ├── arcanist_util └── INTERNAL_ONLY_DIR ├── buckifier ├── buckify_rocksdb.py ├── rocks_test_runner.sh ├── targets_builder.py ├── targets_cfg.py └── util.py ├── build_tools ├── amalgamate.py ├── build_detect_platform ├── cont_integration.sh ├── dependencies.sh ├── dependencies_4.8.1.sh ├── dockerbuild.sh ├── error_filter.py ├── fb_compile_mongo.sh ├── fbcode_config.sh ├── fbcode_config4.8.1.sh ├── format-diff.sh ├── gnu_parallel ├── make_package.sh ├── precommit_checker.py ├── regression_build_test.sh ├── rocksdb-lego-determinator ├── run_ci_db_test.ps1 ├── update_dependencies.sh └── version.sh ├── cache ├── cache_bench.cc ├── cache_test.cc ├── clock_cache.cc ├── clock_cache.h ├── lru_cache.cc ├── lru_cache.h ├── lru_cache_test.cc ├── sharded_cache.cc └── sharded_cache.h ├── coverage ├── coverage_test.sh └── parse_gcov_output.py ├── db ├── builder.cc ├── builder.h ├── c.cc ├── c_test.c ├── column_family.cc ├── column_family.h ├── column_family_test.cc ├── compact_files_test.cc ├── compacted_db_impl.cc ├── compacted_db_impl.h ├── compaction.cc ├── compaction.h ├── compaction_iteration_stats.h ├── compaction_iterator.cc ├── compaction_iterator.h ├── compaction_iterator_test.cc ├── compaction_job.cc ├── compaction_job.h ├── compaction_job_stats_test.cc ├── compaction_job_test.cc ├── compaction_picker.cc ├── compaction_picker.h ├── compaction_picker_test.cc ├── compaction_picker_universal.cc ├── compaction_picker_universal.h ├── comparator_db_test.cc ├── convenience.cc ├── corruption_test.cc ├── cuckoo_table_db_test.cc ├── db_basic_test.cc ├── db_block_cache_test.cc ├── db_bloom_filter_test.cc ├── db_compaction_filter_test.cc ├── db_compaction_test.cc ├── db_dynamic_level_test.cc ├── db_encryption_test.cc ├── db_filesnapshot.cc ├── db_flush_test.cc ├── db_impl.cc ├── db_impl.h ├── db_impl_compaction_flush.cc ├── db_impl_debug.cc ├── db_impl_experimental.cc ├── db_impl_files.cc ├── db_impl_open.cc ├── db_impl_readonly.cc ├── db_impl_readonly.h ├── db_impl_write.cc ├── db_info_dumper.cc ├── db_info_dumper.h ├── db_inplace_update_test.cc ├── db_io_failure_test.cc ├── db_iter.cc ├── db_iter.h ├── db_iter_test.cc ├── db_iterator_test.cc ├── db_log_iter_test.cc ├── db_memtable_test.cc ├── db_merge_operator_test.cc ├── db_options_test.cc ├── db_properties_test.cc ├── db_range_del_test.cc ├── db_sst_test.cc ├── db_statistics_test.cc ├── db_table_properties_test.cc ├── db_tailing_iter_test.cc ├── db_test.cc ├── db_test2.cc ├── db_test_util.cc ├── db_test_util.h ├── db_universal_compaction_test.cc ├── db_wal_test.cc ├── db_write_test.cc ├── dbformat.cc ├── dbformat.h ├── dbformat_test.cc ├── deletefile_test.cc ├── event_helpers.cc ├── event_helpers.h ├── experimental.cc ├── external_sst_file_basic_test.cc ├── external_sst_file_ingestion_job.cc ├── external_sst_file_ingestion_job.h ├── external_sst_file_test.cc ├── fault_injection_test.cc ├── file_indexer.cc ├── file_indexer.h ├── file_indexer_test.cc ├── filename_test.cc ├── flush_job.cc ├── flush_job.h ├── flush_job_test.cc ├── flush_scheduler.cc ├── flush_scheduler.h ├── forward_iterator.cc ├── forward_iterator.h ├── forward_iterator_bench.cc ├── internal_stats.cc ├── internal_stats.h ├── job_context.h ├── listener_test.cc ├── log_format.h ├── log_reader.cc ├── log_reader.h ├── log_test.cc ├── log_writer.cc ├── log_writer.h ├── malloc_stats.cc ├── malloc_stats.h ├── managed_iterator.cc ├── managed_iterator.h ├── manual_compaction_test.cc ├── memtable.cc ├── memtable.h ├── memtable_list.cc ├── memtable_list.h ├── memtable_list_test.cc ├── merge_context.h ├── merge_helper.cc ├── merge_helper.h ├── merge_helper_test.cc ├── merge_operator.cc ├── merge_test.cc ├── options_file_test.cc ├── perf_context_test.cc ├── pinned_iterators_manager.h ├── plain_table_db_test.cc ├── prefix_test.cc ├── range_del_aggregator.cc ├── range_del_aggregator.h ├── range_del_aggregator_test.cc ├── repair.cc ├── repair_test.cc ├── snapshot_impl.cc ├── snapshot_impl.h ├── table_cache.cc ├── table_cache.h ├── table_properties_collector.cc ├── table_properties_collector.h ├── table_properties_collector_test.cc ├── transaction_log_impl.cc ├── transaction_log_impl.h ├── version_builder.cc ├── version_builder.h ├── version_builder_test.cc ├── version_edit.cc ├── version_edit.h ├── version_edit_test.cc ├── version_set.cc ├── version_set.h ├── version_set_test.cc ├── wal_manager.cc ├── wal_manager.h ├── wal_manager_test.cc ├── write_batch.cc ├── write_batch_base.cc ├── write_batch_internal.h ├── write_batch_test.cc ├── write_callback.h ├── write_callback_test.cc ├── write_controller.cc ├── write_controller.h ├── write_controller_test.cc ├── write_thread.cc └── write_thread.h ├── docs ├── .gitignore ├── CNAME ├── CONTRIBUTING.md ├── Gemfile ├── Gemfile.lock ├── LICENSE-DOCUMENTATION ├── README.md ├── TEMPLATE-INFORMATION.md ├── _config.yml ├── _data │ ├── authors.yml │ ├── features.yml │ ├── nav.yml │ ├── nav_docs.yml │ ├── powered_by.yml │ ├── powered_by_highlight.yml │ └── promo.yml ├── _docs │ ├── faq.md │ └── getting-started.md ├── _includes │ ├── blog_pagination.html │ ├── content │ │ ├── gridblocks.html │ │ └── items │ │ │ └── gridblock.html │ ├── doc.html │ ├── doc_paging.html │ ├── footer.html │ ├── head.html │ ├── header.html │ ├── hero.html │ ├── home_header.html │ ├── katex_import.html │ ├── katex_render.html │ ├── nav.html │ ├── nav │ │ ├── collection_nav.html │ │ ├── collection_nav_group.html │ │ ├── collection_nav_group_item.html │ │ └── header_nav.html │ ├── nav_search.html │ ├── plugins │ │ ├── all_share.html │ │ ├── ascii_cinema.html │ │ ├── button.html │ │ ├── github_star.html │ │ ├── github_watch.html │ │ ├── google_share.html │ │ ├── iframe.html │ │ ├── like_button.html │ │ ├── plugin_row.html │ │ ├── post_social_plugins.html │ │ ├── slideshow.html │ │ ├── twitter_follow.html │ │ └── twitter_share.html │ ├── post.html │ ├── powered_by.html │ ├── social_plugins.html │ └── ui │ │ └── button.html ├── _layouts │ ├── basic.html │ ├── blog.html │ ├── blog_default.html │ ├── default.html │ ├── doc_default.html │ ├── doc_page.html │ ├── docs.html │ ├── home.html │ ├── page.html │ ├── plain.html │ ├── post.html │ ├── redirect.html │ └── top-level.html ├── _posts │ ├── 2014-03-27-how-to-backup-rocksdb.markdown │ ├── 2014-03-27-how-to-persist-in-memory-rocksdb-database.markdown │ ├── 2014-04-02-the-1st-rocksdb-local-meetup-held-on-march-27-2014.markdown │ ├── 2014-04-07-rocksdb-2-8-release.markdown │ ├── 2014-04-21-indexing-sst-files-for-better-lookup-performance.markdown │ ├── 2014-05-14-lock.markdown │ ├── 2014-05-19-rocksdb-3-0-release.markdown │ ├── 2014-05-22-rocksdb-3-1-release.markdown │ ├── 2014-06-23-plaintable-a-new-file-format.markdown │ ├── 2014-06-27-avoid-expensive-locks-in-get.markdown │ ├── 2014-06-27-rocksdb-3-2-release.markdown │ ├── 2014-07-29-rocksdb-3-3-release.markdown │ ├── 2014-09-12-cuckoo.markdown │ ├── 2014-09-12-new-bloom-filter-format.markdown │ ├── 2014-09-15-rocksdb-3-5-release.markdown │ ├── 2015-01-16-migrating-from-leveldb-to-rocksdb-2.markdown │ ├── 2015-02-24-reading-rocksdb-options-from-a-file.markdown │ ├── 2015-02-27-write-batch-with-index.markdown │ ├── 2015-04-22-integrating-rocksdb-with-mongodb-2.markdown │ ├── 2015-06-12-rocksdb-in-osquery.markdown │ ├── 2015-07-15-rocksdb-2015-h2-roadmap.markdown │ ├── 2015-07-17-spatial-indexing-in-rocksdb.markdown │ ├── 2015-07-22-rocksdb-is-now-available-in-windows-platform.markdown │ ├── 2015-07-23-dynamic-level.markdown │ ├── 2015-10-27-getthreadlist.markdown │ ├── 2015-11-10-use-checkpoints-for-efficient-snapshots.markdown │ ├── 2015-11-16-analysis-file-read-latency-by-level.markdown │ ├── 2016-01-29-compaction_pri.markdown │ ├── 2016-02-24-rocksdb-4-2-release.markdown │ ├── 2016-02-25-rocksdb-ama.markdown │ ├── 2016-03-07-rocksdb-options-file.markdown │ ├── 2016-04-26-rocksdb-4-5-1-released.markdown │ ├── 2016-07-26-rocksdb-4-8-released.markdown │ ├── 2016-09-28-rocksdb-4-11-2-released.markdown │ ├── 2017-01-06-rocksdb-5-0-1-released.markdown │ ├── 2017-02-07-rocksdb-5-1-2-released.markdown │ ├── 2017-02-17-bulkoad-ingest-sst-file.markdown │ ├── 2017-03-02-rocksdb-5-2-1-released.markdown │ ├── 2017-05-12-partitioned-index-filter.markdown │ ├── 2017-05-14-core-local-stats.markdown │ ├── 2017-05-26-rocksdb-5-4-5-released.markdown │ ├── 2017-06-26-17-level-based-changes.markdown │ ├── 2017-06-29-rocksdb-5-5-1-released.markdown │ └── 2017-07-25-rocksdb-5-6-1-released.markdown ├── _sass │ ├── _base.scss │ ├── _blog.scss │ ├── _buttons.scss │ ├── _footer.scss │ ├── _gridBlock.scss │ ├── _header.scss │ ├── _poweredby.scss │ ├── _promo.scss │ ├── _react_docs_nav.scss │ ├── _react_header_nav.scss │ ├── _reset.scss │ ├── _search.scss │ ├── _slideshow.scss │ ├── _syntax-highlighting.scss │ └── _tables.scss ├── _top-level │ └── support.md ├── blog │ ├── all.html │ └── index.html ├── css │ └── main.scss ├── doc-type-examples │ ├── 2016-04-07-blog-post-example.md │ ├── docs-hello-world.md │ └── top-level-example.md ├── docs │ └── index.html ├── feed.xml ├── index.md └── static │ ├── favicon.png │ ├── fonts │ ├── LatoLatin-Black.woff │ ├── LatoLatin-Black.woff2 │ ├── LatoLatin-BlackItalic.woff │ ├── LatoLatin-BlackItalic.woff2 │ ├── LatoLatin-Italic.woff │ ├── LatoLatin-Italic.woff2 │ ├── LatoLatin-Light.woff │ ├── LatoLatin-Light.woff2 │ ├── LatoLatin-Regular.woff │ └── LatoLatin-Regular.woff2 │ ├── images │ ├── Resize-of-20140327_200754-300x225.jpg │ ├── compaction │ │ ├── full-range.png │ │ ├── l0-l1-contend.png │ │ ├── l1-l2-contend.png │ │ └── part-range-old.png │ ├── pcache-blockindex.jpg │ ├── pcache-fileindex.jpg │ ├── pcache-filelayout.jpg │ ├── pcache-readiopath.jpg │ ├── pcache-tieredstorage.jpg │ ├── pcache-writeiopath.jpg │ ├── promo-adapt.svg │ ├── promo-flash.svg │ ├── promo-operations.svg │ ├── promo-performance.svg │ └── tree_example1.png │ ├── logo.svg │ └── og_image.png ├── env ├── env.cc ├── env_basic_test.cc ├── env_chroot.cc ├── env_chroot.h ├── env_encryption.cc ├── env_hdfs.cc ├── env_posix.cc ├── env_test.cc ├── io_posix.cc ├── io_posix.h ├── mock_env.cc ├── mock_env.h ├── mock_env_test.cc └── posix_logger.h ├── examples ├── .gitignore ├── Makefile ├── README.md ├── c_simple_example.c ├── column_families_example.cc ├── compact_files_example.cc ├── compaction_filter_example.cc ├── optimistic_transaction_example.cc ├── options_file_example.cc ├── rocksdb_option_file_example.ini ├── simple_example.cc └── transaction_example.cc ├── hdfs ├── README ├── env_hdfs.h └── setup.sh ├── include └── rocksdb │ ├── advanced_options.h │ ├── c.h │ ├── cache.h │ ├── cleanable.h │ ├── compaction_filter.h │ ├── compaction_job_stats.h │ ├── comparator.h │ ├── convenience.h │ ├── db.h │ ├── db_bench_tool.h │ ├── db_dump_tool.h │ ├── env.h │ ├── env_encryption.h │ ├── experimental.h │ ├── filter_policy.h │ ├── flush_block_policy.h │ ├── iostats_context.h │ ├── iterator.h │ ├── ldb_tool.h │ ├── listener.h │ ├── memtablerep.h │ ├── merge_operator.h │ ├── metadata.h │ ├── options.h │ ├── perf_context.h │ ├── perf_level.h │ ├── persistent_cache.h │ ├── rate_limiter.h │ ├── slice.h │ ├── slice_transform.h │ ├── snapshot.h │ ├── sst_dump_tool.h │ ├── sst_file_manager.h │ ├── sst_file_writer.h │ ├── statistics.h │ ├── status.h │ ├── table.h │ ├── table_properties.h │ ├── thread_status.h │ ├── threadpool.h │ ├── transaction_log.h │ ├── types.h │ ├── universal_compaction.h │ ├── utilities │ ├── backupable_db.h │ ├── checkpoint.h │ ├── convenience.h │ ├── date_tiered_db.h │ ├── db_ttl.h │ ├── debug.h │ ├── document_db.h │ ├── env_librados.h │ ├── env_mirror.h │ ├── geo_db.h │ ├── info_log_finder.h │ ├── json_document.h │ ├── ldb_cmd.h │ ├── ldb_cmd_execute_result.h │ ├── leveldb_options.h │ ├── lua │ │ ├── rocks_lua_compaction_filter.h │ │ ├── rocks_lua_custom_library.h │ │ └── rocks_lua_util.h │ ├── memory_util.h │ ├── object_registry.h │ ├── optimistic_transaction_db.h │ ├── option_change_migration.h │ ├── options_util.h │ ├── sim_cache.h │ ├── spatial_db.h │ ├── stackable_db.h │ ├── table_properties_collectors.h │ ├── transaction.h │ ├── transaction_db.h │ ├── transaction_db_mutex.h │ ├── utility_db.h │ └── write_batch_with_index.h │ ├── version.h │ ├── wal_filter.h │ ├── write_batch.h │ ├── write_batch_base.h │ └── write_buffer_manager.h ├── java ├── CMakeLists.txt ├── HISTORY-JAVA.md ├── Makefile ├── RELEASE.md ├── benchmark │ └── src │ │ └── main │ │ └── java │ │ └── org │ │ └── rocksdb │ │ └── benchmark │ │ └── DbBenchmark.java ├── crossbuild │ ├── Vagrantfile │ ├── build-linux-centos.sh │ ├── build-linux.sh │ └── docker-build-linux-centos.sh ├── jdb_bench.sh ├── rocksjni.pom ├── rocksjni │ ├── backupablejni.cc │ ├── backupenginejni.cc │ ├── cassandra_compactionfilterjni.cc │ ├── cassandra_value_operator.cc │ ├── checkpoint.cc │ ├── clock_cache.cc │ ├── columnfamilyhandle.cc │ ├── compaction_filter.cc │ ├── compaction_options_fifo.cc │ ├── compaction_options_universal.cc │ ├── comparator.cc │ ├── comparatorjnicallback.cc │ ├── comparatorjnicallback.h │ ├── compression_options.cc │ ├── env.cc │ ├── env_options.cc │ ├── filter.cc │ ├── ingest_external_file_options.cc │ ├── iterator.cc │ ├── loggerjnicallback.cc │ ├── loggerjnicallback.h │ ├── lru_cache.cc │ ├── memtablejni.cc │ ├── merge_operator.cc │ ├── options.cc │ ├── portal.h │ ├── ratelimiterjni.cc │ ├── remove_emptyvalue_compactionfilterjni.cc │ ├── restorejni.cc │ ├── rocksdb_exception_test.cc │ ├── rocksjni.cc │ ├── slice.cc │ ├── snapshot.cc │ ├── sst_file_writerjni.cc │ ├── statistics.cc │ ├── statisticsjni.cc │ ├── statisticsjni.h │ ├── table.cc │ ├── transaction_log.cc │ ├── ttl.cc │ ├── write_batch.cc │ ├── write_batch_test.cc │ ├── write_batch_with_index.cc │ ├── writebatchhandlerjnicallback.cc │ └── writebatchhandlerjnicallback.h ├── samples │ └── src │ │ └── main │ │ └── java │ │ ├── RocksDBColumnFamilySample.java │ │ └── RocksDBSample.java └── src │ ├── main │ └── java │ │ └── org │ │ └── rocksdb │ │ ├── AbstractCompactionFilter.java │ │ ├── AbstractComparator.java │ │ ├── AbstractImmutableNativeReference.java │ │ ├── AbstractNativeReference.java │ │ ├── AbstractRocksIterator.java │ │ ├── AbstractSlice.java │ │ ├── AbstractWriteBatch.java │ │ ├── AccessHint.java │ │ ├── AdvancedColumnFamilyOptionsInterface.java │ │ ├── AdvancedMutableColumnFamilyOptionsInterface.java │ │ ├── BackupEngine.java │ │ ├── BackupInfo.java │ │ ├── BackupableDBOptions.java │ │ ├── BlockBasedTableConfig.java │ │ ├── BloomFilter.java │ │ ├── BuiltinComparator.java │ │ ├── Cache.java │ │ ├── CassandraCompactionFilter.java │ │ ├── CassandraValueMergeOperator.java │ │ ├── Checkpoint.java │ │ ├── ChecksumType.java │ │ ├── ClockCache.java │ │ ├── ColumnFamilyDescriptor.java │ │ ├── ColumnFamilyHandle.java │ │ ├── ColumnFamilyOptions.java │ │ ├── ColumnFamilyOptionsInterface.java │ │ ├── CompactionOptionsFIFO.java │ │ ├── CompactionOptionsUniversal.java │ │ ├── CompactionPriority.java │ │ ├── CompactionStopStyle.java │ │ ├── CompactionStyle.java │ │ ├── Comparator.java │ │ ├── ComparatorOptions.java │ │ ├── CompressionOptions.java │ │ ├── CompressionType.java │ │ ├── DBOptions.java │ │ ├── DBOptionsInterface.java │ │ ├── DbPath.java │ │ ├── DirectComparator.java │ │ ├── DirectSlice.java │ │ ├── EncodingType.java │ │ ├── Env.java │ │ ├── EnvOptions.java │ │ ├── Experimental.java │ │ ├── Filter.java │ │ ├── FlushOptions.java │ │ ├── HashLinkedListMemTableConfig.java │ │ ├── HashSkipListMemTableConfig.java │ │ ├── HistogramData.java │ │ ├── HistogramType.java │ │ ├── IndexType.java │ │ ├── InfoLogLevel.java │ │ ├── IngestExternalFileOptions.java │ │ ├── LRUCache.java │ │ ├── Logger.java │ │ ├── MemTableConfig.java │ │ ├── MergeOperator.java │ │ ├── MutableColumnFamilyOptions.java │ │ ├── MutableColumnFamilyOptionsInterface.java │ │ ├── NativeLibraryLoader.java │ │ ├── Options.java │ │ ├── PlainTableConfig.java │ │ ├── RateLimiter.java │ │ ├── ReadOptions.java │ │ ├── ReadTier.java │ │ ├── RemoveEmptyValueCompactionFilter.java │ │ ├── RestoreOptions.java │ │ ├── RocksDB.java │ │ ├── RocksDBException.java │ │ ├── RocksEnv.java │ │ ├── RocksIterator.java │ │ ├── RocksIteratorInterface.java │ │ ├── RocksMemEnv.java │ │ ├── RocksMutableObject.java │ │ ├── RocksObject.java │ │ ├── SkipListMemTableConfig.java │ │ ├── Slice.java │ │ ├── Snapshot.java │ │ ├── SstFileWriter.java │ │ ├── Statistics.java │ │ ├── StatisticsCollector.java │ │ ├── StatisticsCollectorCallback.java │ │ ├── StatsCollectorInput.java │ │ ├── StatsLevel.java │ │ ├── Status.java │ │ ├── StringAppendOperator.java │ │ ├── TableFormatConfig.java │ │ ├── TickerType.java │ │ ├── TransactionLogIterator.java │ │ ├── TtlDB.java │ │ ├── VectorMemTableConfig.java │ │ ├── WALRecoveryMode.java │ │ ├── WBWIRocksIterator.java │ │ ├── WriteBatch.java │ │ ├── WriteBatchInterface.java │ │ ├── WriteBatchWithIndex.java │ │ ├── WriteOptions.java │ │ └── util │ │ ├── BytewiseComparator.java │ │ ├── DirectBytewiseComparator.java │ │ ├── Environment.java │ │ ├── ReverseBytewiseComparator.java │ │ └── SizeUnit.java │ └── test │ └── java │ └── org │ └── rocksdb │ ├── AbstractComparatorTest.java │ ├── BackupEngineTest.java │ ├── BackupableDBOptionsTest.java │ ├── BlockBasedTableConfigTest.java │ ├── CheckPointTest.java │ ├── ClockCacheTest.java │ ├── ColumnFamilyOptionsTest.java │ ├── ColumnFamilyTest.java │ ├── CompactionOptionsFIFOTest.java │ ├── CompactionOptionsUniversalTest.java │ ├── CompactionPriorityTest.java │ ├── CompactionStopStyleTest.java │ ├── ComparatorOptionsTest.java │ ├── ComparatorTest.java │ ├── CompressionOptionsTest.java │ ├── CompressionTypesTest.java │ ├── DBOptionsTest.java │ ├── DirectComparatorTest.java │ ├── DirectSliceTest.java │ ├── EnvOptionsTest.java │ ├── FilterTest.java │ ├── FlushTest.java │ ├── InfoLogLevelTest.java │ ├── IngestExternalFileOptionsTest.java │ ├── KeyMayExistTest.java │ ├── LRUCacheTest.java │ ├── LoggerTest.java │ ├── MemTableTest.java │ ├── MergeTest.java │ ├── MixedOptionsTest.java │ ├── MutableColumnFamilyOptionsTest.java │ ├── NativeLibraryLoaderTest.java │ ├── OptionsTest.java │ ├── PlainTableConfigTest.java │ ├── PlatformRandomHelper.java │ ├── RateLimiterTest.java │ ├── ReadOnlyTest.java │ ├── ReadOptionsTest.java │ ├── RocksDBExceptionTest.java │ ├── RocksDBTest.java │ ├── RocksEnvTest.java │ ├── RocksIteratorTest.java │ ├── RocksMemEnvTest.java │ ├── RocksMemoryResource.java │ ├── SliceTest.java │ ├── SnapshotTest.java │ ├── SstFileWriterTest.java │ ├── StatisticsCollectorTest.java │ ├── StatisticsTest.java │ ├── StatsCallbackMock.java │ ├── TransactionLogIteratorTest.java │ ├── TtlDBTest.java │ ├── Types.java │ ├── WALRecoveryModeTest.java │ ├── WriteBatchHandlerTest.java │ ├── WriteBatchTest.java │ ├── WriteBatchThreadedTest.java │ ├── WriteBatchWithIndexTest.java │ ├── WriteOptionsTest.java │ ├── test │ └── RocksJunitRunner.java │ └── util │ ├── BytewiseComparatorTest.java │ ├── EnvironmentTest.java │ └── SizeUnitTest.java ├── memtable ├── alloc_tracker.cc ├── hash_cuckoo_rep.cc ├── hash_cuckoo_rep.h ├── hash_linklist_rep.cc ├── hash_linklist_rep.h ├── hash_skiplist_rep.cc ├── hash_skiplist_rep.h ├── inlineskiplist.h ├── inlineskiplist_test.cc ├── memtablerep_bench.cc ├── skiplist.h ├── skiplist_test.cc ├── skiplistrep.cc ├── stl_wrappers.h ├── vectorrep.cc ├── write_buffer_manager.cc └── write_buffer_manager_test.cc ├── monitoring ├── file_read_sample.h ├── histogram.cc ├── histogram.h ├── histogram_test.cc ├── histogram_windowing.cc ├── histogram_windowing.h ├── instrumented_mutex.cc ├── instrumented_mutex.h ├── iostats_context.cc ├── iostats_context_imp.h ├── iostats_context_test.cc ├── perf_context.cc ├── perf_context_imp.h ├── perf_level.cc ├── perf_level_imp.h ├── perf_step_timer.h ├── statistics.cc ├── statistics.h ├── statistics_test.cc ├── thread_status_impl.cc ├── thread_status_updater.cc ├── thread_status_updater.h ├── thread_status_updater_debug.cc ├── thread_status_util.cc ├── thread_status_util.h └── thread_status_util_debug.cc ├── options ├── cf_options.cc ├── cf_options.h ├── db_options.cc ├── db_options.h ├── options.cc ├── options_helper.cc ├── options_helper.h ├── options_parser.cc ├── options_parser.h ├── options_sanity_check.cc ├── options_sanity_check.h ├── options_settable_test.cc └── options_test.cc ├── port ├── README ├── dirent.h ├── likely.h ├── port.h ├── port_example.h ├── port_posix.cc ├── port_posix.h ├── stack_trace.cc ├── stack_trace.h ├── sys_time.h ├── util_logger.h ├── win │ ├── env_default.cc │ ├── env_win.cc │ ├── env_win.h │ ├── io_win.cc │ ├── io_win.h │ ├── port_win.cc │ ├── port_win.h │ ├── win_logger.cc │ ├── win_logger.h │ ├── win_thread.cc │ ├── win_thread.h │ ├── xpress_win.cc │ └── xpress_win.h └── xpress.h ├── src.mk ├── table ├── adaptive_table_factory.cc ├── adaptive_table_factory.h ├── block.cc ├── block.h ├── block_based_filter_block.cc ├── block_based_filter_block.h ├── block_based_filter_block_test.cc ├── block_based_table_builder.cc ├── block_based_table_builder.h ├── block_based_table_factory.cc ├── block_based_table_factory.h ├── block_based_table_reader.cc ├── block_based_table_reader.h ├── block_builder.cc ├── block_builder.h ├── block_prefix_index.cc ├── block_prefix_index.h ├── block_test.cc ├── bloom_block.cc ├── bloom_block.h ├── cleanable_test.cc ├── cuckoo_table_builder.cc ├── cuckoo_table_builder.h ├── cuckoo_table_builder_test.cc ├── cuckoo_table_factory.cc ├── cuckoo_table_factory.h ├── cuckoo_table_reader.cc ├── cuckoo_table_reader.h ├── cuckoo_table_reader_test.cc ├── filter_block.h ├── flush_block_policy.cc ├── format.cc ├── format.h ├── full_filter_bits_builder.h ├── full_filter_block.cc ├── full_filter_block.h ├── full_filter_block_test.cc ├── get_context.cc ├── get_context.h ├── index_builder.cc ├── index_builder.h ├── internal_iterator.h ├── iter_heap.h ├── iterator.cc ├── iterator_wrapper.h ├── merger_test.cc ├── merging_iterator.cc ├── merging_iterator.h ├── meta_blocks.cc ├── meta_blocks.h ├── mock_table.cc ├── mock_table.h ├── partitioned_filter_block.cc ├── partitioned_filter_block.h ├── partitioned_filter_block_test.cc ├── persistent_cache_helper.cc ├── persistent_cache_helper.h ├── persistent_cache_options.h ├── plain_table_builder.cc ├── plain_table_builder.h ├── plain_table_factory.cc ├── plain_table_factory.h ├── plain_table_index.cc ├── plain_table_index.h ├── plain_table_key_coding.cc ├── plain_table_key_coding.h ├── plain_table_reader.cc ├── plain_table_reader.h ├── scoped_arena_iterator.h ├── sst_file_writer.cc ├── sst_file_writer_collectors.h ├── table_builder.h ├── table_properties.cc ├── table_properties_internal.h ├── table_reader.h ├── table_reader_bench.cc ├── table_test.cc ├── two_level_iterator.cc └── two_level_iterator.h ├── third-party ├── fbson │ ├── COMMIT.md │ ├── FbsonDocument.h │ ├── FbsonJsonParser.h │ ├── FbsonStream.h │ ├── FbsonUtil.h │ └── FbsonWriter.h └── gtest-1.7.0 │ └── fused-src │ └── gtest │ ├── CMakeLists.txt │ ├── gtest-all.cc │ └── gtest.h ├── thirdparty.inc ├── tools ├── .db_bench_tool.cc.swp ├── CMakeLists.txt ├── Dockerfile ├── auto_sanity_test.sh ├── benchmark.sh ├── benchmark_leveldb.sh ├── blob_dump.cc ├── check_format_compatible.sh ├── db_bench.cc ├── db_bench_tool.cc ├── db_bench_tool_test.cc ├── db_crashtest.py ├── db_repl_stress.cc ├── db_sanity_test.cc ├── db_stress.cc ├── dbench_monitor ├── dump │ ├── db_dump_tool.cc │ ├── rocksdb_dump.cc │ └── rocksdb_undump.cc ├── generate_random_db.sh ├── ldb.cc ├── ldb_cmd.cc ├── ldb_cmd_impl.h ├── ldb_cmd_test.cc ├── ldb_test.py ├── ldb_tool.cc ├── pflag ├── rdb │ ├── .gitignore │ ├── API.md │ ├── README.md │ ├── binding.gyp │ ├── db_wrapper.cc │ ├── db_wrapper.h │ ├── rdb │ ├── rdb.cc │ └── unit_test.js ├── reduce_levels_test.cc ├── regression_test.sh ├── rocksdb_dump_test.sh ├── run_flash_bench.sh ├── run_leveldb.sh ├── sample-dump.dmp ├── sst_dump.cc ├── sst_dump_test.cc ├── sst_dump_tool.cc ├── sst_dump_tool_imp.h ├── verify_random_db.sh ├── write_stress.cc └── write_stress_runner.py ├── util ├── aligned_buffer.h ├── allocator.h ├── arena.cc ├── arena.h ├── arena_test.cc ├── auto_roll_logger.cc ├── auto_roll_logger.h ├── auto_roll_logger_test.cc ├── autovector.h ├── autovector_test.cc ├── bloom.cc ├── bloom_test.cc ├── build_version.cc ├── build_version.cc.in ├── build_version.h ├── channel.h ├── coding.cc ├── coding.h ├── coding_test.cc ├── compaction_job_stats_impl.cc ├── comparator.cc ├── compression.h ├── concurrent_arena.cc ├── concurrent_arena.h ├── core_local.h ├── crc32c.cc ├── crc32c.h ├── crc32c_test.cc ├── delete_scheduler.cc ├── delete_scheduler.h ├── delete_scheduler_test.cc ├── dynamic_bloom.cc ├── dynamic_bloom.h ├── dynamic_bloom_test.cc ├── event_logger.cc ├── event_logger.h ├── event_logger_test.cc ├── fault_injection_test_env.cc ├── fault_injection_test_env.h ├── file_reader_writer.cc ├── file_reader_writer.h ├── file_reader_writer_test.cc ├── file_util.cc ├── file_util.h ├── filelock_test.cc ├── filename.cc ├── filename.h ├── filter_policy.cc ├── hash.cc ├── hash.h ├── hash_map.h ├── hash_test.cc ├── heap.h ├── heap_test.cc ├── hyperloglog.cc ├── hyperloglog.h ├── kv_map.h ├── latest-generator.cc ├── latest-generator.h ├── log_buffer.cc ├── log_buffer.h ├── log_write_bench.cc ├── logging.h ├── memory_usage.h ├── mpsc.h ├── murmurhash.cc ├── murmurhash.h ├── mutexlock.h ├── random.cc ├── random.h ├── rate_limiter.cc ├── rate_limiter.h ├── rate_limiter_test.cc ├── slice.cc ├── slice_transform_test.cc ├── sst_file_manager_impl.cc ├── sst_file_manager_impl.h ├── status.cc ├── status_message.cc ├── stderr_logger.h ├── stop_watch.h ├── string_util.cc ├── string_util.h ├── sync_point.cc ├── sync_point.h ├── testharness.cc ├── testharness.h ├── testutil.cc ├── testutil.h ├── thread_list_test.cc ├── thread_local.cc ├── thread_local.h ├── thread_local_test.cc ├── thread_operation.h ├── threadpool_imp.cc ├── threadpool_imp.h ├── timer_queue.h ├── timer_queue_test.cc ├── transaction_test_util.cc ├── transaction_test_util.h ├── xxhash.cc ├── xxhash.h ├── zipf.cc └── zipf.h └── utilities ├── backupable ├── backupable_db.cc └── backupable_db_test.cc ├── blob_db ├── blob_db.cc ├── blob_db.h ├── blob_db_impl.cc ├── blob_db_impl.h ├── blob_db_options_impl.cc ├── blob_db_options_impl.h ├── blob_db_test.cc ├── blob_dump_tool.cc ├── blob_dump_tool.h ├── blob_file.cc ├── blob_log_format.cc ├── blob_log_format.h ├── blob_log_reader.cc ├── blob_log_reader.h ├── blob_log_writer.cc └── blob_log_writer.h ├── cassandra ├── cassandra_compaction_filter.cc ├── cassandra_compaction_filter.h ├── cassandra_format_test.cc ├── cassandra_functional_test.cc ├── cassandra_row_merge_test.cc ├── cassandra_serialize_test.cc ├── format.cc ├── format.h ├── merge_operator.cc ├── merge_operator.h ├── serialize.h ├── test_utils.cc └── test_utils.h ├── checkpoint ├── checkpoint_impl.cc ├── checkpoint_impl.h └── checkpoint_test.cc ├── col_buf_decoder.cc ├── col_buf_decoder.h ├── col_buf_encoder.cc ├── col_buf_encoder.h ├── column_aware_encoding_exp.cc ├── column_aware_encoding_test.cc ├── column_aware_encoding_util.cc ├── column_aware_encoding_util.h ├── compaction_filters ├── remove_emptyvalue_compactionfilter.cc └── remove_emptyvalue_compactionfilter.h ├── convenience └── info_log_finder.cc ├── date_tiered ├── date_tiered_db_impl.cc ├── date_tiered_db_impl.h └── date_tiered_test.cc ├── debug.cc ├── document ├── document_db.cc ├── document_db_test.cc ├── json_document.cc ├── json_document_builder.cc └── json_document_test.cc ├── env_librados.cc ├── env_librados.md ├── env_librados_test.cc ├── env_mirror.cc ├── env_mirror_test.cc ├── env_timed.cc ├── env_timed_test.cc ├── geodb ├── geodb_impl.cc ├── geodb_impl.h └── geodb_test.cc ├── leveldb_options └── leveldb_options.cc ├── lua ├── rocks_lua_compaction_filter.cc └── rocks_lua_test.cc ├── memory ├── memory_test.cc └── memory_util.cc ├── merge_operators.h ├── merge_operators ├── max.cc ├── put.cc ├── string_append │ ├── stringappend.cc │ ├── stringappend.h │ ├── stringappend2.cc │ ├── stringappend2.h │ └── stringappend_test.cc └── uint64add.cc ├── object_registry_test.cc ├── option_change_migration ├── option_change_migration.cc └── option_change_migration_test.cc ├── options ├── options_util.cc └── options_util_test.cc ├── persistent_cache ├── block_cache_tier.cc ├── block_cache_tier.h ├── block_cache_tier_file.cc ├── block_cache_tier_file.h ├── block_cache_tier_file_buffer.h ├── block_cache_tier_metadata.cc ├── block_cache_tier_metadata.h ├── hash_table.h ├── hash_table_bench.cc ├── hash_table_evictable.h ├── hash_table_test.cc ├── lrulist.h ├── persistent_cache_bench.cc ├── persistent_cache_test.cc ├── persistent_cache_test.h ├── persistent_cache_tier.cc ├── persistent_cache_tier.h ├── persistent_cache_util.h ├── volatile_tier_impl.cc └── volatile_tier_impl.h ├── redis ├── README ├── redis_list_exception.h ├── redis_list_iterator.h ├── redis_lists.cc ├── redis_lists.h └── redis_lists_test.cc ├── simulator_cache ├── sim_cache.cc └── sim_cache_test.cc ├── spatialdb ├── spatial_db.cc ├── spatial_db_test.cc └── utils.h ├── table_properties_collectors ├── compact_on_deletion_collector.cc ├── compact_on_deletion_collector.h └── compact_on_deletion_collector_test.cc ├── transactions ├── optimistic_transaction_db_impl.cc ├── optimistic_transaction_db_impl.h ├── optimistic_transaction_impl.cc ├── optimistic_transaction_impl.h ├── optimistic_transaction_test.cc ├── transaction_base.cc ├── transaction_base.h ├── transaction_db_impl.cc ├── transaction_db_impl.h ├── transaction_db_mutex_impl.cc ├── transaction_db_mutex_impl.h ├── transaction_impl.cc ├── transaction_impl.h ├── transaction_lock_mgr.cc ├── transaction_lock_mgr.h ├── transaction_test.cc ├── transaction_util.cc └── transaction_util.h ├── ttl ├── db_ttl_impl.cc ├── db_ttl_impl.h └── ttl_test.cc ├── util_merge_operators_test.cc └── write_batch_with_index ├── write_batch_with_index.cc ├── write_batch_with_index_internal.cc ├── write_batch_with_index_internal.h └── write_batch_with_index_test.cc /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theoanab/SILK-USENIXATC2019/35385f14b6d3948c75914c1571e92897280a483e/.DS_Store -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Facebook Inc. 2 | Facebook Engineering Team 3 | 4 | Google Inc. 5 | # Initial version authors: 6 | Jeffrey Dean 7 | Sanjay Ghemawat 8 | 9 | # Partial list of contributors: 10 | Kevin Regan 11 | Johan Bilien 12 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to RocksDB 2 | 3 | ## Contributor License Agreement ("CLA") 4 | 5 | In order to accept your pull request, we need you to submit a CLA. You 6 | only need to do this once, so if you've done this for another Facebook 7 | open source project, you're good to go. If you are submitting a pull 8 | request for the first time, just let us know that you have completed 9 | the CLA and we can cross-check with your GitHub username. 10 | 11 | Complete your CLA here: 12 | 13 | If you prefer to sign a paper copy, we can send you a PDF. Send us an 14 | e-mail or create a new github issue to request the CLA in PDF format. 15 | -------------------------------------------------------------------------------- /DUMP_FORMAT.md: -------------------------------------------------------------------------------- 1 | ## RocksDB dump format 2 | 3 | The version 1 RocksDB dump format is fairly simple: 4 | 5 | 1) The dump starts with the magic 8 byte identifier "ROCKDUMP" 6 | 7 | 2) The magic is followed by an 8 byte big-endian version which is 0x00000001. 8 | 9 | 3) Next are arbitrarily sized chunks of bytes prepended by 4 byte little endian number indicating how large each chunk is. 10 | 11 | 4) The first chunk is special and is a json string indicating some things about the creation of this dump. It contains the following keys: 12 | * database-path: The path of the database this dump was created from. 13 | * hostname: The hostname of the machine where the dump was created. 14 | * creation-time: Unix seconds since epoc when this dump was created. 15 | 16 | 5) Following the info dump the slices paired into are key/value pairs. 17 | -------------------------------------------------------------------------------- /LANGUAGE-BINDINGS.md: -------------------------------------------------------------------------------- 1 | This is the list of all known third-party language bindings for RocksDB. If something is missing, please open a pull request to add it. 2 | 3 | * Java - https://github.com/facebook/rocksdb/tree/master/java 4 | * Python - http://pyrocksdb.readthedocs.org/en/latest/ 5 | * Perl - https://metacpan.org/pod/RocksDB 6 | * Node.js - https://npmjs.org/package/rocksdb 7 | * Go - https://github.com/tecbot/gorocksdb 8 | * Ruby - http://rubygems.org/gems/rocksdb-ruby 9 | * Haskell - https://hackage.haskell.org/package/rocksdb-haskell 10 | * PHP - https://github.com/Photonios/rocksdb-php 11 | * C# - https://github.com/warrenfalk/rocksdb-sharp 12 | * Rust - https://github.com/spacejam/rust-rocksdb 13 | * D programming language - https://github.com/b1naryth1ef/rocksdb 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## SILK: Preventing Latency Spikes in Log-Structured Merge Key-Value Stores 2 | 3 | This is the SILK prototype for the USENIX ATC'19 submission. https://www.usenix.org/conference/atc19/presentation/balmau 4 | 5 | SILK is built as an extension of RocksDB https://rocksdb.org/ 6 | 7 | Useful files for running benchmarks: 8 | 9 | The benchmrks are run through the standard RocksDB db_bench https://github.com/facebook/rocksdb/wiki/Benchmarking-tools 10 | 11 | db_bench_tool.cc is the main db_bench file. Contains all the tests, including the YCSB benchmark and LongPeakTest, which fluctuates load peaks and valleys. 12 | 13 | Useful files for SILK implementation: 14 | compaction_picker.cc 15 | db.h 16 | db_impl.cc 17 | db_impl.h 18 | db_impl_compaction_flush.cc 19 | thread_status_impl.cc 20 | 21 | 22 | -------------------------------------------------------------------------------- /ROCKSDB_LITE.md: -------------------------------------------------------------------------------- 1 | # RocksDBLite 2 | 3 | RocksDBLite is a project focused on mobile use cases, which don't need a lot of fancy things we've built for server workloads and they are very sensitive to binary size. For that reason, we added a compile flag ROCKSDB_LITE that comments out a lot of the nonessential code and keeps the binary lean. 4 | 5 | Some examples of the features disabled by ROCKSDB_LITE: 6 | * compiled-in support for LDB tool 7 | * No backupable DB 8 | * No support for replication (which we provide in form of TrasactionalIterator) 9 | * No advanced monitoring tools 10 | * No special-purpose memtables that are highly optimized for specific use cases 11 | * No Transactions 12 | 13 | When adding a new big feature to RocksDB, please add ROCKSDB_LITE compile guard if: 14 | * Nobody from mobile really needs your feature, 15 | * Your feature is adding a lot of weight to the binary. 16 | 17 | Don't add ROCKSDB_LITE compile guard if: 18 | * It would introduce a lot of code complexity. Compile guards make code harder to read. It's a trade-off. 19 | * Your feature is not adding a lot of weight. 20 | 21 | If unsure, ask. :) 22 | -------------------------------------------------------------------------------- /Vagrantfile: -------------------------------------------------------------------------------- 1 | # Vagrant file 2 | Vagrant.configure("2") do |config| 3 | 4 | config.vm.provider "virtualbox" do |v| 5 | v.memory = 4096 6 | v.cpus = 2 7 | end 8 | 9 | config.vm.define "ubuntu14" do |box| 10 | box.vm.box = "ubuntu/trusty64" 11 | end 12 | 13 | config.vm.define "centos65" do |box| 14 | box.vm.box = "chef/centos-6.5" 15 | end 16 | 17 | config.vm.define "FreeBSD10" do |box| 18 | box.vm.guest = :freebsd 19 | box.vm.box = "robin/freebsd-10" 20 | # FreeBSD does not support 'mount_virtualbox_shared_folder', use NFS 21 | box.vm.synced_folder ".", "/vagrant", :nfs => true, id: "vagrant-root" 22 | box.vm.network "private_network", ip: "10.0.1.10" 23 | 24 | # build everything after creating VM, skip using --no-provision 25 | box.vm.provision "shell", inline: <<-SCRIPT 26 | pkg install -y gmake clang35 27 | export CXX=/usr/local/bin/clang++35 28 | cd /vagrant 29 | gmake clean 30 | gmake all OPT=-g 31 | SCRIPT 32 | end 33 | 34 | end 35 | -------------------------------------------------------------------------------- /WINDOWS_PORT.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theoanab/SILK-USENIXATC2019/35385f14b6d3948c75914c1571e92897280a483e/WINDOWS_PORT.md -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | version: 1.0.{build} 2 | image: Visual Studio 2015 3 | before_build: 4 | - md %APPVEYOR_BUILD_FOLDER%\build 5 | - cd %APPVEYOR_BUILD_FOLDER%\build 6 | - cmake -G "Visual Studio 14 2015 Win64" -DOPTDBG=1 -DXPRESS=1 .. 7 | - cd .. 8 | build: 9 | project: build\rocksdb.sln 10 | parallel: true 11 | verbosity: minimal 12 | test: 13 | test_script: 14 | - ps: build_tools\run_ci_db_test.ps1 -SuiteRun db_basic_test,db_test2,db_test,env_basic_test,env_test -Concurrency 8 15 | 16 | -------------------------------------------------------------------------------- /arcanist_util/INTERNAL_ONLY_DIR: -------------------------------------------------------------------------------- 1 | arcanist_util are only used internaly, If you want to change it please check 2 | /arcanist_util 3 | -------------------------------------------------------------------------------- /buckifier/rocks_test_runner.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Create a tmp directory for the test to use 3 | TEST_DIR=$(mktemp -d /dev/shm/fbcode_rocksdb_XXXXXXX) 4 | TEST_TMPDIR="$TEST_DIR" $@ && rm -rf "$TEST_DIR" 5 | -------------------------------------------------------------------------------- /build_tools/dockerbuild.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | docker run -v $PWD:/rocks -w /rocks buildpack-deps make 3 | -------------------------------------------------------------------------------- /build_tools/version.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | if [ "$#" = "0" ]; then 3 | echo "Usage: $0 major|minor|patch|full" 4 | exit 1 5 | fi 6 | 7 | if [ "$1" = "major" ]; then 8 | cat include/rocksdb/version.h | grep MAJOR | head -n1 | awk '{print $3}' 9 | fi 10 | if [ "$1" = "minor" ]; then 11 | cat include/rocksdb/version.h | grep MINOR | head -n1 | awk '{print $3}' 12 | fi 13 | if [ "$1" = "patch" ]; then 14 | cat include/rocksdb/version.h | grep PATCH | head -n1 | awk '{print $3}' 15 | fi 16 | if [ "$1" = "full" ]; then 17 | awk '/#define ROCKSDB/ { env[$2] = $3 } 18 | END { printf "%s.%s.%s\n", env["ROCKSDB_MAJOR"], 19 | env["ROCKSDB_MINOR"], 20 | env["ROCKSDB_PATCH"] }' \ 21 | include/rocksdb/version.h 22 | fi 23 | -------------------------------------------------------------------------------- /cache/clock_cache.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | // 6 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 7 | // Use of this source code is governed by a BSD-style license that can be 8 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 9 | 10 | #pragma once 11 | 12 | #include "rocksdb/cache.h" 13 | 14 | #if defined(TBB) && !defined(ROCKSDB_LITE) 15 | #define SUPPORT_CLOCK_CACHE 16 | #endif 17 | -------------------------------------------------------------------------------- /db/compaction_iteration_stats.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | 6 | #pragma once 7 | 8 | struct CompactionIterationStats { 9 | // Compaction statistics 10 | 11 | // Doesn't include records skipped because of 12 | // CompactionFilter::Decision::kRemoveAndSkipUntil. 13 | int64_t num_record_drop_user = 0; 14 | 15 | int64_t num_record_drop_hidden = 0; 16 | int64_t num_record_drop_obsolete = 0; 17 | int64_t num_record_drop_range_del = 0; 18 | int64_t num_range_del_drop_obsolete = 0; 19 | uint64_t total_filter_time = 0; 20 | 21 | // Input statistics 22 | // TODO(noetzli): The stats are incomplete. They are lacking everything 23 | // consumed by MergeHelper. 24 | uint64_t num_input_records = 0; 25 | uint64_t num_input_deletion_records = 0; 26 | uint64_t num_input_corrupt_records = 0; 27 | uint64_t total_input_raw_key_bytes = 0; 28 | uint64_t total_input_raw_value_bytes = 0; 29 | 30 | // Single-Delete diagnostics for exceptional situations 31 | uint64_t num_single_del_fallthru = 0; 32 | uint64_t num_single_del_mismatch = 0; 33 | }; 34 | -------------------------------------------------------------------------------- /db/convenience.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | // 6 | 7 | #ifndef ROCKSDB_LITE 8 | 9 | #include "rocksdb/convenience.h" 10 | 11 | #include "db/db_impl.h" 12 | 13 | namespace rocksdb { 14 | 15 | void CancelAllBackgroundWork(DB* db, bool wait) { 16 | (dynamic_cast(db->GetRootDB()))->CancelAllBackgroundWork(wait); 17 | } 18 | 19 | Status DeleteFilesInRange(DB* db, ColumnFamilyHandle* column_family, 20 | const Slice* begin, const Slice* end) { 21 | return (dynamic_cast(db->GetRootDB())) 22 | ->DeleteFilesInRange(column_family, begin, end); 23 | } 24 | 25 | } // namespace rocksdb 26 | 27 | #endif // ROCKSDB_LITE 28 | -------------------------------------------------------------------------------- /db/db_info_dumper.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | #pragma once 6 | 7 | #include 8 | 9 | #include "options/db_options.h" 10 | 11 | namespace rocksdb { 12 | void DumpDBFileSummary(const ImmutableDBOptions& options, 13 | const std::string& dbname); 14 | } // namespace rocksdb 15 | -------------------------------------------------------------------------------- /db/flush_scheduler.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | 6 | #pragma once 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | namespace rocksdb { 14 | 15 | class ColumnFamilyData; 16 | 17 | // Unless otherwise noted, all methods on FlushScheduler should be called 18 | // only with the DB mutex held or from a single-threaded recovery context. 19 | class FlushScheduler { 20 | public: 21 | FlushScheduler() : head_(nullptr) {} 22 | 23 | // May be called from multiple threads at once, but not concurrent with 24 | // any other method calls on this instance 25 | void ScheduleFlush(ColumnFamilyData* cfd); 26 | 27 | // Removes and returns Ref()-ed column family. Client needs to Unref(). 28 | // Filters column families that have been dropped. 29 | ColumnFamilyData* TakeNextColumnFamily(); 30 | 31 | bool Empty(); 32 | 33 | void Clear(); 34 | 35 | private: 36 | struct Node { 37 | ColumnFamilyData* column_family; 38 | Node* next; 39 | }; 40 | 41 | std::atomic head_; 42 | #ifndef NDEBUG 43 | std::mutex checking_mutex_; 44 | std::set checking_set_; 45 | #endif // NDEBUG 46 | }; 47 | 48 | } // namespace rocksdb 49 | -------------------------------------------------------------------------------- /db/malloc_stats.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | // 6 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 7 | // Use of this source code is governed by a BSD-style license that can be 8 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 9 | 10 | #pragma once 11 | 12 | #ifndef ROCKSDB_LITE 13 | 14 | #include 15 | 16 | namespace rocksdb { 17 | 18 | void DumpMallocStats(std::string*); 19 | 20 | } 21 | 22 | #endif // !ROCKSDB_LITE 23 | -------------------------------------------------------------------------------- /db/snapshot_impl.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | 6 | #include "rocksdb/snapshot.h" 7 | 8 | #include "rocksdb/db.h" 9 | 10 | namespace rocksdb { 11 | 12 | ManagedSnapshot::ManagedSnapshot(DB* db) : db_(db), 13 | snapshot_(db->GetSnapshot()) {} 14 | 15 | ManagedSnapshot::ManagedSnapshot(DB* db, const Snapshot* _snapshot) 16 | : db_(db), snapshot_(_snapshot) {} 17 | 18 | ManagedSnapshot::~ManagedSnapshot() { 19 | if (snapshot_) { 20 | db_->ReleaseSnapshot(snapshot_); 21 | } 22 | } 23 | 24 | const Snapshot* ManagedSnapshot::snapshot() { return snapshot_;} 25 | 26 | } // namespace rocksdb 27 | -------------------------------------------------------------------------------- /db/write_callback.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | 6 | #pragma once 7 | 8 | #include "rocksdb/status.h" 9 | 10 | namespace rocksdb { 11 | 12 | class DB; 13 | 14 | class WriteCallback { 15 | public: 16 | virtual ~WriteCallback() {} 17 | 18 | // Will be called while on the write thread before the write executes. If 19 | // this function returns a non-OK status, the write will be aborted and this 20 | // status will be returned to the caller of DB::Write(). 21 | virtual Status Callback(DB* db) = 0; 22 | 23 | // return true if writes with this callback can be batched with other writes 24 | virtual bool AllowWriteBatching() = 0; 25 | }; 26 | 27 | } // namespace rocksdb 28 | -------------------------------------------------------------------------------- /docs/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_STORE 2 | _site/ 3 | *.swo 4 | *.swp 5 | _site 6 | .sass-cache 7 | *.psd 8 | *~ 9 | 10 | -------------------------------------------------------------------------------- /docs/CNAME: -------------------------------------------------------------------------------- 1 | rocksdb.org -------------------------------------------------------------------------------- /docs/Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | gem 'github-pages', '~> 104' 3 | -------------------------------------------------------------------------------- /docs/_data/authors.yml: -------------------------------------------------------------------------------- 1 | icanadi: 2 | full_name: Igor Canadi 3 | fbid: 706165749 4 | 5 | xjin: 6 | full_name: Xing Jin 7 | fbid: 100000739847320 8 | 9 | leijin: 10 | full_name: Lei Jin 11 | fbid: 634570164 12 | 13 | yhciang: 14 | full_name: Yueh-Hsuan Chiang 15 | fbid: 1619020986 16 | 17 | radheshyam: 18 | full_name: Radheshyam Balasundaram 19 | fbid: 800837305 20 | 21 | zagfox: 22 | full_name: Feng Zhu 23 | fbid: 100006493823622 24 | 25 | lgalanis: 26 | full_name: Leonidas Galanis 27 | fbid: 8649950 28 | 29 | sdong: 30 | full_name: Siying Dong 31 | fbid: 9805119 32 | 33 | dmitrism: 34 | full_name: Dmitri Smirnov 35 | 36 | rven2: 37 | full_name: Venkatesh Radhakrishnan 38 | fbid: 100008352697325 39 | 40 | yiwu: 41 | full_name: Yi Wu 42 | fbid: 100000476362039 43 | 44 | maysamyabandeh: 45 | full_name: Maysam Yabandeh 46 | fbid: 100003482360101 47 | 48 | IslamAbdelRahman: 49 | full_name: Islam AbdelRahman 50 | fbid: 642759407 51 | 52 | ajkr: 53 | full_name: Andrew Kryczka 54 | fbid: 100010829806660 55 | 56 | sagar0: 57 | full_name: Sagar Vemuri 58 | fbid: 2419111 59 | 60 | lightmark: 61 | full_name: Aaron Gao 62 | fbid: 1351549072 63 | -------------------------------------------------------------------------------- /docs/_data/features.yml: -------------------------------------------------------------------------------- 1 | - title: High Performance 2 | text: | 3 | RocksDB uses a log structured database engine, written entirely in C++, for maximum performance. Keys and values are just arbitrarily-sized byte streams. 4 | image: images/promo-performance.svg 5 | 6 | - title: Optimized for Fast Storage 7 | text: | 8 | RocksDB is optimized for fast, low latency storage such as flash drives and high-speed disk drives. RocksDB exploits the full potential of high read/write rates offered by flash or RAM. 9 | image: images/promo-flash.svg 10 | 11 | - title: Adaptable 12 | text: | 13 | RocksDB is adaptable to different workloads. From database storage engines such as [MyRocks](https://github.com/facebook/mysql-5.6) to [application data caching](http://techblog.netflix.com/2016/05/application-data-caching-using-ssds.html) to embedded workloads, RocksDB can be used for a variety of data needs. 14 | image: images/promo-adapt.svg 15 | 16 | - title: Basic and Advanced Database Operations 17 | text: | 18 | RocksDB provides basic operations such as opening and closing a database, reading and writing to more advanced operations such as merging and compaction filters. 19 | image: images/promo-operations.svg 20 | -------------------------------------------------------------------------------- /docs/_data/nav.yml: -------------------------------------------------------------------------------- 1 | - title: Docs 2 | href: /docs/ 3 | category: docs 4 | 5 | - title: GitHub 6 | href: https://github.com/facebook/rocksdb/ 7 | category: external 8 | 9 | - title: API (C++) 10 | href: https://github.com/facebook/rocksdb/tree/master/include/rocksdb 11 | category: external 12 | 13 | - title: API (Java) 14 | href: https://github.com/facebook/rocksdb/tree/master/java/src/main/java/org/rocksdb 15 | category: external 16 | 17 | - title: Support 18 | href: /support.html 19 | category: support 20 | 21 | - title: Blog 22 | href: /blog/ 23 | category: blog 24 | 25 | - title: Facebook 26 | href: https://www.facebook.com/groups/rocksdb.dev/ 27 | category: external 28 | 29 | # Use external for external links not associated with the paths of the current site. 30 | # If a category is external, site urls, for example, are not prepended to the href, etc.. 31 | -------------------------------------------------------------------------------- /docs/_data/nav_docs.yml: -------------------------------------------------------------------------------- 1 | - title: Quick Start 2 | items: 3 | - id: getting-started 4 | -------------------------------------------------------------------------------- /docs/_data/powered_by.yml: -------------------------------------------------------------------------------- 1 | # Fill in later if desired 2 | -------------------------------------------------------------------------------- /docs/_data/powered_by_highlight.yml: -------------------------------------------------------------------------------- 1 | # Fill in later if desired 2 | -------------------------------------------------------------------------------- /docs/_data/promo.yml: -------------------------------------------------------------------------------- 1 | # This file determines the list of promotional elements added to the header of \ 2 | # your site's homepage. Full list of plugins are shown 3 | 4 | - type: button 5 | href: docs/getting-started.html 6 | text: Get Started 7 | -------------------------------------------------------------------------------- /docs/_includes/blog_pagination.html: -------------------------------------------------------------------------------- 1 | 2 | {% if paginator.total_pages > 1 %} 3 |
4 | 27 |
28 | {% endif %} 29 | -------------------------------------------------------------------------------- /docs/_includes/content/gridblocks.html: -------------------------------------------------------------------------------- 1 |
2 | {% for item in {{include.data_source}} %} 3 | {% include content/items/gridblock.html item=item layout=include.layout imagealign=include.imagealign align=include.align %} 4 | {% endfor %} 5 |
-------------------------------------------------------------------------------- /docs/_includes/content/items/gridblock.html: -------------------------------------------------------------------------------- 1 | {% if include.layout == "fourColumn" %} 2 | {% assign layout = "fourByGridBlock" %} 3 | {% else %} 4 | {% assign layout = "twoByGridBlock" %} 5 | {% endif %} 6 | 7 | {% if include.imagealign == "side" %} 8 | {% assign imagealign = "imageAlignSide" %} 9 | {% else %} 10 | {% if item.image %} 11 | {% assign imagealign = "imageAlignTop" %} 12 | {% else %} 13 | {% assign imagealign = "" %} 14 | {% endif %} 15 | {% endif %} 16 | 17 | {% if include.align == "right" %} 18 | {% assign align = "alignRight" %} 19 | {% elsif include.align == "center" %} 20 | {% assign align = "alignCenter" %} 21 | {% else %} 22 | {% assign align = "alignLeft" %} 23 | {% endif %} 24 | 25 |
26 | {% if item.image %} 27 |
28 | {{ item.title }} 29 |
30 | {% endif %} 31 |
32 |

{{ item.title }}

33 | {% if item.text %} 34 | {{ item.text | markdownify }} 35 | {% endif %} 36 |
37 |
38 | -------------------------------------------------------------------------------- /docs/_includes/doc.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |

{% if include.truncate %}{{ page.title }}{% else %}{{ page.title }}{% endif %}

4 |
5 | 6 |
7 | {% if include.truncate %} 8 | {% if page.content contains '' %} 9 | {{ page.content | split:'' | first }} 10 | 15 | {% else %} 16 | {{ page.content }} 17 | {% endif %} 18 | {% else %} 19 | {{ content }} 20 | 21 |

Edit on GitHub

22 | {% endif %} 23 |
24 | {% include doc_paging.html %} 25 |
26 | -------------------------------------------------------------------------------- /docs/_includes/doc_paging.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theoanab/SILK-USENIXATC2019/35385f14b6d3948c75914c1571e92897280a483e/docs/_includes/doc_paging.html -------------------------------------------------------------------------------- /docs/_includes/header.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | 5 |

{{ site.title }}

6 |

{{ site.tagline }}

7 | 8 |
9 |

{% if page.excerpt %}{{ page.excerpt | strip_html }}{% else %}{{ site.description }}{% endif %}

10 |
11 |
12 | {% for promo in site.data.promo %} 13 | {% include plugins/{{promo.type}}.html button_href=promo.href button_text=promo.text %} 14 |
15 | {% endfor %} 16 |
17 |
18 |
19 |
20 | -------------------------------------------------------------------------------- /docs/_includes/hero.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theoanab/SILK-USENIXATC2019/35385f14b6d3948c75914c1571e92897280a483e/docs/_includes/hero.html -------------------------------------------------------------------------------- /docs/_includes/home_header.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |

{{ site.tagline }}

6 |
7 |

{% if page.excerpt %}{{ page.excerpt | strip_html }}{% else %}{{ site.description }}{% endif %}

8 |
9 |
10 | {% for promo in site.data.promo %} 11 |
12 | {% include plugins/{{promo.type}}.html href=promo.href text=promo.text children=promo.children %} 13 |
14 | {% endfor %} 15 |
16 |
17 | 20 |
21 |
22 |
23 | -------------------------------------------------------------------------------- /docs/_includes/katex_import.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /docs/_includes/nav/collection_nav_group.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/_includes/nav/collection_nav_group_item.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /docs/_includes/nav/header_nav.html: -------------------------------------------------------------------------------- 1 |
2 | 5 | 17 |
18 | -------------------------------------------------------------------------------- /docs/_includes/nav_search.html: -------------------------------------------------------------------------------- 1 | 4 | 5 | -------------------------------------------------------------------------------- /docs/_includes/plugins/all_share.html: -------------------------------------------------------------------------------- 1 |
2 | {% include plugins/like_button.html %}{% include plugins/twitter_share.html %}{% include plugins/google_share.html %} 3 |
-------------------------------------------------------------------------------- /docs/_includes/plugins/ascii_cinema.html: -------------------------------------------------------------------------------- 1 |
2 | -------------------------------------------------------------------------------- /docs/_includes/plugins/button.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/_includes/plugins/github_star.html: -------------------------------------------------------------------------------- 1 |
2 | Star 3 |
4 | -------------------------------------------------------------------------------- /docs/_includes/plugins/github_watch.html: -------------------------------------------------------------------------------- 1 |
2 | Watch 3 |
4 | -------------------------------------------------------------------------------- /docs/_includes/plugins/google_share.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | 5 | 6 | -------------------------------------------------------------------------------- /docs/_includes/plugins/iframe.html: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 |
5 | {% include plugins/button.html href=include.href text=include.text %} 6 |
-------------------------------------------------------------------------------- /docs/_includes/plugins/like_button.html: -------------------------------------------------------------------------------- 1 |
2 | -------------------------------------------------------------------------------- /docs/_includes/plugins/plugin_row.html: -------------------------------------------------------------------------------- 1 |
2 | {% for child in include.children %} 3 | {% include plugins/{{child.type}}.html href=child.href text=child.text %} 4 | {% endfor %} 5 |
-------------------------------------------------------------------------------- /docs/_includes/plugins/post_social_plugins.html: -------------------------------------------------------------------------------- 1 |
2 | 8 |
15 |
16 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /docs/_includes/plugins/twitter_follow.html: -------------------------------------------------------------------------------- 1 | 4 | 5 | -------------------------------------------------------------------------------- /docs/_includes/plugins/twitter_share.html: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 | -------------------------------------------------------------------------------- /docs/_includes/post.html: -------------------------------------------------------------------------------- 1 |
2 | {% assign author = site.data.authors[page.author] %} 3 |
4 | {% if author.fbid %} 5 |
6 | {{ author.fullname }} 7 |
8 | {% endif %} 9 | {% if author.full_name %} 10 | 11 | {% endif %} 12 |

{% if include.truncate %}{{ page.title }}{% else %}{{ page.title }}{% endif %}

13 | 14 |
15 | 16 |
17 | {% if include.truncate %} 18 | {% if page.content contains '' %} 19 | {{ page.content | split:'' | first | markdownify }} 20 | 25 | {% else %} 26 | {{ page.content | markdownify }} 27 | {% endif %} 28 | {% else %} 29 | {{ content }} 30 | {% endif %} 31 | {% unless include.truncate %} 32 | {% include plugins/like_button.html %} 33 | {% endunless %} 34 |
35 |
36 | -------------------------------------------------------------------------------- /docs/_includes/powered_by.html: -------------------------------------------------------------------------------- 1 | {% if site.data.powered_by.first.items or site.data.powered_by_highlight.first.items %} 2 |
3 |
4 | {% if site.data.powered_by_highlight.first.title %} 5 |

{{ site.data.powered_by_highlight.first.title }}

6 | {% else %} 7 |

{{ site.data.powered_by.first.title }}

8 | {% endif %} 9 | {% if site.data.powered_by_highlight.first.items %} 10 |
11 | {% for item in site.data.powered_by_highlight.first.items %} 12 |
13 | {{ item.name }} 14 |
15 | {% endfor %} 16 |
17 | {% endif %} 18 |
19 | {% for item in site.data.powered_by.first.items %} 20 |
21 | {{ item.name }} 22 |
23 | {% endfor %} 24 |
25 |
Does your app use {{ site.title }}? Add it to this list with a pull request!
26 |
27 |
28 | {% endif %} 29 | -------------------------------------------------------------------------------- /docs/_includes/social_plugins.html: -------------------------------------------------------------------------------- 1 | 7 |
14 | 15 |
16 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /docs/_includes/ui/button.html: -------------------------------------------------------------------------------- 1 | {{ include.button_text }} -------------------------------------------------------------------------------- /docs/_layouts/basic.html: -------------------------------------------------------------------------------- 1 | --- 2 | layout: doc_default 3 | --- 4 | 5 |
6 |
7 |
8 | {{ content }} 9 |
10 |
11 |
12 | 13 | -------------------------------------------------------------------------------- /docs/_layouts/blog.html: -------------------------------------------------------------------------------- 1 | --- 2 | category: blog 3 | layout: blog_default 4 | --- 5 | 6 |
7 |
8 | {{ content }} 9 |
10 |
11 | 12 | -------------------------------------------------------------------------------- /docs/_layouts/blog_default.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | {% include head.html %} 4 | 5 | {% include nav.html alwayson=true %} 6 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /docs/_layouts/default.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | {% include head.html %} 4 | 5 | {% include nav.html alwayson=true %} 6 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /docs/_layouts/doc_default.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | {% include head.html %} 4 | 5 | {% include nav.html alwayson=true %} 6 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /docs/_layouts/doc_page.html: -------------------------------------------------------------------------------- 1 | --- 2 | layout: doc_default 3 | --- 4 | 5 |
6 |
7 | {{ content }} 8 |
9 |
10 | 11 | -------------------------------------------------------------------------------- /docs/_layouts/docs.html: -------------------------------------------------------------------------------- 1 | --- 2 | layout: doc_page 3 | --- 4 | 5 | {% include doc.html %} -------------------------------------------------------------------------------- /docs/_layouts/home.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | {% include head.html %} 4 | 5 | {% include nav.html alwayson=true %} 6 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /docs/_layouts/page.html: -------------------------------------------------------------------------------- 1 | --- 2 | layout: blog 3 | --- 4 | -------------------------------------------------------------------------------- /docs/_layouts/plain.html: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | --- 4 | 5 |
6 |
7 | {{ content }} 8 |
9 |
10 | 11 | -------------------------------------------------------------------------------- /docs/_layouts/post.html: -------------------------------------------------------------------------------- 1 | --- 2 | collection: blog 3 | layout: blog 4 | --- 5 | 6 |
7 | {% include post.html %} 8 |
-------------------------------------------------------------------------------- /docs/_layouts/redirect.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /docs/_layouts/top-level.html: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | --- 4 | 5 |
6 |
7 | {{ content }} 8 |
9 |
10 | 11 | -------------------------------------------------------------------------------- /docs/_posts/2014-05-19-rocksdb-3-0-release.markdown: -------------------------------------------------------------------------------- 1 | --- 2 | title: RocksDB 3.0 release 3 | layout: post 4 | author: icanadi 5 | category: blog 6 | redirect_from: 7 | - /blog/557/rocksdb-3-0-release/ 8 | --- 9 | 10 | Check out new RocksDB release on [Github](https://github.com/facebook/rocksdb/releases/tag/3.0.fb)! 11 | 12 | New features in RocksDB 3.0: 13 | 14 | * [Column Family support](https://github.com/facebook/rocksdb/wiki/Column-Families) 15 | 16 | 17 | * [Ability to chose different checksum function](https://github.com/facebook/rocksdb/commit/0afc8bc29a5800e3212388c327c750d32e31f3d6) 18 | 19 | 20 | * Deprecated ReadOptions::prefix_seek and ReadOptions::prefix 21 | 22 | 23 | 24 | Check out the full [change log](https://github.com/facebook/rocksdb/blob/3.0.fb/HISTORY.md). 25 | -------------------------------------------------------------------------------- /docs/_posts/2014-05-22-rocksdb-3-1-release.markdown: -------------------------------------------------------------------------------- 1 | --- 2 | title: RocksDB 3.1 release 3 | layout: post 4 | author: icanadi 5 | category: blog 6 | redirect_from: 7 | - /blog/575/rocksdb-3-1-release/ 8 | --- 9 | 10 | Check out the new release on [Github](https://github.com/facebook/rocksdb/releases/tag/rocksdb-3.1)! 11 | 12 | New features in RocksDB 3.1: 13 | 14 | * [Materialized hash index](https://github.com/facebook/rocksdb/commit/0b3d03d026a7248e438341264b4c6df339edc1d7) 15 | 16 | 17 | * [FIFO compaction style](https://github.com/facebook/rocksdb/wiki/FIFO-compaction-style) 18 | 19 | 20 | We released 3.1 so fast after 3.0 because one of our internal customers needed materialized hash index. 21 | -------------------------------------------------------------------------------- /docs/_posts/2014-06-27-rocksdb-3-2-release.markdown: -------------------------------------------------------------------------------- 1 | --- 2 | title: RocksDB 3.2 release 3 | layout: post 4 | author: leijin 5 | category: blog 6 | redirect_from: 7 | - /blog/647/rocksdb-3-2-release/ 8 | --- 9 | 10 | Check out new RocksDB release on [GitHub](https://github.com/facebook/rocksdb/releases/tag/rocksdb-3.2)! 11 | 12 | New Features in RocksDB 3.2: 13 | 14 | * PlainTable now supports a new key encoding: for keys of the same prefix, the prefix is only written once. It can be enabled through encoding_type paramter of NewPlainTableFactory() 15 | 16 | 17 | * Add AdaptiveTableFactory, which is used to convert from a DB of PlainTable to BlockBasedTabe, or vise versa. It can be created using NewAdaptiveTableFactory() 18 | 19 | 20 | 21 | Public API changes: 22 | 23 | 24 | * We removed seek compaction as a concept from RocksDB 25 | 26 | 27 | * Add two paramters to NewHashLinkListRepFactory() for logging on too many entries in a hash bucket when flushing 28 | 29 | 30 | * Added new option BlockBasedTableOptions::hash_index_allow_collision. When enabled, prefix hash index for block-based table will not store prefix and allow hash collision, reducing memory consumption 31 | -------------------------------------------------------------------------------- /docs/_posts/2015-04-22-integrating-rocksdb-with-mongodb-2.markdown: -------------------------------------------------------------------------------- 1 | --- 2 | title: Integrating RocksDB with MongoDB 3 | layout: post 4 | author: icanadi 5 | category: blog 6 | redirect_from: 7 | - /blog/1967/integrating-rocksdb-with-mongodb-2/ 8 | --- 9 | 10 | Over the last couple of years, we have been busy integrating RocksDB with various services here at Facebook that needed to store key-value pairs locally. We have also seen other companies using RocksDB as local storage components of their distributed systems. 11 | 12 | 13 | 14 | The next big challenge for us is to bring RocksDB storage engine to general purpose databases. Today we have an exciting milestone to share with our community! We're running MongoDB with RocksDB in production and seeing great results! You can read more about it here: [http://blog.parse.com/announcements/mongodb-rocksdb-parse/](http://blog.parse.com/announcements/mongodb-rocksdb-parse/) 15 | 16 | Keep tuned for benchmarks and more stability and performance improvements. 17 | -------------------------------------------------------------------------------- /docs/_posts/2015-06-12-rocksdb-in-osquery.markdown: -------------------------------------------------------------------------------- 1 | --- 2 | title: RocksDB in osquery 3 | layout: post 4 | author: icanadi 5 | category: lgalanis 6 | redirect_from: 7 | - /blog/1997/rocksdb-in-osquery/ 8 | --- 9 | 10 | Check out [this](https://code.facebook.com/posts/1411870269134471/how-rocksdb-is-used-in-osquery/) blog post by [Mike Arpaia](https://www.facebook.com/mike.arpaia) and [Ted Reed](https://www.facebook.com/treeded) about how osquery leverages RocksDB to build an embedded pub-sub system. This article is a great read and contains insights on how to properly use RocksDB. 11 | -------------------------------------------------------------------------------- /docs/_posts/2015-07-22-rocksdb-is-now-available-in-windows-platform.markdown: -------------------------------------------------------------------------------- 1 | --- 2 | title: RocksDB is now available in Windows Platform 3 | layout: post 4 | author: dmitrism 5 | category: blog 6 | redirect_from: 7 | - /blog/2033/rocksdb-is-now-available-in-windows-platform/ 8 | --- 9 | 10 | Over the past 6 months we have seen a number of use cases where RocksDB is successfully used by the community and various companies to achieve high throughput and volume in a modern server environment. 11 | 12 | We at Microsoft Bing could not be left behind. As a result we are happy to [announce](http://bit.ly/1OmWBT9) the availability of the Windows Port created here at Microsoft which we intend to use as a storage option for one of our key/value data stores. 13 | 14 | 15 | 16 | We are happy to make this available for the community. Keep tuned for more announcements to come. 17 | 18 | ### Comments 19 | 20 | **[Siying Dong](siying.d@fb.com)** 21 | 22 | Appreciate your contributions to RocksDB project! I believe it will benefits many users! 23 | 24 | **[empresas sevilla](oxofkx@gmail.com)** 25 | 26 | Magnifico artículo|, un placer leer el blog 27 | 28 | **[jak usunac](tomogedac@o2.pl)** 29 | 30 | I believe it will benefits too 31 | -------------------------------------------------------------------------------- /docs/_posts/2016-02-25-rocksdb-ama.markdown: -------------------------------------------------------------------------------- 1 | --- 2 | title: RocksDB AMA 3 | layout: post 4 | author: yhchiang 5 | category: blog 6 | redirect_from: 7 | - /blog/3065/rocksdb-ama/ 8 | --- 9 | 10 | RocksDB developers are doing a Reddit Ask-Me-Anything now at 10AM – 11AM PDT! We welcome you to stop by and ask any RocksDB related questions, including existing / upcoming features, tuning tips, or database design. 11 | 12 | Here are some enhancements that we'd like to focus on over the next six months: 13 | 14 | * 2-Phase Commit 15 | * Lua support in some custom functions 16 | * Backup and repair tools 17 | * Direct I/O to bypass OS cache 18 | * RocksDB Java API 19 | 20 | [https://www.reddit.com/r/IAmA/comments/47k1si/we_are_rocksdb_developers_ask_us_anything/](https://www.reddit.com/r/IAmA/comments/47k1si/we_are_rocksdb_developers_ask_us_anything/) 21 | -------------------------------------------------------------------------------- /docs/_posts/2016-03-07-rocksdb-options-file.markdown: -------------------------------------------------------------------------------- 1 | --- 2 | title: RocksDB Options File 3 | layout: post 4 | author: yhciang 5 | category: blog 6 | redirect_from: 7 | - /blog/3089/rocksdb-options-file/ 8 | --- 9 | 10 | In RocksDB 4.3, we added a new set of features that makes managing RocksDB options easier. Specifically: 11 | 12 | * **Persisting Options Automatically**: Each RocksDB database will now automatically persist its current set of options into an INI file on every successful call of DB::Open(), SetOptions(), and CreateColumnFamily() / DropColumnFamily(). 13 | 14 | 15 | 16 | * **Load Options from File**: We added [LoadLatestOptions() / LoadOptionsFromFile()](https://github.com/facebook/rocksdb/blob/4.3.fb/include/rocksdb/utilities/options_util.h#L48-L58) that enables developers to construct RocksDB options object from an options file. 17 | 18 | 19 | 20 | * **Sanity Check Options**: We added [CheckOptionsCompatibility](https://github.com/facebook/rocksdb/blob/4.3.fb/include/rocksdb/utilities/options_util.h#L64-L77) that performs compatibility check on two sets of RocksDB options. 21 | 22 | 23 | 24 | Want to know more about how to use this new features? Check out the [RocksDB Options File wiki page](https://github.com/facebook/rocksdb/wiki/RocksDB-Options-File) and start using this new feature today! 25 | -------------------------------------------------------------------------------- /docs/_posts/2017-02-07-rocksdb-5-1-2-released.markdown: -------------------------------------------------------------------------------- 1 | --- 2 | title: RocksDB 5.1.2 Released! 3 | layout: post 4 | author: maysamyabandeh 5 | category: blog 6 | --- 7 | 8 | ### Public API Change 9 | * Support dynamically change `delete_obsolete_files_period_micros` option via SetDBOptions(). 10 | * Added EventListener::OnExternalFileIngested which will be called when IngestExternalFile() add a file successfully. 11 | * BackupEngine::Open and BackupEngineReadOnly::Open now always return error statuses matching those of the backup Env. 12 | 13 | ### Bug Fixes 14 | * Fix the bug that if 2PC is enabled, checkpoints may loss some recent transactions. 15 | * When file copying is needed when creating checkpoints or bulk loading files, fsync the file after the file copying. 16 | -------------------------------------------------------------------------------- /docs/_posts/2017-03-02-rocksdb-5-2-1-released.markdown: -------------------------------------------------------------------------------- 1 | --- 2 | title: RocksDB 5.2.1 Released! 3 | layout: post 4 | author: sdong 5 | category: blog 6 | --- 7 | 8 | ### Public API Change 9 | * NewLRUCache() will determine number of shard bits automatically based on capacity, if the user doesn't pass one. This also impacts the default block cache when the user doesn't explict provide one. 10 | * Change the default of delayed slowdown value to 16MB/s and further increase the L0 stop condition to 36 files. 11 | 12 | ### New Features 13 | * Added new overloaded function GetApproximateSizes that allows to specify if memtable stats should be computed only without computing SST files' stats approximations. 14 | * Added new function GetApproximateMemTableStats that approximates both number of records and size of memtables. 15 | * (Experimental) Two-level indexing that partition the index and creates a 2nd level index on the partitions. The feature can be enabled by setting kTwoLevelIndexSearch as IndexType and configuring index_per_partition. 16 | 17 | ### Bug Fixes 18 | * RangeSync() should work if ROCKSDB_FALLOCATE_PRESENT is not set 19 | * Fix wrong results in a data race case in Get() 20 | * Some fixes related to 2PC. 21 | * Fix several bugs in Direct I/O supports. 22 | * Fix a regression bug which can cause Seek() to miss some keys if the return key has been updated many times after the snapshot which is used by the iterator. 23 | -------------------------------------------------------------------------------- /docs/_posts/2017-06-29-rocksdb-5-5-1-released.markdown: -------------------------------------------------------------------------------- 1 | --- 2 | title: RocksDB 5.5.1 Released! 3 | layout: post 4 | author: lightmark 5 | category: blog 6 | --- 7 | 8 | ### New Features 9 | * FIFO compaction to support Intra L0 compaction too with CompactionOptionsFIFO.allow_compaction=true. 10 | * Statistics::Reset() to reset user stats. 11 | * ldb add option --try_load_options, which will open DB with its own option file. 12 | * Introduce WriteBatch::PopSavePoint to pop the most recent save point explicitly. 13 | * Support dynamically change `max_open_files` option via SetDBOptions() 14 | * Added DB::CreateColumnFamilie() and DB::DropColumnFamilies() to bulk create/drop column families. 15 | * Add debugging function `GetAllKeyVersions` to see internal versions of a range of keys. 16 | * Support file ingestion with universal compaction style 17 | * Support file ingestion behind with option `allow_ingest_behind` 18 | * New option enable_pipelined_write which may improve write throughput in case writing from multiple threads and WAL enabled. 19 | 20 | ### Bug Fixes 21 | * Fix the bug that Direct I/O uses direct reads for non-SST file 22 | * Fix the bug that flush doesn't respond to fsync result 23 | -------------------------------------------------------------------------------- /docs/_sass/_blog.scss: -------------------------------------------------------------------------------- 1 | .blogContainer { 2 | .posts { 3 | margin-top: 60px; 4 | 5 | .post { 6 | border: 1px solid $primary-bg; 7 | border-radius: 3px; 8 | padding: 10px 20px 20px; 9 | } 10 | } 11 | 12 | .lonePost { 13 | margin-top: 60px; 14 | 15 | .post { 16 | padding: 10px 0px 0px; 17 | } 18 | } 19 | 20 | .post-header { 21 | h1 { 22 | text-align: center; 23 | } 24 | 25 | .post-authorName { 26 | color: rgba($text, 0.7); 27 | font-size: 14px; 28 | font-weight: 900; 29 | margin-top: 0; 30 | padding: 0; 31 | text-align: center; 32 | } 33 | 34 | .authorPhoto { 35 | border-radius: 50%; 36 | height: 50px; 37 | left: 50%; 38 | margin-left: -25px; 39 | overflow: hidden; 40 | position: absolute; 41 | top: -25px; 42 | width: 50px; 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /docs/_sass/_buttons.scss: -------------------------------------------------------------------------------- 1 | .button { 2 | border: 1px solid $primary-bg; 3 | border-radius: 3px; 4 | color: $primary-bg; 5 | display: inline-block; 6 | font-size: 14px; 7 | font-weight: 900; 8 | line-height: 1.2em; 9 | padding: 10px; 10 | text-transform: uppercase; 11 | transition: background 0.3s, color 0.3s; 12 | 13 | &:hover { 14 | background: $primary-bg; 15 | color: $primary-overlay; 16 | } 17 | } 18 | 19 | .homeContainer { 20 | .button { 21 | border-color: $primary-overlay; 22 | border-width: 1px; 23 | color: $primary-overlay; 24 | 25 | &:hover { 26 | background: $primary-overlay; 27 | color: $primary-bg; 28 | } 29 | } 30 | } 31 | 32 | .blockButton { 33 | display: block; 34 | } 35 | 36 | .edit-page-link { 37 | float: right; 38 | font-size: 14px; 39 | font-weight: normal; 40 | line-height: 20px; 41 | opacity: 0.6; 42 | transition: opacity 0.5s; 43 | } 44 | 45 | .edit-page-link:hover { 46 | opacity: 1; 47 | } 48 | -------------------------------------------------------------------------------- /docs/_sass/_poweredby.scss: -------------------------------------------------------------------------------- 1 | .poweredByContainer { 2 | background: $primary-bg; 3 | color: $primary-overlay; 4 | margin-bottom: 20px; 5 | 6 | a { 7 | color: $primary-overlay; 8 | } 9 | 10 | .poweredByWrapper { 11 | h2 { 12 | border-color: $primary-overlay-special; 13 | color: $primary-overlay-special; 14 | } 15 | } 16 | 17 | .poweredByMessage { 18 | color: $primary-overlay-special; 19 | font-size: 14px; 20 | padding-top: 20px; 21 | } 22 | } 23 | 24 | .poweredByItems { 25 | display: flex; 26 | flex-flow: row wrap; 27 | margin: 0 -10px; 28 | } 29 | 30 | .poweredByItem { 31 | box-sizing: border-box; 32 | flex: 1 0 50%; 33 | line-height: 1.1em; 34 | padding: 5px 10px; 35 | 36 | &.itemLarge { 37 | flex-basis: 100%; 38 | padding: 10px; 39 | text-align: center; 40 | 41 | &:nth-child(4) { 42 | padding-bottom: 20px; 43 | } 44 | 45 | img { 46 | max-height: 30px; 47 | } 48 | } 49 | } 50 | 51 | @media only screen and (min-width: 480px) { 52 | .itemLarge { 53 | flex-basis: 50%; 54 | max-width: 50%; 55 | } 56 | } 57 | 58 | @media only screen and (min-width: 1024px) { 59 | .poweredByItem { 60 | flex-basis: 25%; 61 | max-width: 25%; 62 | 63 | &.itemLarge { 64 | padding-bottom: 20px; 65 | text-align: left; 66 | } 67 | } 68 | } 69 | 70 | -------------------------------------------------------------------------------- /docs/_sass/_promo.scss: -------------------------------------------------------------------------------- 1 | .promoSection { 2 | display: flex; 3 | flex-flow: column wrap; 4 | font-size: 125%; 5 | line-height: 1.6em; 6 | margin: -10px 0; 7 | position: relative; 8 | z-index: 99; 9 | 10 | .promoRow { 11 | padding: 10px 0; 12 | 13 | .pluginWrapper { 14 | display: block; 15 | 16 | &.ghWatchWrapper, &.ghStarWrapper { 17 | height: 28px; 18 | } 19 | } 20 | 21 | .pluginRowBlock { 22 | display: flex; 23 | flex-flow: row wrap; 24 | margin: 0 -2px; 25 | 26 | .pluginWrapper { 27 | padding: 0 2px; 28 | } 29 | } 30 | } 31 | } 32 | 33 | iframe.pluginIframe { 34 | height: 500px; 35 | margin-top: 20px; 36 | width: 100%; 37 | } 38 | 39 | .iframeContent { 40 | display: none; 41 | } 42 | 43 | .iframePreview { 44 | display: inline-block; 45 | margin-top: 20px; 46 | } 47 | 48 | @media only screen and (min-width: 1024px) { 49 | .iframeContent { 50 | display: block; 51 | } 52 | .iframePreview { 53 | display: none; 54 | } 55 | } -------------------------------------------------------------------------------- /docs/_sass/_reset.scss: -------------------------------------------------------------------------------- 1 | html, body, div, span, applet, object, iframe, 2 | h1, h2, h3, h4, h5, h6, p, blockquote, pre, 3 | a, abbr, acronym, address, big, cite, code, 4 | del, dfn, em, img, ins, kbd, q, s, samp, 5 | small, strike, strong, sub, sup, tt, var, 6 | b, u, i, center, 7 | dl, dt, dd, ol, ul, li, 8 | fieldset, form, label, legend, 9 | table, caption, tbody, tfoot, thead, tr, th, td, 10 | article, aside, canvas, details, embed, 11 | figure, figcaption, footer, header, hgroup, 12 | menu, nav, output, ruby, section, summary, 13 | time, mark, audio, video { 14 | margin: 0; 15 | padding: 0; 16 | border: 0; 17 | font-size: 100%; 18 | font: inherit; 19 | vertical-align: baseline; 20 | } 21 | /* HTML5 display-role reset for older browsers */ 22 | article, aside, details, figcaption, figure, 23 | footer, header, hgroup, menu, nav, section { 24 | display: block; 25 | } 26 | body { 27 | line-height: 1; 28 | } 29 | ol, ul { 30 | list-style: none; 31 | } 32 | blockquote, q { 33 | quotes: none; 34 | } 35 | blockquote:before, blockquote:after, 36 | q:before, q:after { 37 | content: ''; 38 | content: none; 39 | } 40 | table { 41 | border-collapse: collapse; 42 | border-spacing: 0; 43 | } 44 | -------------------------------------------------------------------------------- /docs/_sass/_slideshow.scss: -------------------------------------------------------------------------------- 1 | .slideshow { 2 | position: relative; 3 | 4 | .slide { 5 | display: none; 6 | 7 | img { 8 | display: block; 9 | margin: 0 auto; 10 | } 11 | 12 | &.slideActive { 13 | display: block; 14 | } 15 | 16 | a { 17 | border: none; 18 | display: block; 19 | } 20 | } 21 | 22 | .pagination { 23 | display: block; 24 | margin: -10px; 25 | padding: 1em 0; 26 | text-align: center; 27 | width: 100%; 28 | 29 | .pager { 30 | background: transparent; 31 | border: 2px solid rgba(255, 255, 255, 0.5); 32 | border-radius: 50%; 33 | cursor: pointer; 34 | display: inline-block; 35 | height: 12px; 36 | margin: 10px; 37 | transition: background-color 0.3s, border-color 0.3s; 38 | width: 12px; 39 | 40 | &.pagerActive { 41 | background: rgba(255, 255, 255, 0.5); 42 | border-width: 4px; 43 | height: 8px; 44 | width: 8px; 45 | } 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /docs/_sass/_tables.scss: -------------------------------------------------------------------------------- 1 | table { 2 | background: $lightergrey; 3 | border: 1px solid $lightgrey; 4 | border-collapse: collapse; 5 | display:table; 6 | margin: 20px 0; 7 | 8 | thead { 9 | border-bottom: 1px solid $lightgrey; 10 | display: table-header-group; 11 | } 12 | tbody { 13 | display: table-row-group; 14 | } 15 | tr { 16 | display: table-row; 17 | &:nth-of-type(odd) { 18 | background: $greyish; 19 | } 20 | 21 | th, td { 22 | border-right: 1px dotted $lightgrey; 23 | display: table-cell; 24 | font-size: 14px; 25 | line-height: 1.3em; 26 | padding: 10px; 27 | text-align: left; 28 | 29 | &:last-of-type { 30 | border-right: 0; 31 | } 32 | 33 | code { 34 | color: $green; 35 | display: inline-block; 36 | font-size: 12px; 37 | } 38 | } 39 | 40 | th { 41 | color: #000000; 42 | font-weight: bold; 43 | font-family: $header-font-family; 44 | text-transform: uppercase; 45 | } 46 | } 47 | } -------------------------------------------------------------------------------- /docs/_top-level/support.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: top-level 3 | title: Support 4 | id: support 5 | category: support 6 | --- 7 | 8 | ## Need help? 9 | 10 | Do not hesitate to ask questions if you are having trouble with RocksDB. 11 | 12 | ### GitHub issues 13 | 14 | Use [GitHub issues](https://github.com/facebook/rocksdb/issues) to report bugs, issues and feature requests for the RocksDB codebase. 15 | 16 | ### Facebook Group 17 | 18 | Use the [RocksDB Facebook group](https://www.facebook.com/groups/rocksdb.dev/) for general questions and discussion about RocksDB. 19 | 20 | ### FAQ 21 | 22 | Check out a list of [commonly asked questions](/docs/support/faq) about RocksDB. 23 | -------------------------------------------------------------------------------- /docs/blog/all.html: -------------------------------------------------------------------------------- 1 | --- 2 | id: all 3 | layout: blog 4 | category: blog 5 | --- 6 | 7 |
8 |
9 |

All Posts

10 | {% for post in site.posts %} 11 | {% assign author = site.data.authors[post.author] %} 12 |

13 | 14 | {{ post.title }} 15 | 16 | on {{ post.date | date: "%B %e, %Y" }} by {{ author.display_name }} 17 |

18 | {% endfor %} 19 |
20 |
21 | -------------------------------------------------------------------------------- /docs/blog/index.html: -------------------------------------------------------------------------------- 1 | --- 2 | id: blog 3 | title: Blog 4 | layout: blog 5 | category: blog 6 | --- 7 | 8 |
9 | {% for page in site.posts %} 10 | {% include post.html truncate=true %} 11 | {% endfor %} 12 |
13 | -------------------------------------------------------------------------------- /docs/doc-type-examples/2016-04-07-blog-post-example.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Blog Post Example 3 | layout: post 4 | author: exampleauthor 5 | category: blog 6 | --- 7 | 8 | Any local blog posts would go in the `_posts` directory. 9 | 10 | This is an example blog post introduction, try to keep it short and about a paragraph long, to encourage people to click through to read the entire post. 11 | 12 | 13 | 14 | Everything below the `` tag will only show on the actual blog post page, not on the `/blog/` index. 15 | 16 | Author is defined in `_data/authors.yml` 17 | 18 | 19 | ## No posts? 20 | 21 | If you have no blog for your site, you can remove the entire `_posts` folder. Otherwise add markdown files in here. See CONTRIBUTING.md for details. 22 | -------------------------------------------------------------------------------- /docs/doc-type-examples/docs-hello-world.md: -------------------------------------------------------------------------------- 1 | --- 2 | docid: hello-world 3 | title: Hello, World! 4 | layout: docs 5 | permalink: /docs/hello-world.html 6 | --- 7 | 8 | Any local docs would go in the `_docs` directory. 9 | 10 | ## No documentation? 11 | 12 | If you have no documentation for your site, you can remove the entire `_docs` folder. Otherwise add markdown files in here. See CONTRIBUTING.md for details. 13 | -------------------------------------------------------------------------------- /docs/doc-type-examples/top-level-example.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: top-level 3 | title: Support Example 4 | id: top-level-example 5 | category: top-level 6 | --- 7 | 8 | This is a static page disconnected from the blog or docs collections that can be added at a top-level (i.e., the same level as `index.md`). 9 | -------------------------------------------------------------------------------- /docs/docs/index.html: -------------------------------------------------------------------------------- 1 | --- 2 | id: docs 3 | title: Docs 4 | layout: redirect 5 | destination: getting-started.html 6 | --- 7 | -------------------------------------------------------------------------------- /docs/feed.xml: -------------------------------------------------------------------------------- 1 | --- 2 | layout: null 3 | --- 4 | 5 | 6 | 7 | {{ site.title | xml_escape }} 8 | {{ site.description | xml_escape }} 9 | {{ absolute_url }}/ 10 | 11 | {{ site.time | date_to_rfc822 }} 12 | {{ site.time | date_to_rfc822 }} 13 | Jekyll v{{ jekyll.version }} 14 | {% for post in site.posts limit:10 %} 15 | 16 | {{ post.title | xml_escape }} 17 | {{ post.content | xml_escape }} 18 | {{ post.date | date_to_rfc822 }} 19 | {{ post.url | absolute_url }} 20 | {{ post.url | absolute_url }} 21 | {% for tag in post.tags %} 22 | {{ tag | xml_escape }} 23 | {% endfor %} 24 | {% for cat in post.categories %} 25 | {{ cat | xml_escape }} 26 | {% endfor %} 27 | 28 | {% endfor %} 29 | 30 | 31 | -------------------------------------------------------------------------------- /docs/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: home 3 | title: RocksDB | A persistent key-value store 4 | id: home 5 | --- 6 | 7 | ## Features 8 | 9 | {% include content/gridblocks.html data_source=site.data.features align="center" %} 10 | -------------------------------------------------------------------------------- /docs/static/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theoanab/SILK-USENIXATC2019/35385f14b6d3948c75914c1571e92897280a483e/docs/static/favicon.png -------------------------------------------------------------------------------- /docs/static/fonts/LatoLatin-Black.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theoanab/SILK-USENIXATC2019/35385f14b6d3948c75914c1571e92897280a483e/docs/static/fonts/LatoLatin-Black.woff -------------------------------------------------------------------------------- /docs/static/fonts/LatoLatin-Black.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theoanab/SILK-USENIXATC2019/35385f14b6d3948c75914c1571e92897280a483e/docs/static/fonts/LatoLatin-Black.woff2 -------------------------------------------------------------------------------- /docs/static/fonts/LatoLatin-BlackItalic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theoanab/SILK-USENIXATC2019/35385f14b6d3948c75914c1571e92897280a483e/docs/static/fonts/LatoLatin-BlackItalic.woff -------------------------------------------------------------------------------- /docs/static/fonts/LatoLatin-BlackItalic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theoanab/SILK-USENIXATC2019/35385f14b6d3948c75914c1571e92897280a483e/docs/static/fonts/LatoLatin-BlackItalic.woff2 -------------------------------------------------------------------------------- /docs/static/fonts/LatoLatin-Italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theoanab/SILK-USENIXATC2019/35385f14b6d3948c75914c1571e92897280a483e/docs/static/fonts/LatoLatin-Italic.woff -------------------------------------------------------------------------------- /docs/static/fonts/LatoLatin-Italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theoanab/SILK-USENIXATC2019/35385f14b6d3948c75914c1571e92897280a483e/docs/static/fonts/LatoLatin-Italic.woff2 -------------------------------------------------------------------------------- /docs/static/fonts/LatoLatin-Light.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theoanab/SILK-USENIXATC2019/35385f14b6d3948c75914c1571e92897280a483e/docs/static/fonts/LatoLatin-Light.woff -------------------------------------------------------------------------------- /docs/static/fonts/LatoLatin-Light.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theoanab/SILK-USENIXATC2019/35385f14b6d3948c75914c1571e92897280a483e/docs/static/fonts/LatoLatin-Light.woff2 -------------------------------------------------------------------------------- /docs/static/fonts/LatoLatin-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theoanab/SILK-USENIXATC2019/35385f14b6d3948c75914c1571e92897280a483e/docs/static/fonts/LatoLatin-Regular.woff -------------------------------------------------------------------------------- /docs/static/fonts/LatoLatin-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theoanab/SILK-USENIXATC2019/35385f14b6d3948c75914c1571e92897280a483e/docs/static/fonts/LatoLatin-Regular.woff2 -------------------------------------------------------------------------------- /docs/static/images/Resize-of-20140327_200754-300x225.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theoanab/SILK-USENIXATC2019/35385f14b6d3948c75914c1571e92897280a483e/docs/static/images/Resize-of-20140327_200754-300x225.jpg -------------------------------------------------------------------------------- /docs/static/images/compaction/full-range.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theoanab/SILK-USENIXATC2019/35385f14b6d3948c75914c1571e92897280a483e/docs/static/images/compaction/full-range.png -------------------------------------------------------------------------------- /docs/static/images/compaction/l0-l1-contend.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theoanab/SILK-USENIXATC2019/35385f14b6d3948c75914c1571e92897280a483e/docs/static/images/compaction/l0-l1-contend.png -------------------------------------------------------------------------------- /docs/static/images/compaction/l1-l2-contend.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theoanab/SILK-USENIXATC2019/35385f14b6d3948c75914c1571e92897280a483e/docs/static/images/compaction/l1-l2-contend.png -------------------------------------------------------------------------------- /docs/static/images/compaction/part-range-old.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theoanab/SILK-USENIXATC2019/35385f14b6d3948c75914c1571e92897280a483e/docs/static/images/compaction/part-range-old.png -------------------------------------------------------------------------------- /docs/static/images/pcache-blockindex.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theoanab/SILK-USENIXATC2019/35385f14b6d3948c75914c1571e92897280a483e/docs/static/images/pcache-blockindex.jpg -------------------------------------------------------------------------------- /docs/static/images/pcache-fileindex.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theoanab/SILK-USENIXATC2019/35385f14b6d3948c75914c1571e92897280a483e/docs/static/images/pcache-fileindex.jpg -------------------------------------------------------------------------------- /docs/static/images/pcache-filelayout.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theoanab/SILK-USENIXATC2019/35385f14b6d3948c75914c1571e92897280a483e/docs/static/images/pcache-filelayout.jpg -------------------------------------------------------------------------------- /docs/static/images/pcache-readiopath.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theoanab/SILK-USENIXATC2019/35385f14b6d3948c75914c1571e92897280a483e/docs/static/images/pcache-readiopath.jpg -------------------------------------------------------------------------------- /docs/static/images/pcache-tieredstorage.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theoanab/SILK-USENIXATC2019/35385f14b6d3948c75914c1571e92897280a483e/docs/static/images/pcache-tieredstorage.jpg -------------------------------------------------------------------------------- /docs/static/images/pcache-writeiopath.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theoanab/SILK-USENIXATC2019/35385f14b6d3948c75914c1571e92897280a483e/docs/static/images/pcache-writeiopath.jpg -------------------------------------------------------------------------------- /docs/static/images/tree_example1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theoanab/SILK-USENIXATC2019/35385f14b6d3948c75914c1571e92897280a483e/docs/static/images/tree_example1.png -------------------------------------------------------------------------------- /docs/static/og_image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theoanab/SILK-USENIXATC2019/35385f14b6d3948c75914c1571e92897280a483e/docs/static/og_image.png -------------------------------------------------------------------------------- /env/env_chroot.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | 6 | #pragma once 7 | 8 | #if !defined(ROCKSDB_LITE) && !defined(OS_WIN) 9 | 10 | #include 11 | 12 | #include "rocksdb/env.h" 13 | 14 | namespace rocksdb { 15 | 16 | // Returns an Env that translates paths such that the root directory appears to 17 | // be chroot_dir. chroot_dir should refer to an existing directory. 18 | Env* NewChrootEnv(Env* base_env, const std::string& chroot_dir); 19 | 20 | } // namespace rocksdb 21 | 22 | #endif // !defined(ROCKSDB_LITE) && !defined(OS_WIN) 23 | -------------------------------------------------------------------------------- /examples/.gitignore: -------------------------------------------------------------------------------- 1 | c_simple_example 2 | column_families_example 3 | compact_files_example 4 | compaction_filter_example 5 | optimistic_transaction_example 6 | options_file_example 7 | simple_example 8 | transaction_example 9 | -------------------------------------------------------------------------------- /examples/README.md: -------------------------------------------------------------------------------- 1 | 1. Compile RocksDB first by executing `make static_lib` in parent dir 2 | 2. Compile all examples: `cd examples/; make all` 3 | -------------------------------------------------------------------------------- /hdfs/README: -------------------------------------------------------------------------------- 1 | This directory contains the hdfs extensions needed to make rocksdb store 2 | files in HDFS. 3 | 4 | It has been compiled and testing against CDH 4.4 (2.0.0+1475-1.cdh4.4.0.p0.23~precise-cdh4.4.0). 5 | 6 | The configuration assumes that packages libhdfs0, libhdfs0-dev are 7 | installed which basically means that hdfs.h is in /usr/include and libhdfs in /usr/lib 8 | 9 | The env_hdfs.h file defines the rocksdb objects that are needed to talk to an 10 | underlying filesystem. 11 | 12 | If you want to compile rocksdb with hdfs support, please set the following 13 | environment variables appropriately (also defined in setup.sh for convenience) 14 | USE_HDFS=1 15 | JAVA_HOME=/usr/local/jdk-7u79-64 16 | LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/jdk-7u79-64/jre/lib/amd64/server:/usr/local/jdk-7u79-64/jre/lib/amd64/:./snappy/libs 17 | make clean all db_bench 18 | 19 | To run dbbench, 20 | set CLASSPATH to include your hadoop distribution 21 | db_bench --hdfs="hdfs://hbaseudbperf001.snc1.facebook.com:9000" 22 | 23 | 24 | -------------------------------------------------------------------------------- /hdfs/setup.sh: -------------------------------------------------------------------------------- 1 | export USE_HDFS=1 2 | export LD_LIBRARY_PATH=$JAVA_HOME/jre/lib/amd64/server:$JAVA_HOME/jre/lib/amd64:/usr/lib/hadoop/lib/native 3 | 4 | export CLASSPATH= 5 | for f in `find /usr/lib/hadoop-hdfs | grep jar`; do export CLASSPATH=$CLASSPATH:$f; done 6 | for f in `find /usr/lib/hadoop | grep jar`; do export CLASSPATH=$CLASSPATH:$f; done 7 | for f in `find /usr/lib/hadoop/client | grep jar`; do export CLASSPATH=$CLASSPATH:$f; done 8 | -------------------------------------------------------------------------------- /include/rocksdb/db_bench_tool.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | #pragma once 6 | 7 | namespace rocksdb { 8 | int db_bench_tool(int argc, char** argv); 9 | } // namespace rocksdb 10 | -------------------------------------------------------------------------------- /include/rocksdb/db_dump_tool.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | 6 | #pragma once 7 | #ifndef ROCKSDB_LITE 8 | 9 | #include 10 | 11 | #include "rocksdb/db.h" 12 | 13 | namespace rocksdb { 14 | 15 | struct DumpOptions { 16 | // Database that will be dumped 17 | std::string db_path; 18 | // File location that will contain dump output 19 | std::string dump_location; 20 | // Dont include db information header in the dump 21 | bool anonymous = false; 22 | }; 23 | 24 | class DbDumpTool { 25 | public: 26 | bool Run(const DumpOptions& dump_options, 27 | rocksdb::Options options = rocksdb::Options()); 28 | }; 29 | 30 | struct UndumpOptions { 31 | // Database that we will load the dumped file into 32 | std::string db_path; 33 | // File location of the dumped file that will be loaded 34 | std::string dump_location; 35 | // Compact the db after loading the dumped file 36 | bool compact_db = false; 37 | }; 38 | 39 | class DbUndumpTool { 40 | public: 41 | bool Run(const UndumpOptions& undump_options, 42 | rocksdb::Options options = rocksdb::Options()); 43 | }; 44 | } // namespace rocksdb 45 | #endif // ROCKSDB_LITE 46 | -------------------------------------------------------------------------------- /include/rocksdb/experimental.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | 6 | #pragma once 7 | 8 | #include "rocksdb/db.h" 9 | #include "rocksdb/status.h" 10 | 11 | namespace rocksdb { 12 | namespace experimental { 13 | 14 | // Supported only for Leveled compaction 15 | Status SuggestCompactRange(DB* db, ColumnFamilyHandle* column_family, 16 | const Slice* begin, const Slice* end); 17 | Status SuggestCompactRange(DB* db, const Slice* begin, const Slice* end); 18 | 19 | // Move all L0 files to target_level skipping compaction. 20 | // This operation succeeds only if the files in L0 have disjoint ranges; this 21 | // is guaranteed to happen, for instance, if keys are inserted in sorted 22 | // order. Furthermore, all levels between 1 and target_level must be empty. 23 | // If any of the above condition is violated, InvalidArgument will be 24 | // returned. 25 | Status PromoteL0(DB* db, ColumnFamilyHandle* column_family, 26 | int target_level = 1); 27 | 28 | } // namespace experimental 29 | } // namespace rocksdb 30 | -------------------------------------------------------------------------------- /include/rocksdb/ldb_tool.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | #ifndef ROCKSDB_LITE 6 | #pragma once 7 | #include 8 | #include 9 | #include "rocksdb/db.h" 10 | #include "rocksdb/options.h" 11 | 12 | namespace rocksdb { 13 | 14 | // An interface for converting a slice to a readable string 15 | class SliceFormatter { 16 | public: 17 | virtual ~SliceFormatter() {} 18 | virtual std::string Format(const Slice& s) const = 0; 19 | }; 20 | 21 | // Options for customizing ldb tool (beyond the DB Options) 22 | struct LDBOptions { 23 | // Create LDBOptions with default values for all fields 24 | LDBOptions(); 25 | 26 | // Key formatter that converts a slice to a readable string. 27 | // Default: Slice::ToString() 28 | std::shared_ptr key_formatter; 29 | 30 | std::string print_help_header = "ldb - RocksDB Tool"; 31 | }; 32 | 33 | class LDBTool { 34 | public: 35 | void Run( 36 | int argc, char** argv, Options db_options = Options(), 37 | const LDBOptions& ldb_options = LDBOptions(), 38 | const std::vector* column_families = nullptr); 39 | }; 40 | 41 | } // namespace rocksdb 42 | 43 | #endif // ROCKSDB_LITE 44 | -------------------------------------------------------------------------------- /include/rocksdb/perf_level.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | 6 | #ifndef INCLUDE_ROCKSDB_PERF_LEVEL_H_ 7 | #define INCLUDE_ROCKSDB_PERF_LEVEL_H_ 8 | 9 | #include 10 | #include 11 | 12 | namespace rocksdb { 13 | 14 | // How much perf stats to collect. Affects perf_context and iostats_context. 15 | enum PerfLevel : unsigned char { 16 | kUninitialized = 0, // unknown setting 17 | kDisable = 1, // disable perf stats 18 | kEnableCount = 2, // enable only count stats 19 | kEnableTimeExceptForMutex = 3, // Other than count stats, also enable time 20 | // stats except for mutexes 21 | kEnableTime = 4, // enable count and time stats 22 | kOutOfBounds = 5 // N.B. Must always be the last value! 23 | }; 24 | 25 | // set the perf stats level for current thread 26 | void SetPerfLevel(PerfLevel level); 27 | 28 | // get current perf stats level for current thread 29 | PerfLevel GetPerfLevel(); 30 | 31 | } // namespace rocksdb 32 | 33 | #endif // INCLUDE_ROCKSDB_PERF_LEVEL_H_ 34 | -------------------------------------------------------------------------------- /include/rocksdb/sst_dump_tool.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | #ifndef ROCKSDB_LITE 6 | #pragma once 7 | 8 | namespace rocksdb { 9 | 10 | class SSTDumpTool { 11 | public: 12 | int Run(int argc, char** argv); 13 | }; 14 | 15 | } // namespace rocksdb 16 | 17 | #endif // ROCKSDB_LITE 18 | -------------------------------------------------------------------------------- /include/rocksdb/types.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | 6 | #ifndef STORAGE_ROCKSDB_INCLUDE_TYPES_H_ 7 | #define STORAGE_ROCKSDB_INCLUDE_TYPES_H_ 8 | 9 | #include 10 | 11 | namespace rocksdb { 12 | 13 | // Define all public custom types here. 14 | 15 | // Represents a sequence number in a WAL file. 16 | typedef uint64_t SequenceNumber; 17 | 18 | } // namespace rocksdb 19 | 20 | #endif // STORAGE_ROCKSDB_INCLUDE_TYPES_H_ 21 | -------------------------------------------------------------------------------- /include/rocksdb/utilities/convenience.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | 6 | #pragma once 7 | 8 | // This file was moved to rocksdb/convenience.h" 9 | 10 | #include "rocksdb/convenience.h" 11 | -------------------------------------------------------------------------------- /include/rocksdb/utilities/info_log_finder.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | 6 | #pragma once 7 | 8 | #include 9 | #include 10 | 11 | #include "rocksdb/db.h" 12 | #include "rocksdb/options.h" 13 | 14 | namespace rocksdb { 15 | 16 | // This function can be used to list the Information logs, 17 | // given the db pointer. 18 | Status GetInfoLogList(DB* db, std::vector* info_log_list); 19 | } // namespace rocksdb 20 | -------------------------------------------------------------------------------- /include/rocksdb/utilities/option_change_migration.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | 6 | #pragma once 7 | 8 | #include 9 | #include "rocksdb/options.h" 10 | #include "rocksdb/status.h" 11 | 12 | namespace rocksdb { 13 | // Try to migrate DB created with old_opts to be use new_opts. 14 | // Multiple column families is not supported. 15 | // It is best-effort. No guarantee to succeed. 16 | // A full compaction may be executed. 17 | Status OptionChangeMigration(std::string dbname, const Options& old_opts, 18 | const Options& new_opts); 19 | } // namespace rocksdb 20 | -------------------------------------------------------------------------------- /include/rocksdb/utilities/table_properties_collectors.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | 6 | #pragma once 7 | #ifndef ROCKSDB_LITE 8 | #include 9 | 10 | #include "rocksdb/table_properties.h" 11 | 12 | namespace rocksdb { 13 | 14 | // Creates a factory of a table property collector that marks a SST 15 | // file as need-compaction when it observe at least "D" deletion 16 | // entries in any "N" consecutive entires. 17 | // 18 | // @param sliding_window_size "N". Note that this number will be 19 | // round up to the smallest multiple of 128 that is no less 20 | // than the specified size. 21 | // @param deletion_trigger "D". Note that even when "N" is changed, 22 | // the specified number for "D" will not be changed. 23 | extern std::shared_ptr 24 | NewCompactOnDeletionCollectorFactory( 25 | size_t sliding_window_size, 26 | size_t deletion_trigger); 27 | } // namespace rocksdb 28 | 29 | #endif // !ROCKSDB_LITE 30 | -------------------------------------------------------------------------------- /include/rocksdb/utilities/utility_db.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 4 | 5 | #pragma once 6 | #ifndef ROCKSDB_LITE 7 | #include 8 | #include 9 | 10 | #include "rocksdb/utilities/stackable_db.h" 11 | #include "rocksdb/utilities/db_ttl.h" 12 | #include "rocksdb/db.h" 13 | 14 | namespace rocksdb { 15 | 16 | // Please don't use this class. It's deprecated 17 | class UtilityDB { 18 | public: 19 | // This function is here only for backwards compatibility. Please use the 20 | // functions defined in DBWithTTl (rocksdb/utilities/db_ttl.h) 21 | // (deprecated) 22 | #if defined(__GNUC__) || defined(__clang__) 23 | __attribute__((deprecated)) 24 | #elif _WIN32 25 | __declspec(deprecated) 26 | #endif 27 | static Status OpenTtlDB(const Options& options, 28 | const std::string& name, 29 | StackableDB** dbptr, 30 | int32_t ttl = 0, 31 | bool read_only = false); 32 | }; 33 | 34 | } // namespace rocksdb 35 | #endif // ROCKSDB_LITE 36 | -------------------------------------------------------------------------------- /include/rocksdb/version.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | #pragma once 6 | 7 | #define ROCKSDB_MAJOR 5 8 | #define ROCKSDB_MINOR 7 9 | #define ROCKSDB_PATCH 0 10 | 11 | // Do not use these. We made the mistake of declaring macros starting with 12 | // double underscore. Now we have to live with our choice. We'll deprecate these 13 | // at some point 14 | #define __ROCKSDB_MAJOR__ ROCKSDB_MAJOR 15 | #define __ROCKSDB_MINOR__ ROCKSDB_MINOR 16 | #define __ROCKSDB_PATCH__ ROCKSDB_PATCH 17 | -------------------------------------------------------------------------------- /java/crossbuild/Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | # Vagrantfile API/syntax version. Don't touch unless you know what you're doing! 5 | VAGRANTFILE_API_VERSION = "2" 6 | 7 | Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 8 | 9 | config.vm.define "linux32" do |linux32| 10 | linux32.vm.box = "hansode/centos-6.7-i386" 11 | end 12 | 13 | config.vm.define "linux64" do |linux64| 14 | linux64.vm.box = "hansode/centos-6.7-x86_64" 15 | end 16 | 17 | config.vm.provider "virtualbox" do |v| 18 | v.memory = 2048 19 | v.cpus = 4 20 | v.customize ["modifyvm", :id, "--nictype1", "virtio" ] 21 | end 22 | 23 | config.vm.provision :shell, path: "build-linux-centos.sh" 24 | config.vm.synced_folder "../target", "/rocksdb-build" 25 | config.vm.synced_folder "../..", "/rocksdb", type: "rsync" 26 | config.vm.boot_timeout = 1200 27 | end 28 | -------------------------------------------------------------------------------- /java/crossbuild/build-linux-centos.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | # remove fixed relesever variable present in the hanscode boxes 6 | sudo rm -f /etc/yum/vars/releasever 7 | 8 | # enable EPEL 9 | sudo yum -y install epel-release 10 | 11 | # install all required packages for rocksdb that are available through yum 12 | sudo yum -y install openssl java-1.7.0-openjdk-devel zlib-devel bzip2-devel lz4-devel snappy-devel libzstd-devel 13 | 14 | # install gcc/g++ 4.8.2 from tru/devtools-2 15 | sudo wget -O /etc/yum.repos.d/devtools-2.repo https://people.centos.org/tru/devtools-2/devtools-2.repo 16 | sudo yum -y install devtoolset-2-binutils devtoolset-2-gcc devtoolset-2-gcc-c++ 17 | 18 | # install gflags 19 | wget https://github.com/gflags/gflags/archive/v2.0.tar.gz -O gflags-2.0.tar.gz 20 | tar xvfz gflags-2.0.tar.gz; cd gflags-2.0; scl enable devtoolset-2 ./configure; scl enable devtoolset-2 make; sudo make install 21 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib 22 | 23 | # set java home so we can build rocksdb jars 24 | export JAVA_HOME=/usr/lib/jvm/java-1.7.0 25 | 26 | # build rocksdb 27 | cd /rocksdb 28 | scl enable devtoolset-2 'make jclean clean' 29 | scl enable devtoolset-2 'PORTABLE=1 make rocksdbjavastatic' 30 | cp /rocksdb/java/target/librocksdbjni-* /rocksdb-build 31 | cp /rocksdb/java/target/rocksdbjni-* /rocksdb-build 32 | 33 | -------------------------------------------------------------------------------- /java/crossbuild/build-linux.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # install all required packages for rocksdb 3 | sudo apt-get update 4 | sudo apt-get -y install git make gcc g++ libgflags-dev libsnappy-dev zlib1g-dev libbz2-dev default-jdk 5 | 6 | # set java home so we can build rocksdb jars 7 | export JAVA_HOME=$(echo /usr/lib/jvm/java-7-openjdk*) 8 | cd /rocksdb 9 | make jclean clean 10 | make -j 4 rocksdbjavastatic 11 | cp /rocksdb/java/target/librocksdbjni-* /rocksdb-build 12 | cp /rocksdb/java/target/rocksdbjni-* /rocksdb-build 13 | sudo shutdown -h now 14 | 15 | -------------------------------------------------------------------------------- /java/crossbuild/docker-build-linux-centos.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | rm -rf /rocksdb-local 6 | cp -r /rocksdb-host /rocksdb-local 7 | cd /rocksdb-local 8 | scl enable devtoolset-2 'make jclean clean' 9 | scl enable devtoolset-2 'PORTABLE=1 make rocksdbjavastatic' 10 | cp java/target/librocksdbjni-linux*.so java/target/rocksdbjni-*-linux*.jar /rocksdb-host/java/target 11 | 12 | -------------------------------------------------------------------------------- /java/jdb_bench.sh: -------------------------------------------------------------------------------- 1 | PLATFORM=64 2 | if [ `getconf LONG_BIT` != "64" ] 3 | then 4 | PLATFORM=32 5 | fi 6 | 7 | ROCKS_JAR=`find target -name rocksdbjni*.jar` 8 | 9 | echo "Running benchmark in $PLATFORM-Bit mode." 10 | java -server -d$PLATFORM -XX:NewSize=4m -XX:+AggressiveOpts -Djava.library.path=target -cp "${ROCKS_JAR}:benchmark/target/classes" org.rocksdb.benchmark.DbBenchmark $@ 11 | -------------------------------------------------------------------------------- /java/rocksjni/cassandra_compactionfilterjni.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | 6 | #include 7 | 8 | #include "include/org_rocksdb_CassandraCompactionFilter.h" 9 | #include "utilities/cassandra/cassandra_compaction_filter.h" 10 | 11 | /* 12 | * Class: org_rocksdb_CassandraCompactionFilter 13 | * Method: createNewCassandraCompactionFilter0 14 | * Signature: ()J 15 | */ 16 | jlong Java_org_rocksdb_CassandraCompactionFilter_createNewCassandraCompactionFilter0( 17 | JNIEnv* env, jclass jcls, jboolean purge_ttl_on_expiration) { 18 | auto* compaction_filter = 19 | new rocksdb::cassandra::CassandraCompactionFilter(purge_ttl_on_expiration); 20 | // set the native handle to our native compaction filter 21 | return reinterpret_cast(compaction_filter); 22 | } 23 | -------------------------------------------------------------------------------- /java/rocksjni/columnfamilyhandle.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | // 6 | // This file implements the "bridge" between Java and C++ and enables 7 | // calling c++ rocksdb::Iterator methods from Java side. 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | #include "include/org_rocksdb_ColumnFamilyHandle.h" 14 | #include "rocksjni/portal.h" 15 | 16 | /* 17 | * Class: org_rocksdb_ColumnFamilyHandle 18 | * Method: disposeInternal 19 | * Signature: (J)V 20 | */ 21 | void Java_org_rocksdb_ColumnFamilyHandle_disposeInternal( 22 | JNIEnv* env, jobject jobj, jlong handle) { 23 | auto* cfh = reinterpret_cast(handle); 24 | assert(cfh != nullptr); 25 | delete cfh; 26 | } 27 | -------------------------------------------------------------------------------- /java/rocksjni/compaction_filter.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | // 6 | // This file implements the "bridge" between Java and C++ for 7 | // rocksdb::CompactionFilter. 8 | 9 | #include 10 | 11 | #include "include/org_rocksdb_AbstractCompactionFilter.h" 12 | #include "rocksdb/compaction_filter.h" 13 | 14 | // 15 | 16 | /* 17 | * Class: org_rocksdb_AbstractCompactionFilter 18 | * Method: disposeInternal 19 | * Signature: (J)V 20 | */ 21 | void Java_org_rocksdb_AbstractCompactionFilter_disposeInternal( 22 | JNIEnv* env, jobject jobj, jlong handle) { 23 | auto* cf = reinterpret_cast(handle); 24 | assert(cf != nullptr); 25 | delete cf; 26 | } 27 | // 28 | -------------------------------------------------------------------------------- /java/rocksjni/remove_emptyvalue_compactionfilterjni.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | 6 | #include 7 | 8 | #include "include/org_rocksdb_RemoveEmptyValueCompactionFilter.h" 9 | #include "utilities/compaction_filters/remove_emptyvalue_compactionfilter.h" 10 | 11 | 12 | /* 13 | * Class: org_rocksdb_RemoveEmptyValueCompactionFilter 14 | * Method: createNewRemoveEmptyValueCompactionFilter0 15 | * Signature: ()J 16 | */ 17 | jlong Java_org_rocksdb_RemoveEmptyValueCompactionFilter_createNewRemoveEmptyValueCompactionFilter0( 18 | JNIEnv* env, jclass jcls) { 19 | auto* compaction_filter = 20 | new rocksdb::RemoveEmptyValueCompactionFilter(); 21 | 22 | // set the native handle to our native compaction filter 23 | return reinterpret_cast(compaction_filter); 24 | } 25 | -------------------------------------------------------------------------------- /java/rocksjni/restorejni.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | // 6 | // This file implements the "bridge" between Java and C++ and enables 7 | // calling C++ rocksdb::RestoreOptions methods 8 | // from Java side. 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | #include "include/org_rocksdb_RestoreOptions.h" 16 | #include "rocksjni/portal.h" 17 | #include "rocksdb/utilities/backupable_db.h" 18 | /* 19 | * Class: org_rocksdb_RestoreOptions 20 | * Method: newRestoreOptions 21 | * Signature: (Z)J 22 | */ 23 | jlong Java_org_rocksdb_RestoreOptions_newRestoreOptions(JNIEnv* env, 24 | jclass jcls, jboolean keep_log_files) { 25 | auto* ropt = new rocksdb::RestoreOptions(keep_log_files); 26 | return reinterpret_cast(ropt); 27 | } 28 | 29 | /* 30 | * Class: org_rocksdb_RestoreOptions 31 | * Method: disposeInternal 32 | * Signature: (J)V 33 | */ 34 | void Java_org_rocksdb_RestoreOptions_disposeInternal(JNIEnv* env, jobject jobj, 35 | jlong jhandle) { 36 | auto* ropt = reinterpret_cast(jhandle); 37 | assert(ropt); 38 | delete ropt; 39 | } 40 | -------------------------------------------------------------------------------- /java/rocksjni/snapshot.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | // 6 | // This file implements the "bridge" between Java and C++. 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | #include "include/org_rocksdb_Snapshot.h" 13 | #include "rocksdb/db.h" 14 | #include "rocksjni/portal.h" 15 | 16 | /* 17 | * Class: org_rocksdb_Snapshot 18 | * Method: getSequenceNumber 19 | * Signature: (J)J 20 | */ 21 | jlong Java_org_rocksdb_Snapshot_getSequenceNumber(JNIEnv* env, 22 | jobject jobj, jlong jsnapshot_handle) { 23 | auto* snapshot = reinterpret_cast( 24 | jsnapshot_handle); 25 | return snapshot->GetSequenceNumber(); 26 | } 27 | -------------------------------------------------------------------------------- /java/rocksjni/statisticsjni.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | // 6 | // This file implements the callback "bridge" between Java and C++ for 7 | // rocksdb::Statistics 8 | 9 | #include "rocksjni/statisticsjni.h" 10 | 11 | namespace rocksdb { 12 | 13 | StatisticsJni::StatisticsJni(std::shared_ptr stats) 14 | : StatisticsImpl(stats, false), m_ignore_histograms() { 15 | } 16 | 17 | StatisticsJni::StatisticsJni(std::shared_ptr stats, 18 | const std::set ignore_histograms) : StatisticsImpl(stats, false), 19 | m_ignore_histograms(ignore_histograms) { 20 | } 21 | 22 | bool StatisticsJni::HistEnabledForType(uint32_t type) const { 23 | if (type >= HISTOGRAM_ENUM_MAX) { 24 | return false; 25 | } 26 | 27 | if (m_ignore_histograms.count(type) > 0) { 28 | return false; 29 | } 30 | 31 | return true; 32 | } 33 | }; -------------------------------------------------------------------------------- /java/rocksjni/statisticsjni.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | // 6 | // This file implements the callback "bridge" between Java and C++ for 7 | // rocksdb::Statistics 8 | 9 | #ifndef JAVA_ROCKSJNI_STATISTICSJNI_H_ 10 | #define JAVA_ROCKSJNI_STATISTICSJNI_H_ 11 | 12 | #include 13 | #include 14 | #include 15 | #include "rocksdb/statistics.h" 16 | #include "monitoring/statistics.h" 17 | 18 | namespace rocksdb { 19 | 20 | class StatisticsJni : public StatisticsImpl { 21 | public: 22 | StatisticsJni(std::shared_ptr stats); 23 | StatisticsJni(std::shared_ptr stats, 24 | const std::set ignore_histograms); 25 | virtual bool HistEnabledForType(uint32_t type) const override; 26 | 27 | private: 28 | const std::set m_ignore_histograms; 29 | }; 30 | 31 | } // namespace rocksdb 32 | 33 | #endif // JAVA_ROCKSJNI_STATISTICSJNI_H_ -------------------------------------------------------------------------------- /java/src/main/java/org/rocksdb/AbstractCompactionFilter.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | package org.rocksdb; 6 | 7 | /** 8 | * A CompactionFilter allows an application to modify/delete a key-value at 9 | * the time of compaction. 10 | * 11 | * At present we just permit an overriding Java class to wrap a C++ 12 | * implementation 13 | */ 14 | public abstract class AbstractCompactionFilter> 15 | extends RocksObject { 16 | 17 | protected AbstractCompactionFilter(final long nativeHandle) { 18 | super(nativeHandle); 19 | } 20 | 21 | /** 22 | * Deletes underlying C++ compaction pointer. 23 | * 24 | * Note that this function should be called only after all 25 | * RocksDB instances referencing the compaction filter are closed. 26 | * Otherwise an undefined behavior will occur. 27 | */ 28 | @Override 29 | protected final native void disposeInternal(final long handle); 30 | } 31 | -------------------------------------------------------------------------------- /java/src/main/java/org/rocksdb/BuiltinComparator.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | 6 | package org.rocksdb; 7 | 8 | /** 9 | * Builtin RocksDB comparators 10 | * 11 | *
    12 | *
  1. BYTEWISE_COMPARATOR - Sorts all keys in ascending bytewise 13 | * order.
  2. 14 | *
  3. REVERSE_BYTEWISE_COMPARATOR - Sorts all keys in descending bytewise 15 | * order
  4. 16 | *
17 | */ 18 | public enum BuiltinComparator { 19 | BYTEWISE_COMPARATOR, REVERSE_BYTEWISE_COMPARATOR 20 | } 21 | -------------------------------------------------------------------------------- /java/src/main/java/org/rocksdb/Cache.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | 6 | package org.rocksdb; 7 | 8 | 9 | public abstract class Cache extends RocksObject { 10 | protected Cache(final long nativeHandle) { 11 | super(nativeHandle); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /java/src/main/java/org/rocksdb/CassandraCompactionFilter.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under the BSD-style license found in the 3 | // LICENSE file in the root directory of this source tree. An additional grant 4 | // of patent rights can be found in the PATENTS file in the same directory. 5 | 6 | package org.rocksdb; 7 | 8 | /** 9 | * Just a Java wrapper around CassandraCompactionFilter implemented in C++ 10 | */ 11 | public class CassandraCompactionFilter 12 | extends AbstractCompactionFilter { 13 | public CassandraCompactionFilter(boolean purgeTtlOnExpiration) { 14 | super(createNewCassandraCompactionFilter0(purgeTtlOnExpiration)); 15 | } 16 | 17 | private native static long createNewCassandraCompactionFilter0(boolean purgeTtlOnExpiration); 18 | } 19 | -------------------------------------------------------------------------------- /java/src/main/java/org/rocksdb/CassandraValueMergeOperator.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | // This source code is also licensed under the GPLv2 license found in the 6 | // COPYING file in the root directory of this source tree. 7 | 8 | package org.rocksdb; 9 | 10 | /** 11 | * CassandraValueMergeOperator is a merge operator that merges two cassandra wide column 12 | * values. 13 | */ 14 | public class CassandraValueMergeOperator extends MergeOperator { 15 | public CassandraValueMergeOperator() { 16 | super(newSharedCassandraValueMergeOperator()); 17 | } 18 | 19 | private native static long newSharedCassandraValueMergeOperator(); 20 | 21 | @Override protected final native void disposeInternal(final long handle); 22 | } 23 | -------------------------------------------------------------------------------- /java/src/main/java/org/rocksdb/ChecksumType.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | 6 | package org.rocksdb; 7 | 8 | /** 9 | * Checksum types used in conjunction with BlockBasedTable. 10 | */ 11 | public enum ChecksumType { 12 | /** 13 | * Not implemented yet. 14 | */ 15 | kNoChecksum((byte) 0), 16 | /** 17 | * CRC32 Checksum 18 | */ 19 | kCRC32c((byte) 1), 20 | /** 21 | * XX Hash 22 | */ 23 | kxxHash((byte) 2); 24 | 25 | /** 26 | * Returns the byte value of the enumerations value 27 | * 28 | * @return byte representation 29 | */ 30 | public byte getValue() { 31 | return value_; 32 | } 33 | 34 | private ChecksumType(byte value) { 35 | value_ = value; 36 | } 37 | 38 | private final byte value_; 39 | } 40 | -------------------------------------------------------------------------------- /java/src/main/java/org/rocksdb/Comparator.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | 6 | package org.rocksdb; 7 | 8 | /** 9 | * Base class for comparators which will receive 10 | * byte[] based access via org.rocksdb.Slice in their 11 | * compare method implementation. 12 | * 13 | * byte[] based slices perform better when small keys 14 | * are involved. When using larger keys consider 15 | * using @see org.rocksdb.DirectComparator 16 | */ 17 | public abstract class Comparator extends AbstractComparator { 18 | 19 | private final long nativeHandle_; 20 | 21 | public Comparator(final ComparatorOptions copt) { 22 | super(); 23 | this.nativeHandle_ = createNewComparator0(copt.nativeHandle_); 24 | } 25 | 26 | @Override 27 | protected final long getNativeHandle() { 28 | return nativeHandle_; 29 | } 30 | 31 | private native long createNewComparator0(final long comparatorOptionsHandle); 32 | } 33 | -------------------------------------------------------------------------------- /java/src/main/java/org/rocksdb/DbPath.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | 6 | package org.rocksdb; 7 | 8 | import java.nio.file.Path; 9 | 10 | /** 11 | * Tuple of database path and target size 12 | */ 13 | public class DbPath { 14 | final Path path; 15 | final long targetSize; 16 | 17 | public DbPath(final Path path, final long targetSize) { 18 | this.path = path; 19 | this.targetSize = targetSize; 20 | } 21 | 22 | @Override 23 | public boolean equals(final Object o) { 24 | if (this == o) { 25 | return true; 26 | } 27 | 28 | if (o == null || getClass() != o.getClass()) { 29 | return false; 30 | } 31 | 32 | final DbPath dbPath = (DbPath) o; 33 | 34 | if (targetSize != dbPath.targetSize) { 35 | return false; 36 | } 37 | 38 | return path != null ? path.equals(dbPath.path) : dbPath.path == null; 39 | } 40 | 41 | @Override 42 | public int hashCode() { 43 | int result = path != null ? path.hashCode() : 0; 44 | result = 31 * result + (int) (targetSize ^ (targetSize >>> 32)); 45 | return result; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /java/src/main/java/org/rocksdb/DirectComparator.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | 6 | package org.rocksdb; 7 | 8 | /** 9 | * Base class for comparators which will receive 10 | * ByteBuffer based access via org.rocksdb.DirectSlice 11 | * in their compare method implementation. 12 | * 13 | * ByteBuffer based slices perform better when large keys 14 | * are involved. When using smaller keys consider 15 | * using @see org.rocksdb.Comparator 16 | */ 17 | public abstract class DirectComparator extends AbstractComparator { 18 | 19 | private final long nativeHandle_; 20 | 21 | public DirectComparator(final ComparatorOptions copt) { 22 | super(); 23 | this.nativeHandle_ = createNewDirectComparator0(copt.nativeHandle_); 24 | } 25 | 26 | @Override 27 | protected final long getNativeHandle() { 28 | return nativeHandle_; 29 | } 30 | 31 | private native long createNewDirectComparator0( 32 | final long comparatorOptionsHandle); 33 | } 34 | -------------------------------------------------------------------------------- /java/src/main/java/org/rocksdb/Experimental.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | 6 | package org.rocksdb; 7 | 8 | import java.lang.annotation.ElementType; 9 | import java.lang.annotation.Documented; 10 | import java.lang.annotation.Retention; 11 | import java.lang.annotation.RetentionPolicy; 12 | import java.lang.annotation.Target; 13 | 14 | /** 15 | * Marks a feature as experimental, meaning that it is likely 16 | * to change or even be removed/re-engineered in the future 17 | */ 18 | @Documented 19 | @Retention(RetentionPolicy.SOURCE) 20 | @Target({ElementType.TYPE, ElementType.METHOD}) 21 | public @interface Experimental { 22 | String value(); 23 | } 24 | -------------------------------------------------------------------------------- /java/src/main/java/org/rocksdb/Filter.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | 6 | package org.rocksdb; 7 | 8 | /** 9 | * Filters are stored in rocksdb and are consulted automatically 10 | * by rocksdb to decide whether or not to read some 11 | * information from disk. In many cases, a filter can cut down the 12 | * number of disk seeks form a handful to a single disk seek per 13 | * DB::Get() call. 14 | */ 15 | public abstract class Filter extends RocksObject { 16 | 17 | protected Filter(final long nativeHandle) { 18 | super(nativeHandle); 19 | } 20 | 21 | /** 22 | * Deletes underlying C++ filter pointer. 23 | * 24 | * Note that this function should be called only after all 25 | * RocksDB instances referencing the filter are closed. 26 | * Otherwise an undefined behavior will occur. 27 | */ 28 | @Override 29 | protected void disposeInternal() { 30 | disposeInternal(nativeHandle_); 31 | } 32 | 33 | @Override 34 | protected final native void disposeInternal(final long handle); 35 | } 36 | -------------------------------------------------------------------------------- /java/src/main/java/org/rocksdb/HistogramData.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | 6 | package org.rocksdb; 7 | 8 | public class HistogramData { 9 | private final double median_; 10 | private final double percentile95_; 11 | private final double percentile99_; 12 | private final double average_; 13 | private final double standardDeviation_; 14 | 15 | public HistogramData(final double median, final double percentile95, 16 | final double percentile99, final double average, 17 | final double standardDeviation) { 18 | median_ = median; 19 | percentile95_ = percentile95; 20 | percentile99_ = percentile99; 21 | average_ = average; 22 | standardDeviation_ = standardDeviation; 23 | } 24 | 25 | public double getMedian() { 26 | return median_; 27 | } 28 | 29 | public double getPercentile95() { 30 | return percentile95_; 31 | } 32 | 33 | public double getPercentile99() { 34 | return percentile99_; 35 | } 36 | 37 | public double getAverage() { 38 | return average_; 39 | } 40 | 41 | public double getStandardDeviation() { 42 | return standardDeviation_; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /java/src/main/java/org/rocksdb/IndexType.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | 6 | package org.rocksdb; 7 | 8 | /** 9 | * IndexType used in conjunction with BlockBasedTable. 10 | */ 11 | public enum IndexType { 12 | /** 13 | * A space efficient index block that is optimized for 14 | * binary-search-based index. 15 | */ 16 | kBinarySearch((byte) 0), 17 | /** 18 | * The hash index, if enabled, will do the hash lookup when 19 | * {@code Options.prefix_extractor} is provided. 20 | */ 21 | kHashSearch((byte) 1), 22 | /** 23 | * A two-level index implementation. Both levels are binary search indexes. 24 | */ 25 | kTwoLevelIndexSearch((byte) 2); 26 | 27 | /** 28 | * Returns the byte value of the enumerations value 29 | * 30 | * @return byte representation 31 | */ 32 | public byte getValue() { 33 | return value_; 34 | } 35 | 36 | private IndexType(byte value) { 37 | value_ = value; 38 | } 39 | 40 | private final byte value_; 41 | } 42 | -------------------------------------------------------------------------------- /java/src/main/java/org/rocksdb/InfoLogLevel.java: -------------------------------------------------------------------------------- 1 | package org.rocksdb; 2 | 3 | /** 4 | * RocksDB log levels. 5 | */ 6 | public enum InfoLogLevel { 7 | DEBUG_LEVEL((byte)0), 8 | INFO_LEVEL((byte)1), 9 | WARN_LEVEL((byte)2), 10 | ERROR_LEVEL((byte)3), 11 | FATAL_LEVEL((byte)4), 12 | HEADER_LEVEL((byte)5), 13 | NUM_INFO_LOG_LEVELS((byte)6); 14 | 15 | private final byte value_; 16 | 17 | private InfoLogLevel(final byte value) { 18 | value_ = value; 19 | } 20 | 21 | /** 22 | * Returns the byte value of the enumerations value 23 | * 24 | * @return byte representation 25 | */ 26 | public byte getValue() { 27 | return value_; 28 | } 29 | 30 | /** 31 | * Get InfoLogLevel by byte value. 32 | * 33 | * @param value byte representation of InfoLogLevel. 34 | * 35 | * @return {@link org.rocksdb.InfoLogLevel} instance. 36 | * @throws java.lang.IllegalArgumentException if an invalid 37 | * value is provided. 38 | */ 39 | public static InfoLogLevel getInfoLogLevel(final byte value) { 40 | for (final InfoLogLevel infoLogLevel : InfoLogLevel.values()) { 41 | if (infoLogLevel.getValue() == value){ 42 | return infoLogLevel; 43 | } 44 | } 45 | throw new IllegalArgumentException( 46 | "Illegal value provided for InfoLogLevel."); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /java/src/main/java/org/rocksdb/MemTableConfig.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | package org.rocksdb; 6 | 7 | /** 8 | * MemTableConfig is used to config the internal mem-table of a RocksDB. 9 | * It is required for each memtable to have one such sub-class to allow 10 | * Java developers to use it. 11 | * 12 | * To make a RocksDB to use a specific MemTable format, its associated 13 | * MemTableConfig should be properly set and passed into Options 14 | * via Options.setMemTableFactory() and open the db using that Options. 15 | * 16 | * @see Options 17 | */ 18 | public abstract class MemTableConfig { 19 | /** 20 | * This function should only be called by Options.setMemTableConfig(), 21 | * which will create a c++ shared-pointer to the c++ MemTableRepFactory 22 | * that associated with the Java MemTableConfig. 23 | * 24 | * @see Options#setMemTableConfig(MemTableConfig) 25 | * 26 | * @return native handle address to native memory table instance. 27 | */ 28 | abstract protected long newMemTableFactoryHandle(); 29 | } 30 | -------------------------------------------------------------------------------- /java/src/main/java/org/rocksdb/MergeOperator.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014, Vlad Balan (vlad.gm@gmail.com). All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | 6 | package org.rocksdb; 7 | 8 | /** 9 | * MergeOperator holds an operator to be applied when compacting 10 | * two merge operands held under the same key in order to obtain a single 11 | * value. 12 | */ 13 | public abstract class MergeOperator extends RocksObject { 14 | protected MergeOperator(final long nativeHandle) { 15 | super(nativeHandle); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /java/src/main/java/org/rocksdb/ReadTier.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | 6 | package org.rocksdb; 7 | 8 | /** 9 | * RocksDB {@link ReadOptions} read tiers. 10 | */ 11 | public enum ReadTier { 12 | READ_ALL_TIER((byte)0), 13 | BLOCK_CACHE_TIER((byte)1), 14 | PERSISTED_TIER((byte)2); 15 | 16 | private final byte value; 17 | 18 | ReadTier(final byte value) { 19 | this.value = value; 20 | } 21 | 22 | /** 23 | * Returns the byte value of the enumerations value 24 | * 25 | * @return byte representation 26 | */ 27 | public byte getValue() { 28 | return value; 29 | } 30 | 31 | /** 32 | * Get ReadTier by byte value. 33 | * 34 | * @param value byte representation of ReadTier. 35 | * 36 | * @return {@link org.rocksdb.ReadTier} instance or null. 37 | * @throws java.lang.IllegalArgumentException if an invalid 38 | * value is provided. 39 | */ 40 | public static ReadTier getReadTier(final byte value) { 41 | for (final ReadTier readTier : ReadTier.values()) { 42 | if (readTier.getValue() == value){ 43 | return readTier; 44 | } 45 | } 46 | throw new IllegalArgumentException("Illegal value provided for ReadTier."); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /java/src/main/java/org/rocksdb/RemoveEmptyValueCompactionFilter.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | 6 | package org.rocksdb; 7 | 8 | /** 9 | * Just a Java wrapper around EmptyValueCompactionFilter implemented in C++ 10 | */ 11 | public class RemoveEmptyValueCompactionFilter 12 | extends AbstractCompactionFilter { 13 | public RemoveEmptyValueCompactionFilter() { 14 | super(createNewRemoveEmptyValueCompactionFilter0()); 15 | } 16 | 17 | private native static long createNewRemoveEmptyValueCompactionFilter0(); 18 | } 19 | -------------------------------------------------------------------------------- /java/src/main/java/org/rocksdb/RestoreOptions.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | 6 | package org.rocksdb; 7 | 8 | /** 9 | * RestoreOptions to control the behavior of restore. 10 | * 11 | * Note that dispose() must be called before this instance become out-of-scope 12 | * to release the allocated memory in c++. 13 | * 14 | */ 15 | public class RestoreOptions extends RocksObject { 16 | /** 17 | * Constructor 18 | * 19 | * @param keepLogFiles If true, restore won't overwrite the existing log files 20 | * in wal_dir. It will also move all log files from archive directory to 21 | * wal_dir. Use this option in combination with 22 | * BackupableDBOptions::backup_log_files = false for persisting in-memory 23 | * databases. 24 | * Default: false 25 | */ 26 | public RestoreOptions(final boolean keepLogFiles) { 27 | super(newRestoreOptions(keepLogFiles)); 28 | } 29 | 30 | private native static long newRestoreOptions(boolean keepLogFiles); 31 | @Override protected final native void disposeInternal(final long handle); 32 | } 33 | -------------------------------------------------------------------------------- /java/src/main/java/org/rocksdb/RocksDBException.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | 6 | package org.rocksdb; 7 | 8 | /** 9 | * A RocksDBException encapsulates the error of an operation. This exception 10 | * type is used to describe an internal error from the c++ rocksdb library. 11 | */ 12 | public class RocksDBException extends Exception { 13 | 14 | /* @Nullable */ private final Status status; 15 | 16 | /** 17 | * The private construct used by a set of public static factory method. 18 | * 19 | * @param msg the specified error message. 20 | */ 21 | public RocksDBException(final String msg) { 22 | this(msg, null); 23 | } 24 | 25 | public RocksDBException(final String msg, final Status status) { 26 | super(msg); 27 | this.status = status; 28 | } 29 | 30 | public RocksDBException(final Status status) { 31 | super(status.getState() != null ? status.getState() 32 | : status.getCodeString()); 33 | this.status = status; 34 | } 35 | 36 | /** 37 | * Get the status returned from RocksDB 38 | * 39 | * @return The status reported by RocksDB, or null if no status is available 40 | */ 41 | public Status getStatus() { 42 | return status; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /java/src/main/java/org/rocksdb/RocksMemEnv.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | 6 | package org.rocksdb; 7 | 8 | /** 9 | * RocksDB memory environment. 10 | */ 11 | public class RocksMemEnv extends Env { 12 | 13 | /** 14 | *

Creates a new RocksDB environment that stores its data 15 | * in memory and delegates all non-file-storage tasks to 16 | * base_env. The caller must delete the result when it is 17 | * no longer needed.

18 | * 19 | *

{@code *base_env} must remain live while the result is in use.

20 | */ 21 | public RocksMemEnv() { 22 | super(createMemEnv()); 23 | } 24 | 25 | private static native long createMemEnv(); 26 | @Override protected final native void disposeInternal(final long handle); 27 | } 28 | -------------------------------------------------------------------------------- /java/src/main/java/org/rocksdb/Snapshot.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | 6 | package org.rocksdb; 7 | 8 | /** 9 | * Snapshot of database 10 | */ 11 | public class Snapshot extends RocksObject { 12 | Snapshot(final long nativeHandle) { 13 | super(nativeHandle); 14 | } 15 | 16 | /** 17 | * Return the associated sequence number; 18 | * 19 | * @return the associated sequence number of 20 | * this snapshot. 21 | */ 22 | public long getSequenceNumber() { 23 | assert(isOwningHandle()); 24 | return getSequenceNumber(nativeHandle_); 25 | } 26 | 27 | /** 28 | * Dont release C++ Snapshot pointer. The pointer 29 | * to the snapshot is released by the database 30 | * instance. 31 | */ 32 | @Override 33 | protected final void disposeInternal(final long handle) { 34 | } 35 | 36 | private native long getSequenceNumber(long handle); 37 | } 38 | -------------------------------------------------------------------------------- /java/src/main/java/org/rocksdb/StatisticsCollectorCallback.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | 6 | package org.rocksdb; 7 | 8 | /** 9 | * Callback interface provided to StatisticsCollector. 10 | * 11 | * Thread safety: 12 | * StatisticsCollector doesn't make any guarantees about thread safety. 13 | * If the same reference of StatisticsCollectorCallback is passed to multiple 14 | * StatisticsCollector references, then its the responsibility of the 15 | * user to make StatisticsCollectorCallback's implementation thread-safe. 16 | * 17 | */ 18 | public interface StatisticsCollectorCallback { 19 | /** 20 | * Callback function to get ticker values. 21 | * @param tickerType Ticker type. 22 | * @param tickerCount Value of ticker type. 23 | */ 24 | void tickerCallback(TickerType tickerType, long tickerCount); 25 | 26 | /** 27 | * Callback function to get histogram values. 28 | * @param histType Histogram type. 29 | * @param histData Histogram data. 30 | */ 31 | void histogramCallback(HistogramType histType, HistogramData histData); 32 | } 33 | -------------------------------------------------------------------------------- /java/src/main/java/org/rocksdb/StatsCollectorInput.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | 6 | package org.rocksdb; 7 | 8 | /** 9 | * Contains all information necessary to collect statistics from one instance 10 | * of DB statistics. 11 | */ 12 | public class StatsCollectorInput { 13 | private final Statistics _statistics; 14 | private final StatisticsCollectorCallback _statsCallback; 15 | 16 | /** 17 | * Constructor for StatsCollectorInput. 18 | * 19 | * @param statistics Reference of DB statistics. 20 | * @param statsCallback Reference of statistics callback interface. 21 | */ 22 | public StatsCollectorInput(final Statistics statistics, 23 | final StatisticsCollectorCallback statsCallback) { 24 | _statistics = statistics; 25 | _statsCallback = statsCallback; 26 | } 27 | 28 | public Statistics getStatistics() { 29 | return _statistics; 30 | } 31 | 32 | public StatisticsCollectorCallback getCallback() { 33 | return _statsCallback; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /java/src/main/java/org/rocksdb/StringAppendOperator.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014, Vlad Balan (vlad.gm@gmail.com). All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | 6 | package org.rocksdb; 7 | 8 | /** 9 | * StringAppendOperator is a merge operator that concatenates 10 | * two strings. 11 | */ 12 | public class StringAppendOperator extends MergeOperator { 13 | public StringAppendOperator() { 14 | super(newSharedStringAppendOperator()); 15 | } 16 | 17 | private native static long newSharedStringAppendOperator(); 18 | @Override protected final native void disposeInternal(final long handle); 19 | } 20 | -------------------------------------------------------------------------------- /java/src/main/java/org/rocksdb/TableFormatConfig.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | package org.rocksdb; 6 | 7 | /** 8 | * TableFormatConfig is used to config the internal Table format of a RocksDB. 9 | * To make a RocksDB to use a specific Table format, its associated 10 | * TableFormatConfig should be properly set and passed into Options via 11 | * Options.setTableFormatConfig() and open the db using that Options. 12 | */ 13 | public abstract class TableFormatConfig { 14 | /** 15 | *

This function should only be called by Options.setTableFormatConfig(), 16 | * which will create a c++ shared-pointer to the c++ TableFactory 17 | * that associated with the Java TableFormatConfig.

18 | * 19 | * @return native handle address to native table instance. 20 | */ 21 | abstract protected long newTableFactoryHandle(); 22 | } 23 | -------------------------------------------------------------------------------- /java/src/main/java/org/rocksdb/VectorMemTableConfig.java: -------------------------------------------------------------------------------- 1 | package org.rocksdb; 2 | 3 | /** 4 | * The config for vector memtable representation. 5 | */ 6 | public class VectorMemTableConfig extends MemTableConfig { 7 | public static final int DEFAULT_RESERVED_SIZE = 0; 8 | 9 | /** 10 | * VectorMemTableConfig constructor 11 | */ 12 | public VectorMemTableConfig() { 13 | reservedSize_ = DEFAULT_RESERVED_SIZE; 14 | } 15 | 16 | /** 17 | * Set the initial size of the vector that will be used 18 | * by the memtable created based on this config. 19 | * 20 | * @param size the initial size of the vector. 21 | * @return the reference to the current config. 22 | */ 23 | public VectorMemTableConfig setReservedSize(final int size) { 24 | reservedSize_ = size; 25 | return this; 26 | } 27 | 28 | /** 29 | * Returns the initial size of the vector used by the memtable 30 | * created based on this config. 31 | * 32 | * @return the initial size of the vector. 33 | */ 34 | public int reservedSize() { 35 | return reservedSize_; 36 | } 37 | 38 | @Override protected long newMemTableFactoryHandle() { 39 | return newMemTableFactoryHandle(reservedSize_); 40 | } 41 | 42 | private native long newMemTableFactoryHandle(long reservedSize) 43 | throws IllegalArgumentException; 44 | private int reservedSize_; 45 | } 46 | -------------------------------------------------------------------------------- /java/src/main/java/org/rocksdb/util/ReverseBytewiseComparator.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | 6 | package org.rocksdb.util; 7 | 8 | import org.rocksdb.BuiltinComparator; 9 | import org.rocksdb.ComparatorOptions; 10 | import org.rocksdb.Slice; 11 | 12 | /** 13 | * This is a Java Native implementation of the C++ 14 | * equivalent ReverseBytewiseComparatorImpl using {@link Slice} 15 | * 16 | * The performance of Comparators implemented in Java is always 17 | * less than their C++ counterparts due to the bridging overhead, 18 | * as such you likely don't want to use this apart from benchmarking 19 | * and you most likely instead wanted 20 | * {@link BuiltinComparator#REVERSE_BYTEWISE_COMPARATOR} 21 | */ 22 | public class ReverseBytewiseComparator extends BytewiseComparator { 23 | 24 | public ReverseBytewiseComparator(final ComparatorOptions copt) { 25 | super(copt); 26 | } 27 | 28 | @Override 29 | public String name() { 30 | return "rocksdb.java.ReverseBytewiseComparator"; 31 | } 32 | 33 | @Override 34 | public int compare(final Slice a, final Slice b) { 35 | return -super.compare(a, b); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /java/src/main/java/org/rocksdb/util/SizeUnit.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | 6 | package org.rocksdb.util; 7 | 8 | public class SizeUnit { 9 | public static final long KB = 1024L; 10 | public static final long MB = KB * KB; 11 | public static final long GB = KB * MB; 12 | public static final long TB = KB * GB; 13 | public static final long PB = KB * TB; 14 | 15 | private SizeUnit() {} 16 | } 17 | -------------------------------------------------------------------------------- /java/src/test/java/org/rocksdb/ClockCacheTest.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | 6 | package org.rocksdb; 7 | 8 | import org.junit.Test; 9 | 10 | public class ClockCacheTest { 11 | 12 | static { 13 | RocksDB.loadLibrary(); 14 | } 15 | 16 | @Test 17 | public void newClockCache() { 18 | final long capacity = 1000; 19 | final int numShardBits = 16; 20 | final boolean strictCapacityLimit = true; 21 | try(final Cache clockCache = new ClockCache(capacity, 22 | numShardBits, strictCapacityLimit)) { 23 | //no op 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /java/src/test/java/org/rocksdb/CompactionOptionsFIFOTest.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | 6 | package org.rocksdb; 7 | 8 | import org.junit.Test; 9 | 10 | import static org.assertj.core.api.Assertions.assertThat; 11 | 12 | public class CompactionOptionsFIFOTest { 13 | 14 | static { 15 | RocksDB.loadLibrary(); 16 | } 17 | 18 | @Test 19 | public void maxTableFilesSize() { 20 | final long size = 500 * 1024 * 1026; 21 | try(final CompactionOptionsFIFO opt = new CompactionOptionsFIFO()) { 22 | opt.setMaxTableFilesSize(size); 23 | assertThat(opt.maxTableFilesSize()).isEqualTo(size); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /java/src/test/java/org/rocksdb/CompactionPriorityTest.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | 6 | package org.rocksdb; 7 | 8 | import org.junit.Test; 9 | 10 | import static org.assertj.core.api.Assertions.assertThat; 11 | 12 | public class CompactionPriorityTest { 13 | 14 | @Test(expected = IllegalArgumentException.class) 15 | public void failIfIllegalByteValueProvided() { 16 | CompactionPriority.getCompactionPriority((byte) -1); 17 | } 18 | 19 | @Test 20 | public void getCompactionPriority() { 21 | assertThat(CompactionPriority.getCompactionPriority( 22 | CompactionPriority.OldestLargestSeqFirst.getValue())) 23 | .isEqualTo(CompactionPriority.OldestLargestSeqFirst); 24 | } 25 | 26 | @Test 27 | public void valueOf() { 28 | assertThat(CompactionPriority.valueOf("OldestSmallestSeqFirst")). 29 | isEqualTo(CompactionPriority.OldestSmallestSeqFirst); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /java/src/test/java/org/rocksdb/CompactionStopStyleTest.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | 6 | package org.rocksdb; 7 | 8 | import org.junit.Test; 9 | 10 | import static org.assertj.core.api.Assertions.assertThat; 11 | 12 | public class CompactionStopStyleTest { 13 | 14 | @Test(expected = IllegalArgumentException.class) 15 | public void failIfIllegalByteValueProvided() { 16 | CompactionStopStyle.getCompactionStopStyle((byte) -1); 17 | } 18 | 19 | @Test 20 | public void getCompactionStopStyle() { 21 | assertThat(CompactionStopStyle.getCompactionStopStyle( 22 | CompactionStopStyle.CompactionStopStyleTotalSize.getValue())) 23 | .isEqualTo(CompactionStopStyle.CompactionStopStyleTotalSize); 24 | } 25 | 26 | @Test 27 | public void valueOf() { 28 | assertThat(CompactionStopStyle.valueOf("CompactionStopStyleSimilarSize")). 29 | isEqualTo(CompactionStopStyle.CompactionStopStyleSimilarSize); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /java/src/test/java/org/rocksdb/ComparatorOptionsTest.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | 6 | package org.rocksdb; 7 | 8 | import org.junit.ClassRule; 9 | import org.junit.Test; 10 | 11 | import static org.assertj.core.api.Assertions.assertThat; 12 | 13 | public class ComparatorOptionsTest { 14 | 15 | @ClassRule 16 | public static final RocksMemoryResource rocksMemoryResource = 17 | new RocksMemoryResource(); 18 | 19 | @Test 20 | public void comparatorOptions() { 21 | try(final ComparatorOptions copt = new ComparatorOptions()) { 22 | 23 | assertThat(copt).isNotNull(); 24 | // UseAdaptiveMutex test 25 | copt.setUseAdaptiveMutex(true); 26 | assertThat(copt.useAdaptiveMutex()).isTrue(); 27 | 28 | copt.setUseAdaptiveMutex(false); 29 | assertThat(copt.useAdaptiveMutex()).isFalse(); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /java/src/test/java/org/rocksdb/CompressionTypesTest.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | 6 | package org.rocksdb; 7 | 8 | import org.junit.Test; 9 | 10 | 11 | public class CompressionTypesTest { 12 | @Test 13 | public void getCompressionType() { 14 | for (final CompressionType compressionType : CompressionType.values()) { 15 | String libraryName = compressionType.getLibraryName(); 16 | compressionType.equals(CompressionType.getCompressionType( 17 | libraryName)); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /java/src/test/java/org/rocksdb/FilterTest.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | 6 | package org.rocksdb; 7 | 8 | import org.junit.ClassRule; 9 | import org.junit.Test; 10 | 11 | public class FilterTest { 12 | 13 | @ClassRule 14 | public static final RocksMemoryResource rocksMemoryResource = 15 | new RocksMemoryResource(); 16 | 17 | @Test 18 | public void filter() { 19 | // new Bloom filter 20 | final BlockBasedTableConfig blockConfig = new BlockBasedTableConfig(); 21 | try(final Options options = new Options()) { 22 | 23 | try(final Filter bloomFilter = new BloomFilter()) { 24 | blockConfig.setFilter(bloomFilter); 25 | options.setTableFormatConfig(blockConfig); 26 | } 27 | 28 | try(final Filter bloomFilter = new BloomFilter(10)) { 29 | blockConfig.setFilter(bloomFilter); 30 | options.setTableFormatConfig(blockConfig); 31 | } 32 | 33 | try(final Filter bloomFilter = new BloomFilter(10, false)) { 34 | blockConfig.setFilter(bloomFilter); 35 | options.setTableFormatConfig(blockConfig); 36 | } 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /java/src/test/java/org/rocksdb/LRUCacheTest.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | 6 | package org.rocksdb; 7 | 8 | import org.junit.Test; 9 | 10 | public class LRUCacheTest { 11 | 12 | static { 13 | RocksDB.loadLibrary(); 14 | } 15 | 16 | @Test 17 | public void newLRUCache() { 18 | final long capacity = 1000; 19 | final int numShardBits = 16; 20 | final boolean strictCapacityLimit = true; 21 | final double highPriPoolRatio = 5; 22 | try(final Cache lruCache = new LRUCache(capacity, 23 | numShardBits, strictCapacityLimit, highPriPoolRatio)) { 24 | //no op 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /java/src/test/java/org/rocksdb/RocksMemoryResource.java: -------------------------------------------------------------------------------- 1 | package org.rocksdb; 2 | 3 | import org.junit.rules.ExternalResource; 4 | 5 | /** 6 | * Resource to trigger garbage collection after each test 7 | * run. 8 | * 9 | * @deprecated Will be removed with the implementation of 10 | * {@link RocksObject#finalize()} 11 | */ 12 | @Deprecated 13 | public class RocksMemoryResource extends ExternalResource { 14 | 15 | static { 16 | RocksDB.loadLibrary(); 17 | } 18 | 19 | @Override 20 | protected void after() { 21 | System.gc(); 22 | System.runFinalization(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /java/src/test/java/org/rocksdb/StatsCallbackMock.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | 6 | package org.rocksdb; 7 | 8 | public class StatsCallbackMock implements StatisticsCollectorCallback { 9 | public int tickerCallbackCount = 0; 10 | public int histCallbackCount = 0; 11 | 12 | public void tickerCallback(TickerType tickerType, long tickerCount) { 13 | tickerCallbackCount++; 14 | } 15 | 16 | public void histogramCallback(HistogramType histType, 17 | HistogramData histData) { 18 | histCallbackCount++; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /java/src/test/java/org/rocksdb/Types.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | 6 | package org.rocksdb; 7 | 8 | /** 9 | * Simple type conversion methods 10 | * for use in tests 11 | */ 12 | public class Types { 13 | 14 | /** 15 | * Convert first 4 bytes of a byte array to an int 16 | * 17 | * @param data The byte array 18 | * 19 | * @return An integer 20 | */ 21 | public static int byteToInt(final byte data[]) { 22 | return (data[0] & 0xff) | 23 | ((data[1] & 0xff) << 8) | 24 | ((data[2] & 0xff) << 16) | 25 | ((data[3] & 0xff) << 24); 26 | } 27 | 28 | /** 29 | * Convert an int to 4 bytes 30 | * 31 | * @param v The int 32 | * 33 | * @return A byte array containing 4 bytes 34 | */ 35 | public static byte[] intToByte(final int v) { 36 | return new byte[] { 37 | (byte)((v >>> 0) & 0xff), 38 | (byte)((v >>> 8) & 0xff), 39 | (byte)((v >>> 16) & 0xff), 40 | (byte)((v >>> 24) & 0xff) 41 | }; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /java/src/test/java/org/rocksdb/WALRecoveryModeTest.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | 6 | package org.rocksdb; 7 | 8 | import org.junit.Test; 9 | 10 | import static org.assertj.core.api.Assertions.assertThat; 11 | 12 | 13 | public class WALRecoveryModeTest { 14 | 15 | @Test 16 | public void getWALRecoveryMode() { 17 | for (final WALRecoveryMode walRecoveryMode : WALRecoveryMode.values()) { 18 | assertThat(WALRecoveryMode.getWALRecoveryMode(walRecoveryMode.getValue())) 19 | .isEqualTo(walRecoveryMode); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /java/src/test/java/org/rocksdb/util/SizeUnitTest.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | package org.rocksdb.util; 6 | 7 | import org.junit.Test; 8 | 9 | import static org.assertj.core.api.Assertions.assertThat; 10 | 11 | public class SizeUnitTest { 12 | 13 | public static final long COMPUTATION_UNIT = 1024L; 14 | 15 | @Test 16 | public void sizeUnit() { 17 | assertThat(SizeUnit.KB).isEqualTo(COMPUTATION_UNIT); 18 | assertThat(SizeUnit.MB).isEqualTo( 19 | SizeUnit.KB * COMPUTATION_UNIT); 20 | assertThat(SizeUnit.GB).isEqualTo( 21 | SizeUnit.MB * COMPUTATION_UNIT); 22 | assertThat(SizeUnit.TB).isEqualTo( 23 | SizeUnit.GB * COMPUTATION_UNIT); 24 | assertThat(SizeUnit.PB).isEqualTo( 25 | SizeUnit.TB * COMPUTATION_UNIT); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /memtable/stl_wrappers.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | #pragma once 6 | 7 | #include 8 | #include 9 | 10 | #include "rocksdb/comparator.h" 11 | #include "rocksdb/memtablerep.h" 12 | #include "rocksdb/slice.h" 13 | #include "util/coding.h" 14 | #include "util/murmurhash.h" 15 | 16 | namespace rocksdb { 17 | namespace stl_wrappers { 18 | 19 | class Base { 20 | protected: 21 | const MemTableRep::KeyComparator& compare_; 22 | explicit Base(const MemTableRep::KeyComparator& compare) 23 | : compare_(compare) {} 24 | }; 25 | 26 | struct Compare : private Base { 27 | explicit Compare(const MemTableRep::KeyComparator& compare) : Base(compare) {} 28 | inline bool operator()(const char* a, const char* b) const { 29 | return compare_(a, b) < 0; 30 | } 31 | }; 32 | 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /monitoring/file_read_sample.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | // 6 | #pragma once 7 | #include "db/version_edit.h" 8 | #include "util/random.h" 9 | 10 | namespace rocksdb { 11 | static const uint32_t kFileReadSampleRate = 1024; 12 | extern bool should_sample_file_read(); 13 | extern void sample_file_read_inc(FileMetaData*); 14 | 15 | inline bool should_sample_file_read() { 16 | return (Random::GetTLSInstance()->Next() % kFileReadSampleRate == 307); 17 | } 18 | 19 | inline void sample_file_read_inc(FileMetaData* meta) { 20 | meta->stats.num_reads_sampled.fetch_add(kFileReadSampleRate, 21 | std::memory_order_relaxed); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /monitoring/iostats_context_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | 6 | #include "rocksdb/iostats_context.h" 7 | #include "util/testharness.h" 8 | 9 | namespace rocksdb { 10 | 11 | TEST(IOStatsContextTest, ToString) { 12 | get_iostats_context()->Reset(); 13 | get_iostats_context()->bytes_read = 12345; 14 | 15 | std::string zero_included = get_iostats_context()->ToString(); 16 | ASSERT_NE(std::string::npos, zero_included.find("= 0")); 17 | ASSERT_NE(std::string::npos, zero_included.find("= 12345")); 18 | 19 | std::string zero_excluded = get_iostats_context()->ToString(true); 20 | ASSERT_EQ(std::string::npos, zero_excluded.find("= 0")); 21 | ASSERT_NE(std::string::npos, zero_excluded.find("= 12345")); 22 | } 23 | 24 | } // namespace rocksdb 25 | 26 | int main(int argc, char** argv) { 27 | ::testing::InitGoogleTest(&argc, argv); 28 | return RUN_ALL_TESTS(); 29 | } 30 | -------------------------------------------------------------------------------- /monitoring/perf_level.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | // 6 | 7 | #include 8 | #include "monitoring/perf_level_imp.h" 9 | 10 | namespace rocksdb { 11 | 12 | #ifdef ROCKSDB_SUPPORT_THREAD_LOCAL 13 | __thread PerfLevel perf_level = kEnableCount; 14 | #else 15 | PerfLevel perf_level = kEnableCount; 16 | #endif 17 | 18 | void SetPerfLevel(PerfLevel level) { 19 | assert(level > kUninitialized); 20 | assert(level < kOutOfBounds); 21 | perf_level = level; 22 | } 23 | 24 | PerfLevel GetPerfLevel() { 25 | return perf_level; 26 | } 27 | 28 | } // namespace rocksdb 29 | -------------------------------------------------------------------------------- /monitoring/perf_level_imp.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | // 6 | #pragma once 7 | #include "rocksdb/perf_level.h" 8 | #include "port/port.h" 9 | 10 | namespace rocksdb { 11 | 12 | #ifdef ROCKSDB_SUPPORT_THREAD_LOCAL 13 | extern __thread PerfLevel perf_level; 14 | #else 15 | extern PerfLevel perf_level; 16 | #endif 17 | 18 | } // namespace rocksdb 19 | -------------------------------------------------------------------------------- /monitoring/perf_step_timer.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | // 6 | #pragma once 7 | #include "monitoring/perf_level_imp.h" 8 | #include "rocksdb/env.h" 9 | #include "util/stop_watch.h" 10 | 11 | namespace rocksdb { 12 | 13 | class PerfStepTimer { 14 | public: 15 | explicit PerfStepTimer(uint64_t* metric, bool for_mutex = false) 16 | : enabled_(perf_level >= PerfLevel::kEnableTime || 17 | (!for_mutex && perf_level >= kEnableTimeExceptForMutex)), 18 | env_(enabled_ ? Env::Default() : nullptr), 19 | start_(0), 20 | metric_(metric) {} 21 | 22 | ~PerfStepTimer() { 23 | Stop(); 24 | } 25 | 26 | void Start() { 27 | if (enabled_) { 28 | start_ = env_->NowNanos(); 29 | } 30 | } 31 | 32 | void Measure() { 33 | if (start_) { 34 | uint64_t now = env_->NowNanos(); 35 | *metric_ += now - start_; 36 | start_ = now; 37 | } 38 | } 39 | 40 | void Stop() { 41 | if (start_) { 42 | *metric_ += env_->NowNanos() - start_; 43 | start_ = 0; 44 | } 45 | } 46 | 47 | private: 48 | const bool enabled_; 49 | Env* const env_; 50 | uint64_t start_; 51 | uint64_t* metric_; 52 | }; 53 | 54 | } // namespace rocksdb 55 | -------------------------------------------------------------------------------- /monitoring/statistics_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | // 6 | 7 | #include "port/stack_trace.h" 8 | #include "util/testharness.h" 9 | #include "util/testutil.h" 10 | 11 | #include "rocksdb/statistics.h" 12 | 13 | namespace rocksdb { 14 | 15 | class StatisticsTest : public testing::Test {}; 16 | 17 | // Sanity check to make sure that contents and order of TickersNameMap 18 | // match Tickers enum 19 | TEST_F(StatisticsTest, Sanity) { 20 | EXPECT_EQ(static_cast(Tickers::TICKER_ENUM_MAX), 21 | TickersNameMap.size()); 22 | 23 | for (uint32_t t = 0; t < Tickers::TICKER_ENUM_MAX; t++) { 24 | auto pair = TickersNameMap[static_cast(t)]; 25 | ASSERT_EQ(pair.first, t) << "Miss match at " << pair.second; 26 | } 27 | } 28 | 29 | } // namespace rocksdb 30 | 31 | int main(int argc, char** argv) { 32 | rocksdb::port::InstallStackTraceHandler(); 33 | ::testing::InitGoogleTest(&argc, argv); 34 | return RUN_ALL_TESTS(); 35 | } 36 | -------------------------------------------------------------------------------- /monitoring/thread_status_util_debug.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | 6 | #include 7 | 8 | #include "monitoring/thread_status_updater.h" 9 | #include "monitoring/thread_status_util.h" 10 | #include "rocksdb/env.h" 11 | 12 | namespace rocksdb { 13 | 14 | #ifndef NDEBUG 15 | // the delay for debugging purpose. 16 | static std::atomic states_delay[ThreadStatus::NUM_STATE_TYPES]; 17 | 18 | void ThreadStatusUtil::TEST_SetStateDelay( 19 | const ThreadStatus::StateType state, int micro) { 20 | states_delay[state].store(micro, std::memory_order_relaxed); 21 | } 22 | 23 | void ThreadStatusUtil::TEST_StateDelay(const ThreadStatus::StateType state) { 24 | auto delay = states_delay[state].load(std::memory_order_relaxed); 25 | if (delay > 0) { 26 | Env::Default()->SleepForMicroseconds(delay); 27 | } 28 | } 29 | 30 | #endif // !NDEBUG 31 | 32 | } // namespace rocksdb 33 | -------------------------------------------------------------------------------- /options/options_sanity_check.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | 6 | #ifndef ROCKSDB_LITE 7 | 8 | #include "options/options_sanity_check.h" 9 | 10 | namespace rocksdb { 11 | 12 | namespace { 13 | OptionsSanityCheckLevel SanityCheckLevelHelper( 14 | const std::unordered_map& smap, 15 | const std::string& name) { 16 | auto iter = smap.find(name); 17 | return iter != smap.end() ? iter->second : kSanityLevelExactMatch; 18 | } 19 | } 20 | 21 | OptionsSanityCheckLevel DBOptionSanityCheckLevel( 22 | const std::string& option_name) { 23 | return SanityCheckLevelHelper(sanity_level_db_options, option_name); 24 | } 25 | 26 | OptionsSanityCheckLevel CFOptionSanityCheckLevel( 27 | const std::string& option_name) { 28 | return SanityCheckLevelHelper(sanity_level_cf_options, option_name); 29 | } 30 | 31 | OptionsSanityCheckLevel BBTOptionSanityCheckLevel( 32 | const std::string& option_name) { 33 | return SanityCheckLevelHelper(sanity_level_bbt_options, option_name); 34 | } 35 | 36 | } // namespace rocksdb 37 | 38 | #endif // !ROCKSDB_LITE 39 | -------------------------------------------------------------------------------- /port/README: -------------------------------------------------------------------------------- 1 | This directory contains interfaces and implementations that isolate the 2 | rest of the package from platform details. 3 | 4 | Code in the rest of the package includes "port.h" from this directory. 5 | "port.h" in turn includes a platform specific "port_.h" file 6 | that provides the platform specific implementation. 7 | 8 | See port_posix.h for an example of what must be provided in a platform 9 | specific header file. 10 | 11 | -------------------------------------------------------------------------------- /port/dirent.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | // 6 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 7 | // Use of this source code is governed by a BSD-style license that can be 8 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 9 | // 10 | // See port_example.h for documentation for the following types/functions. 11 | 12 | #ifndef STORAGE_LEVELDB_PORT_DIRENT_H_ 13 | #define STORAGE_LEVELDB_PORT_DIRENT_H_ 14 | 15 | #ifdef ROCKSDB_PLATFORM_POSIX 16 | #include 17 | #include 18 | #elif defined(OS_WIN) 19 | 20 | namespace rocksdb { 21 | namespace port { 22 | 23 | struct dirent { 24 | char d_name[_MAX_PATH]; /* filename */ 25 | }; 26 | 27 | struct DIR; 28 | 29 | DIR* opendir(const char* name); 30 | 31 | dirent* readdir(DIR* dirp); 32 | 33 | int closedir(DIR* dirp); 34 | 35 | } // namespace port 36 | 37 | using port::dirent; 38 | using port::DIR; 39 | using port::opendir; 40 | using port::readdir; 41 | using port::closedir; 42 | 43 | } // namespace rocksdb 44 | 45 | #endif // OS_WIN 46 | 47 | #endif // STORAGE_LEVELDB_PORT_DIRENT_H_ 48 | -------------------------------------------------------------------------------- /port/likely.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | // 6 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 7 | // Use of this source code is governed by a BSD-style license that can be 8 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 9 | 10 | #ifndef PORT_LIKELY_H_ 11 | #define PORT_LIKELY_H_ 12 | 13 | #if defined(__GNUC__) && __GNUC__ >= 4 14 | #define LIKELY(x) (__builtin_expect((x), 1)) 15 | #define UNLIKELY(x) (__builtin_expect((x), 0)) 16 | #else 17 | #define LIKELY(x) (x) 18 | #define UNLIKELY(x) (x) 19 | #endif 20 | 21 | #endif // PORT_LIKELY_H_ 22 | -------------------------------------------------------------------------------- /port/port.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | // 6 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 7 | // Use of this source code is governed by a BSD-style license that can be 8 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 9 | 10 | #pragma once 11 | 12 | #include 13 | 14 | // Include the appropriate platform specific file below. If you are 15 | // porting to a new platform, see "port_example.h" for documentation 16 | // of what the new port_.h file must provide. 17 | #if defined(ROCKSDB_PLATFORM_POSIX) 18 | #include "port/port_posix.h" 19 | #elif defined(OS_WIN) 20 | #include "port/win/port_win.h" 21 | #endif 22 | -------------------------------------------------------------------------------- /port/stack_trace.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | // 6 | #pragma once 7 | namespace rocksdb { 8 | namespace port { 9 | 10 | // Install a signal handler to print callstack on the following signals: 11 | // SIGILL SIGSEGV SIGBUS SIGABRT 12 | // Currently supports linux only. No-op otherwise. 13 | void InstallStackTraceHandler(); 14 | 15 | // Prints stack, skips skip_first_frames frames 16 | void PrintStack(int first_frames_to_skip = 0); 17 | 18 | } // namespace port 19 | } // namespace rocksdb 20 | -------------------------------------------------------------------------------- /port/sys_time.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | // 6 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 7 | // Use of this source code is governed by a BSD-style license that can be 8 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 9 | 10 | // This file is a portable substitute for sys/time.h which does not exist on 11 | // Windows 12 | 13 | #ifndef STORAGE_LEVELDB_PORT_SYS_TIME_H_ 14 | #define STORAGE_LEVELDB_PORT_SYS_TIME_H_ 15 | 16 | #if defined(OS_WIN) && defined(_MSC_VER) 17 | 18 | #include 19 | 20 | namespace rocksdb { 21 | 22 | namespace port { 23 | 24 | // Avoid including winsock2.h for this definition 25 | typedef struct timeval { 26 | long tv_sec; 27 | long tv_usec; 28 | } timeval; 29 | 30 | void gettimeofday(struct timeval* tv, struct timezone* tz); 31 | 32 | inline struct tm* localtime_r(const time_t* timep, struct tm* result) { 33 | errno_t ret = localtime_s(result, timep); 34 | return (ret == 0) ? result : NULL; 35 | } 36 | } 37 | 38 | using port::timeval; 39 | using port::gettimeofday; 40 | using port::localtime_r; 41 | } 42 | 43 | #else 44 | #include 45 | #include 46 | #endif 47 | 48 | #endif // STORAGE_LEVELDB_PORT_SYS_TIME_H_ 49 | -------------------------------------------------------------------------------- /port/util_logger.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | // 6 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 7 | // Use of this source code is governed by a BSD-style license that can be 8 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 9 | 10 | #ifndef STORAGE_LEVELDB_PORT_UTIL_LOGGER_H_ 11 | #define STORAGE_LEVELDB_PORT_UTIL_LOGGER_H_ 12 | 13 | // Include the appropriate platform specific file below. If you are 14 | // porting to a new platform, see "port_example.h" for documentation 15 | // of what the new port_.h file must provide. 16 | 17 | #if defined(ROCKSDB_PLATFORM_POSIX) 18 | #include "env/posix_logger.h" 19 | #elif defined(OS_WIN) 20 | #include "port/win/win_logger.h" 21 | #endif 22 | 23 | #endif // STORAGE_LEVELDB_PORT_UTIL_LOGGER_H_ 24 | -------------------------------------------------------------------------------- /port/win/env_default.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | // 6 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 7 | // Use of this source code is governed by a BSD-style license that can be 8 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 9 | 10 | #include 11 | 12 | #include 13 | #include "port/win/env_win.h" 14 | 15 | namespace rocksdb { 16 | namespace port { 17 | 18 | // We choose to create this on the heap and using std::once for the following 19 | // reasons 20 | // 1) Currently available MS compiler does not implement atomic C++11 21 | // initialization of 22 | // function local statics 23 | // 2) We choose not to destroy the env because joining the threads from the 24 | // system loader 25 | // which destroys the statics (same as from DLLMain) creates a system loader 26 | // dead-lock. 27 | // in this manner any remaining threads are terminated OK. 28 | namespace { 29 | std::once_flag winenv_once_flag; 30 | Env* envptr; 31 | }; 32 | 33 | } 34 | 35 | Env* Env::Default() { 36 | using namespace port; 37 | std::call_once(winenv_once_flag, []() { envptr = new WinEnv(); }); 38 | return envptr; 39 | } 40 | 41 | } 42 | 43 | -------------------------------------------------------------------------------- /port/win/xpress_win.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | // 6 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 7 | // Use of this source code is governed by a BSD-style license that can be 8 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 9 | 10 | #pragma once 11 | 12 | #include 13 | 14 | namespace rocksdb { 15 | namespace port { 16 | namespace xpress { 17 | 18 | bool Compress(const char* input, size_t length, std::string* output); 19 | 20 | char* Decompress(const char* input_data, size_t input_length, 21 | int* decompress_size); 22 | 23 | } 24 | } 25 | } 26 | 27 | -------------------------------------------------------------------------------- /port/xpress.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | // 6 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 7 | // Use of this source code is governed by a BSD-style license that can be 8 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 9 | 10 | #pragma once 11 | 12 | // Xpress on Windows is implemeted using Win API 13 | #if defined(ROCKSDB_PLATFORM_POSIX) 14 | #error "Xpress compression not implemented" 15 | #elif defined(OS_WIN) 16 | #include "port/win/xpress_win.h" 17 | #endif 18 | -------------------------------------------------------------------------------- /table/bloom_block.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | 6 | #include "table/bloom_block.h" 7 | 8 | #include 9 | #include "rocksdb/slice.h" 10 | #include "util/dynamic_bloom.h" 11 | 12 | namespace rocksdb { 13 | 14 | void BloomBlockBuilder::AddKeysHashes(const std::vector& keys_hashes) { 15 | for (auto hash : keys_hashes) { 16 | bloom_.AddHash(hash); 17 | } 18 | } 19 | 20 | Slice BloomBlockBuilder::Finish() { return bloom_.GetRawData(); } 21 | 22 | const std::string BloomBlockBuilder::kBloomBlock = "kBloomBlock"; 23 | } // namespace rocksdb 24 | -------------------------------------------------------------------------------- /table/bloom_block.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | #pragma once 6 | 7 | #include 8 | #include 9 | #include "util/dynamic_bloom.h" 10 | 11 | namespace rocksdb { 12 | class Logger; 13 | 14 | class BloomBlockBuilder { 15 | public: 16 | static const std::string kBloomBlock; 17 | 18 | explicit BloomBlockBuilder(uint32_t num_probes = 6) 19 | : bloom_(num_probes, nullptr) {} 20 | 21 | void SetTotalBits(Allocator* allocator, uint32_t total_bits, 22 | uint32_t locality, size_t huge_page_tlb_size, 23 | Logger* logger) { 24 | bloom_.SetTotalBits(allocator, total_bits, locality, huge_page_tlb_size, 25 | logger); 26 | } 27 | 28 | uint32_t GetNumBlocks() const { return bloom_.GetNumBlocks(); } 29 | 30 | void AddKeysHashes(const std::vector& keys_hashes); 31 | 32 | Slice Finish(); 33 | 34 | private: 35 | DynamicBloom bloom_; 36 | }; 37 | 38 | }; // namespace rocksdb 39 | -------------------------------------------------------------------------------- /table/iter_heap.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | // 6 | 7 | #pragma once 8 | 9 | #include "rocksdb/comparator.h" 10 | #include "table/iterator_wrapper.h" 11 | 12 | namespace rocksdb { 13 | 14 | // When used with std::priority_queue, this comparison functor puts the 15 | // iterator with the max/largest key on top. 16 | class MaxIteratorComparator { 17 | public: 18 | MaxIteratorComparator(const Comparator* comparator) : 19 | comparator_(comparator) {} 20 | 21 | bool operator()(IteratorWrapper* a, IteratorWrapper* b) const { 22 | return comparator_->Compare(a->key(), b->key()) < 0; 23 | } 24 | private: 25 | const Comparator* comparator_; 26 | }; 27 | 28 | // When used with std::priority_queue, this comparison functor puts the 29 | // iterator with the min/smallest key on top. 30 | class MinIteratorComparator { 31 | public: 32 | MinIteratorComparator(const Comparator* comparator) : 33 | comparator_(comparator) {} 34 | 35 | bool operator()(IteratorWrapper* a, IteratorWrapper* b) const { 36 | return comparator_->Compare(a->key(), b->key()) > 0; 37 | } 38 | private: 39 | const Comparator* comparator_; 40 | }; 41 | 42 | } // namespace rocksdb 43 | -------------------------------------------------------------------------------- /table/persistent_cache_options.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | #pragma once 6 | 7 | #include 8 | 9 | #include "monitoring/statistics.h" 10 | #include "rocksdb/persistent_cache.h" 11 | 12 | namespace rocksdb { 13 | 14 | // PersistentCacheOptions 15 | // 16 | // This describe the caching behavior for page cache 17 | // This is used to pass the context for caching and the cache handle 18 | struct PersistentCacheOptions { 19 | PersistentCacheOptions() {} 20 | explicit PersistentCacheOptions( 21 | const std::shared_ptr& _persistent_cache, 22 | const std::string _key_prefix, Statistics* const _statistics) 23 | : persistent_cache(_persistent_cache), 24 | key_prefix(_key_prefix), 25 | statistics(_statistics) {} 26 | 27 | virtual ~PersistentCacheOptions() {} 28 | 29 | std::shared_ptr persistent_cache; 30 | std::string key_prefix; 31 | Statistics* statistics = nullptr; 32 | }; 33 | 34 | } // namespace rocksdb 35 | -------------------------------------------------------------------------------- /table/table_properties_internal.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | 6 | #pragma once 7 | 8 | #include "rocksdb/status.h" 9 | #include "rocksdb/iterator.h" 10 | 11 | namespace rocksdb { 12 | 13 | class InternalIterator; 14 | class BlockHandle; 15 | 16 | // Seek to the properties block. 17 | // If it successfully seeks to the properties block, "is_found" will be 18 | // set to true. 19 | Status SeekToPropertiesBlock(InternalIterator* meta_iter, bool* is_found); 20 | 21 | // Seek to the compression dictionary block. 22 | // If it successfully seeks to the properties block, "is_found" will be 23 | // set to true. 24 | Status SeekToCompressionDictBlock(InternalIterator* meta_iter, bool* is_found); 25 | 26 | // TODO(andrewkr) should not put all meta block in table_properties.h/cc 27 | Status SeekToRangeDelBlock(InternalIterator* meta_iter, bool* is_found, 28 | BlockHandle* block_handle); 29 | 30 | } // namespace rocksdb 31 | -------------------------------------------------------------------------------- /third-party/fbson/COMMIT.md: -------------------------------------------------------------------------------- 1 | fbson commit: 2 | https://github.com/facebook/mysql-5.6/commit/55ef9ff25c934659a70b4094e9b406c48e9dd43d 3 | 4 | # TODO. 5 | * Had to convert zero sized array to [1] sized arrays due to the fact that MS Compiler complains about it not being standard. At some point need to contribute this change back to MySql where this code was taken from. 6 | -------------------------------------------------------------------------------- /third-party/gtest-1.7.0/fused-src/gtest/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(gtest gtest-all.cc) 2 | -------------------------------------------------------------------------------- /tools/.db_bench_tool.cc.swp: -------------------------------------------------------------------------------- 1 | b0nano 2.5.3Dbalmaulpdxeon2680db_bench_tool.cc -------------------------------------------------------------------------------- /tools/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(TOOLS 2 | sst_dump.cc 3 | db_sanity_test.cc 4 | db_stress.cc 5 | write_stress.cc 6 | ldb.cc 7 | db_repl_stress.cc 8 | dump/rocksdb_dump.cc 9 | dump/rocksdb_undump.cc) 10 | foreach(src ${TOOLS}) 11 | get_filename_component(exename ${src} NAME_WE) 12 | add_executable(${exename}${ARTIFACT_SUFFIX} 13 | ${src}) 14 | target_link_libraries(${exename}${ARTIFACT_SUFFIX} ${LIBS}) 15 | list(APPEND tool_deps ${exename}) 16 | endforeach() 17 | add_custom_target(tools 18 | DEPENDS ${tool_deps}) 19 | add_custom_target(ldb_tests 20 | COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/ldb_tests.py 21 | DEPENDS ldb) 22 | -------------------------------------------------------------------------------- /tools/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM buildpack-deps:wheezy 2 | 3 | ADD ./ldb /rocksdb/tools/ldb 4 | 5 | CMD /rocksdb/tools/ldb 6 | -------------------------------------------------------------------------------- /tools/db_bench.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013-present, Facebook, Inc. All rights reserved. 2 | // This source code is licensed under both the GPLv2 (found in the 3 | // COPYING file in the root directory) and Apache 2.0 License 4 | // (found in the LICENSE.Apache file in the root directory). 5 | // 6 | // Copyright (c) 2011 The LevelDB Authors. All rights reserved. 7 | // Use of this source code is governed by a BSD-style license that can be 8 | // found in the LICENSE file. See the AUTHORS file for names of contributors. 9 | 10 | #ifndef __STDC_FORMAT_MACROS 11 | #define __STDC_FORMAT_MACROS 12 | #endif 13 | 14 | #ifndef GFLAGS 15 | #include 16 | int main() { 17 | fprintf(stderr, "Please install gflags to run rocksdb tools\n"); 18 | return 1; 19 | } 20 | #else 21 | #include 22 | int main(int argc, char** argv) { return rocksdb::db_bench_tool(argc, argv); } 23 | #endif // GFLAGS 24 | -------------------------------------------------------------------------------- /tools/generate_random_db.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # A shell script to load some pre generated data file to a DB using ldb tool 4 | # ./ldb needs to be avaible to be executed. 5 | # 6 | # Usage: