db_options.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. // Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
  2. // This source code is licensed under both the GPLv2 (found in the
  3. // COPYING file in the root directory) and Apache 2.0 License
  4. // (found in the LICENSE.Apache file in the root directory).
  5. #pragma once
  6. #include <string>
  7. #include <vector>
  8. #include "rocksdb/options.h"
  9. namespace ROCKSDB_NAMESPACE {
  10. struct ImmutableDBOptions {
  11. ImmutableDBOptions();
  12. explicit ImmutableDBOptions(const DBOptions& options);
  13. void Dump(Logger* log) const;
  14. bool create_if_missing;
  15. bool create_missing_column_families;
  16. bool error_if_exists;
  17. bool paranoid_checks;
  18. Env* env;
  19. std::shared_ptr<FileSystem> fs;
  20. std::shared_ptr<RateLimiter> rate_limiter;
  21. std::shared_ptr<SstFileManager> sst_file_manager;
  22. std::shared_ptr<Logger> info_log;
  23. InfoLogLevel info_log_level;
  24. int max_file_opening_threads;
  25. std::shared_ptr<Statistics> statistics;
  26. bool use_fsync;
  27. std::vector<DbPath> db_paths;
  28. std::string db_log_dir;
  29. std::string wal_dir;
  30. uint32_t max_subcompactions;
  31. int max_background_flushes;
  32. size_t max_log_file_size;
  33. size_t log_file_time_to_roll;
  34. size_t keep_log_file_num;
  35. size_t recycle_log_file_num;
  36. uint64_t max_manifest_file_size;
  37. int table_cache_numshardbits;
  38. uint64_t wal_ttl_seconds;
  39. uint64_t wal_size_limit_mb;
  40. uint64_t max_write_batch_group_size_bytes;
  41. size_t manifest_preallocation_size;
  42. bool allow_mmap_reads;
  43. bool allow_mmap_writes;
  44. bool use_direct_reads;
  45. bool use_direct_io_for_flush_and_compaction;
  46. bool allow_fallocate;
  47. bool is_fd_close_on_exec;
  48. bool advise_random_on_open;
  49. size_t db_write_buffer_size;
  50. std::shared_ptr<WriteBufferManager> write_buffer_manager;
  51. DBOptions::AccessHint access_hint_on_compaction_start;
  52. bool new_table_reader_for_compaction_inputs;
  53. size_t random_access_max_buffer_size;
  54. bool use_adaptive_mutex;
  55. std::vector<std::shared_ptr<EventListener>> listeners;
  56. bool enable_thread_tracking;
  57. bool enable_pipelined_write;
  58. bool unordered_write;
  59. bool allow_concurrent_memtable_write;
  60. bool enable_write_thread_adaptive_yield;
  61. uint64_t write_thread_max_yield_usec;
  62. uint64_t write_thread_slow_yield_usec;
  63. bool skip_stats_update_on_db_open;
  64. bool skip_checking_sst_file_sizes_on_db_open;
  65. WALRecoveryMode wal_recovery_mode;
  66. bool allow_2pc;
  67. std::shared_ptr<Cache> row_cache;
  68. #ifndef ROCKSDB_LITE
  69. WalFilter* wal_filter;
  70. #endif // ROCKSDB_LITE
  71. bool fail_if_options_file_error;
  72. bool dump_malloc_stats;
  73. bool avoid_flush_during_recovery;
  74. bool allow_ingest_behind;
  75. bool preserve_deletes;
  76. bool two_write_queues;
  77. bool manual_wal_flush;
  78. bool atomic_flush;
  79. bool avoid_unnecessary_blocking_io;
  80. bool persist_stats_to_disk;
  81. bool write_dbid_to_manifest;
  82. size_t log_readahead_size;
  83. std::shared_ptr<FileChecksumFunc> sst_file_checksum_func;
  84. };
  85. struct MutableDBOptions {
  86. MutableDBOptions();
  87. explicit MutableDBOptions(const MutableDBOptions& options) = default;
  88. explicit MutableDBOptions(const DBOptions& options);
  89. void Dump(Logger* log) const;
  90. int max_background_jobs;
  91. int base_background_compactions;
  92. int max_background_compactions;
  93. bool avoid_flush_during_shutdown;
  94. size_t writable_file_max_buffer_size;
  95. uint64_t delayed_write_rate;
  96. uint64_t max_total_wal_size;
  97. uint64_t delete_obsolete_files_period_micros;
  98. unsigned int stats_dump_period_sec;
  99. unsigned int stats_persist_period_sec;
  100. size_t stats_history_buffer_size;
  101. int max_open_files;
  102. uint64_t bytes_per_sync;
  103. uint64_t wal_bytes_per_sync;
  104. bool strict_bytes_per_sync;
  105. size_t compaction_readahead_size;
  106. };
  107. } // namespace ROCKSDB_NAMESPACE