Skip to content

Commit 459789a

Browse files
authored
Merge pull request #40 from meitu/refactor/config-base-code
refactor the config code base and make it clearly
2 parents 838a1cc + a222214 commit 459789a

13 files changed

Lines changed: 786 additions & 769 deletions

CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ target_sources(kvrocks PRIVATE
121121
src/rocksdb_crc32c.h
122122
src/config.cc
123123
src/config.h
124+
src/config_type.h
124125
src/stats.cc
125126
src/stats.h
126127
src/server.cc
@@ -204,6 +205,7 @@ target_sources(kvrocks2redis PRIVATE
204205
src/rocksdb_crc32c.h
205206
src/config.cc
206207
src/config.h
208+
src/config_type.h
207209
src/stats.cc
208210
src/stats.h
209211
src/server.cc
@@ -258,6 +260,8 @@ add_executable(unittest
258260
src/redis_zset.cc
259261
src/redis_sortedint.cc
260262
src/redis_sortedint.h
263+
src/redis_slot.cc
264+
src/redis_slot.h
261265
src/util.cc
262266
src/storage.cc
263267
src/lock_manager.cc
@@ -287,7 +291,7 @@ add_executable(unittest
287291
tests/task_runner_test.cc
288292
tests/t_bitmap_test.cc
289293
tests/compact_test.cc
290-
tests/log_collector_test.cc)
294+
tests/log_collector_test.cc src/config_type.h)
291295

292296
add_dependencies(unittest glog rocksdb snappy jemalloc)
293297
target_compile_features(unittest PRIVATE cxx_std_11)

kvrocks.conf

Lines changed: 58 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@ workers 8
2424
# Default: 1
2525
repl-workers 1
2626

27-
# The value should be INFO, WARNING, ERROR, FATAL
28-
# Default: INFO
29-
loglevel INFO
30-
3127
# By default kvrocks does not run as a daemon. Use 'yes' if you need it.
3228
# Note that kvrocks will write a pid file in /var/run/kvrocks.pid when daemonized.
3329
daemonize no
@@ -73,16 +69,10 @@ db-name change.me.db
7369
# Note that you must specify a directory here, not a file name.
7470
dir /tmp/kvrocks
7571

76-
# The backup directory
77-
#
78-
# The DB will be written inside this directory
79-
# Note that you must specify a directory here, not a file name.
80-
# kvrocks will create backup directory in ${CONFIG_DIR}/backup by default.
81-
# backup-dir /tmp/kvrocks/backup
82-
8372
# When running daemonized, kvrocks writes a pid file in ${CONFIG_DIR}/kvrocks.pid by
8473
# default. You can specify a custom pid file location here.
8574
# pidfile /var/run/kvrocks.pid
75+
pidfile ""
8676

8777
# You can configure a slave instance to accept writes or not. Writing against
8878
# a slave instance may be useful to store some ephemeral data (because data
@@ -178,8 +168,24 @@ max-backup-keep-hours 168
178168
# Enable the kvrocks to support the codis protocol, if the db enabled the codis mode at first open,
179169
# this option must not be disabled after restarted, and vice versa
180170
# Defalut: no
181-
# codis-enabled yes
171+
codis-enabled no
182172

173+
# Ratio of the samples would be recorded when the profiling was enabled.
174+
# we simply use the rand to determine whether to record the sample or not.
175+
#
176+
# Default: 0
177+
profiling-sample-ratio 0
178+
179+
# There is no limit to this length. Just be aware that it will consume memory.
180+
# You can reclaim memory used by the perf log with PERFLOG RESET.
181+
#
182+
# Default: 256
183+
profiling-sample-record-max-len 256
184+
185+
# profiling-sample-record-threshold-ms use to tell the kvrocks when to record.
186+
#
187+
# Default: 100 millisecond
188+
profiling-sample-record-threshold-ms 100
183189

184190
################################## SLOW LOG ###################################
185191

@@ -224,11 +230,10 @@ supervised no
224230
# would compact the db at 3am and 4am everyday
225231
compact-cron 0 3 * * *
226232

227-
# Backup Scheduler, auto backup at schedule time
228-
# time expression format is the same as compact-cron
233+
# Bgsave scheduler, auto bgsave at schedule time
234+
# time expression format is the same as crontab(currently only support * and int)
229235
# e.g. compact-cron 0 3 * * * 0 4 * * *
230-
# would backup the db at 3am and 4am everyday
231-
# bgsave-cron 0 4 * * *
236+
# would bgsave the db at 3am and 4am everyday
232237

233238
################################ ROCKSDB #####################################
234239

@@ -330,5 +335,42 @@ rocksdb.cache_index_and_filter_blocks no
330335
# default snappy
331336
rocksdb.compression snappy
332337

338+
# If non-zero, we perform bigger reads when doing compaction. If you're
339+
# running RocksDB on spinning disks, you should set this to at least 2MB.
340+
# That way RocksDB's compaction is doing sequential instead of random reads.
341+
# When non-zero, we also force new_table_reader_for_compaction_inputs to
342+
# true.
343+
#
344+
# Default: 2 MB
345+
rocksdb.compaction_readahead_size 2097152
346+
347+
# he limited write rate to DB if soft_pending_compaction_bytes_limit or
348+
# level0_slowdown_writes_trigger is triggered.
349+
350+
# If the value is 0, we will infer a value from `rater_limiter` value
351+
# if it is not empty, or 16MB if `rater_limiter` is empty. Note that
352+
# if users change the rate in `rate_limiter` after DB is opened,
353+
# `delayed_write_rate` won't be adjusted.
354+
#
355+
rocksdb.delayed_write_rate 0
356+
# If enable_pipelined_write is true, separate write thread queue is
357+
# maintained for WAL write and memtable write.
358+
#
359+
# Default: yes
360+
rocksdb.enable_pipelined_write yes
361+
362+
# Soft limit on number of level-0 files. We start slowing down writes at this
363+
# point. A value <0 means that no writing slow down will be triggered by
364+
# number of files in level-0.
365+
#
366+
# Default: 20
367+
rocksdb.level0_slowdown_writes_trigger 20
368+
369+
# if not zero, dump rocksdb.stats to LOG every stats_dump_period_sec
370+
#
371+
# Default: 0
372+
rocksdb.stats_dump_period_sec 0
373+
374+
333375
################################ NAMESPACE #####################################
334376
# namespace.test change.me

0 commit comments

Comments
 (0)