summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/acl.c4
-rw-r--r--src/config.c2
-rw-r--r--src/expire.c11
-rw-r--r--src/module.c6
-rw-r--r--src/redismodule.h2
-rw-r--r--src/sentinel.c2
-rw-r--r--src/t_stream.c6
7 files changed, 23 insertions, 10 deletions
diff --git a/src/acl.c b/src/acl.c
index db742c649..1f395bd3f 100644
--- a/src/acl.c
+++ b/src/acl.c
@@ -183,12 +183,12 @@ int ACLListMatchSds(void *a, void *b) {
return sdscmp(a,b) == 0;
}
-/* Method to free list elements from ACL users password/ptterns lists. */
+/* Method to free list elements from ACL users password/patterns lists. */
void ACLListFreeSds(void *item) {
sdsfree(item);
}
-/* Method to duplicate list elements from ACL users password/ptterns lists. */
+/* Method to duplicate list elements from ACL users password/patterns lists. */
void *ACLListDupSds(void *item) {
return sdsdup(item);
}
diff --git a/src/config.c b/src/config.c
index ed19d336b..0526de84d 100644
--- a/src/config.c
+++ b/src/config.c
@@ -2196,7 +2196,7 @@ standardConfig configs[] = {
/* Integer configs */
createIntConfig("databases", NULL, IMMUTABLE_CONFIG, 1, INT_MAX, server.dbnum, 16, INTEGER_CONFIG, NULL, NULL),
createIntConfig("port", NULL, IMMUTABLE_CONFIG, 0, 65535, server.port, 6379, INTEGER_CONFIG, NULL, NULL), /* TCP port. */
- createIntConfig("io-threads", NULL, IMMUTABLE_CONFIG, 1, 512, server.io_threads_num, 1, INTEGER_CONFIG, NULL, NULL), /* Single threaded by default */
+ createIntConfig("io-threads", NULL, IMMUTABLE_CONFIG, 1, 128, server.io_threads_num, 1, INTEGER_CONFIG, NULL, NULL), /* Single threaded by default */
createIntConfig("auto-aof-rewrite-percentage", NULL, MODIFIABLE_CONFIG, 0, INT_MAX, server.aof_rewrite_perc, 100, INTEGER_CONFIG, NULL, NULL),
createIntConfig("cluster-replica-validity-factor", "cluster-slave-validity-factor", MODIFIABLE_CONFIG, 0, INT_MAX, server.cluster_slave_validity_factor, 10, INTEGER_CONFIG, NULL, NULL), /* Slave max data age factor. */
createIntConfig("list-max-ziplist-size", NULL, MODIFIABLE_CONFIG, INT_MIN, INT_MAX, server.list_max_ziplist_size, -2, INTEGER_CONFIG, NULL, NULL),
diff --git a/src/expire.c b/src/expire.c
index b4ab9ab18..5aff72ee0 100644
--- a/src/expire.c
+++ b/src/expire.c
@@ -203,8 +203,10 @@ void activeExpireCycle(int type) {
* distribute the time evenly across DBs. */
current_db++;
- /* Continue to expire if at the end of the cycle more than 25%
- * of the keys were expired. */
+ /* Continue to expire if at the end of the cycle there are still
+ * a big percentage of keys to expire, compared to the number of keys
+ * we scanned. The percentage, stored in config_cycle_acceptable_stale
+ * is not fixed, but depends on the Redis configured "expire effort". */
do {
unsigned long num, slots;
long long now, ttl_sum;
@@ -305,8 +307,9 @@ void activeExpireCycle(int type) {
}
/* We don't repeat the cycle for the current database if there are
* an acceptable amount of stale keys (logically expired but yet
- * not reclained). */
- } while ((expired*100/sampled) > config_cycle_acceptable_stale);
+ * not reclaimed). */
+ } while (sampled == 0 ||
+ (expired*100/sampled) > config_cycle_acceptable_stale);
}
elapsed = ustime()-start;
diff --git a/src/module.c b/src/module.c
index 705ffec2c..965bb4460 100644
--- a/src/module.c
+++ b/src/module.c
@@ -1842,6 +1842,12 @@ int RM_GetContextFlags(RedisModuleCtx *ctx) {
flags |= REDISMODULE_CTX_FLAGS_REPLICATED;
}
+ /* For DIRTY flags, we need the blocked client if used */
+ client *c = ctx->blocked_client ? ctx->blocked_client->client : ctx->client;
+ if (c && (c->flags & (CLIENT_DIRTY_CAS|CLIENT_DIRTY_EXEC))) {
+ flags |= REDISMODULE_CTX_FLAGS_MULTI_DIRTY;
+ }
+
if (server.cluster_enabled)
flags |= REDISMODULE_CTX_FLAGS_CLUSTER;
diff --git a/src/redismodule.h b/src/redismodule.h
index 57f98fb93..637078f2b 100644
--- a/src/redismodule.h
+++ b/src/redismodule.h
@@ -110,6 +110,8 @@
#define REDISMODULE_CTX_FLAGS_REPLICA_IS_ONLINE (1<<17)
/* There is currently some background process active. */
#define REDISMODULE_CTX_FLAGS_ACTIVE_CHILD (1<<18)
+/* The next EXEC will fail due to dirty CAS (touched keys). */
+#define REDISMODULE_CTX_FLAGS_MULTI_DIRTY (1<<19)
/* Keyspace changes notification classes. Every class is associated with a
* character for configuration purposes.
diff --git a/src/sentinel.c b/src/sentinel.c
index 10117252d..10c003d03 100644
--- a/src/sentinel.c
+++ b/src/sentinel.c
@@ -4308,7 +4308,7 @@ void sentinelFailoverDetectEnd(sentinelRedisInstance *master) {
sentinelRedisInstance *slave = dictGetVal(de);
int retval;
- if (slave->flags & (SRI_RECONF_DONE|SRI_RECONF_SENT)) continue;
+ if (slave->flags & (SRI_PROMOTED|SRI_RECONF_DONE|SRI_RECONF_SENT)) continue;
if (slave->link->disconnected) continue;
retval = sentinelSendSlaveOf(slave,
diff --git a/src/t_stream.c b/src/t_stream.c
index 3d46ca0da..ae57202c1 100644
--- a/src/t_stream.c
+++ b/src/t_stream.c
@@ -2246,7 +2246,7 @@ void xclaimCommand(client *c) {
}
/* Do the actual claiming. */
- streamConsumer *consumer = streamLookupConsumer(group,c->argv[3]->ptr,1);
+ streamConsumer *consumer = NULL;
void *arraylenptr = addReplyDeferredLen(c);
size_t arraylen = 0;
for (int j = 5; j <= last_id_arg; j++) {
@@ -2298,9 +2298,11 @@ void xclaimCommand(client *c) {
if (nack->consumer)
raxRemove(nack->consumer->pel,buf,sizeof(buf),NULL);
/* Update the consumer and idle time. */
+ if (consumer == NULL)
+ consumer = streamLookupConsumer(group,c->argv[3]->ptr,1);
nack->consumer = consumer;
nack->delivery_time = deliverytime;
- /* Set the delivery attempts counter if given, otherwise
+ /* Set the delivery attempts counter if given, otherwise
* autoincrement unless JUSTID option provided */
if (retrycount >= 0) {
nack->delivery_count = retrycount;