├── CMakeLists.txt ├── CONTRIBUTING.md ├── DEFAULT_OPTIONS_HISTORY.md ├── DUMP_FORMAT.md ├── HISTORY.md ├── INSTALL.md ├── LANGUAGE-BINDINGS.md ├── Makefile ├── README.md ├── ROCKSDB_LITE.md ├── USERS.md ├── Vagrantfile ├── WINDOWS_PORT.md ├── appveyor.yml ├── arcanist_util ├── __phutil_library_init__.php ├── __phutil_library_map__.php ├── config │ ├── FacebookArcanistConfiguration.php │ ├── FacebookOldArcanistConfiguration.php │ └── RocksDBCommonHelper.php ├── cpp_linter │ ├── ArcanistCpplintLinter.php │ ├── BaseDirectoryScopedFormatLinter.php │ ├── FacebookHowtoevenLinter.php │ ├── FbcodeClangFormatLinter.php │ ├── FbcodeCppLinter.php │ └── cpplint.py ├── lint_engine │ ├── FacebookFbcodeLintEngine.php │ └── FacebookHowtoevenLintEngine.php └── unit_engine │ ├── FacebookFbcodeUnitTestEngine.php │ └── FacebookOldFbcodeUnitTestEngine.php ├── 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_new_version.sh ├── make_package.sh ├── precommit_checker.py ├── regression_build_test.sh ├── rocksdb-lego-determinator ├── run_ci_db_test.ps1 ├── update_dependencies.sh └── version.sh ├── coverage ├── coverage_test.sh └── parse_gcov_output.py ├── db ├── auto_roll_logger.cc ├── auto_roll_logger.h ├── auto_roll_logger_test.cc ├── 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_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 ├── comparator_db_test.cc ├── convenience.cc ├── corruption_test.cc ├── cuckoo_table_db_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_filesnapshot.cc ├── db_flush_test.cc ├── db_impl.cc ├── db_impl.h ├── db_impl_debug.cc ├── db_impl_experimental.cc ├── db_impl_readonly.cc ├── db_impl_readonly.h ├── 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_options_test.cc ├── db_properties_test.cc ├── db_sst_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 ├── dbformat.cc ├── dbformat.h ├── dbformat_test.cc ├── deletefile_test.cc ├── event_helpers.cc ├── event_helpers.h ├── experimental.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.cc ├── filename.h ├── 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 ├── inlineskiplist.h ├── inlineskiplist_test.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 ├── managed_iterator.cc ├── managed_iterator.h ├── manual_compaction_test.cc ├── memtable.cc ├── memtable.h ├── memtable_allocator.cc ├── memtable_allocator.h ├── memtable_list.cc ├── memtable_list.h ├── memtable_list_test.cc ├── memtablerep_bench.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 ├── repair.cc ├── repair_test.cc ├── skiplist.h ├── skiplist_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 ├── xfunc_test_points.cc └── xfunc_test_points.h ├── docs ├── .gitignore ├── CNAME ├── CONTRIBUTING.md ├── Gemfile ├── Gemfile.lock ├── README.md ├── TEMPLATE-INFORMATION.md ├── _config.yml ├── _config_local_dev.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 ├── _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 │ ├── promo-adapt.svg │ ├── promo-flash.svg │ ├── promo-operations.svg │ ├── promo-performance.svg │ └── tree_example1.png │ ├── logo.svg │ └── og_image.png ├── 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 │ ├── c.h │ ├── cache.h │ ├── compaction_filter.h │ ├── compaction_job_stats.h │ ├── comparator.h │ ├── convenience.h │ ├── db.h │ ├── db_bench_tool.h │ ├── db_dump_tool.h │ ├── env.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 │ ├── document_db.h │ ├── env_librados.h │ ├── env_mirror.h │ ├── env_registry.h │ ├── flashcache.h │ ├── geo_db.h │ ├── info_log_finder.h │ ├── json_document.h │ ├── ldb_cmd.h │ ├── ldb_cmd_execute_result.h │ ├── leveldb_options.h │ ├── memory_util.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 ├── jdb_bench.sh ├── rocksjni.pom ├── rocksjni │ ├── backupablejni.cc │ ├── backupenginejni.cc │ ├── checkpoint.cc │ ├── columnfamilyhandle.cc │ ├── compaction_filter.cc │ ├── comparator.cc │ ├── comparatorjnicallback.cc │ ├── comparatorjnicallback.h │ ├── env.cc │ ├── env_options.cc │ ├── external_sst_file_info.cc │ ├── filter.cc │ ├── iterator.cc │ ├── loggerjnicallback.cc │ ├── loggerjnicallback.h │ ├── 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 │ ├── 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 │ │ ├── BackupEngine.java │ │ ├── BackupInfo.java │ │ ├── BackupableDB.java │ │ ├── BackupableDBOptions.java │ │ ├── BlockBasedTableConfig.java │ │ ├── BloomFilter.java │ │ ├── BuiltinComparator.java │ │ ├── Checkpoint.java │ │ ├── ChecksumType.java │ │ ├── ColumnFamilyDescriptor.java │ │ ├── ColumnFamilyHandle.java │ │ ├── ColumnFamilyOptions.java │ │ ├── ColumnFamilyOptionsInterface.java │ │ ├── CompactionStyle.java │ │ ├── Comparator.java │ │ ├── ComparatorOptions.java │ │ ├── CompressionType.java │ │ ├── DBOptions.java │ │ ├── DBOptionsInterface.java │ │ ├── DirectComparator.java │ │ ├── DirectSlice.java │ │ ├── EncodingType.java │ │ ├── Env.java │ │ ├── EnvOptions.java │ │ ├── Experimental.java │ │ ├── ExternalSstFileInfo.java │ │ ├── Filter.java │ │ ├── FlushOptions.java │ │ ├── GenericRateLimiterConfig.java │ │ ├── HashLinkedListMemTableConfig.java │ │ ├── HashSkipListMemTableConfig.java │ │ ├── HistogramData.java │ │ ├── HistogramType.java │ │ ├── IndexType.java │ │ ├── InfoLogLevel.java │ │ ├── Logger.java │ │ ├── MemTableConfig.java │ │ ├── MergeOperator.java │ │ ├── MutableColumnFamilyOptions.java │ │ ├── MutableColumnFamilyOptionsInterface.java │ │ ├── NativeLibraryLoader.java │ │ ├── Options.java │ │ ├── PlainTableConfig.java │ │ ├── RateLimiter.java │ │ ├── RateLimiterConfig.java │ │ ├── ReadOptions.java │ │ ├── ReadTier.java │ │ ├── RemoveEmptyValueCompactionFilter.java │ │ ├── RestoreBackupableDB.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 │ │ ├── Status.java │ │ ├── StringAppendOperator.java │ │ ├── TableFormatConfig.java │ │ ├── TickerType.java │ │ ├── TransactionLogIterator.java │ │ ├── TtlDB.java │ │ ├── VectorMemTableConfig.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 │ ├── ColumnFamilyOptionsTest.java │ ├── ColumnFamilyTest.java │ ├── ComparatorOptionsTest.java │ ├── ComparatorTest.java │ ├── CompressionOptionsTest.java │ ├── DBOptionsTest.java │ ├── DirectComparatorTest.java │ ├── DirectSliceTest.java │ ├── EnvOptionsTest.java │ ├── ExternalSstFileInfoTest.java │ ├── FilterTest.java │ ├── FlushTest.java │ ├── InfoLogLevelTest.java │ ├── KeyMayExistTest.java │ ├── LoggerTest.java │ ├── MemTableTest.java │ ├── MergeTest.java │ ├── MixedOptionsTest.java │ ├── MutableColumnFamilyOptionsTest.java │ ├── NativeLibraryLoaderTest.java │ ├── OptionsTest.java │ ├── PlainTableConfigTest.java │ ├── PlatformRandomHelper.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 │ ├── StatsCallbackMock.java │ ├── TransactionLogIteratorTest.java │ ├── TtlDBTest.java │ ├── Types.java │ ├── WriteBatchHandlerTest.java │ ├── WriteBatchTest.java │ ├── WriteBatchThreadedTest.java │ ├── WriteBatchWithIndexTest.java │ ├── WriteOptionsTest.java │ ├── test │ └── RocksJunitRunner.java │ └── util │ ├── BytewiseComparatorTest.java │ ├── EnvironmentTest.java │ └── SizeUnitTest.java ├── memtable ├── hash_cuckoo_rep.cc ├── hash_cuckoo_rep.h ├── hash_linklist_rep.cc ├── hash_linklist_rep.h ├── hash_skiplist_rep.cc ├── hash_skiplist_rep.h ├── skiplistrep.cc ├── stl_wrappers.h └── vectorrep.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 │ ├── 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 ├── 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_block.cc ├── full_filter_block.h ├── full_filter_block_test.cc ├── get_context.cc ├── get_context.h ├── internal_iterator.h ├── iter_heap.h ├── iterator.cc ├── iterator_wrapper.h ├── merger.cc ├── merger.h ├── merger_test.cc ├── meta_blocks.cc ├── meta_blocks.h ├── mock_table.cc ├── mock_table.h ├── persistent_cache_helper.cc ├── persistent_cache_helper.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 ├── flashcache │ └── flashcache_ioctl.h └── gtest-1.7.0 │ └── fused-src │ └── gtest │ ├── CMakeLists.txt │ ├── gtest-all.cc │ └── gtest.h ├── thirdparty.inc ├── tools ├── .DS_Store ├── CMakeLists.txt ├── Dockerfile ├── auto_sanity_test.sh ├── benchmark.sh ├── benchmark_leveldb.sh ├── 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 ├── autovector.h ├── autovector_test.cc ├── bloom.cc ├── bloom_test.cc ├── build_version.cc ├── build_version.cc.in ├── build_version.h ├── cache_bench.cc ├── cache_test.cc ├── cf_options.cc ├── cf_options.h ├── channel.h ├── clock_cache.cc ├── clock_cache.h ├── coding.cc ├── coding.h ├── coding_test.cc ├── compaction_job_stats_impl.cc ├── comparator.cc ├── compression.h ├── concurrent_arena.cc ├── concurrent_arena.h ├── crc32c.cc ├── crc32c.h ├── crc32c_test.cc ├── db_options.cc ├── db_options.h ├── delete_scheduler.cc ├── delete_scheduler.h ├── delete_scheduler_test.cc ├── dynamic_bloom.cc ├── dynamic_bloom.h ├── dynamic_bloom_test.cc ├── env.cc ├── env_basic_test.cc ├── env_chroot.cc ├── env_chroot.h ├── env_hdfs.cc ├── env_posix.cc ├── env_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 ├── filter_policy.cc ├── hash.cc ├── hash.h ├── heap.h ├── heap_test.cc ├── histogram.cc ├── histogram.h ├── histogram_test.cc ├── histogram_windowing.cc ├── histogram_windowing.h ├── hyperloglog.cc ├── hyperloglog.h ├── instrumented_mutex.cc ├── instrumented_mutex.h ├── io_posix.cc ├── io_posix.h ├── iostats_context.cc ├── iostats_context_imp.h ├── iostats_context_test.cc ├── kv_map.h ├── log_buffer.cc ├── log_buffer.h ├── log_write_bench.cc ├── logging.cc ├── logging.h ├── lru_cache.cc ├── lru_cache.h ├── lru_cache_test.cc ├── memenv.cc ├── mock_env.cc ├── mock_env.h ├── mock_env_test.cc ├── murmurhash.cc ├── murmurhash.h ├── mutexlock.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 ├── perf_context.cc ├── perf_context_imp.h ├── perf_level.cc ├── perf_level_imp.h ├── perf_step_timer.h ├── posix_logger.h ├── random.cc ├── random.h ├── rate_limiter.cc ├── rate_limiter.h ├── rate_limiter_test.cc ├── sharded_cache.cc ├── sharded_cache.h ├── slice.cc ├── slice_transform_test.cc ├── sst_file_manager_impl.cc ├── sst_file_manager_impl.h ├── statistics.cc ├── statistics.h ├── statistics_test.cc ├── 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 ├── 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 ├── threadpool_imp.cc ├── threadpool_imp.h ├── transaction_test_util.cc ├── transaction_test_util.h ├── xfunc.cc ├── xfunc.h ├── xxhash.cc └── xxhash.h └── utilities ├── backupable ├── backupable_db.cc └── backupable_db_test.cc ├── blob_db ├── blob_db.cc ├── blob_db.h └── blob_db_test.cc ├── checkpoint ├── checkpoint.cc └── 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 ├── 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_registry.cc ├── env_registry_test.cc ├── flashcache ├── flashcache.cc └── flashcache.h ├── geodb ├── geodb_impl.cc ├── geodb_impl.h └── geodb_test.cc ├── leveldb_options └── leveldb_options.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 ├── 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 /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 | 16 | ## License 17 | 18 | By contributing to RocksDB, you agree that your contributions will be 19 | licensed under the [BSD License](LICENSE). 20 | -------------------------------------------------------------------------------- /DEFAULT_OPTIONS_HISTORY.md: -------------------------------------------------------------------------------- 1 | # RocksDB default options change log 2 | ## 4.8.0 (5/2/2016) 3 | * options.max_open_files changes from 5000 to -1. It improves performance, but users need to set file descriptor limit to be large enough and watch memory usage for index and bloom filters. 4 | * options.base_background_compactions changes from max_background_compactions to 1. When users set higher max_background_compactions but the write throughput is not high, the writes are less spiky to disks. 5 | * options.wal_recovery_mode changes from kTolerateCorruptedTailRecords to kPointInTimeRecovery. Avoid some false positive when file system or hardware reorder the writes for file data and metadata. 6 | 7 | ## 4.7.0 (4/8/2016) 8 | * options.write_buffer_size changes from 4MB to 64MB. 9 | * options.target_file_size_base changes from 2MB to 64MB. 10 | * options.max_bytes_for_level_base changes from 10MB to 256MB. 11 | * options.soft_pending_compaction_bytes_limit changes from 0 (disabled) to 64GB. 12 | * options.hard_pending_compaction_bytes_limit changes from 0 (disabled) to 256GB. 13 | * table_cache_numshardbits changes from 4 to 6. 14 | * max_file_opening_threads changes from 1 to 16. 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 | -------------------------------------------------------------------------------- /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/epfl-labos/TRIAD/c9f9067aada1c0d605b1a91db3c86a03746aa845/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 -EnableRerun -Run db_test2 -Concurrency 8 15 | - ps: build_tools\run_ci_db_test.ps1 -EnableRerun -Run db_test -Exclude DBTest.GroupCommitTest -Concurrency 10 16 | - ps: build_tools\run_ci_db_test.ps1 -Run env_test -Concurrency 1 17 | 18 | -------------------------------------------------------------------------------- /arcanist_util/__phutil_library_init__.php: -------------------------------------------------------------------------------- 1 | getPaths() as $path) { 13 | // Don't try to lint deleted files or changed directories. 14 | if (!Filesystem::pathExists($path) || is_dir($path)) { 15 | continue; 16 | } 17 | 18 | if (preg_match('/\.(cpp|c|cc|cxx|h|hh|hpp|hxx|tcc)$/', $path)) { 19 | $paths[] = $path; 20 | } 21 | } 22 | 23 | $howtoeven = new FacebookHowtoevenLinter(); 24 | $howtoeven->setPaths($paths); 25 | return array($howtoeven); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /arcanist_util/unit_engine/FacebookFbcodeUnitTestEngine.php: -------------------------------------------------------------------------------- 1 | setName("dummy_placeholder_entry"); 14 | $result->setResult(ArcanistUnitTestResult::RESULT_PASS); 15 | return array($result); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /arcanist_util/unit_engine/FacebookOldFbcodeUnitTestEngine.php: -------------------------------------------------------------------------------- 1 | setName("dummy_placeholder_entry"); 14 | $result->setResult(ArcanistUnitTestResult::RESULT_PASS); 15 | return array($result); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /build_tools/dockerbuild.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | docker run -v $PWD:/rocks -w /rocks buildpack-deps make 3 | -------------------------------------------------------------------------------- /build_tools/make_new_version.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) 2011-present, Facebook, Inc. All rights reserved. 3 | # This source code is licensed under the BSD-style license found in the 4 | # LICENSE file in the root directory of this source tree. An additional grant 5 | # of patent rights can be found in the PATENTS file in the same directory. 6 | 7 | set -e 8 | if [ -z "$GIT" ] 9 | then 10 | GIT="git" 11 | fi 12 | 13 | # Print out the colored progress info so that it can be brainlessly 14 | # distinguished by users. 15 | function title() { 16 | echo -e "\033[1;32m$*\033[0m" 17 | } 18 | 19 | usage="Create new RocksDB version and prepare it for the release process\n" 20 | usage+="USAGE: ./make_new_version.sh " 21 | 22 | # -- Pre-check 23 | if [[ $# < 1 ]]; then 24 | echo -e $usage 25 | exit 1 26 | fi 27 | 28 | ROCKSDB_VERSION=$1 29 | 30 | GIT_BRANCH=`git rev-parse --abbrev-ref HEAD` 31 | echo $GIT_BRANCH 32 | 33 | if [ $GIT_BRANCH != "master" ]; then 34 | echo "Error: Current branch is '$GIT_BRANCH', Please switch to master branch." 35 | exit 1 36 | fi 37 | 38 | title "Adding new tag for this release ..." 39 | BRANCH="$ROCKSDB_VERSION.fb" 40 | $GIT checkout -b $BRANCH 41 | 42 | # Setting up the proxy for remote repo access 43 | title "Pushing new branch to remote repo ..." 44 | git push origin --set-upstream $BRANCH 45 | 46 | title "Branch $BRANCH is pushed to github;" 47 | -------------------------------------------------------------------------------- /build_tools/version.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | if [ "$#" = "0" ]; then 3 | echo "Usage: $0 major|minor|patch" 4 | exit 1 5 | fi 6 | if [ "$1" = "major" ]; then 7 | cat include/rocksdb/version.h | grep MAJOR | head -n1 | awk '{print $3}' 8 | fi 9 | if [ "$1" = "minor" ]; then 10 | cat include/rocksdb/version.h | grep MINOR | head -n1 | awk '{print $3}' 11 | fi 12 | if [ "$1" = "patch" ]; then 13 | cat include/rocksdb/version.h | grep PATCH | head -n1 | awk '{print $3}' 14 | fi 15 | -------------------------------------------------------------------------------- /db/convenience.cc: -------------------------------------------------------------------------------- 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 | // Copyright (c) 2012 Facebook. 7 | // Use of this source code is governed by a BSD-style license that can be 8 | // found in the LICENSE file. 9 | 10 | #ifndef ROCKSDB_LITE 11 | 12 | #include "rocksdb/convenience.h" 13 | 14 | #include "db/db_impl.h" 15 | 16 | namespace rocksdb { 17 | 18 | void CancelAllBackgroundWork(DB* db, bool wait) { 19 | (dynamic_cast(db))->CancelAllBackgroundWork(wait); 20 | } 21 | 22 | Status DeleteFilesInRange(DB* db, ColumnFamilyHandle* column_family, 23 | const Slice* begin, const Slice* end) { 24 | return (dynamic_cast(db)) 25 | ->DeleteFilesInRange(column_family, begin, end); 26 | } 27 | 28 | } // namespace rocksdb 29 | 30 | #endif // ROCKSDB_LITE 31 | -------------------------------------------------------------------------------- /db/db_info_dumper.h: -------------------------------------------------------------------------------- 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 | #pragma once 6 | 7 | #include 8 | 9 | #include "util/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 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 | #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/snapshot_impl.cc: -------------------------------------------------------------------------------- 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 | #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 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 | #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 | -------------------------------------------------------------------------------- /db/xfunc_test_points.h: -------------------------------------------------------------------------------- 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 | #pragma once 7 | 8 | #include "db/db_impl.h" 9 | #include "db/managed_iterator.h" 10 | #include "db/write_callback.h" 11 | #include "rocksdb/options.h" 12 | #include "rocksdb/write_batch.h" 13 | #include "util/xfunc.h" 14 | 15 | namespace rocksdb { 16 | 17 | #ifdef XFUNC 18 | 19 | // DB-specific test points for the cross-functional test framework (see 20 | // util/xfunc.h). 21 | void xf_manage_release(ManagedIterator* iter); 22 | void xf_manage_create(ManagedIterator* iter); 23 | void xf_manage_new(DBImpl* db, ReadOptions* readoptions, 24 | bool is_snapshot_supported); 25 | void xf_transaction_write(const WriteOptions& write_options, 26 | const DBOptions& db_options, 27 | class WriteBatch* my_batch, 28 | class WriteCallback* callback, DBImpl* db_impl, 29 | Status* success, bool* write_attempted); 30 | 31 | #endif // XFUNC 32 | 33 | } // namespace rocksdb 34 | -------------------------------------------------------------------------------- /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', group: :jekyll_plugins 3 | gem 'jekyll-redirect-from' 4 | -------------------------------------------------------------------------------- /docs/_config_local_dev.yml: -------------------------------------------------------------------------------- 1 | # Local development config settings to over-ride base. 2 | # `jekyll serve` will by default generate a webserver at localhost:4000, so 3 | # only change `url` if you're using a non-default location. 4 | 5 | baseurl: "" 6 | url: "http://127.0.0.1:4000" -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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: github 8 | 9 | - title: API (C++) 10 | href: https://github.com/facebook/rocksdb/tree/master/include/rocksdb 11 | category: api 12 | 13 | - title: API (Java) 14 | href: https://github.com/facebook/rocksdb/tree/master/java/src/main/java/org/rocksdb 15 | category: api 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: facebook 28 | -------------------------------------------------------------------------------- /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 | 30 | -------------------------------------------------------------------------------- /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/epfl-labos/TRIAD/c9f9067aada1c0d605b1a91db3c86a03746aa845/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 |
-------------------------------------------------------------------------------- /docs/_includes/hero.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/epfl-labos/TRIAD/c9f9067aada1c0d605b1a91db3c86a03746aa845/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.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | 5 | 6 |

