X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/7b81e5a16ca577b7aa10dd0398cce4ba9cdf0842..e7a2e7c1f7b1e46704aaf0850f75d13d418c1db7:/src/redis.h diff --git a/src/redis.h b/src/redis.h index 0330db74..79a28911 100644 --- a/src/redis.h +++ b/src/redis.h @@ -40,6 +40,7 @@ /* Static server configuration */ #define REDIS_SERVERPORT 6379 /* TCP port */ #define REDIS_MAXIDLETIME 0 /* default client timeout: infinite */ +#define REDIS_MAX_QUERYBUF_LEN (1024*1024*1024) /* 1GB max query buffer. */ #define REDIS_IOBUF_LEN (1024*16) #define REDIS_LOADBUF_LEN 1024 #define REDIS_DEFAULT_DBNUM 16 @@ -53,6 +54,7 @@ #define REDIS_MAX_LOGMSG_LEN 1024 /* Default maximum length of syslog messages */ #define REDIS_AUTO_AOFREWRITE_PERC 100 #define REDIS_AUTO_AOFREWRITE_MIN_SIZE (1024*1024) +#define REDIS_AOFREWRITE_ITEMS_PER_CMD 64 #define REDIS_SLOWLOG_LOG_SLOWER_THAN 10000 #define REDIS_SLOWLOG_MAX_LEN 64 #define REDIS_MAX_CLIENTS 10000 @@ -215,6 +217,11 @@ #define UNIT_SECONDS 0 #define UNIT_MILLISECONDS 1 +/* SHUTDOWN flags */ +#define REDIS_SHUTDOWN_SAVE 1 /* Force SAVE on SHUTDOWN even if no save + points are configured. */ +#define REDIS_SHUTDOWN_NOSAVE 2 /* Don't SAVE on SHUTDOWN. */ + /* We can print the stacktrace, so our assert is defined this way: */ #define redisAssertWithInfo(_c,_o,_e) ((_e)?(void)0 : (_redisAssertWithInfo(_c,_o,#_e,__FILE__,__LINE__),_exit(1))) #define redisAssert(_e) ((_e)?(void)0 : (_redisAssert(#_e,__FILE__,__LINE__),_exit(1))) @@ -288,7 +295,7 @@ typedef struct redisClient { sds querybuf; int argc; robj **argv; - struct redisCommand *cmd; + struct redisCommand *cmd, *lastcmd; int reqtype; int multibulklen; /* number of multi bulk arguments left to read */ long bulklen; /* length of bulk argument in multi bulk request */ @@ -521,6 +528,7 @@ struct redisServer { long long stat_keyspace_misses; /* number of failed lookups of keys */ size_t stat_peak_memory; /* max used memory record */ long long stat_fork_time; /* time needed to perform latets fork() */ + long long stat_rejected_conn; /* clients rejected because of maxclients */ list *slowlog; long long slowlog_entry_id; long long slowlog_log_slower_than; @@ -528,6 +536,7 @@ struct redisServer { /* Configuration */ int verbosity; int maxidletime; + size_t client_max_querybuf_len; int dbnum; int daemonize; int appendonly; @@ -538,7 +547,8 @@ struct redisServer { off_t auto_aofrewrite_base_size;/* AOF size on latest startup or rewrite. */ off_t appendonly_current_size; /* AOF current size. */ int aofrewrite_scheduled; /* Rewrite once BGSAVE terminates. */ - int shutdown_asap; + int aof_wait_rewrite; /* Don't append to AOF before rewrite */ + int shutdown_asap; /* SHUTDOWN needed */ int activerehashing; char *requirepass; /* Persistence */ @@ -615,13 +625,22 @@ struct redisServer { /* Scripting */ lua_State *lua; /* The Lua interpreter. We use just one for all clients */ redisClient *lua_client; /* The "fake client" to query Redis from Lua */ + redisClient *lua_caller; /* The client running EVAL right now, or NULL */ dict *lua_scripts; /* A dictionary of SHA1 -> Lua scripts */ long long lua_time_limit; long long lua_time_start; + int lua_write_dirty; /* True if a write command was called during the + execution of the current script. */ int lua_random_dirty; /* True if a random command was called during the - exection of the current script. */ + execution of the current script. */ int lua_timedout; /* True if we reached the time limit for script execution. */ + int lua_kill; /* Kill the script if true. */ + /* Assert & bug reportign */ + char *assert_failed; + char *assert_file; + int assert_line; + int bug_report_start; /* True if bug report header already logged. */ }; typedef struct pubsubPattern { @@ -756,6 +775,8 @@ void addReplyMultiBulkLen(redisClient *c, long length); void *dupClientReplyValue(void *o); void getClientsMaxBuffers(unsigned long *longest_output_list, unsigned long *biggest_input_buffer); +sds getClientInfoString(redisClient *client); +sds getAllClientsInfoString(void); void rewriteClientCommandVector(redisClient *c, int argc, ...); void rewriteClientCommandArgument(redisClient *c, int i, robj *newval); @@ -935,7 +956,7 @@ int listMatchPubsubPattern(void *a, void *b); int pubsubPublishMessage(robj *channel, robj *message); /* Configuration */ -void loadServerConfig(char *filename); +void loadServerConfig(char *filename, char *options); void appendServerSaveParams(time_t seconds, int changes); void resetServerSaveParams(); @@ -1134,5 +1155,6 @@ void *realloc(void *ptr, size_t size) __attribute__ ((deprecated)); void _redisAssertWithInfo(redisClient *c, robj *o, char *estr, char *file, int line); void _redisAssert(char *estr, char *file, int line); void _redisPanic(char *msg, char *file, int line); +void bugReportStart(void); #endif