mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-23 08:38:27 -05:00
Merge pull request #6624 from oranagra/config_c_step_3
Additional config.c refractory and bugfixes
This commit is contained in:
commit
ce7ec725e3
@ -13,15 +13,10 @@
|
|||||||
|
|
||||||
/* The following defines are amount of time, sometimes expressed as
|
/* The following defines are amount of time, sometimes expressed as
|
||||||
* multiplicators of the node timeout value (when ending with MULT). */
|
* multiplicators of the node timeout value (when ending with MULT). */
|
||||||
#define CLUSTER_DEFAULT_NODE_TIMEOUT 15000
|
|
||||||
#define CLUSTER_DEFAULT_SLAVE_VALIDITY 10 /* Slave max data age factor. */
|
|
||||||
#define CLUSTER_DEFAULT_REQUIRE_FULL_COVERAGE 1
|
|
||||||
#define CLUSTER_DEFAULT_SLAVE_NO_FAILOVER 0 /* Failover by default. */
|
|
||||||
#define CLUSTER_FAIL_REPORT_VALIDITY_MULT 2 /* Fail report validity. */
|
#define CLUSTER_FAIL_REPORT_VALIDITY_MULT 2 /* Fail report validity. */
|
||||||
#define CLUSTER_FAIL_UNDO_TIME_MULT 2 /* Undo fail if master is back. */
|
#define CLUSTER_FAIL_UNDO_TIME_MULT 2 /* Undo fail if master is back. */
|
||||||
#define CLUSTER_FAIL_UNDO_TIME_ADD 10 /* Some additional time. */
|
#define CLUSTER_FAIL_UNDO_TIME_ADD 10 /* Some additional time. */
|
||||||
#define CLUSTER_FAILOVER_DELAY 5 /* Seconds */
|
#define CLUSTER_FAILOVER_DELAY 5 /* Seconds */
|
||||||
#define CLUSTER_DEFAULT_MIGRATION_BARRIER 1
|
|
||||||
#define CLUSTER_MF_TIMEOUT 5000 /* Milliseconds to do a manual failover. */
|
#define CLUSTER_MF_TIMEOUT 5000 /* Milliseconds to do a manual failover. */
|
||||||
#define CLUSTER_MF_PAUSE_MULT 2 /* Master pause manual failover mult. */
|
#define CLUSTER_MF_PAUSE_MULT 2 /* Master pause manual failover mult. */
|
||||||
#define CLUSTER_SLAVE_MIGRATION_DELAY 5000 /* Delay for slave migration. */
|
#define CLUSTER_SLAVE_MIGRATION_DELAY 5000 /* Delay for slave migration. */
|
||||||
|
1099
src/config.c
1099
src/config.c
File diff suppressed because it is too large
Load Diff
108
src/server.c
108
src/server.c
@ -2274,50 +2274,18 @@ void initServerConfig(void) {
|
|||||||
server.timezone = getTimeZone(); /* Initialized by tzset(). */
|
server.timezone = getTimeZone(); /* Initialized by tzset(). */
|
||||||
server.configfile = NULL;
|
server.configfile = NULL;
|
||||||
server.executable = NULL;
|
server.executable = NULL;
|
||||||
server.hz = server.config_hz = CONFIG_DEFAULT_HZ;
|
|
||||||
server.dynamic_hz = CONFIG_DEFAULT_DYNAMIC_HZ;
|
|
||||||
server.arch_bits = (sizeof(long) == 8) ? 64 : 32;
|
server.arch_bits = (sizeof(long) == 8) ? 64 : 32;
|
||||||
server.port = CONFIG_DEFAULT_SERVER_PORT;
|
|
||||||
server.tls_port = CONFIG_DEFAULT_SERVER_TLS_PORT;
|
|
||||||
server.tcp_backlog = CONFIG_DEFAULT_TCP_BACKLOG;
|
|
||||||
server.bindaddr_count = 0;
|
server.bindaddr_count = 0;
|
||||||
server.unixsocket = NULL;
|
|
||||||
server.unixsocketperm = CONFIG_DEFAULT_UNIX_SOCKET_PERM;
|
server.unixsocketperm = CONFIG_DEFAULT_UNIX_SOCKET_PERM;
|
||||||
server.ipfd_count = 0;
|
server.ipfd_count = 0;
|
||||||
server.tlsfd_count = 0;
|
server.tlsfd_count = 0;
|
||||||
server.sofd = -1;
|
server.sofd = -1;
|
||||||
server.protected_mode = CONFIG_DEFAULT_PROTECTED_MODE;
|
|
||||||
server.gopher_enabled = CONFIG_DEFAULT_GOPHER_ENABLED;
|
|
||||||
server.dbnum = CONFIG_DEFAULT_DBNUM;
|
|
||||||
server.verbosity = CONFIG_DEFAULT_VERBOSITY;
|
|
||||||
server.maxidletime = CONFIG_DEFAULT_CLIENT_TIMEOUT;
|
|
||||||
server.tcpkeepalive = CONFIG_DEFAULT_TCP_KEEPALIVE;
|
|
||||||
server.active_expire_enabled = 1;
|
server.active_expire_enabled = 1;
|
||||||
server.active_expire_effort = CONFIG_DEFAULT_ACTIVE_EXPIRE_EFFORT;
|
|
||||||
server.jemalloc_bg_thread = 1;
|
|
||||||
server.active_defrag_enabled = CONFIG_DEFAULT_ACTIVE_DEFRAG;
|
|
||||||
server.active_defrag_ignore_bytes = CONFIG_DEFAULT_DEFRAG_IGNORE_BYTES;
|
|
||||||
server.active_defrag_threshold_lower = CONFIG_DEFAULT_DEFRAG_THRESHOLD_LOWER;
|
|
||||||
server.active_defrag_threshold_upper = CONFIG_DEFAULT_DEFRAG_THRESHOLD_UPPER;
|
|
||||||
server.active_defrag_cycle_min = CONFIG_DEFAULT_DEFRAG_CYCLE_MIN;
|
|
||||||
server.active_defrag_cycle_max = CONFIG_DEFAULT_DEFRAG_CYCLE_MAX;
|
|
||||||
server.active_defrag_max_scan_fields = CONFIG_DEFAULT_DEFRAG_MAX_SCAN_FIELDS;
|
|
||||||
server.proto_max_bulk_len = CONFIG_DEFAULT_PROTO_MAX_BULK_LEN;
|
|
||||||
server.client_max_querybuf_len = PROTO_MAX_QUERYBUF_LEN;
|
server.client_max_querybuf_len = PROTO_MAX_QUERYBUF_LEN;
|
||||||
server.saveparams = NULL;
|
server.saveparams = NULL;
|
||||||
server.loading = 0;
|
server.loading = 0;
|
||||||
server.logfile = zstrdup(CONFIG_DEFAULT_LOGFILE);
|
server.logfile = zstrdup(CONFIG_DEFAULT_LOGFILE);
|
||||||
server.syslog_enabled = CONFIG_DEFAULT_SYSLOG_ENABLED;
|
|
||||||
server.syslog_ident = zstrdup(CONFIG_DEFAULT_SYSLOG_IDENT);
|
|
||||||
server.syslog_facility = LOG_LOCAL0;
|
|
||||||
server.daemonize = CONFIG_DEFAULT_DAEMONIZE;
|
|
||||||
server.supervised = 0;
|
|
||||||
server.supervised_mode = SUPERVISED_NONE;
|
|
||||||
server.aof_state = AOF_OFF;
|
server.aof_state = AOF_OFF;
|
||||||
server.aof_fsync = CONFIG_DEFAULT_AOF_FSYNC;
|
|
||||||
server.aof_no_fsync_on_rewrite = CONFIG_DEFAULT_AOF_NO_FSYNC_ON_REWRITE;
|
|
||||||
server.aof_rewrite_perc = AOF_REWRITE_PERC;
|
|
||||||
server.aof_rewrite_min_size = AOF_REWRITE_MIN_SIZE;
|
|
||||||
server.aof_rewrite_base_size = 0;
|
server.aof_rewrite_base_size = 0;
|
||||||
server.aof_rewrite_scheduled = 0;
|
server.aof_rewrite_scheduled = 0;
|
||||||
server.aof_flush_sleep = 0;
|
server.aof_flush_sleep = 0;
|
||||||
@ -2329,63 +2297,18 @@ void initServerConfig(void) {
|
|||||||
server.aof_fd = -1;
|
server.aof_fd = -1;
|
||||||
server.aof_selected_db = -1; /* Make sure the first time will not match */
|
server.aof_selected_db = -1; /* Make sure the first time will not match */
|
||||||
server.aof_flush_postponed_start = 0;
|
server.aof_flush_postponed_start = 0;
|
||||||
server.aof_rewrite_incremental_fsync = CONFIG_DEFAULT_AOF_REWRITE_INCREMENTAL_FSYNC;
|
|
||||||
server.rdb_save_incremental_fsync = CONFIG_DEFAULT_RDB_SAVE_INCREMENTAL_FSYNC;
|
|
||||||
server.rdb_key_save_delay = CONFIG_DEFAULT_RDB_KEY_SAVE_DELAY;
|
|
||||||
server.key_load_delay = CONFIG_DEFAULT_KEY_LOAD_DELAY;
|
|
||||||
server.aof_load_truncated = CONFIG_DEFAULT_AOF_LOAD_TRUNCATED;
|
|
||||||
server.aof_use_rdb_preamble = CONFIG_DEFAULT_AOF_USE_RDB_PREAMBLE;
|
|
||||||
server.pidfile = NULL;
|
server.pidfile = NULL;
|
||||||
server.rdb_filename = zstrdup(CONFIG_DEFAULT_RDB_FILENAME);
|
|
||||||
server.aof_filename = zstrdup(CONFIG_DEFAULT_AOF_FILENAME);
|
|
||||||
server.acl_filename = zstrdup(CONFIG_DEFAULT_ACL_FILENAME);
|
|
||||||
server.rdb_compression = CONFIG_DEFAULT_RDB_COMPRESSION;
|
|
||||||
server.rdb_checksum = CONFIG_DEFAULT_RDB_CHECKSUM;
|
|
||||||
server.stop_writes_on_bgsave_err = CONFIG_DEFAULT_STOP_WRITES_ON_BGSAVE_ERROR;
|
|
||||||
server.activerehashing = CONFIG_DEFAULT_ACTIVE_REHASHING;
|
|
||||||
server.active_defrag_running = 0;
|
server.active_defrag_running = 0;
|
||||||
server.notify_keyspace_events = 0;
|
server.notify_keyspace_events = 0;
|
||||||
server.maxclients = CONFIG_DEFAULT_MAX_CLIENTS;
|
|
||||||
server.blocked_clients = 0;
|
server.blocked_clients = 0;
|
||||||
memset(server.blocked_clients_by_type,0,
|
memset(server.blocked_clients_by_type,0,
|
||||||
sizeof(server.blocked_clients_by_type));
|
sizeof(server.blocked_clients_by_type));
|
||||||
server.maxmemory = CONFIG_DEFAULT_MAXMEMORY;
|
|
||||||
server.maxmemory_policy = CONFIG_DEFAULT_MAXMEMORY_POLICY;
|
|
||||||
server.maxmemory_samples = CONFIG_DEFAULT_MAXMEMORY_SAMPLES;
|
|
||||||
server.lfu_log_factor = CONFIG_DEFAULT_LFU_LOG_FACTOR;
|
|
||||||
server.lfu_decay_time = CONFIG_DEFAULT_LFU_DECAY_TIME;
|
|
||||||
server.hash_max_ziplist_entries = OBJ_HASH_MAX_ZIPLIST_ENTRIES;
|
|
||||||
server.hash_max_ziplist_value = OBJ_HASH_MAX_ZIPLIST_VALUE;
|
|
||||||
server.list_max_ziplist_size = OBJ_LIST_MAX_ZIPLIST_SIZE;
|
|
||||||
server.list_compress_depth = OBJ_LIST_COMPRESS_DEPTH;
|
|
||||||
server.set_max_intset_entries = OBJ_SET_MAX_INTSET_ENTRIES;
|
|
||||||
server.zset_max_ziplist_entries = OBJ_ZSET_MAX_ZIPLIST_ENTRIES;
|
|
||||||
server.zset_max_ziplist_value = OBJ_ZSET_MAX_ZIPLIST_VALUE;
|
|
||||||
server.hll_sparse_max_bytes = CONFIG_DEFAULT_HLL_SPARSE_MAX_BYTES;
|
|
||||||
server.stream_node_max_bytes = OBJ_STREAM_NODE_MAX_BYTES;
|
|
||||||
server.stream_node_max_entries = OBJ_STREAM_NODE_MAX_ENTRIES;
|
|
||||||
server.shutdown_asap = 0;
|
server.shutdown_asap = 0;
|
||||||
server.cluster_enabled = 0;
|
|
||||||
server.cluster_node_timeout = CLUSTER_DEFAULT_NODE_TIMEOUT;
|
|
||||||
server.cluster_migration_barrier = CLUSTER_DEFAULT_MIGRATION_BARRIER;
|
|
||||||
server.cluster_slave_validity_factor = CLUSTER_DEFAULT_SLAVE_VALIDITY;
|
|
||||||
server.cluster_require_full_coverage = CLUSTER_DEFAULT_REQUIRE_FULL_COVERAGE;
|
|
||||||
server.cluster_slave_no_failover = CLUSTER_DEFAULT_SLAVE_NO_FAILOVER;
|
|
||||||
server.cluster_configfile = zstrdup(CONFIG_DEFAULT_CLUSTER_CONFIG_FILE);
|
server.cluster_configfile = zstrdup(CONFIG_DEFAULT_CLUSTER_CONFIG_FILE);
|
||||||
server.cluster_announce_ip = CONFIG_DEFAULT_CLUSTER_ANNOUNCE_IP;
|
|
||||||
server.cluster_announce_port = CONFIG_DEFAULT_CLUSTER_ANNOUNCE_PORT;
|
|
||||||
server.cluster_announce_bus_port = CONFIG_DEFAULT_CLUSTER_ANNOUNCE_BUS_PORT;
|
|
||||||
server.cluster_module_flags = CLUSTER_MODULE_FLAG_NONE;
|
server.cluster_module_flags = CLUSTER_MODULE_FLAG_NONE;
|
||||||
server.migrate_cached_sockets = dictCreate(&migrateCacheDictType,NULL);
|
server.migrate_cached_sockets = dictCreate(&migrateCacheDictType,NULL);
|
||||||
server.next_client_id = 1; /* Client IDs, start from 1 .*/
|
server.next_client_id = 1; /* Client IDs, start from 1 .*/
|
||||||
server.loading_process_events_interval_bytes = (1024*1024*2);
|
server.loading_process_events_interval_bytes = (1024*1024*2);
|
||||||
server.lazyfree_lazy_eviction = CONFIG_DEFAULT_LAZYFREE_LAZY_EVICTION;
|
|
||||||
server.lazyfree_lazy_expire = CONFIG_DEFAULT_LAZYFREE_LAZY_EXPIRE;
|
|
||||||
server.lazyfree_lazy_server_del = CONFIG_DEFAULT_LAZYFREE_LAZY_SERVER_DEL;
|
|
||||||
server.always_show_logo = CONFIG_DEFAULT_ALWAYS_SHOW_LOGO;
|
|
||||||
server.lua_time_limit = LUA_SCRIPT_TIME_LIMIT;
|
|
||||||
server.io_threads_num = CONFIG_DEFAULT_IO_THREADS_NUM;
|
|
||||||
server.io_threads_do_reads = CONFIG_DEFAULT_IO_THREADS_DO_READS;
|
|
||||||
|
|
||||||
server.lruclock = getLRUClock();
|
server.lruclock = getLRUClock();
|
||||||
resetServerSaveParams();
|
resetServerSaveParams();
|
||||||
@ -2406,31 +2329,14 @@ void initServerConfig(void) {
|
|||||||
server.repl_transfer_fd = -1;
|
server.repl_transfer_fd = -1;
|
||||||
server.repl_transfer_s = NULL;
|
server.repl_transfer_s = NULL;
|
||||||
server.repl_syncio_timeout = CONFIG_REPL_SYNCIO_TIMEOUT;
|
server.repl_syncio_timeout = CONFIG_REPL_SYNCIO_TIMEOUT;
|
||||||
server.repl_serve_stale_data = CONFIG_DEFAULT_SLAVE_SERVE_STALE_DATA;
|
|
||||||
server.repl_slave_ro = CONFIG_DEFAULT_SLAVE_READ_ONLY;
|
|
||||||
server.repl_slave_ignore_maxmemory = CONFIG_DEFAULT_SLAVE_IGNORE_MAXMEMORY;
|
|
||||||
server.repl_slave_lazy_flush = CONFIG_DEFAULT_SLAVE_LAZY_FLUSH;
|
|
||||||
server.repl_down_since = 0; /* Never connected, repl is down since EVER. */
|
server.repl_down_since = 0; /* Never connected, repl is down since EVER. */
|
||||||
server.repl_disable_tcp_nodelay = CONFIG_DEFAULT_REPL_DISABLE_TCP_NODELAY;
|
|
||||||
server.repl_diskless_sync = CONFIG_DEFAULT_REPL_DISKLESS_SYNC;
|
|
||||||
server.repl_diskless_load = CONFIG_DEFAULT_REPL_DISKLESS_LOAD;
|
|
||||||
server.repl_diskless_sync_delay = CONFIG_DEFAULT_REPL_DISKLESS_SYNC_DELAY;
|
|
||||||
server.repl_ping_slave_period = CONFIG_DEFAULT_REPL_PING_SLAVE_PERIOD;
|
|
||||||
server.repl_timeout = CONFIG_DEFAULT_REPL_TIMEOUT;
|
|
||||||
server.repl_min_slaves_to_write = CONFIG_DEFAULT_MIN_SLAVES_TO_WRITE;
|
|
||||||
server.repl_min_slaves_max_lag = CONFIG_DEFAULT_MIN_SLAVES_MAX_LAG;
|
|
||||||
server.slave_priority = CONFIG_DEFAULT_SLAVE_PRIORITY;
|
|
||||||
server.slave_announce_ip = CONFIG_DEFAULT_SLAVE_ANNOUNCE_IP;
|
|
||||||
server.slave_announce_port = CONFIG_DEFAULT_SLAVE_ANNOUNCE_PORT;
|
|
||||||
server.master_repl_offset = 0;
|
server.master_repl_offset = 0;
|
||||||
|
|
||||||
/* Replication partial resync backlog */
|
/* Replication partial resync backlog */
|
||||||
server.repl_backlog = NULL;
|
server.repl_backlog = NULL;
|
||||||
server.repl_backlog_size = CONFIG_DEFAULT_REPL_BACKLOG_SIZE;
|
|
||||||
server.repl_backlog_histlen = 0;
|
server.repl_backlog_histlen = 0;
|
||||||
server.repl_backlog_idx = 0;
|
server.repl_backlog_idx = 0;
|
||||||
server.repl_backlog_off = 0;
|
server.repl_backlog_off = 0;
|
||||||
server.repl_backlog_time_limit = CONFIG_DEFAULT_REPL_BACKLOG_TIME_LIMIT;
|
|
||||||
server.repl_no_slaves_since = time(NULL);
|
server.repl_no_slaves_since = time(NULL);
|
||||||
|
|
||||||
/* Client output buffer limits */
|
/* Client output buffer limits */
|
||||||
@ -2463,16 +2369,6 @@ void initServerConfig(void) {
|
|||||||
server.xclaimCommand = lookupCommandByCString("xclaim");
|
server.xclaimCommand = lookupCommandByCString("xclaim");
|
||||||
server.xgroupCommand = lookupCommandByCString("xgroup");
|
server.xgroupCommand = lookupCommandByCString("xgroup");
|
||||||
|
|
||||||
/* Slow log */
|
|
||||||
server.slowlog_log_slower_than = CONFIG_DEFAULT_SLOWLOG_LOG_SLOWER_THAN;
|
|
||||||
server.slowlog_max_len = CONFIG_DEFAULT_SLOWLOG_MAX_LEN;
|
|
||||||
|
|
||||||
/* Latency monitor */
|
|
||||||
server.latency_monitor_threshold = CONFIG_DEFAULT_LATENCY_MONITOR_THRESHOLD;
|
|
||||||
|
|
||||||
/* Tracking. */
|
|
||||||
server.tracking_table_max_fill = CONFIG_DEFAULT_TRACKING_TABLE_MAX_FILL;
|
|
||||||
|
|
||||||
/* Debugging */
|
/* Debugging */
|
||||||
server.assert_failed = "<no assertion failed>";
|
server.assert_failed = "<no assertion failed>";
|
||||||
server.assert_file = "<no file>";
|
server.assert_file = "<no file>";
|
||||||
@ -2485,6 +2381,8 @@ void initServerConfig(void) {
|
|||||||
* script to the slave / AOF. This is the new way starting from
|
* script to the slave / AOF. This is the new way starting from
|
||||||
* Redis 5. However it is possible to revert it via redis.conf. */
|
* Redis 5. However it is possible to revert it via redis.conf. */
|
||||||
server.lua_always_replicate_commands = 1;
|
server.lua_always_replicate_commands = 1;
|
||||||
|
|
||||||
|
initConfigValues();
|
||||||
}
|
}
|
||||||
|
|
||||||
extern char **environ;
|
extern char **environ;
|
||||||
@ -2784,6 +2682,8 @@ void initServer(void) {
|
|||||||
server.syslog_facility);
|
server.syslog_facility);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Initialization after setting defaults from the config system. */
|
||||||
|
server.aof_state = server.aof_enabled ? AOF_ON : AOF_OFF;
|
||||||
server.hz = server.config_hz;
|
server.hz = server.config_hz;
|
||||||
server.pid = getpid();
|
server.pid = getpid();
|
||||||
server.current_client = NULL;
|
server.current_client = NULL;
|
||||||
|
98
src/server.h
98
src/server.h
@ -84,18 +84,10 @@ typedef long long ustime_t; /* microsecond time type. */
|
|||||||
#define C_ERR -1
|
#define C_ERR -1
|
||||||
|
|
||||||
/* Static server configuration */
|
/* Static server configuration */
|
||||||
#define CONFIG_DEFAULT_DYNAMIC_HZ 1 /* Adapt hz to # of clients.*/
|
|
||||||
#define CONFIG_DEFAULT_HZ 10 /* Time interrupt calls/sec. */
|
#define CONFIG_DEFAULT_HZ 10 /* Time interrupt calls/sec. */
|
||||||
#define CONFIG_MIN_HZ 1
|
#define CONFIG_MIN_HZ 1
|
||||||
#define CONFIG_MAX_HZ 500
|
#define CONFIG_MAX_HZ 500
|
||||||
#define MAX_CLIENTS_PER_CLOCK_TICK 200 /* HZ is adapted based on that. */
|
#define MAX_CLIENTS_PER_CLOCK_TICK 200 /* HZ is adapted based on that. */
|
||||||
#define CONFIG_DEFAULT_SERVER_PORT 6379 /* TCP port. */
|
|
||||||
#define CONFIG_DEFAULT_SERVER_TLS_PORT 0 /* TCP port. */
|
|
||||||
#define CONFIG_DEFAULT_TCP_BACKLOG 511 /* TCP listen backlog. */
|
|
||||||
#define CONFIG_DEFAULT_CLIENT_TIMEOUT 0 /* Default client timeout: infinite */
|
|
||||||
#define CONFIG_DEFAULT_DBNUM 16
|
|
||||||
#define CONFIG_DEFAULT_IO_THREADS_NUM 1 /* Single threaded by default */
|
|
||||||
#define CONFIG_DEFAULT_IO_THREADS_DO_READS 0 /* Read + parse from threads? */
|
|
||||||
#define CONFIG_MAX_LINE 1024
|
#define CONFIG_MAX_LINE 1024
|
||||||
#define CRON_DBS_PER_CALL 16
|
#define CRON_DBS_PER_CALL 16
|
||||||
#define NET_MAX_WRITES_PER_EVENT (1024*64)
|
#define NET_MAX_WRITES_PER_EVENT (1024*64)
|
||||||
@ -103,84 +95,21 @@ typedef long long ustime_t; /* microsecond time type. */
|
|||||||
#define OBJ_SHARED_INTEGERS 10000
|
#define OBJ_SHARED_INTEGERS 10000
|
||||||
#define OBJ_SHARED_BULKHDR_LEN 32
|
#define OBJ_SHARED_BULKHDR_LEN 32
|
||||||
#define LOG_MAX_LEN 1024 /* Default maximum length of syslog messages.*/
|
#define LOG_MAX_LEN 1024 /* Default maximum length of syslog messages.*/
|
||||||
#define AOF_REWRITE_PERC 100
|
|
||||||
#define AOF_REWRITE_MIN_SIZE (64*1024*1024)
|
|
||||||
#define AOF_REWRITE_ITEMS_PER_CMD 64
|
#define AOF_REWRITE_ITEMS_PER_CMD 64
|
||||||
#define AOF_READ_DIFF_INTERVAL_BYTES (1024*10)
|
#define AOF_READ_DIFF_INTERVAL_BYTES (1024*10)
|
||||||
#define CONFIG_DEFAULT_SLOWLOG_LOG_SLOWER_THAN 10000
|
|
||||||
#define CONFIG_DEFAULT_SLOWLOG_MAX_LEN 128
|
|
||||||
#define CONFIG_DEFAULT_MAX_CLIENTS 10000
|
|
||||||
#define CONFIG_AUTHPASS_MAX_LEN 512
|
#define CONFIG_AUTHPASS_MAX_LEN 512
|
||||||
#define CONFIG_DEFAULT_SLAVE_PRIORITY 100
|
|
||||||
#define CONFIG_DEFAULT_REPL_TIMEOUT 60
|
|
||||||
#define CONFIG_DEFAULT_REPL_PING_SLAVE_PERIOD 10
|
|
||||||
#define CONFIG_RUN_ID_SIZE 40
|
#define CONFIG_RUN_ID_SIZE 40
|
||||||
#define RDB_EOF_MARK_SIZE 40
|
#define RDB_EOF_MARK_SIZE 40
|
||||||
#define CONFIG_DEFAULT_REPL_BACKLOG_SIZE (1024*1024) /* 1mb */
|
|
||||||
#define CONFIG_DEFAULT_REPL_BACKLOG_TIME_LIMIT (60*60) /* 1 hour */
|
|
||||||
#define CONFIG_REPL_BACKLOG_MIN_SIZE (1024*16) /* 16k */
|
#define CONFIG_REPL_BACKLOG_MIN_SIZE (1024*16) /* 16k */
|
||||||
#define CONFIG_BGSAVE_RETRY_DELAY 5 /* Wait a few secs before trying again. */
|
#define CONFIG_BGSAVE_RETRY_DELAY 5 /* Wait a few secs before trying again. */
|
||||||
#define CONFIG_DEFAULT_PID_FILE "/var/run/redis.pid"
|
#define CONFIG_DEFAULT_PID_FILE "/var/run/redis.pid"
|
||||||
#define CONFIG_DEFAULT_SYSLOG_IDENT "redis"
|
|
||||||
#define CONFIG_DEFAULT_CLUSTER_CONFIG_FILE "nodes.conf"
|
#define CONFIG_DEFAULT_CLUSTER_CONFIG_FILE "nodes.conf"
|
||||||
#define CONFIG_DEFAULT_CLUSTER_ANNOUNCE_IP NULL /* Auto detect. */
|
|
||||||
#define CONFIG_DEFAULT_CLUSTER_ANNOUNCE_PORT 0 /* Use server.port */
|
|
||||||
#define CONFIG_DEFAULT_CLUSTER_ANNOUNCE_BUS_PORT 0 /* Use +10000 offset. */
|
|
||||||
#define CONFIG_DEFAULT_DAEMONIZE 0
|
|
||||||
#define CONFIG_DEFAULT_UNIX_SOCKET_PERM 0
|
#define CONFIG_DEFAULT_UNIX_SOCKET_PERM 0
|
||||||
#define CONFIG_DEFAULT_TCP_KEEPALIVE 300
|
|
||||||
#define CONFIG_DEFAULT_PROTECTED_MODE 1
|
|
||||||
#define CONFIG_DEFAULT_GOPHER_ENABLED 0
|
|
||||||
#define CONFIG_DEFAULT_LOGFILE ""
|
#define CONFIG_DEFAULT_LOGFILE ""
|
||||||
#define CONFIG_DEFAULT_SYSLOG_ENABLED 0
|
|
||||||
#define CONFIG_DEFAULT_STOP_WRITES_ON_BGSAVE_ERROR 1
|
|
||||||
#define CONFIG_DEFAULT_RDB_COMPRESSION 1
|
|
||||||
#define CONFIG_DEFAULT_RDB_CHECKSUM 1
|
|
||||||
#define CONFIG_DEFAULT_RDB_FILENAME "dump.rdb"
|
|
||||||
#define CONFIG_DEFAULT_REPL_DISKLESS_SYNC 0
|
|
||||||
#define CONFIG_DEFAULT_REPL_DISKLESS_SYNC_DELAY 5
|
|
||||||
#define CONFIG_DEFAULT_RDB_KEY_SAVE_DELAY 0
|
|
||||||
#define CONFIG_DEFAULT_KEY_LOAD_DELAY 0
|
|
||||||
#define CONFIG_DEFAULT_SLAVE_SERVE_STALE_DATA 1
|
|
||||||
#define CONFIG_DEFAULT_SLAVE_READ_ONLY 1
|
|
||||||
#define CONFIG_DEFAULT_SLAVE_IGNORE_MAXMEMORY 1
|
|
||||||
#define CONFIG_DEFAULT_SLAVE_ANNOUNCE_IP NULL
|
|
||||||
#define CONFIG_DEFAULT_SLAVE_ANNOUNCE_PORT 0
|
|
||||||
#define CONFIG_DEFAULT_REPL_DISABLE_TCP_NODELAY 0
|
|
||||||
#define CONFIG_DEFAULT_MAXMEMORY 0
|
|
||||||
#define CONFIG_DEFAULT_MAXMEMORY_SAMPLES 5
|
|
||||||
#define CONFIG_DEFAULT_LFU_LOG_FACTOR 10
|
|
||||||
#define CONFIG_DEFAULT_LFU_DECAY_TIME 1
|
|
||||||
#define CONFIG_DEFAULT_AOF_FILENAME "appendonly.aof"
|
|
||||||
#define CONFIG_DEFAULT_AOF_NO_FSYNC_ON_REWRITE 0
|
|
||||||
#define CONFIG_DEFAULT_AOF_LOAD_TRUNCATED 1
|
|
||||||
#define CONFIG_DEFAULT_AOF_USE_RDB_PREAMBLE 1
|
|
||||||
#define CONFIG_DEFAULT_ACTIVE_REHASHING 1
|
|
||||||
#define CONFIG_DEFAULT_AOF_REWRITE_INCREMENTAL_FSYNC 1
|
|
||||||
#define CONFIG_DEFAULT_RDB_SAVE_INCREMENTAL_FSYNC 1
|
|
||||||
#define CONFIG_DEFAULT_MIN_SLAVES_TO_WRITE 0
|
|
||||||
#define CONFIG_DEFAULT_MIN_SLAVES_MAX_LAG 10
|
|
||||||
#define CONFIG_DEFAULT_ACL_FILENAME ""
|
|
||||||
#define NET_IP_STR_LEN 46 /* INET6_ADDRSTRLEN is 46, but we need to be sure */
|
#define NET_IP_STR_LEN 46 /* INET6_ADDRSTRLEN is 46, but we need to be sure */
|
||||||
#define NET_PEER_ID_LEN (NET_IP_STR_LEN+32) /* Must be enough for ip:port */
|
#define NET_PEER_ID_LEN (NET_IP_STR_LEN+32) /* Must be enough for ip:port */
|
||||||
#define CONFIG_BINDADDR_MAX 16
|
#define CONFIG_BINDADDR_MAX 16
|
||||||
#define CONFIG_MIN_RESERVED_FDS 32
|
#define CONFIG_MIN_RESERVED_FDS 32
|
||||||
#define CONFIG_DEFAULT_LATENCY_MONITOR_THRESHOLD 0
|
|
||||||
#define CONFIG_DEFAULT_SLAVE_LAZY_FLUSH 0
|
|
||||||
#define CONFIG_DEFAULT_LAZYFREE_LAZY_EVICTION 0
|
|
||||||
#define CONFIG_DEFAULT_LAZYFREE_LAZY_EXPIRE 0
|
|
||||||
#define CONFIG_DEFAULT_LAZYFREE_LAZY_SERVER_DEL 0
|
|
||||||
#define CONFIG_DEFAULT_ALWAYS_SHOW_LOGO 0
|
|
||||||
#define CONFIG_DEFAULT_ACTIVE_DEFRAG 0
|
|
||||||
#define CONFIG_DEFAULT_DEFRAG_THRESHOLD_LOWER 10 /* don't defrag when fragmentation is below 10% */
|
|
||||||
#define CONFIG_DEFAULT_DEFRAG_THRESHOLD_UPPER 100 /* maximum defrag force at 100% fragmentation */
|
|
||||||
#define CONFIG_DEFAULT_DEFRAG_IGNORE_BYTES (100<<20) /* don't defrag if frag overhead is below 100mb */
|
|
||||||
#define CONFIG_DEFAULT_DEFRAG_CYCLE_MIN 1 /* 1% CPU min (at lower threshold) */
|
|
||||||
#define CONFIG_DEFAULT_DEFRAG_CYCLE_MAX 25 /* 25% CPU max (at upper threshold) */
|
|
||||||
#define CONFIG_DEFAULT_DEFRAG_MAX_SCAN_FIELDS 1000 /* keys with more than 1000 fields will be processed separately */
|
|
||||||
#define CONFIG_DEFAULT_PROTO_MAX_BULK_LEN (512ll*1024*1024) /* Bulk request max size */
|
|
||||||
#define CONFIG_DEFAULT_TRACKING_TABLE_MAX_FILL 10 /* 10% tracking table max fill. */
|
|
||||||
#define CONFIG_DEFAULT_ACTIVE_EXPIRE_EFFORT 1 /* From 1 to 10. */
|
|
||||||
|
|
||||||
#define ACTIVE_EXPIRE_CYCLE_SLOW 0
|
#define ACTIVE_EXPIRE_CYCLE_SLOW 0
|
||||||
#define ACTIVE_EXPIRE_CYCLE_FAST 1
|
#define ACTIVE_EXPIRE_CYCLE_FAST 1
|
||||||
@ -391,7 +320,6 @@ typedef long long ustime_t; /* microsecond time type. */
|
|||||||
#define LL_NOTICE 2
|
#define LL_NOTICE 2
|
||||||
#define LL_WARNING 3
|
#define LL_WARNING 3
|
||||||
#define LL_RAW (1<<10) /* Modifier to log without timestamp */
|
#define LL_RAW (1<<10) /* Modifier to log without timestamp */
|
||||||
#define CONFIG_DEFAULT_VERBOSITY LL_NOTICE
|
|
||||||
|
|
||||||
/* Supervision options */
|
/* Supervision options */
|
||||||
#define SUPERVISED_NONE 0
|
#define SUPERVISED_NONE 0
|
||||||
@ -409,29 +337,11 @@ typedef long long ustime_t; /* microsecond time type. */
|
|||||||
#define AOF_FSYNC_NO 0
|
#define AOF_FSYNC_NO 0
|
||||||
#define AOF_FSYNC_ALWAYS 1
|
#define AOF_FSYNC_ALWAYS 1
|
||||||
#define AOF_FSYNC_EVERYSEC 2
|
#define AOF_FSYNC_EVERYSEC 2
|
||||||
#define CONFIG_DEFAULT_AOF_FSYNC AOF_FSYNC_EVERYSEC
|
|
||||||
|
|
||||||
/* Replication diskless load defines */
|
/* Replication diskless load defines */
|
||||||
#define REPL_DISKLESS_LOAD_DISABLED 0
|
#define REPL_DISKLESS_LOAD_DISABLED 0
|
||||||
#define REPL_DISKLESS_LOAD_WHEN_DB_EMPTY 1
|
#define REPL_DISKLESS_LOAD_WHEN_DB_EMPTY 1
|
||||||
#define REPL_DISKLESS_LOAD_SWAPDB 2
|
#define REPL_DISKLESS_LOAD_SWAPDB 2
|
||||||
#define CONFIG_DEFAULT_REPL_DISKLESS_LOAD REPL_DISKLESS_LOAD_DISABLED
|
|
||||||
|
|
||||||
/* Zipped structures related defaults */
|
|
||||||
#define OBJ_HASH_MAX_ZIPLIST_ENTRIES 512
|
|
||||||
#define OBJ_HASH_MAX_ZIPLIST_VALUE 64
|
|
||||||
#define OBJ_SET_MAX_INTSET_ENTRIES 512
|
|
||||||
#define OBJ_ZSET_MAX_ZIPLIST_ENTRIES 128
|
|
||||||
#define OBJ_ZSET_MAX_ZIPLIST_VALUE 64
|
|
||||||
#define OBJ_STREAM_NODE_MAX_BYTES 4096
|
|
||||||
#define OBJ_STREAM_NODE_MAX_ENTRIES 100
|
|
||||||
|
|
||||||
/* List defaults */
|
|
||||||
#define OBJ_LIST_MAX_ZIPLIST_SIZE -2
|
|
||||||
#define OBJ_LIST_COMPRESS_DEPTH 0
|
|
||||||
|
|
||||||
/* HyperLogLog defines */
|
|
||||||
#define CONFIG_DEFAULT_HLL_SPARSE_MAX_BYTES 3000
|
|
||||||
|
|
||||||
/* Sets operations codes */
|
/* Sets operations codes */
|
||||||
#define SET_OP_UNION 0
|
#define SET_OP_UNION 0
|
||||||
@ -456,11 +366,6 @@ typedef long long ustime_t; /* microsecond time type. */
|
|||||||
#define MAXMEMORY_ALLKEYS_RANDOM ((6<<8)|MAXMEMORY_FLAG_ALLKEYS)
|
#define MAXMEMORY_ALLKEYS_RANDOM ((6<<8)|MAXMEMORY_FLAG_ALLKEYS)
|
||||||
#define MAXMEMORY_NO_EVICTION (7<<8)
|
#define MAXMEMORY_NO_EVICTION (7<<8)
|
||||||
|
|
||||||
#define CONFIG_DEFAULT_MAXMEMORY_POLICY MAXMEMORY_NO_EVICTION
|
|
||||||
|
|
||||||
/* Scripting */
|
|
||||||
#define LUA_SCRIPT_TIME_LIMIT 5000 /* milliseconds */
|
|
||||||
|
|
||||||
/* Units */
|
/* Units */
|
||||||
#define UNIT_SECONDS 0
|
#define UNIT_SECONDS 0
|
||||||
#define UNIT_MILLISECONDS 1
|
#define UNIT_MILLISECONDS 1
|
||||||
@ -1396,7 +1301,7 @@ struct redisServer {
|
|||||||
size_t zset_max_ziplist_value;
|
size_t zset_max_ziplist_value;
|
||||||
size_t hll_sparse_max_bytes;
|
size_t hll_sparse_max_bytes;
|
||||||
size_t stream_node_max_bytes;
|
size_t stream_node_max_bytes;
|
||||||
int64_t stream_node_max_entries;
|
long long stream_node_max_entries;
|
||||||
/* List parameters */
|
/* List parameters */
|
||||||
int list_max_ziplist_size;
|
int list_max_ziplist_size;
|
||||||
int list_compress_depth;
|
int list_compress_depth;
|
||||||
@ -2077,6 +1982,7 @@ void resetServerSaveParams(void);
|
|||||||
struct rewriteConfigState; /* Forward declaration to export API. */
|
struct rewriteConfigState; /* Forward declaration to export API. */
|
||||||
void rewriteConfigRewriteLine(struct rewriteConfigState *state, const char *option, sds line, int force);
|
void rewriteConfigRewriteLine(struct rewriteConfigState *state, const char *option, sds line, int force);
|
||||||
int rewriteConfig(char *path);
|
int rewriteConfig(char *path);
|
||||||
|
void initConfigValues();
|
||||||
|
|
||||||
/* db.c -- Keyspace access API */
|
/* db.c -- Keyspace access API */
|
||||||
int removeExpire(redisDb *db, robj *key);
|
int removeExpire(redisDb *db, robj *key);
|
||||||
|
@ -57,4 +57,69 @@ start_server {tags {"introspection"}} {
|
|||||||
fail "Client still listed in CLIENT LIST after SETNAME."
|
fail "Client still listed in CLIENT LIST after SETNAME."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test {CONFIG sanity} {
|
||||||
|
# Do CONFIG GET, CONFIG SET and then CONFIG GET again
|
||||||
|
# Skip immutable configs, one with no get, and other complicated configs
|
||||||
|
set skip_configs {
|
||||||
|
rdbchecksum
|
||||||
|
daemonize
|
||||||
|
io-threads-do-reads
|
||||||
|
lua-replicate-commands
|
||||||
|
always-show-logo
|
||||||
|
syslog-enabled
|
||||||
|
cluster-enabled
|
||||||
|
aclfile
|
||||||
|
unixsocket
|
||||||
|
pidfile
|
||||||
|
syslog-ident
|
||||||
|
appendfilename
|
||||||
|
supervised
|
||||||
|
syslog-facility
|
||||||
|
databases
|
||||||
|
port
|
||||||
|
io-threads
|
||||||
|
tls-port
|
||||||
|
tls-prefer-server-ciphers
|
||||||
|
tls-cert-file
|
||||||
|
tls-key-file
|
||||||
|
tls-dh-params-file
|
||||||
|
tls-ca-cert-file
|
||||||
|
tls-ca-cert-dir
|
||||||
|
tls-protocols
|
||||||
|
tls-ciphers
|
||||||
|
tls-ciphersuites
|
||||||
|
logfile
|
||||||
|
unixsocketperm
|
||||||
|
slaveof
|
||||||
|
bind
|
||||||
|
requirepass
|
||||||
|
}
|
||||||
|
|
||||||
|
set configs {}
|
||||||
|
foreach {k v} [r config get *] {
|
||||||
|
if {[lsearch $skip_configs $k] != -1} {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
dict set configs $k $v
|
||||||
|
# try to set the config to the same value it already has
|
||||||
|
r config set $k $v
|
||||||
|
}
|
||||||
|
|
||||||
|
set newconfigs {}
|
||||||
|
foreach {k v} [r config get *] {
|
||||||
|
if {[lsearch $skip_configs $k] != -1} {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
dict set newconfigs $k $v
|
||||||
|
}
|
||||||
|
|
||||||
|
dict for {k v} $configs {
|
||||||
|
set vv [dict get $newconfigs $k]
|
||||||
|
if {$v != $vv} {
|
||||||
|
fail "config $k mismatch, expecting $v but got $vv"
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user