{{ site.title }}

7 |
8 | 9 | 23 | 26 |
27 |
28 |
29 | -------------------------------------------------------------------------------- /docs/_includes/nav/collection_nav_group.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/_includes/nav/collection_nav_group_item.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /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/2014-09-15-rocksdb-3-5-release.markdown: -------------------------------------------------------------------------------- 1 | --- 2 | title: RocksDB 3.5 Release! 3 | layout: post 4 | author: leijin 5 | category: blog 6 | redirect_from: 7 | - /blog/1547/rocksdb-3-5-release/ 8 | --- 9 | 10 | New RocksDB release - 3.5! 11 | 12 | 13 | **New Features** 14 | 15 | 16 | 1. Add include/utilities/write_batch_with_index.h, providing a utility class to query data out of WriteBatch when building it. 17 | 18 | 19 | 2. new ReadOptions.total_order_seek to force total order seek when block-based table is built with hash index. 20 | 21 | 22 | 23 | **Public API changes** 24 | 25 | 26 | 1. The Prefix Extractor used with V2 compaction filters is now passed user key to SliceTransform::Transform instead of unparsed RocksDB key. 27 | 28 | 29 | 2. Move BlockBasedTable related options to BlockBasedTableOptions from Options. Change corresponding JNI interface. Options affected include: no_block_cache, block_cache, block_cache_compressed, block_size, block_size_deviation, block_restart_interval, filter_policy, whole_key_filtering. filter_policy is changed to shared_ptr from a raw pointer. 30 | 31 | 32 | 3. Remove deprecated options: disable_seek_compaction and db_stats_log_interval 33 | 34 | 35 | 4. OptimizeForPointLookup() takes one parameter for block cache size. It now builds hash index, bloom filter, and block cache. 36 | 37 | 38 | [https://github.com/facebook/rocksdb/releases/tag/v3.5](https://github.com/facebook/rocksdb/releases/tag/rocksdb-3.5) 39 | -------------------------------------------------------------------------------- /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/_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 | The [GitHub issues](https://github.com/facebook/rocksdb/issues) page is a good place to ask 15 | questions, find answers, and report issues. 16 | 17 | ### Facebook Group 18 | 19 | 20 | 21 | ### FAQ 22 | 23 | Check out a list of [commonly asked questions](/docs/support/faq) about RocksDB. 24 | -------------------------------------------------------------------------------- /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 | {{ site.url }}{{ site.baseurl }}/ 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 | prepend: site.baseurl | prepend: site.url }} 20 | {{ post.url | prepend: site.baseurl | prepend: site.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/epfl-labos/TRIAD/c9f9067aada1c0d605b1a91db3c86a03746aa845/docs/static/favicon.png -------------------------------------------------------------------------------- /docs/static/fonts/LatoLatin-Black.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/epfl-labos/TRIAD/c9f9067aada1c0d605b1a91db3c86a03746aa845/docs/static/fonts/LatoLatin-Black.woff -------------------------------------------------------------------------------- /docs/static/fonts/LatoLatin-Black.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/epfl-labos/TRIAD/c9f9067aada1c0d605b1a91db3c86a03746aa845/docs/static/fonts/LatoLatin-Black.woff2 -------------------------------------------------------------------------------- /docs/static/fonts/LatoLatin-BlackItalic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/epfl-labos/TRIAD/c9f9067aada1c0d605b1a91db3c86a03746aa845/docs/static/fonts/LatoLatin-BlackItalic.woff -------------------------------------------------------------------------------- /docs/static/fonts/LatoLatin-BlackItalic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/epfl-labos/TRIAD/c9f9067aada1c0d605b1a91db3c86a03746aa845/docs/static/fonts/LatoLatin-BlackItalic.woff2 -------------------------------------------------------------------------------- /docs/static/fonts/LatoLatin-Italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/epfl-labos/TRIAD/c9f9067aada1c0d605b1a91db3c86a03746aa845/docs/static/fonts/LatoLatin-Italic.woff -------------------------------------------------------------------------------- /docs/static/fonts/LatoLatin-Italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/epfl-labos/TRIAD/c9f9067aada1c0d605b1a91db3c86a03746aa845/docs/static/fonts/LatoLatin-Italic.woff2 -------------------------------------------------------------------------------- /docs/static/fonts/LatoLatin-Light.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/epfl-labos/TRIAD/c9f9067aada1c0d605b1a91db3c86a03746aa845/docs/static/fonts/LatoLatin-Light.woff -------------------------------------------------------------------------------- /docs/static/fonts/LatoLatin-Light.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/epfl-labos/TRIAD/c9f9067aada1c0d605b1a91db3c86a03746aa845/docs/static/fonts/LatoLatin-Light.woff2 -------------------------------------------------------------------------------- /docs/static/fonts/LatoLatin-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/epfl-labos/TRIAD/c9f9067aada1c0d605b1a91db3c86a03746aa845/docs/static/fonts/LatoLatin-Regular.woff -------------------------------------------------------------------------------- /docs/static/fonts/LatoLatin-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/epfl-labos/TRIAD/c9f9067aada1c0d605b1a91db3c86a03746aa845/docs/static/fonts/LatoLatin-Regular.woff2 -------------------------------------------------------------------------------- /docs/static/images/Resize-of-20140327_200754-300x225.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/epfl-labos/TRIAD/c9f9067aada1c0d605b1a91db3c86a03746aa845/docs/static/images/Resize-of-20140327_200754-300x225.jpg -------------------------------------------------------------------------------- /docs/static/images/tree_example1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/epfl-labos/TRIAD/c9f9067aada1c0d605b1a91db3c86a03746aa845/docs/static/images/tree_example1.png -------------------------------------------------------------------------------- /docs/static/og_image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/epfl-labos/TRIAD/c9f9067aada1c0d605b1a91db3c86a03746aa845/docs/static/og_image.png -------------------------------------------------------------------------------- /examples/.gitignore: -------------------------------------------------------------------------------- 1 | c_simple_example 2 | column_families_example 3 | compact_files_example 4 | compaction_filter_example 5 | optimistic_transaction_example 6 | simple_example 7 | transaction_example 8 | -------------------------------------------------------------------------------- /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 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 | #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 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 | #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 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 | #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 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 | #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 | 31 | class LDBTool { 32 | public: 33 | void Run( 34 | int argc, char** argv, Options db_options = Options(), 35 | const LDBOptions& ldb_options = LDBOptions(), 36 | const std::vector* column_families = nullptr); 37 | }; 38 | 39 | } // namespace rocksdb 40 | 41 | #endif // ROCKSDB_LITE 42 | -------------------------------------------------------------------------------- /include/rocksdb/perf_level.h: -------------------------------------------------------------------------------- 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 | #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 | 16 | enum PerfLevel : unsigned char { 17 | kUninitialized = 0, // unknown setting 18 | kDisable = 1, // disable perf stats 19 | kEnableCount = 2, // enable only count stats 20 | kEnableTimeExceptForMutex = 3, // Other than count stats, also enable time 21 | // stats except for mutexes 22 | kEnableTime = 4, // enable count and time stats 23 | kOutOfBounds = 5 // N.B. Must always be the last value! 24 | }; 25 | 26 | // set the perf stats level for current thread 27 | void SetPerfLevel(PerfLevel level); 28 | 29 | // get current perf stats level for current thread 30 | PerfLevel GetPerfLevel(); 31 | 32 | } // namespace rocksdb 33 | 34 | #endif // INCLUDE_ROCKSDB_PERF_LEVEL_H_ 35 | -------------------------------------------------------------------------------- /include/rocksdb/snapshot.h: -------------------------------------------------------------------------------- 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 | #pragma once 7 | 8 | #include "rocksdb/types.h" 9 | 10 | namespace rocksdb { 11 | 12 | class DB; 13 | 14 | // Abstract handle to particular state of a DB. 15 | // A Snapshot is an immutable object and can therefore be safely 16 | // accessed from multiple threads without any external synchronization. 17 | // 18 | // To Create a Snapshot, call DB::GetSnapshot(). 19 | // To Destroy a Snapshot, call DB::ReleaseSnapshot(snapshot). 20 | class Snapshot { 21 | public: 22 | // returns Snapshot's sequence number 23 | virtual SequenceNumber GetSequenceNumber() const = 0; 24 | 25 | protected: 26 | virtual ~Snapshot(); 27 | }; 28 | 29 | // Simple RAII wrapper class for Snapshot. 30 | // Constructing this object will create a snapshot. Destructing will 31 | // release the snapshot. 32 | class ManagedSnapshot { 33 | public: 34 | explicit ManagedSnapshot(DB* db); 35 | 36 | // Instead of creating a snapshot, take ownership of the input snapshot. 37 | ManagedSnapshot(DB* db, const Snapshot* _snapshot); 38 | 39 | ~ManagedSnapshot(); 40 | 41 | const Snapshot* snapshot(); 42 | 43 | private: 44 | DB* db_; 45 | const Snapshot* snapshot_; 46 | }; 47 | 48 | } // namespace rocksdb 49 | -------------------------------------------------------------------------------- /include/rocksdb/sst_dump_tool.h: -------------------------------------------------------------------------------- 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 | #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/threadpool.h: -------------------------------------------------------------------------------- 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 | // 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 | #pragma once 10 | 11 | namespace rocksdb { 12 | 13 | /* 14 | * ThreadPool is a component that will spawn N background threads that will 15 | * be used to execute scheduled work, The number of background threads could 16 | * be modified by calling SetBackgroundThreads(). 17 | * */ 18 | class ThreadPool { 19 | public: 20 | virtual ~ThreadPool() {} 21 | 22 | // Wait for all threads to finish. 23 | virtual void JoinAllThreads() = 0; 24 | 25 | // Set the number of background threads that will be executing the 26 | // scheduled jobs. 27 | virtual void SetBackgroundThreads(int num) = 0; 28 | 29 | // Get the number of jobs scheduled in the ThreadPool queue. 30 | virtual unsigned int GetQueueLen() const = 0; 31 | }; 32 | 33 | // NewThreadPool() is a function that could be used to create a ThreadPool 34 | // with `num_threads` background threads. 35 | extern ThreadPool* NewThreadPool(int num_threads); 36 | 37 | } // namespace rocksdb 38 | -------------------------------------------------------------------------------- /include/rocksdb/types.h: -------------------------------------------------------------------------------- 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 | #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/checkpoint.h: -------------------------------------------------------------------------------- 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 | // A checkpoint is an openable snapshot of a database at a point in time. 7 | 8 | #pragma once 9 | #ifndef ROCKSDB_LITE 10 | 11 | #include 12 | #include "rocksdb/status.h" 13 | 14 | namespace rocksdb { 15 | 16 | class DB; 17 | 18 | class Checkpoint { 19 | public: 20 | // Creates a Checkpoint object to be used for creating openable sbapshots 21 | static Status Create(DB* db, Checkpoint** checkpoint_ptr); 22 | 23 | // Builds an openable snapshot of RocksDB on the same disk, which 24 | // accepts an output directory on the same disk, and under the directory 25 | // (1) hard-linked SST files pointing to existing live SST files 26 | // SST files will be copied if output directory is on a different filesystem 27 | // (2) a copied manifest files and other files 28 | // The directory should not already exist and will be created by this API. 29 | // The directory will be an absolute path 30 | virtual Status CreateCheckpoint(const std::string& checkpoint_dir); 31 | 32 | virtual ~Checkpoint() {} 33 | }; 34 | 35 | } // namespace rocksdb 36 | #endif // !ROCKSDB_LITE 37 | -------------------------------------------------------------------------------- /include/rocksdb/utilities/convenience.h: -------------------------------------------------------------------------------- 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 | #pragma once 7 | 8 | // This file was moved to rocksdb/convenience.h" 9 | 10 | #include "rocksdb/convenience.h" 11 | -------------------------------------------------------------------------------- /include/rocksdb/utilities/flashcache.h: -------------------------------------------------------------------------------- 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 | #pragma once 7 | 8 | #include 9 | #include "rocksdb/env.h" 10 | 11 | namespace rocksdb { 12 | 13 | // This API is experimental. We will mark it stable once we run it in production 14 | // for a while. 15 | // NewFlashcacheAwareEnv() creates and Env that blacklists all background 16 | // threads (used for flush and compaction) from using flashcache to cache their 17 | // reads. Reads from compaction thread don't need to be cached because they are 18 | // going to be soon made obsolete (due to nature of compaction) 19 | // Usually you would pass Env::Default() as base. 20 | // cachedev_fd is a file descriptor of the flashcache device. Caller has to 21 | // open flashcache device before calling this API. 22 | extern std::unique_ptr NewFlashcacheAwareEnv( 23 | Env* base, const int cachedev_fd); 24 | 25 | } // namespace rocksdb 26 | -------------------------------------------------------------------------------- /include/rocksdb/utilities/info_log_finder.h: -------------------------------------------------------------------------------- 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 | #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 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 | #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 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 | #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 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 | #pragma once 6 | 7 | #define ROCKSDB_MAJOR 4 8 | #define ROCKSDB_MINOR 13 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-5.6-i386" 11 | end 12 | 13 | config.vm.define "linux64" do |linux64| 14 | linux64.vm.box = "hansode/centos-5.6-x86_64" 15 | end 16 | 17 | config.vm.provider "virtualbox" do |v| 18 | v.memory = 2048 19 | v.cpus = 4 20 | end 21 | 22 | config.vm.provision :shell, path: "build-linux-centos.sh" 23 | config.vm.synced_folder "../target", "/rocksdb-build" 24 | config.vm.synced_folder "../..", "/rocksdb", type: "rsync" 25 | config.vm.boot_timeout = 1200 26 | end 27 | -------------------------------------------------------------------------------- /java/crossbuild/build-linux-centos.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # install all required packages for rocksdb that are available through yum 3 | ARCH=$(uname -i) 4 | sudo yum -y install openssl java-1.7.0-openjdk-devel.$ARCH 5 | 6 | # install gcc/g++ 4.8.2 via CERN (http://linux.web.cern.ch/linux/devtoolset/) 7 | sudo wget -O /etc/yum.repos.d/slc5-devtoolset.repo http://linuxsoft.cern.ch/cern/devtoolset/slc5-devtoolset.repo 8 | sudo wget -O /etc/pki/rpm-gpg/RPM-GPG-KEY-cern http://ftp.mirrorservice.org/sites/ftp.scientificlinux.org/linux/scientific/51/i386/RPM-GPG-KEYs/RPM-GPG-KEY-cern 9 | sudo yum -y install devtoolset-2 10 | 11 | wget http://gflags.googlecode.com/files/gflags-2.0-no-svn-files.tar.gz 12 | tar xvfz gflags-2.0-no-svn-files.tar.gz; cd gflags-2.0; scl enable devtoolset-2 ./configure; scl enable devtoolset-2 make; sudo make install 13 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib 14 | 15 | # set java home so we can build rocksdb jars 16 | export JAVA_HOME=/usr/lib/jvm/java-1.7.0 17 | 18 | # build rocksdb 19 | cd /rocksdb 20 | scl enable devtoolset-2 'make jclean clean' 21 | scl enable devtoolset-2 'PORTABLE=1 make rocksdbjavastatic' 22 | cp /rocksdb/java/target/librocksdbjni-* /rocksdb-build 23 | cp /rocksdb/java/target/rocksdbjni-* /rocksdb-build 24 | 25 | -------------------------------------------------------------------------------- /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/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/columnfamilyhandle.cc: -------------------------------------------------------------------------------- 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 | // 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 it = reinterpret_cast(handle); 24 | delete it; 25 | } 26 | -------------------------------------------------------------------------------- /java/rocksjni/compaction_filter.cc: -------------------------------------------------------------------------------- 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 | // 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 | delete reinterpret_cast(handle); 24 | } 25 | // 26 | -------------------------------------------------------------------------------- /java/rocksjni/merge_operator.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014, Vlad Balan (vlad.gm@gmail.com). 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 | // This file implements the "bridge" between Java and C++ 7 | // for rocksdb::MergeOperator. 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | #include "include/org_rocksdb_StringAppendOperator.h" 16 | #include "rocksjni/portal.h" 17 | #include "rocksdb/db.h" 18 | #include "rocksdb/options.h" 19 | #include "rocksdb/statistics.h" 20 | #include "rocksdb/memtablerep.h" 21 | #include "rocksdb/table.h" 22 | #include "rocksdb/slice_transform.h" 23 | #include "rocksdb/merge_operator.h" 24 | #include "utilities/merge_operators.h" 25 | 26 | /* 27 | * Class: org_rocksdb_StringAppendOperator 28 | * Method: newMergeOperatorHandle 29 | * Signature: ()J 30 | */ 31 | jlong Java_org_rocksdb_StringAppendOperator_newMergeOperatorHandleImpl 32 | (JNIEnv* env, jobject jobj) { 33 | std::shared_ptr *op = 34 | new std::shared_ptr(); 35 | *op = rocksdb::MergeOperators::CreateFromStringId("stringappend"); 36 | return reinterpret_cast(op); 37 | } 38 | -------------------------------------------------------------------------------- /java/rocksjni/remove_emptyvalue_compactionfilterjni.cc: -------------------------------------------------------------------------------- 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 | #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 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 | // This file implements the "bridge" between Java and C++ and enables 7 | // calling c++ rocksdb::RestoreBackupableDB and 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 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 | // 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/src/main/java/org/rocksdb/AbstractCompactionFilter.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 | 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 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 | * 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/ChecksumType.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 | * 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 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 | * 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/DirectComparator.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 | * 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 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 | 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 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 | * 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 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 | 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/HistogramType.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 | public enum HistogramType { 9 | DB_GET(0), 10 | DB_WRITE(1), 11 | COMPACTION_TIME(2), 12 | TABLE_SYNC_MICROS(3), 13 | COMPACTION_OUTFILE_SYNC_MICROS(4), 14 | WAL_FILE_SYNC_MICROS(5), 15 | MANIFEST_FILE_SYNC_MICROS(6), 16 | // TIME SPENT IN IO DURING TABLE OPEN 17 | TABLE_OPEN_IO_MICROS(7), 18 | DB_MULTIGET(8), 19 | READ_BLOCK_COMPACTION_MICROS(9), 20 | READ_BLOCK_GET_MICROS(10), 21 | WRITE_RAW_BLOCK_MICROS(11), 22 | STALL_L0_SLOWDOWN_COUNT(12), 23 | STALL_MEMTABLE_COMPACTION_COUNT(13), 24 | STALL_L0_NUM_FILES_COUNT(14), 25 | HARD_RATE_LIMIT_DELAY_COUNT(15), 26 | SOFT_RATE_LIMIT_DELAY_COUNT(16), 27 | NUM_FILES_IN_SINGLE_COMPACTION(17), 28 | DB_SEEK(18), 29 | WRITE_STALL(19); 30 | 31 | private final int value_; 32 | 33 | private HistogramType(int value) { 34 | value_ = value; 35 | } 36 | 37 | public int getValue() { 38 | return value_; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /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 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 | * 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 | /** 24 | * Returns the byte value of the enumerations value 25 | * 26 | * @return byte representation 27 | */ 28 | public byte getValue() { 29 | return value_; 30 | } 31 | 32 | private IndexType(byte value) { 33 | value_ = value; 34 | } 35 | 36 | private final byte value_; 37 | } 38 | -------------------------------------------------------------------------------- /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(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 or null. 36 | * @throws java.lang.IllegalArgumentException if an invalid 37 | * value is provided. 38 | */ 39 | public static InfoLogLevel getInfoLogLevel(byte value) { 40 | for (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 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 | 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 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 | * 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 interface MergeOperator { 14 | long newMergeOperatorHandle(); 15 | } 16 | -------------------------------------------------------------------------------- /java/src/main/java/org/rocksdb/RateLimiterConfig.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 | package org.rocksdb; 6 | 7 | /** 8 | * Config for rate limiter, which is used to control write rate of flush and 9 | * compaction. 10 | * 11 | * @deprecated obsolete. See: {@link org.rocksdb.RateLimiter}. 12 | */ 13 | @Deprecated 14 | public abstract class RateLimiterConfig { 15 | /** 16 | * This function should only be called by 17 | * {@link org.rocksdb.DBOptions#setRateLimiter(long, long)}, which will 18 | * create a c++ shared-pointer to the c++ {@code RateLimiter} that is associated 19 | * with a Java RateLimiterConfig. 20 | * 21 | * @see org.rocksdb.DBOptions#setRateLimiter(long, long) 22 | * 23 | * @return native handle address to rate limiter instance. 24 | */ 25 | abstract protected long newRateLimiterHandle(); 26 | } 27 | -------------------------------------------------------------------------------- /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 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 | * 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 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 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 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 | * 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 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 | * 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 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 | * 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/SkipListMemTableConfig.java: -------------------------------------------------------------------------------- 1 | package org.rocksdb; 2 | 3 | /** 4 | * The config for skip-list memtable representation. 5 | */ 6 | public class SkipListMemTableConfig extends MemTableConfig { 7 | 8 | public static final long DEFAULT_LOOKAHEAD = 0; 9 | 10 | /** 11 | * SkipListMemTableConfig constructor 12 | */ 13 | public SkipListMemTableConfig() { 14 | lookahead_ = DEFAULT_LOOKAHEAD; 15 | } 16 | 17 | /** 18 | * Sets lookahead for SkipList 19 | * 20 | * @param lookahead If non-zero, each iterator's seek operation 21 | * will start the search from the previously visited record 22 | * (doing at most 'lookahead' steps). This is an 23 | * optimization for the access pattern including many 24 | * seeks with consecutive keys. 25 | * @return the current instance of SkipListMemTableConfig 26 | */ 27 | public SkipListMemTableConfig setLookahead(final long lookahead) { 28 | lookahead_ = lookahead; 29 | return this; 30 | } 31 | 32 | /** 33 | * Returns the currently set lookahead value. 34 | * 35 | * @return lookahead value 36 | */ 37 | public long lookahead() { 38 | return lookahead_; 39 | } 40 | 41 | 42 | @Override protected long newMemTableFactoryHandle() { 43 | return newMemTableFactoryHandle0(lookahead_); 44 | } 45 | 46 | private native long newMemTableFactoryHandle0(long lookahead) 47 | throws IllegalArgumentException; 48 | 49 | private long lookahead_; 50 | } 51 | -------------------------------------------------------------------------------- /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 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 | * 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/Statistics.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 | * Statistics to analyze the performance of a db. Pointer for statistics object 10 | * is managed by Options class. 11 | */ 12 | public class Statistics { 13 | 14 | private final long statsHandle_; 15 | 16 | public Statistics(final long statsHandle) { 17 | statsHandle_ = statsHandle; 18 | } 19 | 20 | public long getTickerCount(TickerType tickerType) { 21 | assert(isInitialized()); 22 | return getTickerCount0(tickerType.getValue(), statsHandle_); 23 | } 24 | 25 | public HistogramData getHistogramData(final HistogramType histogramType) { 26 | assert(isInitialized()); 27 | return getHistogramData0( 28 | histogramType.getValue(), statsHandle_); 29 | } 30 | 31 | private boolean isInitialized() { 32 | return (statsHandle_ != 0); 33 | } 34 | 35 | private native long getTickerCount0(int tickerType, long handle); 36 | private native HistogramData getHistogramData0(int histogramType, 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 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 | * 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 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 | * 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 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 | * StringAppendOperator is a merge operator that concatenates 10 | * two strings. 11 | */ 12 | public class StringAppendOperator implements MergeOperator { 13 | @Override public long newMergeOperatorHandle() { 14 | return newMergeOperatorHandleImpl(); 15 | } 16 | private native long newMergeOperatorHandleImpl(); 17 | } 18 | -------------------------------------------------------------------------------- /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 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 | 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 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.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 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.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/ComparatorOptionsTest.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 | 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/CompressionOptionsTest.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 | import org.junit.Test; 9 | 10 | 11 | public class CompressionOptionsTest { 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 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 | 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/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 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 | 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 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 | * 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/WriteOptionsTest.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 | import org.junit.ClassRule; 9 | import org.junit.Test; 10 | 11 | import static org.assertj.core.api.Assertions.assertThat; 12 | 13 | public class WriteOptionsTest { 14 | 15 | @ClassRule 16 | public static final RocksMemoryResource rocksMemoryResource = 17 | new RocksMemoryResource(); 18 | 19 | @Test 20 | public void writeOptions() { 21 | try (final WriteOptions writeOptions = new WriteOptions()) { 22 | writeOptions.setDisableWAL(true); 23 | assertThat(writeOptions.disableWAL()).isTrue(); 24 | writeOptions.setDisableWAL(false); 25 | assertThat(writeOptions.disableWAL()).isFalse(); 26 | writeOptions.setSync(true); 27 | assertThat(writeOptions.sync()).isTrue(); 28 | writeOptions.setSync(false); 29 | assertThat(writeOptions.sync()).isFalse(); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /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 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 | 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 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 | #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 | -------------------------------------------------------------------------------- /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 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 | // 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 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 | // 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 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 | // 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 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 | #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 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 | // 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 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 | // 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 "util/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 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 | // 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 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 | // 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 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 | // 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 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 | #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 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 | #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 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 | 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/table_properties_internal.h: -------------------------------------------------------------------------------- 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 | #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/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/epfl-labos/TRIAD/c9f9067aada1c0d605b1a91db3c86a03746aa845/tools/.DS_Store -------------------------------------------------------------------------------- /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 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 | // 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: