Resolved merge conflicts in prior commit
Former-commit-id: b88f06b16f3d9e58ec884c61d2d074d7a489775e
This commit is contained in:
parent
1d882b5ddd
commit
93b0482376
@ -462,10 +462,7 @@ clean:
|
||||
distclean: clean
|
||||
-(cd ../deps && $(MAKE) distclean)
|
||||
-(cd modules && $(MAKE) clean)
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
-(cd ../tests/modules && $(MAKE) clean)
|
||||
>>>>>>> 6.2.6
|
||||
-(rm -f .make-*)
|
||||
|
||||
.PHONY: distclean
|
||||
|
@ -1895,15 +1895,7 @@ void addACLLogEntry(client *c, int reason, int argpos, sds username) {
|
||||
void aclCommand(client *c) {
|
||||
char *sub = szFromObj(c->argv[1]);
|
||||
if (!strcasecmp(sub,"setuser") && c->argc >= 3) {
|
||||
<<<<<<< HEAD:src/acl.cpp
|
||||
/* Consider information about passwords or permissions
|
||||
* to be sensitive, which will be the arguments for this
|
||||
* subcommand. */
|
||||
preventCommandLogging(c);
|
||||
sds username = szFromObj(c->argv[2]);
|
||||
=======
|
||||
sds username = c->argv[2]->ptr;
|
||||
>>>>>>> 6.2.6:src/acl.c
|
||||
/* Check username validity. */
|
||||
if (ACLStringHasSpaces(username,sdslen(username))) {
|
||||
addReplyErrorFormat(c,
|
||||
|
@ -75,7 +75,7 @@ static int aeApiCreate(aeEventLoop *eventLoop) {
|
||||
return -1;
|
||||
}
|
||||
anetCloexec(state->kqfd);
|
||||
state->eventsMask = zmalloc(EVENT_MASK_MALLOC_SIZE(eventLoop->setsize));
|
||||
state->eventsMask = zmalloc(EVENT_MASK_MALLOC_SIZE(eventLoop->setsize), MALLOC_LOCAL);
|
||||
memset(state->eventsMask, 0, EVENT_MASK_MALLOC_SIZE(eventLoop->setsize));
|
||||
eventLoop->apidata = state;
|
||||
return 0;
|
||||
@ -84,13 +84,9 @@ static int aeApiCreate(aeEventLoop *eventLoop) {
|
||||
static int aeApiResize(aeEventLoop *eventLoop, int setsize) {
|
||||
aeApiState *state = (aeApiState*)eventLoop->apidata;
|
||||
|
||||
<<<<<<< HEAD
|
||||
state->events = (struct kevent*)zrealloc(state->events, sizeof(struct kevent)*setsize, MALLOC_LOCAL);
|
||||
=======
|
||||
state->events = zrealloc(state->events, sizeof(struct kevent)*setsize);
|
||||
state->eventsMask = zrealloc(state->eventsMask, EVENT_MASK_MALLOC_SIZE(setsize));
|
||||
state->events = (struct kevent*)zrealloc(state->events, sizeof(struct kevent)*setsize, MALLOC_LOCAL);
|
||||
state->eventsMask = (char*)zrealloc(state->eventsMask, EVENT_MASK_MALLOC_SIZE(setsize), MALLOC_LOCAL);
|
||||
memset(state->eventsMask, 0, EVENT_MASK_MALLOC_SIZE(setsize));
|
||||
>>>>>>> 6.2.6
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
11
src/aof.cpp
11
src/aof.cpp
@ -131,7 +131,7 @@ void installAofRewriteEvent()
|
||||
g_pserver->aof_rewrite_pending = true;
|
||||
int res = aePostFunction(g_pserver->rgthreadvar[IDX_EVENT_LOOP_MAIN].el, [] {
|
||||
g_pserver->aof_rewrite_pending = false;
|
||||
if (g_pserver->aof_pipe_write_data_to_child >= 0)
|
||||
if (!g_pserver->aof_stop_sending_diff && g_pserver->aof_pipe_write_data_to_child >= 0)
|
||||
aeCreateFileEvent(g_pserver->rgthreadvar[IDX_EVENT_LOOP_MAIN].el, g_pserver->aof_pipe_write_data_to_child, AE_WRITABLE, aofChildWriteDiffData, NULL);
|
||||
});
|
||||
if (res != AE_OK)
|
||||
@ -180,16 +180,7 @@ void aofRewriteBufferAppend(unsigned char *s, unsigned long len) {
|
||||
|
||||
/* Install a file event to send data to the rewrite child if there is
|
||||
* not one already. */
|
||||
<<<<<<< HEAD:src/aof.cpp
|
||||
installAofRewriteEvent();
|
||||
=======
|
||||
if (!server.aof_stop_sending_diff &&
|
||||
aeGetFileEvents(server.el,server.aof_pipe_write_data_to_child) == 0)
|
||||
{
|
||||
aeCreateFileEvent(server.el, server.aof_pipe_write_data_to_child,
|
||||
AE_WRITABLE, aofChildWriteDiffData, NULL);
|
||||
}
|
||||
>>>>>>> 6.2.6:src/aof.c
|
||||
}
|
||||
|
||||
/* Write the buffer (possibly composed of multiple blocks) into the specified
|
||||
|
@ -37,15 +37,9 @@
|
||||
/* Count number of bits set in the binary array pointed by 's' and long
|
||||
* 'count' bytes. The implementation of this function is required to
|
||||
* work with an input string length up to 512 MB or more (server.proto_max_bulk_len) */
|
||||
<<<<<<< HEAD:src/bitops.cpp
|
||||
size_t redisPopcount(const void *s, long count) {
|
||||
size_t bits = 0;
|
||||
unsigned char *p = (unsigned char*)s;
|
||||
=======
|
||||
long long redisPopcount(void *s, long count) {
|
||||
long long redisPopcount(const void *s, long count) {
|
||||
long long bits = 0;
|
||||
unsigned char *p = s;
|
||||
>>>>>>> 6.2.6:src/bitops.c
|
||||
unsigned char *p = (unsigned char*)s;
|
||||
uint32_t *p4;
|
||||
static const unsigned char bitsinbyte[256] = {0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,4,5,5,6,5,6,6,7,5,6,6,7,6,7,7,8};
|
||||
|
||||
@ -104,11 +98,7 @@ long long redisPopcount(void *s, long count) {
|
||||
* no zero bit is found, it returns count*8 assuming the string is zero
|
||||
* padded on the right. However if 'bit' is 1 it is possible that there is
|
||||
* not a single set bit in the bitmap. In this special case -1 is returned. */
|
||||
<<<<<<< HEAD:src/bitops.cpp
|
||||
long redisBitpos(const void *s, unsigned long count, int bit) {
|
||||
=======
|
||||
long long redisBitpos(void *s, unsigned long count, int bit) {
|
||||
>>>>>>> 6.2.6:src/bitops.c
|
||||
long long redisBitpos(const void *s, unsigned long count, int bit) {
|
||||
unsigned long *l;
|
||||
unsigned char *c;
|
||||
unsigned long skipval, word = 0, one;
|
||||
@ -538,13 +528,8 @@ const unsigned char *getObjectReadOnlyString(robj_roptr o, long *len, char *llbu
|
||||
/* SETBIT key offset bitvalue */
|
||||
void setbitCommand(client *c) {
|
||||
robj *o;
|
||||
<<<<<<< HEAD:src/bitops.cpp
|
||||
const char *err = "bit is not an integer or out of range";
|
||||
size_t bitoffset;
|
||||
=======
|
||||
char *err = "bit is not an integer or out of range";
|
||||
uint64_t bitoffset;
|
||||
>>>>>>> 6.2.6:src/bitops.c
|
||||
ssize_t byte, bit;
|
||||
int byteval, bitval;
|
||||
long on;
|
||||
@ -1020,13 +1005,8 @@ struct bitfieldOp {
|
||||
* when flags is set to BITFIELD_FLAG_READONLY: in this case only the
|
||||
* GET subcommand is allowed, other subcommands will return an error. */
|
||||
void bitfieldGeneric(client *c, int flags) {
|
||||
<<<<<<< HEAD:src/bitops.cpp
|
||||
robj_roptr o;
|
||||
size_t bitoffset;
|
||||
=======
|
||||
robj *o;
|
||||
uint64_t bitoffset;
|
||||
>>>>>>> 6.2.6:src/bitops.c
|
||||
int j, numops = 0, changes = 0;
|
||||
struct bitfieldOp *ops = NULL; /* Array of ops to execute at end. */
|
||||
int owtype = BFOVERFLOW_WRAP; /* Overflow type. */
|
||||
|
@ -88,15 +88,12 @@ typedef struct bkinfo {
|
||||
* flag is set client query buffer is not longer processed, but accumulated,
|
||||
* and will be processed when the client is unblocked. */
|
||||
void blockClient(client *c, int btype) {
|
||||
<<<<<<< HEAD:src/blocked.cpp
|
||||
serverAssert(GlobalLocksAcquired());
|
||||
=======
|
||||
/* Master client should never be blocked unless pause or module */
|
||||
serverAssert(!(c->flags & CLIENT_MASTER &&
|
||||
btype != BLOCKED_MODULE &&
|
||||
btype != BLOCKED_PAUSE));
|
||||
|
||||
>>>>>>> 6.2.6:src/blocked.c
|
||||
c->flags |= CLIENT_BLOCKED;
|
||||
c->btype = btype;
|
||||
g_pserver->blocked_clients++;
|
||||
|
@ -746,7 +746,7 @@ void clusterAcceptHandler(aeEventLoop *el, int fd, void *privdata, int mask) {
|
||||
}
|
||||
connNonBlock(conn);
|
||||
connEnableTcpNoDelay(conn);
|
||||
connKeepAlive(conn,server.cluster_node_timeout * 2);
|
||||
connKeepAlive(conn,g_pserver->cluster_node_timeout * 2);
|
||||
|
||||
/* Use non-blocking I/O for cluster messages. */
|
||||
serverLog(LL_VERBOSE,"Accepting cluster node connection from %s:%d", cip, cport);
|
||||
@ -5191,7 +5191,7 @@ void mvccrestoreCommand(client *c) {
|
||||
rio payload;
|
||||
rioInitWithBuffer(&payload,szFromObj(c->argv[4]));
|
||||
if (((type = rdbLoadObjectType(&payload)) == -1) ||
|
||||
((obj = rdbLoadObject(type,&payload,szFromObj(key), OBJ_MVCC_INVALID)) == NULL))
|
||||
((obj = rdbLoadObject(type,&payload,szFromObj(key),NULL,OBJ_MVCC_INVALID)) == NULL))
|
||||
{
|
||||
addReplyError(c,"Bad data format");
|
||||
return;
|
||||
@ -5277,11 +5277,7 @@ void restoreCommand(client *c) {
|
||||
|
||||
rioInitWithBuffer(&payload,szFromObj(c->argv[3]));
|
||||
if (((type = rdbLoadObjectType(&payload)) == -1) ||
|
||||
<<<<<<< HEAD:src/cluster.cpp
|
||||
((obj = rdbLoadObject(type,&payload,szFromObj(key), OBJ_MVCC_INVALID)) == NULL))
|
||||
=======
|
||||
((obj = rdbLoadObject(type,&payload,key->ptr,NULL)) == NULL))
|
||||
>>>>>>> 6.2.6:src/cluster.c
|
||||
((obj = rdbLoadObject(type,&payload,szFromObj(key),NULL,OBJ_MVCC_INVALID)) == NULL))
|
||||
{
|
||||
addReplyError(c,"Bad data format");
|
||||
return;
|
||||
@ -5464,31 +5460,19 @@ void migrateCommand(client *c) {
|
||||
return;
|
||||
}
|
||||
j++;
|
||||
<<<<<<< HEAD:src/cluster.cpp
|
||||
password = szFromObj(c->argv[j]);
|
||||
} else if (!strcasecmp(szFromObj(c->argv[j]),"auth2")) {
|
||||
=======
|
||||
password = c->argv[j]->ptr;
|
||||
redactClientCommandArgument(c,j);
|
||||
} else if (!strcasecmp(c->argv[j]->ptr,"auth2")) {
|
||||
>>>>>>> 6.2.6:src/cluster.c
|
||||
} else if (!strcasecmp(szFromObj(c->argv[j]),"auth2")) {
|
||||
if (moreargs < 2) {
|
||||
addReply(c,shared.syntaxerr);
|
||||
return;
|
||||
}
|
||||
<<<<<<< HEAD:src/cluster.cpp
|
||||
username = szFromObj(c->argv[++j]);
|
||||
redactClientCommandArgument(c,j);
|
||||
password = szFromObj(c->argv[++j]);
|
||||
redactClientCommandArgument(c,j);
|
||||
} else if (!strcasecmp(szFromObj(c->argv[j]),"keys")) {
|
||||
if (sdslen(szFromObj(c->argv[3])) != 0) {
|
||||
=======
|
||||
username = c->argv[++j]->ptr;
|
||||
redactClientCommandArgument(c,j);
|
||||
password = c->argv[++j]->ptr;
|
||||
redactClientCommandArgument(c,j);
|
||||
} else if (!strcasecmp(c->argv[j]->ptr,"keys")) {
|
||||
if (sdslen(c->argv[3]->ptr) != 0) {
|
||||
>>>>>>> 6.2.6:src/cluster.c
|
||||
addReplyError(c,
|
||||
"When using MIGRATE KEYS option, the key argument"
|
||||
" must be set to the empty string");
|
||||
|
27
src/db.cpp
27
src/db.cpp
@ -30,11 +30,8 @@
|
||||
#include "server.h"
|
||||
#include "cluster.h"
|
||||
#include "atomicvar.h"
|
||||
<<<<<<< HEAD:src/db.cpp
|
||||
#include "aelocker.h"
|
||||
=======
|
||||
#include "latency.h"
|
||||
>>>>>>> 6.2.6:src/db.c
|
||||
|
||||
#include <signal.h>
|
||||
#include <ctype.h>
|
||||
@ -1678,16 +1675,17 @@ expireEntry *getExpire(redisDb *db, robj_roptr key) {
|
||||
void deleteExpiredKeyAndPropagate(redisDb *db, robj *keyobj) {
|
||||
mstime_t expire_latency;
|
||||
latencyStartMonitor(expire_latency);
|
||||
if (server.lazyfree_lazy_expire)
|
||||
if (g_pserver->lazyfree_lazy_expire) {
|
||||
dbAsyncDelete(db,keyobj);
|
||||
else
|
||||
} else {
|
||||
dbSyncDelete(db,keyobj);
|
||||
}
|
||||
latencyEndMonitor(expire_latency);
|
||||
latencyAddSampleIfNeeded("expire-del",expire_latency);
|
||||
notifyKeyspaceEvent(NOTIFY_EXPIRED,"expired",keyobj,db->id);
|
||||
signalModifiedKey(NULL, db, keyobj);
|
||||
propagateExpire(db,keyobj,server.lazyfree_lazy_expire);
|
||||
server.stat_expiredkeys++;
|
||||
signalModifiedKey(NULL,db,keyobj);
|
||||
propagateExpire(db,keyobj,g_pserver->lazyfree_lazy_expire);
|
||||
g_pserver->stat_expiredkeys++;
|
||||
}
|
||||
|
||||
/* Propagate expires into slaves and the AOF file.
|
||||
@ -1843,20 +1841,7 @@ int expireIfNeeded(redisDb *db, robj *key) {
|
||||
if (checkClientPauseTimeoutAndReturnIfPaused()) return 1;
|
||||
|
||||
/* Delete the key */
|
||||
<<<<<<< HEAD:src/db.cpp
|
||||
if (g_pserver->lazyfree_lazy_expire) {
|
||||
dbAsyncDelete(db,key);
|
||||
} else {
|
||||
dbSyncDelete(db,key);
|
||||
}
|
||||
g_pserver->stat_expiredkeys++;
|
||||
propagateExpire(db,key,g_pserver->lazyfree_lazy_expire);
|
||||
notifyKeyspaceEvent(NOTIFY_EXPIRED,
|
||||
"expired",key,db->id);
|
||||
signalModifiedKey(NULL,db,key);
|
||||
=======
|
||||
deleteExpiredKeyAndPropagate(db,key);
|
||||
>>>>>>> 6.2.6:src/db.c
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,6 @@
|
||||
*
|
||||
* The parameter 'now' is the current time in milliseconds as is passed
|
||||
* to the function to avoid too many gettimeofday() syscalls. */
|
||||
<<<<<<< HEAD:src/expire.cpp
|
||||
void activeExpireCycleExpireFullKey(redisDb *db, const char *key) {
|
||||
robj *keyobj = createStringObject(key,sdslen(key));
|
||||
mstime_t expire_latency;
|
||||
@ -78,15 +77,6 @@ int activeExpireCycleExpire(redisDb *db, expireEntry &e, long long now, size_t &
|
||||
{
|
||||
activeExpireCycleExpireFullKey(db, e.key());
|
||||
++tried;
|
||||
=======
|
||||
int activeExpireCycleTryExpire(redisDb *db, dictEntry *de, long long now) {
|
||||
long long t = dictGetSignedIntegerVal(de);
|
||||
if (now > t) {
|
||||
sds key = dictGetKey(de);
|
||||
robj *keyobj = createStringObject(key,sdslen(key));
|
||||
deleteExpiredKeyAndPropagate(db,keyobj);
|
||||
decrRefCount(keyobj);
|
||||
>>>>>>> 6.2.6:src/expire.c
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
16
src/geo.cpp
16
src/geo.cpp
@ -518,16 +518,8 @@ void georadiusGeneric(client *c, int srcKeyIndex, int flags) {
|
||||
int storedist = 0; /* 0 for STORE, 1 for STOREDIST. */
|
||||
|
||||
/* Look up the requested zset */
|
||||
<<<<<<< HEAD:src/geo.cpp
|
||||
robj_roptr zobj = nullptr;
|
||||
if ((zobj = lookupKeyReadOrReply(c, c->argv[srcKeyIndex], shared.emptyarray)) == nullptr ||
|
||||
checkType(c, zobj, OBJ_ZSET)) {
|
||||
return;
|
||||
}
|
||||
=======
|
||||
robj *zobj = lookupKeyRead(c->db, c->argv[srcKeyIndex]);
|
||||
robj_roptr zobj = lookupKeyRead(c->db, c->argv[srcKeyIndex]);
|
||||
if (checkType(c, zobj, OBJ_ZSET)) return;
|
||||
>>>>>>> 6.2.6:src/geo.c
|
||||
|
||||
/* Find long/lat to use for radius or box search based on inquiry type */
|
||||
int base_args;
|
||||
@ -621,7 +613,7 @@ void georadiusGeneric(client *c, int srcKeyIndex, int flags) {
|
||||
!fromloc)
|
||||
{
|
||||
/* No source key, proceed with argument parsing and return an error when done. */
|
||||
if (zobj == NULL) {
|
||||
if (!zobj) {
|
||||
frommember = 1;
|
||||
i++;
|
||||
continue;
|
||||
@ -696,13 +688,13 @@ void georadiusGeneric(client *c, int srcKeyIndex, int flags) {
|
||||
}
|
||||
|
||||
/* Return ASAP when src key does not exist. */
|
||||
if (zobj == NULL) {
|
||||
if (!zobj) {
|
||||
if (storekey) {
|
||||
/* store key is not NULL, try to delete it and return 0. */
|
||||
if (dbDelete(c->db, storekey)) {
|
||||
signalModifiedKey(c, c->db, storekey);
|
||||
notifyKeyspaceEvent(NOTIFY_GENERIC, "del", storekey, c->db->id);
|
||||
server.dirty++;
|
||||
g_pserver->dirty++;
|
||||
}
|
||||
addReply(c, shared.czero);
|
||||
} else {
|
||||
|
@ -104,14 +104,9 @@ intset *intsetNew(void) {
|
||||
|
||||
/* Resize the intset */
|
||||
static intset *intsetResize(intset *is, uint32_t len) {
|
||||
<<<<<<< HEAD
|
||||
uint32_t size = len*intrev32ifbe(is->encoding);
|
||||
is = zrealloc(is,sizeof(intset)+size, MALLOC_SHARED);
|
||||
=======
|
||||
uint64_t size = (uint64_t)len*intrev32ifbe(is->encoding);
|
||||
assert(size <= SIZE_MAX - sizeof(intset));
|
||||
is = zrealloc(is,sizeof(intset)+size);
|
||||
>>>>>>> 6.2.6
|
||||
is = zrealloc(is,sizeof(intset)+size, MALLOC_SHARED);
|
||||
return is;
|
||||
}
|
||||
|
||||
|
@ -2632,11 +2632,7 @@ int RM_StringTruncate(RedisModuleKey *key, size_t newlen) {
|
||||
if (newlen > curlen) {
|
||||
key->value->m_ptr = sdsgrowzero(szFromObj(key->value),newlen);
|
||||
} else if (newlen < curlen) {
|
||||
<<<<<<< HEAD:src/module.cpp
|
||||
sdsrange(szFromObj(key->value),0,newlen-1);
|
||||
=======
|
||||
sdssubstr(key->value->ptr,0,newlen);
|
||||
>>>>>>> 6.2.6:src/module.c
|
||||
sdssubstr(szFromObj(key->value),0,newlen);
|
||||
/* If the string is too wasteful, reallocate it. */
|
||||
if (sdslen(szFromObj(key->value)) < sdsavail(szFromObj(key->value)))
|
||||
key->value->m_ptr = sdsRemoveFreeSpace(szFromObj(key->value));
|
||||
@ -5790,7 +5786,7 @@ int moduleBlockedClientMayTimeout(client *c) {
|
||||
if (c->btype != BLOCKED_MODULE)
|
||||
return 1;
|
||||
|
||||
RedisModuleBlockedClient *bc = c->bpop.module_blocked_handle;
|
||||
RedisModuleBlockedClient *bc = (RedisModuleBlockedClient*)c->bpop.module_blocked_handle;
|
||||
return (bc && bc->timeout_callback != NULL);
|
||||
}
|
||||
|
||||
|
@ -156,12 +156,7 @@ void execCommandAbort(client *c, sds error) {
|
||||
/* Send EXEC to clients waiting data from MONITOR. We did send a MULTI
|
||||
* already, and didn't send any of the queued commands, now we'll just send
|
||||
* EXEC so it is clear that the transaction is over. */
|
||||
<<<<<<< HEAD:src/multi.cpp
|
||||
if (listLength(g_pserver->monitors) && !g_pserver->loading)
|
||||
replicationFeedMonitors(c,g_pserver->monitors,c->db->id,c->argv,c->argc);
|
||||
=======
|
||||
replicationFeedMonitors(c,server.monitors,c->db->id,c->argv,c->argc);
|
||||
>>>>>>> 6.2.6:src/multi.c
|
||||
replicationFeedMonitors(c,g_pserver->monitors,c->db->id,c->argv,c->argc);
|
||||
}
|
||||
|
||||
void execCommand(client *c) {
|
||||
@ -198,7 +193,6 @@ void execCommand(client *c) {
|
||||
return;
|
||||
}
|
||||
|
||||
{ // GOTO Protectect Variable Scope
|
||||
uint64_t old_flags = c->flags;
|
||||
|
||||
/* we do not want to allow blocking commands inside multi */
|
||||
@ -285,21 +279,7 @@ void execCommand(client *c) {
|
||||
afterPropagateExec();
|
||||
}
|
||||
|
||||
<<<<<<< HEAD:src/multi.cpp
|
||||
serverTL->in_exec = 0;
|
||||
} // END Goto Variable Protection Scope
|
||||
|
||||
handle_monitor:
|
||||
/* Send EXEC to clients waiting data from MONITOR. We do it here
|
||||
* since the natural order of commands execution is actually:
|
||||
* MUTLI, EXEC, ... commands inside transaction ...
|
||||
* Instead EXEC is flagged as CMD_SKIP_MONITOR in the command
|
||||
* table, and we do it here with correct ordering. */
|
||||
if (listLength(g_pserver->monitors) && !g_pserver->loading)
|
||||
replicationFeedMonitors(c,g_pserver->monitors,c->db->id,c->argv,c->argc);
|
||||
=======
|
||||
server.in_exec = 0;
|
||||
>>>>>>> 6.2.6:src/multi.c
|
||||
}
|
||||
|
||||
/* ===================== WATCH (CAS alike for MULTI/EXEC) ===================
|
||||
@ -386,7 +366,7 @@ int isWatchedKeyExpired(client *c) {
|
||||
if (listLength(c->watched_keys) == 0) return 0;
|
||||
listRewind(c->watched_keys,&li);
|
||||
while ((ln = listNext(&li))) {
|
||||
wk = listNodeValue(ln);
|
||||
wk = (watchedKey*)listNodeValue(ln);
|
||||
if (keyIsExpired(wk->db, wk->key)) return 1;
|
||||
}
|
||||
|
||||
|
@ -112,11 +112,6 @@ static void clientSetDefaultAuth(client *c) {
|
||||
!(c->user->flags & USER_FLAG_DISABLED);
|
||||
}
|
||||
|
||||
<<<<<<< HEAD:src/networking.cpp
|
||||
client *createClient(connection *conn, int iel) {
|
||||
client *c = (client*)zmalloc(sizeof(client), MALLOC_LOCAL);
|
||||
serverAssert(conn == nullptr || (iel == (serverTL - g_pserver->rgthreadvar)));
|
||||
=======
|
||||
int authRequired(client *c) {
|
||||
/* Check if the user is authenticated. This check is skipped in case
|
||||
* the default user is flagged as "nopass" and is active. */
|
||||
@ -126,9 +121,9 @@ int authRequired(client *c) {
|
||||
return auth_required;
|
||||
}
|
||||
|
||||
client *createClient(connection *conn) {
|
||||
client *c = zmalloc(sizeof(client));
|
||||
>>>>>>> 6.2.6:src/networking.c
|
||||
client *createClient(connection *conn, int iel) {
|
||||
client *c = (client*)zmalloc(sizeof(client), MALLOC_LOCAL);
|
||||
serverAssert(conn == nullptr || (iel == (serverTL - g_pserver->rgthreadvar)));
|
||||
|
||||
c->iel = iel;
|
||||
/* passing NULL as conn it is possible to create a non connected client.
|
||||
@ -1932,7 +1927,7 @@ void ProcessPendingAsyncWrites()
|
||||
(c->replstate == SLAVE_STATE_ONLINE && !c->repl_put_online_on_ack))))
|
||||
continue;
|
||||
|
||||
asyncCloseClientOnOutputBufferLimitReached(c);
|
||||
closeClientOnOutputBufferLimitReached(c, 1);
|
||||
if (c->flags & CLIENT_CLOSE_ASAP)
|
||||
continue; // we will never write this so don't post an op
|
||||
|
||||
@ -2366,14 +2361,11 @@ int processMultibulkBuffer(client *c) {
|
||||
|
||||
/* Perform necessary tasks after a command was executed:
|
||||
*
|
||||
* 1. The client is reset unless there are reasons to avoid doing it.
|
||||
* 1. The client is reset unless there are reasons to avoid doing it.
|
||||
* 2. In the case of master clients, the replication offset is updated.
|
||||
* 3. Propagate commands we got from our master to replicas down the line. */
|
||||
<<<<<<< HEAD:src/networking.cpp
|
||||
void commandProcessed(client *c, int flags) {
|
||||
=======
|
||||
void commandProcessed(client *c) {
|
||||
/* If client is blocked(including paused), just return avoid reset and replicate.
|
||||
/* If client is blocked(including paused), just return avoid reset and replicate.
|
||||
*
|
||||
* 1. Don't reset the client structure for blocked clients, so that the reply
|
||||
* callback will still be able to access the client argv and argc fields.
|
||||
@ -2384,7 +2376,6 @@ void commandProcessed(client *c) {
|
||||
|
||||
resetClient(c);
|
||||
|
||||
>>>>>>> 6.2.6:src/networking.c
|
||||
long long prev_offset = c->reploff;
|
||||
if (c->flags & CLIENT_MASTER && !(c->flags & CLIENT_MULTI)) {
|
||||
/* Update the applied replication offset of our master. */
|
||||
@ -3122,12 +3113,8 @@ NULL
|
||||
if (getLongLongFromObjectOrReply(c,c->argv[2],&id,NULL)
|
||||
!= C_OK) return;
|
||||
struct client *target = lookupClientByID(id);
|
||||
<<<<<<< HEAD:src/networking.cpp
|
||||
if (target && target->flags & CLIENT_BLOCKED) {
|
||||
std::unique_lock<fastlock> ul(target->lock);
|
||||
=======
|
||||
if (target && target->flags & CLIENT_BLOCKED && moduleBlockedClientMayTimeout(target)) {
|
||||
>>>>>>> 6.2.6:src/networking.c
|
||||
std::unique_lock<fastlock> ul(target->lock);
|
||||
if (unblock_error)
|
||||
addReplyError(target,
|
||||
"-UNBLOCKED client unblocked via CLIENT UNBLOCK");
|
||||
@ -3832,12 +3819,8 @@ void unpauseClients(void) {
|
||||
listIter li;
|
||||
client *c;
|
||||
|
||||
<<<<<<< HEAD:src/networking.cpp
|
||||
g_pserver->client_pause_type = CLIENT_PAUSE_OFF;
|
||||
=======
|
||||
server.client_pause_type = CLIENT_PAUSE_OFF;
|
||||
server.client_pause_end_time = 0;
|
||||
>>>>>>> 6.2.6:src/networking.c
|
||||
g_pserver->client_pause_end_time = 0;
|
||||
|
||||
/* Unblock all of the clients so they are reprocessed. */
|
||||
listRewind(g_pserver->paused_clients,&li);
|
||||
@ -3901,7 +3884,6 @@ void processEventsWhileBlocked(int iel) {
|
||||
vecclients.push_back(c);
|
||||
}
|
||||
}
|
||||
<<<<<<< HEAD:src/networking.cpp
|
||||
|
||||
/* Since we're about to release our lock we need to flush the repl backlog queue */
|
||||
bool fReplBacklog = g_pserver->repl_batch_offStart >= 0;
|
||||
@ -3915,25 +3897,6 @@ void processEventsWhileBlocked(int iel) {
|
||||
aeReleaseLock();
|
||||
serverAssert(!GlobalLocksAcquired());
|
||||
try
|
||||
=======
|
||||
listEmpty(server.clients_pending_write);
|
||||
|
||||
/* Update processed count on server */
|
||||
server.stat_io_writes_processed += processed;
|
||||
|
||||
return processed;
|
||||
}
|
||||
|
||||
/* Return 1 if we want to handle the client read later using threaded I/O.
|
||||
* This is called by the readable handler of the event loop.
|
||||
* As a side effect of calling this function the client is put in the
|
||||
* pending read clients and flagged as such. */
|
||||
int postponeClientRead(client *c) {
|
||||
if (server.io_threads_active &&
|
||||
server.io_threads_do_reads &&
|
||||
!ProcessingEventsWhileBlocked &&
|
||||
!(c->flags & (CLIENT_MASTER|CLIENT_SLAVE|CLIENT_PENDING_READ|CLIENT_BLOCKED)))
|
||||
>>>>>>> 6.2.6:src/networking.c
|
||||
{
|
||||
ProcessingEventsWhileBlocked = 1;
|
||||
while (iterations--) {
|
||||
@ -3965,40 +3928,7 @@ int postponeClientRead(client *c) {
|
||||
locker.arm(nullptr);
|
||||
locker.release();
|
||||
|
||||
<<<<<<< HEAD:src/networking.cpp
|
||||
g_pserver->events_processed_while_blocked += eventsCount;
|
||||
=======
|
||||
/* Also use the main thread to process a slice of clients. */
|
||||
listRewind(io_threads_list[0],&li);
|
||||
while((ln = listNext(&li))) {
|
||||
client *c = listNodeValue(ln);
|
||||
readQueryFromClient(c->conn);
|
||||
}
|
||||
listEmpty(io_threads_list[0]);
|
||||
|
||||
/* Wait for all the other threads to end their work. */
|
||||
while(1) {
|
||||
unsigned long pending = 0;
|
||||
for (int j = 1; j < server.io_threads_num; j++)
|
||||
pending += getIOPendingCount(j);
|
||||
if (pending == 0) break;
|
||||
}
|
||||
|
||||
/* Run the list of clients again to process the new buffers. */
|
||||
while(listLength(server.clients_pending_read)) {
|
||||
ln = listFirst(server.clients_pending_read);
|
||||
client *c = listNodeValue(ln);
|
||||
c->flags &= ~CLIENT_PENDING_READ;
|
||||
listDelNode(server.clients_pending_read,ln);
|
||||
|
||||
serverAssert(!(c->flags & CLIENT_BLOCKED));
|
||||
if (processPendingCommandsAndResetClient(c) == C_ERR) {
|
||||
/* If the client is no longer valid, we avoid
|
||||
* processing the client later. So we just go
|
||||
* to the next. */
|
||||
continue;
|
||||
}
|
||||
>>>>>>> 6.2.6:src/networking.c
|
||||
|
||||
whileBlockedCron();
|
||||
|
||||
|
@ -975,13 +975,8 @@ size_t objectComputeSize(robj *o, size_t sample_size) {
|
||||
serverPanic("Unknown hash encoding");
|
||||
}
|
||||
} else if (o->type == OBJ_STREAM) {
|
||||
<<<<<<< HEAD:src/object.cpp
|
||||
stream *s = (stream*)ptrFromObj(o);
|
||||
asize = sizeof(*o);
|
||||
=======
|
||||
stream *s = o->ptr;
|
||||
asize = sizeof(*o)+sizeof(*s);
|
||||
>>>>>>> 6.2.6:src/object.c
|
||||
asize += streamRadixTreeMemoryUsage(s->rax);
|
||||
|
||||
/* Now we have to add the listpacks. The last listpack is often non
|
||||
@ -1330,16 +1325,9 @@ robj_roptr objectCommandLookup(client *c, robj *key) {
|
||||
return lookupKeyReadWithFlags(c->db,key,LOOKUP_NOTOUCH|LOOKUP_NONOTIFY);
|
||||
}
|
||||
|
||||
<<<<<<< HEAD:src/object.cpp
|
||||
robj_roptr objectCommandLookupOrReply(client *c, robj *key, robj *reply) {
|
||||
robj_roptr o = objectCommandLookup(c,key);
|
||||
|
||||
if (!o) addReply(c, reply);
|
||||
=======
|
||||
robj *objectCommandLookupOrReply(client *c, robj *key, robj *reply) {
|
||||
robj *o = objectCommandLookup(c,key);
|
||||
if (!o) SentReplyOnKeyMiss(c, reply);
|
||||
>>>>>>> 6.2.6:src/object.c
|
||||
return o;
|
||||
}
|
||||
|
||||
|
254
src/rdb.cpp
254
src/rdb.cpp
@ -547,19 +547,13 @@ void *rdbGenericLoadStringObject(rio *rdb, int flags, size_t *lenptr) {
|
||||
}
|
||||
return buf;
|
||||
} else {
|
||||
<<<<<<< HEAD:src/rdb.cpp
|
||||
robj *o = encode ? createStringObject(SDS_NOINIT,len) :
|
||||
createRawStringObject(SDS_NOINIT,len);
|
||||
if (len && rioRead(rdb,ptrFromObj(o),len) == 0) {
|
||||
=======
|
||||
robj *o = encode ? tryCreateStringObject(SDS_NOINIT,len) :
|
||||
tryCreateRawStringObject(SDS_NOINIT,len);
|
||||
if (!o) {
|
||||
serverLog(server.loading? LL_WARNING: LL_VERBOSE, "rdbGenericLoadStringObject failed allocating %llu bytes", len);
|
||||
serverLog(g_pserver->loading? LL_WARNING: LL_VERBOSE, "rdbGenericLoadStringObject failed allocating %llu bytes", len);
|
||||
return NULL;
|
||||
}
|
||||
if (len && rioRead(rdb,o->ptr,len) == 0) {
|
||||
>>>>>>> 6.2.6:src/rdb.c
|
||||
if (len && rioRead(rdb,ptrFromObj(o),len) == 0) {
|
||||
decrRefCount(o);
|
||||
return NULL;
|
||||
}
|
||||
@ -1611,29 +1605,19 @@ robj *rdbLoadCheckModuleValue(rio *rdb, char *modulename) {
|
||||
}
|
||||
|
||||
/* Load a Redis object of the specified type from the specified file.
|
||||
<<<<<<< HEAD:src/rdb.cpp
|
||||
* On success a newly allocated object is returned, otherwise NULL. */
|
||||
robj *rdbLoadObject(int rdbtype, rio *rdb, sds key, uint64_t mvcc_tstamp) {
|
||||
=======
|
||||
* On success a newly allocated object is returned, otherwise NULL.
|
||||
* When the function returns NULL and if 'error' is not NULL, the
|
||||
* integer pointed by 'error' is set to the type of error that occurred */
|
||||
robj *rdbLoadObject(int rdbtype, rio *rdb, sds key, int *error) {
|
||||
>>>>>>> 6.2.6:src/rdb.c
|
||||
robj *rdbLoadObject(int rdbtype, rio *rdb, sds key, int *error, uint64_t mvcc_tstamp) {
|
||||
robj *o = NULL, *ele, *dec;
|
||||
uint64_t len;
|
||||
unsigned int i;
|
||||
|
||||
<<<<<<< HEAD:src/rdb.cpp
|
||||
int deep_integrity_validation = cserver.sanitize_dump_payload == SANITIZE_DUMP_YES;
|
||||
if (cserver.sanitize_dump_payload == SANITIZE_DUMP_CLIENTS) {
|
||||
=======
|
||||
/* Set default error of load object, it will be set to 0 on success. */
|
||||
if (error) *error = RDB_LOAD_ERR_OTHER;
|
||||
|
||||
int deep_integrity_validation = server.sanitize_dump_payload == SANITIZE_DUMP_YES;
|
||||
if (server.sanitize_dump_payload == SANITIZE_DUMP_CLIENTS) {
|
||||
>>>>>>> 6.2.6:src/rdb.c
|
||||
int deep_integrity_validation = cserver.sanitize_dump_payload == SANITIZE_DUMP_YES;
|
||||
if (cserver.sanitize_dump_payload == SANITIZE_DUMP_CLIENTS) {
|
||||
/* Skip sanitization when loading (an RDB), or getting a RESTORE command
|
||||
* from either the master or a client using an ACL user with the skip-sanitize-payload flag. */
|
||||
int skip = g_pserver->loading ||
|
||||
@ -1674,13 +1658,9 @@ robj *rdbLoadObject(int rdbtype, rio *rdb, sds key, int *error) {
|
||||
if (len == 0) goto emptykey;
|
||||
|
||||
/* Use a regular set when there are too many entries. */
|
||||
<<<<<<< HEAD:src/rdb.cpp
|
||||
if (len > g_pserver->set_max_intset_entries) {
|
||||
=======
|
||||
size_t max_entries = server.set_max_intset_entries;
|
||||
size_t max_entries = g_pserver->set_max_intset_entries;
|
||||
if (max_entries >= 1<<30) max_entries = 1<<30;
|
||||
if (len > max_entries) {
|
||||
>>>>>>> 6.2.6:src/rdb.c
|
||||
o = createSetObject();
|
||||
/* It's faster to expand the dict to the right size asap in order
|
||||
* to avoid rehashing */
|
||||
@ -1795,18 +1775,11 @@ robj *rdbLoadObject(int rdbtype, rio *rdb, sds key, int *error) {
|
||||
}
|
||||
|
||||
/* Convert *after* loading, since sorted sets are not stored ordered. */
|
||||
<<<<<<< HEAD:src/rdb.cpp
|
||||
if (zsetLength(o) <= g_pserver->zset_max_ziplist_entries &&
|
||||
maxelelen <= g_pserver->zset_max_ziplist_value)
|
||||
zsetConvert(o,OBJ_ENCODING_ZIPLIST);
|
||||
=======
|
||||
if (zsetLength(o) <= server.zset_max_ziplist_entries &&
|
||||
maxelelen <= server.zset_max_ziplist_value &&
|
||||
maxelelen <= g_pserver->zset_max_ziplist_value &&
|
||||
ziplistSafeToAdd(NULL, totelelen))
|
||||
{
|
||||
zsetConvert(o,OBJ_ENCODING_ZIPLIST);
|
||||
}
|
||||
>>>>>>> 6.2.6:src/rdb.c
|
||||
zsetConvert(o,OBJ_ENCODING_ZIPLIST);
|
||||
|
||||
} else if (rdbtype == RDB_TYPE_HASH) {
|
||||
uint64_t len;
|
||||
int ret;
|
||||
@ -1860,25 +1833,13 @@ robj *rdbLoadObject(int rdbtype, rio *rdb, sds key, int *error) {
|
||||
}
|
||||
}
|
||||
|
||||
<<<<<<< HEAD:src/rdb.cpp
|
||||
/* Add pair to ziplist */
|
||||
o->m_ptr = ziplistPush((unsigned char*)ptrFromObj(o), (unsigned char*)field,
|
||||
sdslen(field), ZIPLIST_TAIL);
|
||||
o->m_ptr = ziplistPush((unsigned char*)ptrFromObj(o), (unsigned char*)value,
|
||||
sdslen(value), ZIPLIST_TAIL);
|
||||
|
||||
/* Convert to hash table if size threshold is exceeded */
|
||||
if (sdslen(field) > g_pserver->hash_max_ziplist_value ||
|
||||
sdslen(value) > g_pserver->hash_max_ziplist_value)
|
||||
=======
|
||||
/* Convert to hash table if size threshold is exceeded */
|
||||
if (sdslen(field) > server.hash_max_ziplist_value ||
|
||||
sdslen(value) > server.hash_max_ziplist_value ||
|
||||
!ziplistSafeToAdd(o->ptr, sdslen(field)+sdslen(value)))
|
||||
>>>>>>> 6.2.6:src/rdb.c
|
||||
sdslen(value) > g_pserver->hash_max_ziplist_value ||
|
||||
!ziplistSafeToAdd((unsigned char*)ptrFromObj(o), sdslen(field)+sdslen(value)))
|
||||
{
|
||||
hashTypeConvert(o, OBJ_ENCODING_HT);
|
||||
ret = dictAdd((dict*)o->ptr, field, value);
|
||||
ret = dictAdd((dict*)ptrFromObj(o), field, value);
|
||||
if (ret == DICT_ERR) {
|
||||
rdbReportCorruptRDB("Duplicate hash fields detected");
|
||||
if (dupSearchDict) dictRelease(dupSearchDict);
|
||||
@ -1891,11 +1852,12 @@ robj *rdbLoadObject(int rdbtype, rio *rdb, sds key, int *error) {
|
||||
}
|
||||
|
||||
/* Add pair to ziplist */
|
||||
o->ptr = ziplistPush(o->ptr, (unsigned char*)field,
|
||||
o->m_ptr = ziplistPush((unsigned char*)ptrFromObj(o), (unsigned char*)field,
|
||||
sdslen(field), ZIPLIST_TAIL);
|
||||
o->ptr = ziplistPush(o->ptr, (unsigned char*)value,
|
||||
o->m_ptr = ziplistPush((unsigned char*)ptrFromObj(o), (unsigned char*)value,
|
||||
sdslen(value), ZIPLIST_TAIL);
|
||||
|
||||
|
||||
sdsfree(field);
|
||||
sdsfree(value);
|
||||
}
|
||||
@ -1965,23 +1927,19 @@ robj *rdbLoadObject(int rdbtype, rio *rdb, sds key, int *error) {
|
||||
zfree(zl);
|
||||
return NULL;
|
||||
}
|
||||
<<<<<<< HEAD:src/rdb.cpp
|
||||
quicklistAppendZiplist((quicklist*)ptrFromObj(o), zl);
|
||||
=======
|
||||
|
||||
/* Silently skip empty ziplists, if we'll end up with empty quicklist we'll fail later. */
|
||||
if (ziplistLen(zl) == 0) {
|
||||
zfree(zl);
|
||||
continue;
|
||||
} else {
|
||||
quicklistAppendZiplist(o->ptr, zl);
|
||||
quicklistAppendZiplist((quicklist*)ptrFromObj(o), zl);
|
||||
}
|
||||
}
|
||||
|
||||
if (quicklistCount(o->ptr) == 0) {
|
||||
if (quicklistCount((quicklist*)ptrFromObj(o)) == 0) {
|
||||
decrRefCount(o);
|
||||
goto emptykey;
|
||||
>>>>>>> 6.2.6:src/rdb.c
|
||||
}
|
||||
} else if (rdbtype == RDB_TYPE_HASH_ZIPMAP ||
|
||||
rdbtype == RDB_TYPE_LIST_ZIPLIST ||
|
||||
@ -2069,7 +2027,7 @@ robj *rdbLoadObject(int rdbtype, rio *rdb, sds key, int *error) {
|
||||
|
||||
if (ziplistLen(encoded) == 0) {
|
||||
zfree(encoded);
|
||||
o->ptr = NULL;
|
||||
o->m_ptr = NULL;
|
||||
decrRefCount(o);
|
||||
goto emptykey;
|
||||
}
|
||||
@ -2103,18 +2061,14 @@ robj *rdbLoadObject(int rdbtype, rio *rdb, sds key, int *error) {
|
||||
}
|
||||
o->type = OBJ_ZSET;
|
||||
o->encoding = OBJ_ENCODING_ZIPLIST;
|
||||
<<<<<<< HEAD:src/rdb.cpp
|
||||
if (zsetLength(o) > g_pserver->zset_max_ziplist_entries)
|
||||
=======
|
||||
if (zsetLength(o) == 0) {
|
||||
zfree(encoded);
|
||||
o->ptr = NULL;
|
||||
o->m_ptr = NULL;
|
||||
decrRefCount(o);
|
||||
goto emptykey;
|
||||
}
|
||||
|
||||
if (zsetLength(o) > server.zset_max_ziplist_entries)
|
||||
>>>>>>> 6.2.6:src/rdb.c
|
||||
if (zsetLength(o) > g_pserver->zset_max_ziplist_entries)
|
||||
zsetConvert(o,OBJ_ENCODING_SKIPLIST);
|
||||
break;
|
||||
case RDB_TYPE_HASH_ZIPLIST:
|
||||
@ -2128,18 +2082,14 @@ robj *rdbLoadObject(int rdbtype, rio *rdb, sds key, int *error) {
|
||||
}
|
||||
o->type = OBJ_HASH;
|
||||
o->encoding = OBJ_ENCODING_ZIPLIST;
|
||||
<<<<<<< HEAD:src/rdb.cpp
|
||||
if (hashTypeLength(o) > g_pserver->hash_max_ziplist_entries)
|
||||
=======
|
||||
if (hashTypeLength(o) == 0) {
|
||||
zfree(encoded);
|
||||
o->ptr = NULL;
|
||||
o->m_ptr = NULL;
|
||||
decrRefCount(o);
|
||||
goto emptykey;
|
||||
}
|
||||
|
||||
if (hashTypeLength(o) > server.hash_max_ziplist_entries)
|
||||
>>>>>>> 6.2.6:src/rdb.c
|
||||
if (hashTypeLength(o) > g_pserver->hash_max_ziplist_entries)
|
||||
hashTypeConvert(o, OBJ_ENCODING_HT);
|
||||
break;
|
||||
default:
|
||||
@ -2377,7 +2327,7 @@ robj *rdbLoadObject(int rdbtype, rio *rdb, sds key, int *error) {
|
||||
raxStart(&ri_cg_pel,cgroup->pel);
|
||||
raxSeek(&ri_cg_pel,"^",NULL,0);
|
||||
while(raxNext(&ri_cg_pel)) {
|
||||
streamNACK *nack = ri_cg_pel.data;
|
||||
streamNACK *nack = (streamNACK *)ri_cg_pel.data;
|
||||
if (!nack->consumer) {
|
||||
raxStop(&ri_cg_pel);
|
||||
rdbReportCorruptRDB("Stream CG PEL entry without consumer");
|
||||
@ -2465,13 +2415,10 @@ robj *rdbLoadObject(int rdbtype, rio *rdb, sds key, int *error) {
|
||||
rdbReportReadError("Unknown RDB encoding type %d",rdbtype);
|
||||
return NULL;
|
||||
}
|
||||
<<<<<<< HEAD:src/rdb.cpp
|
||||
|
||||
setMvccTstamp(o, mvcc_tstamp);
|
||||
serverAssert(!o->FExpires());
|
||||
=======
|
||||
if (error) *error = 0;
|
||||
>>>>>>> 6.2.6:src/rdb.c
|
||||
return o;
|
||||
|
||||
emptykey:
|
||||
@ -2595,7 +2542,6 @@ int rdbLoadRio(rio *rdb, int rdbflags, rdbSaveInfo *rsi) {
|
||||
int type, rdbver;
|
||||
redisDb *db = g_pserver->db+0;
|
||||
char buf[1024];
|
||||
<<<<<<< HEAD:src/rdb.cpp
|
||||
/* Key-specific attributes, set by opcodes before the key type. */
|
||||
long long lru_idle = -1, lfu_freq = -1, expiretime = -1, now;
|
||||
long long lru_clock = 0;
|
||||
@ -2603,10 +2549,8 @@ int rdbLoadRio(rio *rdb, int rdbflags, rdbSaveInfo *rsi) {
|
||||
robj *subexpireKey = nullptr;
|
||||
sds key = nullptr;
|
||||
bool fLastKeyExpired = false;
|
||||
=======
|
||||
int error;
|
||||
long long empty_keys_skipped = 0, expired_keys_skipped = 0, keys_loaded = 0;
|
||||
>>>>>>> 6.2.6:src/rdb.c
|
||||
|
||||
rdb->update_cksum = rdbLoadProgressCallback;
|
||||
rdb->max_processing_chunk = g_pserver->loading_process_events_interval_bytes;
|
||||
@ -2841,38 +2785,7 @@ int rdbLoadRio(rio *rdb, int rdbflags, rdbSaveInfo *rsi) {
|
||||
if ((key = (sds)rdbGenericLoadStringObject(rdb,RDB_LOAD_SDS,NULL)) == NULL)
|
||||
goto eoferr;
|
||||
/* Read value */
|
||||
<<<<<<< HEAD:src/rdb.cpp
|
||||
if ((val = rdbLoadObject(type,rdb,key,mvcc_tstamp)) == NULL) {
|
||||
sdsfree(key);
|
||||
key = nullptr;
|
||||
goto eoferr;
|
||||
}
|
||||
bool fStaleMvccKey = (rsi) ? mvccFromObj(val) < rsi->mvccMinThreshold : false;
|
||||
=======
|
||||
val = rdbLoadObject(type,rdb,key,&error);
|
||||
>>>>>>> 6.2.6:src/rdb.c
|
||||
|
||||
/* Check if the key already expired. This function is used when loading
|
||||
* an RDB file from disk, either at startup, or when an RDB was
|
||||
* received from the master. In the latter case, the master is
|
||||
* responsible for key expiry. If we would expire keys here, the
|
||||
* snapshot taken by the master may not be reflected on the replica.
|
||||
* Similarly if the RDB is the preamble of an AOF file, we want to
|
||||
* load all the keys as they are, since the log of operations later
|
||||
* assume to work in an exact keyspace state. */
|
||||
<<<<<<< HEAD:src/rdb.cpp
|
||||
redisObjectStack keyobj;
|
||||
initStaticStringObject(keyobj,key);
|
||||
bool fExpiredKey = iAmMaster() && !(rdbflags&RDBFLAGS_AOF_PREAMBLE) && expiretime != -1 && expiretime < now;
|
||||
if (fStaleMvccKey || fExpiredKey) {
|
||||
if (fStaleMvccKey && !fExpiredKey && rsi != nullptr && rsi->mi != nullptr && rsi->mi->staleKeyMap != nullptr && lookupKeyRead(db, &keyobj) == nullptr) {
|
||||
// We have a key that we've already deleted and is not back in our database.
|
||||
// We'll need to inform the sending master of the delete if it is also a replica of us
|
||||
robj_sharedptr objKeyDup(createStringObject(key, sdslen(key)));
|
||||
rsi->mi->staleKeyMap->operator[](db - g_pserver->db).push_back(objKeyDup);
|
||||
}
|
||||
fLastKeyExpired = true;
|
||||
=======
|
||||
val = rdbLoadObject(type,rdb,key,&error,mvcc_tstamp);
|
||||
if (val == NULL) {
|
||||
/* Since we used to have bug that could lead to empty keys
|
||||
* (See #8453), we rather not fail when empty key is encountered
|
||||
@ -2882,67 +2795,68 @@ int rdbLoadRio(rio *rdb, int rdbflags, rdbSaveInfo *rsi) {
|
||||
if(empty_keys_skipped++ < 10)
|
||||
serverLog(LL_WARNING, "rdbLoadObject skipping empty key: %s", key);
|
||||
sdsfree(key);
|
||||
key = nullptr;
|
||||
} else {
|
||||
sdsfree(key);
|
||||
goto eoferr;
|
||||
}
|
||||
} else if (iAmMaster() &&
|
||||
!(rdbflags&RDBFLAGS_AOF_PREAMBLE) &&
|
||||
expiretime != -1 && expiretime < now)
|
||||
{
|
||||
>>>>>>> 6.2.6:src/rdb.c
|
||||
sdsfree(key);
|
||||
key = nullptr;
|
||||
decrRefCount(val);
|
||||
<<<<<<< HEAD:src/rdb.cpp
|
||||
val = nullptr;
|
||||
=======
|
||||
expired_keys_skipped++;
|
||||
>>>>>>> 6.2.6:src/rdb.c
|
||||
} else {
|
||||
bool fStaleMvccKey = (rsi) ? mvccFromObj(val) < rsi->mvccMinThreshold : false;
|
||||
|
||||
/* Check if the key already expired. This function is used when loading
|
||||
* an RDB file from disk, either at startup, or when an RDB was
|
||||
* received from the master. In the latter case, the master is
|
||||
* responsible for key expiry. If we would expire keys here, the
|
||||
* snapshot taken by the master may not be reflected on the replica.
|
||||
* Similarly if the RDB is the preamble of an AOF file, we want to
|
||||
* load all the keys as they are, since the log of operations later
|
||||
* assume to work in an exact keyspace state. */
|
||||
redisObjectStack keyobj;
|
||||
initStaticStringObject(keyobj,key);
|
||||
|
||||
/* Add the new object in the hash table */
|
||||
<<<<<<< HEAD:src/rdb.cpp
|
||||
int fInserted = dbMerge(db, key, val, (rsi && rsi->fForceSetKey) || (rdbflags & RDBFLAGS_ALLOW_DUP)); // Note: dbMerge will incrRef
|
||||
fLastKeyExpired = false;
|
||||
|
||||
if (fInserted)
|
||||
{
|
||||
/* Set the expire time if needed */
|
||||
if (expiretime != -1)
|
||||
{
|
||||
setExpire(NULL,db,&keyobj,nullptr,expiretime);
|
||||
=======
|
||||
int added = dbAddRDBLoad(db,key,val);
|
||||
keys_loaded++;
|
||||
if (!added) {
|
||||
if (rdbflags & RDBFLAGS_ALLOW_DUP) {
|
||||
/* This flag is useful for DEBUG RELOAD special modes.
|
||||
* When it's set we allow new keys to replace the current
|
||||
* keys with the same name. */
|
||||
dbSyncDelete(db,&keyobj);
|
||||
dbAddRDBLoad(db,key,val);
|
||||
} else {
|
||||
serverLog(LL_WARNING,
|
||||
"RDB has duplicated key '%s' in DB %d",key,db->id);
|
||||
serverPanic("Duplicated key found in RDB file");
|
||||
>>>>>>> 6.2.6:src/rdb.c
|
||||
bool fExpiredKey = iAmMaster() && !(rdbflags&RDBFLAGS_AOF_PREAMBLE) && expiretime != -1 && expiretime < now;
|
||||
|
||||
if (fStaleMvccKey || fExpiredKey) {
|
||||
if (fStaleMvccKey && !fExpiredKey && rsi != nullptr && rsi->mi != nullptr && rsi->mi->staleKeyMap != nullptr && lookupKeyRead(db, &keyobj) == nullptr) {
|
||||
// We have a key that we've already deleted and is not back in our database.
|
||||
// We'll need to inform the sending master of the delete if it is also a replica of us
|
||||
robj_sharedptr objKeyDup(createStringObject(key, sdslen(key)));
|
||||
rsi->mi->staleKeyMap->operator[](db - g_pserver->db).push_back(objKeyDup);
|
||||
}
|
||||
|
||||
/* Set usage information (for eviction). */
|
||||
objectSetLRUOrLFU(val,lfu_freq,lru_idle,lru_clock,1000);
|
||||
|
||||
/* call key space notification on key loaded for modules only */
|
||||
moduleNotifyKeyspaceEvent(NOTIFY_LOADED, "loaded", &keyobj, db->id);
|
||||
|
||||
replicationNotifyLoadedKey(db, &keyobj, val, expiretime);
|
||||
}
|
||||
else
|
||||
{
|
||||
fLastKeyExpired = true;
|
||||
sdsfree(key);
|
||||
key = nullptr;
|
||||
decrRefCount(val);
|
||||
val = nullptr;
|
||||
expired_keys_skipped++;
|
||||
} else {
|
||||
redisObjectStack keyobj;
|
||||
initStaticStringObject(keyobj,key);
|
||||
|
||||
/* Add the new object in the hash table */
|
||||
int fInserted = dbMerge(db, key, val, (rsi && rsi->fForceSetKey) || (rdbflags & RDBFLAGS_ALLOW_DUP)); // Note: dbMerge will incrRef
|
||||
fLastKeyExpired = false;
|
||||
keys_loaded++;
|
||||
if (fInserted)
|
||||
{
|
||||
/* Set the expire time if needed */
|
||||
if (expiretime != -1)
|
||||
{
|
||||
setExpire(NULL,db,&keyobj,nullptr,expiretime);
|
||||
}
|
||||
|
||||
/* Set usage information (for eviction). */
|
||||
objectSetLRUOrLFU(val,lfu_freq,lru_idle,lru_clock,1000);
|
||||
|
||||
/* call key space notification on key loaded for modules only */
|
||||
moduleNotifyKeyspaceEvent(NOTIFY_LOADED, "loaded", &keyobj, db->id);
|
||||
|
||||
replicationNotifyLoadedKey(db, &keyobj, val, expiretime);
|
||||
}
|
||||
else
|
||||
{
|
||||
decrRefCount(val);
|
||||
val = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -3099,7 +3013,6 @@ static void backgroundSaveDoneHandlerSocket(int exitcode, int bysignal) {
|
||||
serverLog(LL_WARNING,
|
||||
"Background transfer terminated by signal %d", bysignal);
|
||||
}
|
||||
<<<<<<< HEAD:src/rdb.cpp
|
||||
if (g_pserver->rdb_child_exit_pipe!=-1)
|
||||
close(g_pserver->rdb_child_exit_pipe);
|
||||
auto pipeT = g_pserver->rdb_pipe_read;
|
||||
@ -3116,21 +3029,6 @@ static void backgroundSaveDoneHandlerSocket(int exitcode, int bysignal) {
|
||||
zfree(g_pserver->rdb_pipe_buff);
|
||||
g_pserver->rdb_pipe_buff = NULL;
|
||||
g_pserver->rdb_pipe_bufflen = 0;
|
||||
=======
|
||||
if (server.rdb_child_exit_pipe!=-1)
|
||||
close(server.rdb_child_exit_pipe);
|
||||
aeDeleteFileEvent(server.el, server.rdb_pipe_read, AE_READABLE);
|
||||
close(server.rdb_pipe_read);
|
||||
server.rdb_child_exit_pipe = -1;
|
||||
server.rdb_pipe_read = -1;
|
||||
zfree(server.rdb_pipe_conns);
|
||||
server.rdb_pipe_conns = NULL;
|
||||
server.rdb_pipe_numconns = 0;
|
||||
server.rdb_pipe_numconns_writing = 0;
|
||||
zfree(server.rdb_pipe_buff);
|
||||
server.rdb_pipe_buff = NULL;
|
||||
server.rdb_pipe_bufflen = 0;
|
||||
>>>>>>> 6.2.6:src/rdb.c
|
||||
}
|
||||
|
||||
/* When a background RDB saving/transfer terminates, call the right handler. */
|
||||
|
@ -158,11 +158,7 @@ int rdbSaveS3(char *path, rdbSaveInfo *rsi);
|
||||
int rdbLoadS3(char *path, rdbSaveInfo *rsi, int rdbflags);
|
||||
ssize_t rdbSaveObject(rio *rdb, robj_roptr o, robj *key);
|
||||
size_t rdbSavedObjectLen(robj *o, robj *key);
|
||||
<<<<<<< HEAD
|
||||
robj *rdbLoadObject(int type, rio *rdb, sds key, uint64_t mvcc_tstamp);
|
||||
=======
|
||||
robj *rdbLoadObject(int type, rio *rdb, sds key, int *error);
|
||||
>>>>>>> 6.2.6
|
||||
robj *rdbLoadObject(int type, rio *rdb, sds key, int *error, uint64_t mvcc_tstamp);
|
||||
void backgroundSaveDoneHandler(int exitcode, int bysignal);
|
||||
int rdbSaveKeyValuePair(rio *rdb, robj *key, robj *val, long long expiretime);
|
||||
ssize_t rdbSaveSingleModuleAux(rio *rdb, int when, moduleType *mt);
|
||||
|
@ -308,11 +308,7 @@ int redis_check_rdb(const char *rdbfilename, FILE *fp) {
|
||||
rdbstate.keys++;
|
||||
/* Read value */
|
||||
rdbstate.doing = RDB_CHECK_DOING_READ_OBJECT_VALUE;
|
||||
<<<<<<< HEAD:src/redis-check-rdb.cpp
|
||||
if ((val = rdbLoadObject(type,&rdb,szFromObj(key),OBJ_MVCC_INVALID)) == NULL) goto eoferr;
|
||||
=======
|
||||
if ((val = rdbLoadObject(type,&rdb,key->ptr,NULL)) == NULL) goto eoferr;
|
||||
>>>>>>> 6.2.6:src/redis-check-rdb.c
|
||||
if ((val = rdbLoadObject(type,&rdb,szFromObj(key),NULL,OBJ_MVCC_INVALID)) == NULL) goto eoferr;
|
||||
/* Check if the key already expired. */
|
||||
if (expiretime != -1 && expiretime < now)
|
||||
rdbstate.already_expired++;
|
||||
|
101
src/redis-cli.c
101
src/redis-cli.c
@ -72,102 +72,7 @@
|
||||
redisContext *context;
|
||||
struct config config;
|
||||
|
||||
<<<<<<< HEAD
|
||||
int g_fTestMode = 0;
|
||||
=======
|
||||
static uint64_t dictSdsHash(const void *key);
|
||||
static int dictSdsKeyCompare(void *privdata, const void *key1,
|
||||
const void *key2);
|
||||
static void dictSdsDestructor(void *privdata, void *val);
|
||||
static void dictListDestructor(void *privdata, void *val);
|
||||
|
||||
/* Cluster Manager Command Info */
|
||||
typedef struct clusterManagerCommand {
|
||||
char *name;
|
||||
int argc;
|
||||
char **argv;
|
||||
int flags;
|
||||
int replicas;
|
||||
char *from;
|
||||
char *to;
|
||||
char **weight;
|
||||
int weight_argc;
|
||||
char *master_id;
|
||||
int slots;
|
||||
int timeout;
|
||||
int pipeline;
|
||||
float threshold;
|
||||
char *backup_dir;
|
||||
char *from_user;
|
||||
char *from_pass;
|
||||
int from_askpass;
|
||||
} clusterManagerCommand;
|
||||
|
||||
static void createClusterManagerCommand(char *cmdname, int argc, char **argv);
|
||||
|
||||
|
||||
static redisContext *context;
|
||||
static struct config {
|
||||
char *hostip;
|
||||
int hostport;
|
||||
char *hostsocket;
|
||||
int tls;
|
||||
cliSSLconfig sslconfig;
|
||||
long repeat;
|
||||
long interval;
|
||||
int dbnum; /* db num currently selected */
|
||||
int input_dbnum; /* db num user input */
|
||||
int interactive;
|
||||
int shutdown;
|
||||
int monitor_mode;
|
||||
int pubsub_mode;
|
||||
int latency_mode;
|
||||
int latency_dist_mode;
|
||||
int latency_history;
|
||||
int lru_test_mode;
|
||||
long long lru_test_sample_size;
|
||||
int cluster_mode;
|
||||
int cluster_reissue_command;
|
||||
int cluster_send_asking;
|
||||
int slave_mode;
|
||||
int pipe_mode;
|
||||
int pipe_timeout;
|
||||
int getrdb_mode;
|
||||
int stat_mode;
|
||||
int scan_mode;
|
||||
int intrinsic_latency_mode;
|
||||
int intrinsic_latency_duration;
|
||||
sds pattern;
|
||||
char *rdb_filename;
|
||||
int bigkeys;
|
||||
int memkeys;
|
||||
unsigned memkeys_samples;
|
||||
int hotkeys;
|
||||
int stdinarg; /* get last arg from stdin. (-x option) */
|
||||
char *auth;
|
||||
int askpass;
|
||||
char *user;
|
||||
int quoted_input; /* Force input args to be treated as quoted strings */
|
||||
int output; /* output mode, see OUTPUT_* defines */
|
||||
int push_output; /* Should we display spontaneous PUSH replies */
|
||||
sds mb_delim;
|
||||
sds cmd_delim;
|
||||
char prompt[128];
|
||||
char *eval;
|
||||
int eval_ldb;
|
||||
int eval_ldb_sync; /* Ask for synchronous mode of the Lua debugger. */
|
||||
int eval_ldb_end; /* Lua debugging session ended. */
|
||||
int enable_ldb_on_eval; /* Handle manual SCRIPT DEBUG + EVAL commands. */
|
||||
int last_cmd_type;
|
||||
int verbose;
|
||||
int set_errcode;
|
||||
clusterManagerCommand cluster_manager_command;
|
||||
int no_auth_warning;
|
||||
int resp3;
|
||||
int in_multi;
|
||||
int pre_multi_dbnum;
|
||||
} config;
|
||||
>>>>>>> 6.2.6
|
||||
|
||||
/* User preferences. */
|
||||
static struct pref {
|
||||
@ -1853,12 +1758,8 @@ static void usage(void) {
|
||||
" --lru-test <keys> Simulate a cache workload with an 80-20 distribution.\n"
|
||||
" --replica Simulate a replica showing commands received from the master.\n"
|
||||
" --rdb <filename> Transfer an RDB dump from remote server to local file.\n"
|
||||
<<<<<<< HEAD
|
||||
" --pipe Transfer raw KeyDB protocol from stdin to server.\n"
|
||||
=======
|
||||
" Use filename of \"-\" to write to stdout.\n"
|
||||
" --pipe Transfer raw Redis protocol from stdin to server.\n"
|
||||
>>>>>>> 6.2.6
|
||||
" --pipe Transfer raw KeyDB protocol from stdin to server.\n"
|
||||
" --pipe-timeout <n> In --pipe mode, abort with error if after sending all data.\n"
|
||||
" no reply is received within <n> seconds.\n"
|
||||
" Default timeout: %d. Use 0 to wait forever.\n",
|
||||
|
@ -146,7 +146,8 @@ extern struct config {
|
||||
char *key;
|
||||
long repeat;
|
||||
long interval;
|
||||
int dbnum;
|
||||
int dbnum; /* db num currently selected */
|
||||
int input_dbnum; /* db num user input */
|
||||
int interactive;
|
||||
int shutdown;
|
||||
int monitor_mode;
|
||||
@ -158,6 +159,7 @@ extern struct config {
|
||||
long long lru_test_sample_size;
|
||||
int cluster_mode;
|
||||
int cluster_reissue_command;
|
||||
int cluster_send_asking;
|
||||
int slave_mode;
|
||||
int pipe_mode;
|
||||
int pipe_timeout;
|
||||
|
@ -609,7 +609,7 @@ void replicationFeedSlavesFromMasterStream(char *buf, size_t buflen) {
|
||||
}
|
||||
|
||||
void replicationFeedMonitors(client *c, list *monitors, int dictid, robj **argv, int argc) {
|
||||
if (!(listLength(server.monitors) && !server.loading)) return;
|
||||
if (!(listLength(g_pserver->monitors) && !g_pserver->loading)) return;
|
||||
listNode *ln;
|
||||
listIter li;
|
||||
int j;
|
||||
|
@ -1739,7 +1739,7 @@ void evalGenericCommand(client *c, int evalsha) {
|
||||
void evalCommand(client *c) {
|
||||
/* Explicitly feed monitor here so that lua commands appear after their
|
||||
* script command. */
|
||||
replicationFeedMonitors(c,server.monitors,c->db->id,c->argv,c->argc);
|
||||
replicationFeedMonitors(c,g_pserver->monitors,c->db->id,c->argv,c->argc);
|
||||
if (!(c->flags & CLIENT_LUA_DEBUG))
|
||||
evalGenericCommand(c,0);
|
||||
else
|
||||
@ -1747,14 +1747,10 @@ void evalCommand(client *c) {
|
||||
}
|
||||
|
||||
void evalShaCommand(client *c) {
|
||||
<<<<<<< HEAD:src/scripting.cpp
|
||||
if (sdslen((sds)ptrFromObj(c->argv[1])) != 40) {
|
||||
=======
|
||||
/* Explicitly feed monitor here so that lua commands appear after their
|
||||
* script command. */
|
||||
replicationFeedMonitors(c,server.monitors,c->db->id,c->argv,c->argc);
|
||||
if (sdslen(c->argv[1]->ptr) != 40) {
|
||||
>>>>>>> 6.2.6:src/scripting.c
|
||||
replicationFeedMonitors(c,g_pserver->monitors,c->db->id,c->argv,c->argc);
|
||||
if (sdslen((sds)ptrFromObj(c->argv[1])) != 40) {
|
||||
/* We know that a match is not possible if the provided SHA is
|
||||
* not the right length. So we return an error ASAP, this way
|
||||
* evalGenericCommand() can be implemented without string length
|
||||
@ -2133,7 +2129,7 @@ int ldbDelBreakpoint(int line) {
|
||||
* On success the command is parsed and returned as an array of SDS strings,
|
||||
* otherwise NULL is returned and there is to read more buffer. */
|
||||
sds *ldbReplParseCommand(int *argcp, char** err) {
|
||||
static char* protocol_error = "protocol error";
|
||||
static sds protocol_error = sdsnew("protocol error");
|
||||
sds *argv = NULL;
|
||||
int argc = 0;
|
||||
char *plen = NULL;
|
||||
@ -2150,13 +2146,8 @@ sds *ldbReplParseCommand(int *argcp, char** err) {
|
||||
|
||||
/* Seek and parse *<count>\r\n. */
|
||||
p = strchr(p,'*'); if (!p) goto protoerr;
|
||||
<<<<<<< HEAD:src/scripting.cpp
|
||||
plen = p+1; /* Multi bulk len pointer. */
|
||||
p = strstr(p,"\r\n"); if (!p) goto protoerr;
|
||||
=======
|
||||
char *plen = p+1; /* Multi bulk len pointer. */
|
||||
p = strstr(p,"\r\n"); if (!p) goto keep_reading;
|
||||
>>>>>>> 6.2.6:src/scripting.c
|
||||
*p = '\0'; p += 2;
|
||||
*argcp = atoi(plen);
|
||||
if (*argcp <= 0 || *argcp > 1024) goto protoerr;
|
||||
@ -2625,7 +2616,9 @@ void ldbRedis(lua_State *lua, sds *argv, int argc) {
|
||||
* given by the user (without the first argument) and we also push the 'redis' global table and
|
||||
* 'redis.call' function so:
|
||||
* (1 (redis table)) + (1 (redis.call function)) + (argc - 1 (all arguments without the first)) = argc + 1*/
|
||||
ldbLogRedisReply("max lua stack reached");
|
||||
sds reply = sdsnew("max lua stack reached");
|
||||
ldbLogRedisReply(reply);
|
||||
sdsfree(reply);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -290,15 +290,8 @@ sds sdsMakeRoomFor(sds s, size_t addlen) {
|
||||
if (type == SDS_TYPE_5) type = SDS_TYPE_8;
|
||||
|
||||
hdrlen = sdsHdrSize(type);
|
||||
<<<<<<< HEAD
|
||||
assert(hdrlen + newlen + 1 > len); /* Catch size_t overflow */
|
||||
if (oldtype==type && (len+1024) >= avail) {
|
||||
// note: if we have a lot of free space don't use this as we don't want s_realloc copying
|
||||
// uninitialized data
|
||||
=======
|
||||
assert(hdrlen + newlen + 1 > reqlen); /* Catch size_t overflow */
|
||||
if (oldtype==type) {
|
||||
>>>>>>> 6.2.6
|
||||
newsh = s_realloc_usable(sh, hdrlen+newlen+1, &usable);
|
||||
if (newsh == NULL) return NULL;
|
||||
s = (char*)newsh+hdrlen;
|
||||
|
@ -3187,21 +3187,13 @@ void sentinelConfigSetCommand(client *c) {
|
||||
sentinel.announce_port = numval;
|
||||
} else if (!strcasecmp(szFromObj(o), "sentinel-user")) {
|
||||
sdsfree(sentinel.sentinel_auth_user);
|
||||
<<<<<<< HEAD:src/sentinel.cpp
|
||||
sentinel.sentinel_auth_user = sdsnew(szFromObj(val));
|
||||
=======
|
||||
sentinel.sentinel_auth_user = sdslen(val->ptr) == 0 ?
|
||||
NULL : sdsdup(val->ptr);
|
||||
>>>>>>> 6.2.6:src/sentinel.c
|
||||
sentinel.sentinel_auth_user = sdslen(szFromObj(val)) == 0 ?
|
||||
NULL : sdsdup(szFromObj(val));
|
||||
drop_conns = 1;
|
||||
} else if (!strcasecmp(szFromObj(o), "sentinel-pass")) {
|
||||
sdsfree(sentinel.sentinel_auth_pass);
|
||||
<<<<<<< HEAD:src/sentinel.cpp
|
||||
sentinel.sentinel_auth_pass = sdsnew(szFromObj(val));
|
||||
=======
|
||||
sentinel.sentinel_auth_pass = sdslen(val->ptr) == 0 ?
|
||||
NULL : sdsdup(val->ptr);
|
||||
>>>>>>> 6.2.6:src/sentinel.c
|
||||
sentinel.sentinel_auth_pass = sdslen(szFromObj(val)) == 0 ?
|
||||
NULL : sdsdup(szFromObj(val));
|
||||
drop_conns = 1;
|
||||
} else {
|
||||
addReplyErrorFormat(c, "Invalid argument '%s' to SENTINEL CONFIG SET",
|
||||
|
120
src/server.cpp
120
src/server.cpp
@ -1908,7 +1908,6 @@ void clientsCron(int iel) {
|
||||
/* Rotate the list, take the current head, process.
|
||||
* This way if the client must be removed from the list it's the
|
||||
* first element and we don't incur into O(N) computation. */
|
||||
<<<<<<< HEAD:src/server.cpp
|
||||
listRotateTailToHead(g_pserver->clients);
|
||||
head = (listNode*)listFirst(g_pserver->clients);
|
||||
c = (client*)listNodeValue(head);
|
||||
@ -1922,22 +1921,10 @@ void clientsCron(int iel) {
|
||||
if (clientsCronResizeQueryBuffer(c)) goto LContinue;
|
||||
if (clientsCronTrackExpansiveClients(c, curr_peak_mem_usage_slot)) goto LContinue;
|
||||
if (clientsCronTrackClientsMemUsage(c)) goto LContinue;
|
||||
if (closeClientOnOutputBufferLimitReached(c, 0)) continue; // Client also free'd
|
||||
LContinue:
|
||||
fastlock_unlock(&c->lock);
|
||||
}
|
||||
=======
|
||||
listRotateTailToHead(server.clients);
|
||||
head = listFirst(server.clients);
|
||||
c = listNodeValue(head);
|
||||
/* The following functions do different service checks on the client.
|
||||
* The protocol is that they return non-zero if the client was
|
||||
* terminated. */
|
||||
if (clientsCronHandleTimeout(c,now)) continue;
|
||||
if (clientsCronResizeQueryBuffer(c)) continue;
|
||||
if (clientsCronTrackExpansiveClients(c, curr_peak_mem_usage_slot)) continue;
|
||||
if (clientsCronTrackClientsMemUsage(c)) continue;
|
||||
if (closeClientOnOutputBufferLimitReached(c, 0)) continue;
|
||||
>>>>>>> 6.2.6:src/server.c
|
||||
}
|
||||
|
||||
/* Free any pending clients */
|
||||
@ -2779,7 +2766,6 @@ void createSharedObjects(void) {
|
||||
shared.eval = makeObjectShared("EVAL",4);
|
||||
|
||||
/* Shared command argument */
|
||||
<<<<<<< HEAD:src/server.cpp
|
||||
shared.left = makeObjectShared("left",4);
|
||||
shared.right = makeObjectShared("right",5);
|
||||
shared.pxat = makeObjectShared("PXAT", 4);
|
||||
@ -2799,33 +2785,13 @@ void createSharedObjects(void) {
|
||||
shared.getack = makeObjectShared("GETACK",6);
|
||||
shared.special_asterick = makeObjectShared("*",1);
|
||||
shared.special_equals = makeObjectShared("=",1);
|
||||
shared.redacted = makeObjectShared("(redacted)",10);
|
||||
|
||||
/* KeyDB Specific */
|
||||
shared.hdel = makeObjectShared(createStringObject("HDEL", 4));
|
||||
shared.zrem = makeObjectShared(createStringObject("ZREM", 4));
|
||||
shared.mvccrestore = makeObjectShared(createStringObject("KEYDB.MVCCRESTORE", 17));
|
||||
shared.pexpirememberat = makeObjectShared(createStringObject("PEXPIREMEMBERAT",15));
|
||||
=======
|
||||
shared.left = createStringObject("left",4);
|
||||
shared.right = createStringObject("right",5);
|
||||
shared.pxat = createStringObject("PXAT", 4);
|
||||
shared.px = createStringObject("PX",2);
|
||||
shared.time = createStringObject("TIME",4);
|
||||
shared.retrycount = createStringObject("RETRYCOUNT",10);
|
||||
shared.force = createStringObject("FORCE",5);
|
||||
shared.justid = createStringObject("JUSTID",6);
|
||||
shared.lastid = createStringObject("LASTID",6);
|
||||
shared.default_username = createStringObject("default",7);
|
||||
shared.ping = createStringObject("ping",4);
|
||||
shared.setid = createStringObject("SETID",5);
|
||||
shared.keepttl = createStringObject("KEEPTTL",7);
|
||||
shared.load = createStringObject("LOAD",4);
|
||||
shared.createconsumer = createStringObject("CREATECONSUMER",14);
|
||||
shared.getack = createStringObject("GETACK",6);
|
||||
shared.special_asterick = createStringObject("*",1);
|
||||
shared.special_equals = createStringObject("=",1);
|
||||
shared.redacted = makeObjectShared(createStringObject("(redacted)",10));
|
||||
>>>>>>> 6.2.6:src/server.c
|
||||
|
||||
for (j = 0; j < OBJ_SHARED_INTEGERS; j++) {
|
||||
shared.integers[j] =
|
||||
@ -3002,7 +2968,6 @@ void initServerConfig(void) {
|
||||
|
||||
/* By default we want scripts to be always replicated by effects
|
||||
* (single commands executed by the script), and not by sending the
|
||||
<<<<<<< HEAD:src/server.cpp
|
||||
* script to the replica / AOF. This is the new way starting from
|
||||
* Redis 5. However it is possible to revert it via keydb.conf. */
|
||||
g_pserver->lua_always_replicate_commands = 1;
|
||||
@ -3011,16 +2976,10 @@ void initServerConfig(void) {
|
||||
cserver.cthreads = CONFIG_DEFAULT_THREADS;
|
||||
cserver.fThreadAffinity = CONFIG_DEFAULT_THREAD_AFFINITY;
|
||||
cserver.threadAffinityOffset = 0;
|
||||
=======
|
||||
* script to the slave / AOF. This is the new way starting from
|
||||
* Redis 5. However it is possible to revert it via redis.conf. */
|
||||
server.lua_always_replicate_commands = 1;
|
||||
|
||||
/* Client Pause related */
|
||||
server.client_pause_type = CLIENT_PAUSE_OFF;
|
||||
server.client_pause_end_time = 0;
|
||||
|
||||
>>>>>>> 6.2.6:src/server.c
|
||||
g_pserver->client_pause_type = CLIENT_PAUSE_OFF;
|
||||
g_pserver->client_pause_end_time = 0;
|
||||
initConfigValues();
|
||||
}
|
||||
|
||||
@ -4029,18 +3988,6 @@ void call(client *c, int flags) {
|
||||
serverAssert(GlobalLocksAcquired());
|
||||
static long long prev_err_count;
|
||||
|
||||
<<<<<<< HEAD:src/server.cpp
|
||||
serverTL->fixed_time_expire++;
|
||||
|
||||
/* Send the command to clients in MONITOR mode if applicable.
|
||||
* Administrative commands are considered too dangerous to be shown. */
|
||||
if (listLength(g_pserver->monitors) &&
|
||||
!g_pserver->loading.load(std::memory_order_relaxed) &&
|
||||
!(c->cmd->flags & (CMD_SKIP_MONITOR|CMD_ADMIN)))
|
||||
{
|
||||
replicationFeedMonitors(c,g_pserver->monitors,c->db->id,c->argv,c->argc);
|
||||
}
|
||||
|
||||
/* We need to transfer async writes before a client's repl state gets changed. Otherwise
|
||||
we won't be able to propogate them correctly. */
|
||||
if (c->cmd->flags & CMD_CATEGORY_REPLICATION) {
|
||||
@ -4048,8 +3995,6 @@ void call(client *c, int flags) {
|
||||
ProcessPendingAsyncWrites();
|
||||
}
|
||||
|
||||
=======
|
||||
>>>>>>> 6.2.6:src/server.c
|
||||
/* Initialization: clear the flags that must be set by the command on
|
||||
* demand, and initialize the array for additional commands propagation. */
|
||||
c->flags &= ~(CLIENT_FORCE_AOF|CLIENT_FORCE_REPL|CLIENT_PREVENT_PROP);
|
||||
@ -4057,22 +4002,15 @@ void call(client *c, int flags) {
|
||||
redisOpArrayInit(&g_pserver->also_propagate);
|
||||
|
||||
/* Call the command. */
|
||||
<<<<<<< HEAD:src/server.cpp
|
||||
dirty = g_pserver->dirty;
|
||||
prev_err_count = g_pserver->stat_total_error_replies;
|
||||
updateCachedTime(0);
|
||||
incrementMvccTstamp();
|
||||
=======
|
||||
dirty = server.dirty;
|
||||
prev_err_count = server.stat_total_error_replies;
|
||||
|
||||
/* Update cache time, in case we have nested calls we want to
|
||||
* update only on the first call*/
|
||||
if (server.fixed_time_expire++ == 0) {
|
||||
if (g_pserver->fixed_time_expire++ == 0) {
|
||||
updateCachedTime(0);
|
||||
}
|
||||
|
||||
>>>>>>> 6.2.6:src/server.c
|
||||
incrementMvccTstamp();
|
||||
elapsedStart(&call_timer);
|
||||
try {
|
||||
c->cmd->proc(c);
|
||||
@ -4142,7 +4080,7 @@ void call(client *c, int flags) {
|
||||
if (!(c->cmd->flags & (CMD_SKIP_MONITOR|CMD_ADMIN))) {
|
||||
robj **argv = c->original_argv ? c->original_argv : c->argv;
|
||||
int argc = c->original_argv ? c->original_argc : c->argc;
|
||||
replicationFeedMonitors(c,server.monitors,c->db->id,argv,argc);
|
||||
replicationFeedMonitors(c,g_pserver->monitors,c->db->id,argv,argc);
|
||||
}
|
||||
|
||||
/* Clear the original argv.
|
||||
@ -5500,7 +5438,6 @@ sds genRedisInfoString(const char *section) {
|
||||
info = sdscatprintf(info,
|
||||
"# Replication\r\n"
|
||||
"role:%s\r\n",
|
||||
<<<<<<< HEAD:src/server.cpp
|
||||
listLength(g_pserver->masters) == 0 ? "master"
|
||||
: g_pserver->fActiveReplica ? "active-replica" : "slave");
|
||||
if (listLength(g_pserver->masters)) {
|
||||
@ -5514,45 +5451,16 @@ sds genRedisInfoString(const char *section) {
|
||||
while ((ln = listNext(&li)))
|
||||
{
|
||||
long long slave_repl_offset = 1;
|
||||
long long slave_read_repl_offset = 1;
|
||||
redisMaster *mi = (redisMaster*)listNodeValue(ln);
|
||||
|
||||
if (mi->master)
|
||||
if (mi->master){
|
||||
slave_repl_offset = mi->master->reploff;
|
||||
else if (mi->cached_master)
|
||||
slave_read_repl_offset = mi->master->read_reploff;
|
||||
} else if (mi->cached_master){
|
||||
slave_repl_offset = mi->cached_master->reploff;
|
||||
=======
|
||||
server.masterhost == NULL ? "master" : "slave");
|
||||
if (server.masterhost) {
|
||||
long long slave_repl_offset = 1;
|
||||
long long slave_read_repl_offset = 1;
|
||||
|
||||
if (server.master) {
|
||||
slave_repl_offset = server.master->reploff;
|
||||
slave_read_repl_offset = server.master->read_reploff;
|
||||
} else if (server.cached_master) {
|
||||
slave_repl_offset = server.cached_master->reploff;
|
||||
slave_read_repl_offset = server.cached_master->read_reploff;
|
||||
}
|
||||
|
||||
info = sdscatprintf(info,
|
||||
"master_host:%s\r\n"
|
||||
"master_port:%d\r\n"
|
||||
"master_link_status:%s\r\n"
|
||||
"master_last_io_seconds_ago:%d\r\n"
|
||||
"master_sync_in_progress:%d\r\n"
|
||||
"slave_read_repl_offset:%lld\r\n"
|
||||
"slave_repl_offset:%lld\r\n"
|
||||
,server.masterhost,
|
||||
server.masterport,
|
||||
(server.repl_state == REPL_STATE_CONNECTED) ?
|
||||
"up" : "down",
|
||||
server.master ?
|
||||
((int)(server.unixtime-server.master->lastinteraction)) : -1,
|
||||
server.repl_state == REPL_STATE_TRANSFER,
|
||||
slave_read_repl_offset,
|
||||
slave_repl_offset
|
||||
);
|
||||
>>>>>>> 6.2.6:src/server.c
|
||||
slave_read_repl_offset = mi->cached_master->read_reploff;
|
||||
}
|
||||
|
||||
char master_prefix[128] = "";
|
||||
if (cmasters != 0) {
|
||||
@ -5565,6 +5473,7 @@ sds genRedisInfoString(const char *section) {
|
||||
"master%s_link_status:%s\r\n"
|
||||
"master%s_last_io_seconds_ago:%d\r\n"
|
||||
"master%s_sync_in_progress:%d\r\n"
|
||||
"slave_read_repl_offset:%lld\r\n"
|
||||
"slave_repl_offset:%lld\r\n"
|
||||
,master_prefix, mi->masterhost,
|
||||
master_prefix, mi->masterport,
|
||||
@ -5573,6 +5482,7 @@ sds genRedisInfoString(const char *section) {
|
||||
master_prefix, mi->master ?
|
||||
((int)(g_pserver->unixtime-mi->master->lastinteraction)) : -1,
|
||||
master_prefix, mi->repl_state == REPL_STATE_TRANSFER,
|
||||
slave_read_repl_offset,
|
||||
slave_repl_offset
|
||||
);
|
||||
|
||||
|
40
src/server.h
40
src/server.h
@ -471,11 +471,7 @@ extern int configOOMScoreAdjValuesDefaults[CONFIG_OOM_COUNT];
|
||||
and AOF client */
|
||||
#define CLIENT_REPL_RDBONLY (1ULL<<42) /* This client is a replica that only wants
|
||||
RDB without replication buffer. */
|
||||
<<<<<<< HEAD
|
||||
#define CLIENT_PREVENT_LOGGING (1ULL<<43) /* Prevent logging of command to slowlog */
|
||||
#define CLIENT_FORCE_REPLY (1ULL<<44) /* Should addReply be forced to write the text? */
|
||||
=======
|
||||
>>>>>>> 6.2.6
|
||||
|
||||
/* Client block type (btype field in client structure)
|
||||
* if CLIENT_BLOCKED flag is set. */
|
||||
@ -1288,14 +1284,9 @@ struct sharedObjectsStruct {
|
||||
*emptyscan, *multi, *exec, *left, *right, *hset, *srem, *xgroup, *xclaim,
|
||||
*script, *replconf, *eval, *persist, *set, *pexpireat, *pexpire,
|
||||
*time, *pxat, *px, *retrycount, *force, *justid,
|
||||
<<<<<<< HEAD
|
||||
*lastid, *ping, *replping, *setid, *keepttl, *load, *createconsumer,
|
||||
*getack, *special_asterick, *special_equals, *default_username,
|
||||
*hdel, *zrem, *mvccrestore, *pexpirememberat,
|
||||
=======
|
||||
*lastid, *ping, *setid, *keepttl, *load, *createconsumer,
|
||||
*getack, *special_asterick, *special_equals, *default_username, *redacted,
|
||||
>>>>>>> 6.2.6
|
||||
*hdel, *zrem, *mvccrestore, *pexpirememberat, *redacted,
|
||||
*select[PROTO_SHARED_SELECT_CMDS],
|
||||
*integers[OBJ_SHARED_INTEGERS],
|
||||
*mbulkhdr[OBJ_SHARED_BULKHDR_LEN], /* "*<value>\r\n" */
|
||||
@ -2189,15 +2180,9 @@ extern "C" void getRandomHexChars(char *p, size_t len);
|
||||
extern "C" void getRandomBytes(unsigned char *p, size_t len);
|
||||
uint64_t crc64(uint64_t crc, const unsigned char *s, uint64_t l);
|
||||
void exitFromChild(int retcode);
|
||||
<<<<<<< HEAD
|
||||
size_t redisPopcount(const void *s, long count);
|
||||
long long redisPopcount(const void *s, long count);
|
||||
int redisSetProcTitle(const char *title);
|
||||
int validateProcTitleTemplate(const char *_template);
|
||||
=======
|
||||
long long redisPopcount(void *s, long count);
|
||||
int redisSetProcTitle(char *title);
|
||||
int validateProcTitleTemplate(const char *template);
|
||||
>>>>>>> 6.2.6
|
||||
int redisCommunicateSystemd(const char *sd_notify_msg);
|
||||
void redisSetCpuAffinity(const char *cpulist);
|
||||
|
||||
@ -2271,13 +2256,8 @@ void rewriteClientCommandArgument(client *c, int i, robj *newval);
|
||||
void replaceClientCommandVector(client *c, int argc, robj **argv);
|
||||
void redactClientCommandArgument(client *c, int argc);
|
||||
unsigned long getClientOutputBufferMemoryUsage(client *c);
|
||||
<<<<<<< HEAD
|
||||
int freeClientsInAsyncFreeQueue(int iel);
|
||||
void asyncCloseClientOnOutputBufferLimitReached(client *c);
|
||||
=======
|
||||
int freeClientsInAsyncFreeQueue(void);
|
||||
int closeClientOnOutputBufferLimitReached(client *c, int async);
|
||||
>>>>>>> 6.2.6
|
||||
int getClientType(client *c);
|
||||
int getClientTypeByName(const char *name);
|
||||
const char *getClientTypeName(int cclass);
|
||||
@ -2592,13 +2572,8 @@ unsigned char *zzlFirstInRange(unsigned char *zl, zrangespec *range);
|
||||
unsigned char *zzlLastInRange(unsigned char *zl, zrangespec *range);
|
||||
unsigned long zsetLength(robj_roptr zobj);
|
||||
void zsetConvert(robj *zobj, int encoding);
|
||||
<<<<<<< HEAD
|
||||
void zsetConvertToZiplistIfNeeded(robj *zobj, size_t maxelelen);
|
||||
int zsetScore(robj_roptr zobj, sds member, double *score);
|
||||
=======
|
||||
void zsetConvertToZiplistIfNeeded(robj *zobj, size_t maxelelen, size_t totelelen);
|
||||
int zsetScore(robj *zobj, sds member, double *score);
|
||||
>>>>>>> 6.2.6
|
||||
int zsetScore(robj_roptr zobj, sds member, double *score);
|
||||
unsigned long zslGetRank(zskiplist *zsl, double score, sds o);
|
||||
int zsetAdd(robj *zobj, double score, sds ele, int in_flags, int *out_flags, double *newscore);
|
||||
long zsetRank(robj_roptr zobj, sds ele, int reverse);
|
||||
@ -2745,16 +2720,12 @@ void initConfigValues();
|
||||
|
||||
/* db.c -- Keyspace access API */
|
||||
int removeExpire(redisDb *db, robj *key);
|
||||
<<<<<<< HEAD
|
||||
int removeExpireCore(redisDb *db, robj *key, dictEntry *de);
|
||||
int removeSubkeyExpire(redisDb *db, robj *key, robj *subkey);
|
||||
void propagateExpire(redisDb *db, robj *key, int lazy);
|
||||
void propagateSubkeyExpire(redisDb *db, int type, robj *key, robj *subkey);
|
||||
=======
|
||||
void deleteExpiredKeyAndPropagate(redisDb *db, robj *keyobj);
|
||||
void propagateExpire(redisDb *db, robj *key, int lazy);
|
||||
int keyIsExpired(redisDb *db, robj *key);
|
||||
>>>>>>> 6.2.6
|
||||
int expireIfNeeded(redisDb *db, robj *key);
|
||||
expireEntry *getExpire(redisDb *db, robj_roptr key);
|
||||
void setExpire(client *c, redisDb *db, robj *key, robj *subkey, long long when);
|
||||
@ -2766,14 +2737,9 @@ robj_roptr lookupKeyReadOrReply(client *c, robj *key, robj *reply);
|
||||
robj *lookupKeyWriteOrReply(client *c, robj *key, robj *reply);
|
||||
robj_roptr lookupKeyReadWithFlags(redisDb *db, robj *key, int flags);
|
||||
robj *lookupKeyWriteWithFlags(redisDb *db, robj *key, int flags);
|
||||
<<<<<<< HEAD
|
||||
robj_roptr objectCommandLookup(client *c, robj *key);
|
||||
robj_roptr objectCommandLookupOrReply(client *c, robj *key, robj *reply);
|
||||
=======
|
||||
robj *objectCommandLookup(client *c, robj *key);
|
||||
robj *objectCommandLookupOrReply(client *c, robj *key, robj *reply);
|
||||
void SentReplyOnKeyMiss(client *c, robj *reply);
|
||||
>>>>>>> 6.2.6
|
||||
int objectSetLRUOrLFU(robj *val, long long lfu_freq, long long lru_idle,
|
||||
long long lru_clock, int lru_multiplier);
|
||||
#define LOOKUP_NONE 0
|
||||
|
@ -44,22 +44,16 @@ void hashTypeTryConversion(robj *o, robj **argv, int start, int end) {
|
||||
if (o->encoding != OBJ_ENCODING_ZIPLIST) return;
|
||||
|
||||
for (i = start; i <= end; i++) {
|
||||
<<<<<<< HEAD:src/t_hash.cpp
|
||||
if (sdsEncodedObject(argv[i]) &&
|
||||
sdslen(szFromObj(argv[i])) > g_pserver->hash_max_ziplist_value)
|
||||
{
|
||||
=======
|
||||
if (!sdsEncodedObject(argv[i]))
|
||||
continue;
|
||||
size_t len = sdslen(argv[i]->ptr);
|
||||
if (len > server.hash_max_ziplist_value) {
|
||||
>>>>>>> 6.2.6:src/t_hash.c
|
||||
size_t len = sdslen(szFromObj(argv[i]));
|
||||
if (len > g_pserver->hash_max_ziplist_value) {
|
||||
hashTypeConvert(o, OBJ_ENCODING_HT);
|
||||
return;
|
||||
}
|
||||
sum += len;
|
||||
}
|
||||
if (!ziplistSafeToAdd(o->ptr, sum))
|
||||
if (!ziplistSafeToAdd((unsigned char *)ptrFromObj(o), sum))
|
||||
hashTypeConvert(o, OBJ_ENCODING_HT);
|
||||
}
|
||||
|
||||
@ -1026,13 +1020,8 @@ void hrandfieldWithCountCommand(client *c, long l, int withvalues) {
|
||||
int uniq = 1;
|
||||
robj_roptr hash;
|
||||
|
||||
<<<<<<< HEAD:src/t_hash.cpp
|
||||
if ((hash = lookupKeyReadOrReply(c,c->argv[1],shared.null[c->resp]))
|
||||
== nullptr || checkType(c,hash,OBJ_HASH)) return;
|
||||
=======
|
||||
if ((hash = lookupKeyReadOrReply(c,c->argv[1],shared.emptyarray))
|
||||
== NULL || checkType(c,hash,OBJ_HASH)) return;
|
||||
>>>>>>> 6.2.6:src/t_hash.c
|
||||
== nullptr || checkType(c,hash,OBJ_HASH)) return;
|
||||
size = hashTypeLength(hash);
|
||||
|
||||
if(l >= 0) {
|
||||
|
@ -227,7 +227,7 @@ void pushGenericCommand(client *c, int where, int xx) {
|
||||
int j;
|
||||
|
||||
for (j = 2; j < c->argc; j++) {
|
||||
if (sdslen(c->argv[j]->ptr) > LIST_MAX_ITEM_SIZE) {
|
||||
if (sdslen(szFromObj(c->argv[j])) > LIST_MAX_ITEM_SIZE) {
|
||||
addReplyError(c, "Element too large");
|
||||
return;
|
||||
}
|
||||
@ -296,7 +296,7 @@ void linsertCommand(client *c) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (sdslen(c->argv[4]->ptr) > LIST_MAX_ITEM_SIZE) {
|
||||
if (sdslen(szFromObj(c->argv[4])) > LIST_MAX_ITEM_SIZE) {
|
||||
addReplyError(c, "Element too large");
|
||||
return;
|
||||
}
|
||||
@ -368,7 +368,7 @@ void lsetCommand(client *c) {
|
||||
long index;
|
||||
robj *value = c->argv[3];
|
||||
|
||||
if (sdslen(value->ptr) > LIST_MAX_ITEM_SIZE) {
|
||||
if (sdslen(szFromObj(value)) > LIST_MAX_ITEM_SIZE) {
|
||||
addReplyError(c, "Element too large");
|
||||
return;
|
||||
}
|
||||
@ -595,7 +595,7 @@ void lposCommand(client *c) {
|
||||
int direction = LIST_TAIL;
|
||||
long rank = 1, count = -1, maxlen = 0; /* Count -1: option not given. */
|
||||
|
||||
if (sdslen(ele->ptr) > LIST_MAX_ITEM_SIZE) {
|
||||
if (sdslen(szFromObj(ele)) > LIST_MAX_ITEM_SIZE) {
|
||||
addReplyError(c, "Element too large");
|
||||
return;
|
||||
}
|
||||
@ -695,7 +695,7 @@ void lremCommand(client *c) {
|
||||
long toremove;
|
||||
long removed = 0;
|
||||
|
||||
if (sdslen(obj->ptr) > LIST_MAX_ITEM_SIZE) {
|
||||
if (sdslen(szFromObj(obj)) > LIST_MAX_ITEM_SIZE) {
|
||||
addReplyError(c, "Element too large");
|
||||
return;
|
||||
}
|
||||
|
@ -66,14 +66,10 @@ int setTypeAdd(robj *subject, const char *value) {
|
||||
if (success) {
|
||||
/* Convert to regular set when the intset contains
|
||||
* too many entries. */
|
||||
<<<<<<< HEAD:src/t_set.cpp
|
||||
if (intsetLen((intset*)subject->m_ptr) > g_pserver->set_max_intset_entries)
|
||||
=======
|
||||
size_t max_entries = server.set_max_intset_entries;
|
||||
size_t max_entries = g_pserver->set_max_intset_entries;
|
||||
/* limit to 1G entries due to intset internals. */
|
||||
if (max_entries >= 1<<30) max_entries = 1<<30;
|
||||
if (intsetLen(subject->ptr) > max_entries)
|
||||
>>>>>>> 6.2.6:src/t_set.c
|
||||
if (intsetLen((intset*)subject->m_ptr) > max_entries)
|
||||
setTypeConvert(subject,OBJ_ENCODING_HT);
|
||||
return 1;
|
||||
}
|
||||
@ -404,21 +400,12 @@ void smoveCommand(client *c) {
|
||||
}
|
||||
|
||||
signalModifiedKey(c,c->db,c->argv[1]);
|
||||
<<<<<<< HEAD:src/t_set.cpp
|
||||
signalModifiedKey(c,c->db,c->argv[2]);
|
||||
g_pserver->dirty++;
|
||||
|
||||
/* An extra key has changed when ele was successfully added to dstset */
|
||||
if (setTypeAdd(dstset,szFromObj(ele))) {
|
||||
g_pserver->dirty++;
|
||||
=======
|
||||
server.dirty++;
|
||||
|
||||
/* An extra key has changed when ele was successfully added to dstset */
|
||||
if (setTypeAdd(dstset,ele->ptr)) {
|
||||
server.dirty++;
|
||||
signalModifiedKey(c,c->db,c->argv[2]);
|
||||
>>>>>>> 6.2.6:src/t_set.c
|
||||
notifyKeyspaceEvent(NOTIFY_SET,"sadd",c->argv[2],c->db->id);
|
||||
}
|
||||
addReply(c,shared.cone);
|
||||
@ -886,24 +873,10 @@ void sinterGenericCommand(client *c, robj **setkeys,
|
||||
lookupKeyWrite(c->db,setkeys[j]) :
|
||||
lookupKeyRead(c->db,setkeys[j]).unsafe_robjcast();
|
||||
if (!setobj) {
|
||||
<<<<<<< HEAD:src/t_set.cpp
|
||||
zfree(sets);
|
||||
if (dstkey) {
|
||||
if (dbDelete(c->db,dstkey)) {
|
||||
signalModifiedKey(c,c->db,dstkey);
|
||||
g_pserver->dirty++;
|
||||
}
|
||||
addReply(c,shared.czero);
|
||||
} else {
|
||||
addReply(c,shared.emptyset[c->resp]);
|
||||
}
|
||||
return;
|
||||
=======
|
||||
/* A NULL is considered an empty set */
|
||||
empty += 1;
|
||||
sets[j] = NULL;
|
||||
continue;
|
||||
>>>>>>> 6.2.6:src/t_set.c
|
||||
}
|
||||
if (checkType(c,setobj,OBJ_SET)) {
|
||||
zfree(sets);
|
||||
@ -920,7 +893,7 @@ void sinterGenericCommand(client *c, robj **setkeys,
|
||||
if (dbDelete(c->db,dstkey)) {
|
||||
signalModifiedKey(c,c->db,dstkey);
|
||||
notifyKeyspaceEvent(NOTIFY_GENERIC,"del",dstkey,c->db->id);
|
||||
server.dirty++;
|
||||
g_pserver->dirty++;
|
||||
}
|
||||
addReply(c,shared.czero);
|
||||
} else {
|
||||
|
@ -468,7 +468,7 @@ int streamAppendItem(stream *s, robj **argv, int64_t numfields, streamID *added_
|
||||
* can't be bigger than 32bit length. */
|
||||
size_t totelelen = 0;
|
||||
for (int64_t i = 0; i < numfields*2; i++) {
|
||||
sds ele = argv[i]->ptr;
|
||||
sds ele = szFromObj(argv[i]);
|
||||
totelelen += sdslen(ele);
|
||||
}
|
||||
if (totelelen > STREAM_LISTPACK_MAX_SIZE) {
|
||||
@ -533,16 +533,10 @@ int streamAppendItem(stream *s, robj **argv, int64_t numfields, streamID *added_
|
||||
* if we need to switch to the next one. 'lp' will be set to NULL if
|
||||
* the current node is full. */
|
||||
if (lp != NULL) {
|
||||
<<<<<<< HEAD:src/t_stream.cpp
|
||||
if (g_pserver->stream_node_max_bytes &&
|
||||
lp_bytes >= g_pserver->stream_node_max_bytes)
|
||||
{
|
||||
=======
|
||||
size_t node_max_bytes = server.stream_node_max_bytes;
|
||||
size_t node_max_bytes = g_pserver->stream_node_max_bytes;
|
||||
if (node_max_bytes == 0 || node_max_bytes > STREAM_LISTPACK_MAX_SIZE)
|
||||
node_max_bytes = STREAM_LISTPACK_MAX_SIZE;
|
||||
if (lp_bytes + totelelen >= node_max_bytes) {
|
||||
>>>>>>> 6.2.6:src/t_stream.c
|
||||
lp = NULL;
|
||||
} else if (g_pserver->stream_node_max_entries) {
|
||||
unsigned char *lp_ele = lpFirst(lp);
|
||||
|
@ -800,17 +800,14 @@ void stralgoLCS(client *c) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
<<<<<<< HEAD:src/t_string.cpp
|
||||
{ // Scope variables below for the goto
|
||||
|
||||
=======
|
||||
/* Detect string truncation or later overflows. */
|
||||
if (sdslen(a) >= UINT32_MAX-1 || sdslen(b) >= UINT32_MAX-1) {
|
||||
addReplyError(c, "String too long for LCS");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
>>>>>>> 6.2.6:src/t_string.c
|
||||
/* Compute the LCS using the vanilla dynamic programming technique of
|
||||
* building a table of LCS(x,y) substrings. */
|
||||
uint32_t alen = sdslen(a);
|
||||
@ -819,10 +816,6 @@ void stralgoLCS(client *c) {
|
||||
/* Setup an uint32_t array to store at LCS[i,j] the length of the
|
||||
* LCS A0..i-1, B0..j-1. Note that we have a linear array here, so
|
||||
* we index it as LCS[j+(blen+1)*j] */
|
||||
<<<<<<< HEAD:src/t_string.cpp
|
||||
uint32_t *lcs = (uint32_t*)zmalloc((size_t)(alen+1)*(blen+1)*sizeof(uint32_t));
|
||||
=======
|
||||
>>>>>>> 6.2.6:src/t_string.c
|
||||
#define LCS(A,B) lcs[(B)+((A)*(blen+1))]
|
||||
|
||||
/* Try to allocate the LCS table, and abort on overflow or insufficient memory. */
|
||||
@ -830,7 +823,7 @@ void stralgoLCS(client *c) {
|
||||
unsigned long long lcsalloc = lcssize * sizeof(uint32_t);
|
||||
uint32_t *lcs = NULL;
|
||||
if (lcsalloc < SIZE_MAX && lcsalloc / lcssize == sizeof(uint32_t))
|
||||
lcs = ztrymalloc(lcsalloc);
|
||||
lcs = (uint32_t *)ztrymalloc(lcsalloc);
|
||||
if (!lcs) {
|
||||
addReplyError(c, "Insufficient memory");
|
||||
goto cleanup;
|
||||
|
@ -1248,18 +1248,10 @@ void zsetConvertToZiplistIfNeeded(robj *zobj, size_t maxelelen, size_t totelelen
|
||||
if (zobj->encoding == OBJ_ENCODING_ZIPLIST) return;
|
||||
zset *set = (zset*)zobj->m_ptr;
|
||||
|
||||
<<<<<<< HEAD:src/t_zset.cpp
|
||||
if (set->zsl->length <= g_pserver->zset_max_ziplist_entries &&
|
||||
maxelelen <= g_pserver->zset_max_ziplist_value)
|
||||
zsetConvert(zobj,OBJ_ENCODING_ZIPLIST);
|
||||
=======
|
||||
if (zset->zsl->length <= server.zset_max_ziplist_entries &&
|
||||
maxelelen <= server.zset_max_ziplist_value &&
|
||||
maxelelen <= g_pserver->zset_max_ziplist_value &&
|
||||
ziplistSafeToAdd(NULL, totelelen))
|
||||
{
|
||||
zsetConvert(zobj,OBJ_ENCODING_ZIPLIST);
|
||||
}
|
||||
>>>>>>> 6.2.6:src/t_zset.c
|
||||
zsetConvert(zobj,OBJ_ENCODING_ZIPLIST);
|
||||
}
|
||||
|
||||
/* Return (by reference) the score of the specified member of the sorted set
|
||||
@ -1381,19 +1373,13 @@ int zsetAdd(robj *zobj, double score, sds ele, int in_flags, int *out_flags, dou
|
||||
} else if (!xx) {
|
||||
/* check if the element is too large or the list
|
||||
* becomes too long *before* executing zzlInsert. */
|
||||
<<<<<<< HEAD:src/t_zset.cpp
|
||||
zobj->m_ptr = zzlInsert((unsigned char*)zobj->m_ptr,ele,score);
|
||||
if (zzlLength((unsigned char*)zobj->m_ptr) > g_pserver->zset_max_ziplist_entries ||
|
||||
sdslen(ele) > g_pserver->zset_max_ziplist_value)
|
||||
=======
|
||||
if (zzlLength(zobj->ptr)+1 > server.zset_max_ziplist_entries ||
|
||||
sdslen(ele) > server.zset_max_ziplist_value ||
|
||||
!ziplistSafeToAdd(zobj->ptr, sdslen(ele)))
|
||||
if (zzlLength((unsigned char*)ptrFromObj(zobj))+1 > g_pserver->zset_max_ziplist_entries ||
|
||||
sdslen(ele) > g_pserver->zset_max_ziplist_value ||
|
||||
!ziplistSafeToAdd((unsigned char *)ptrFromObj(zobj), sdslen(ele)))
|
||||
{
|
||||
>>>>>>> 6.2.6:src/t_zset.c
|
||||
zsetConvert(zobj,OBJ_ENCODING_SKIPLIST);
|
||||
} else {
|
||||
zobj->ptr = zzlInsert(zobj->ptr,ele,score);
|
||||
zobj->m_ptr = zzlInsert((unsigned char *)ptrFromObj(zobj),ele,score);
|
||||
if (newscore) *newscore = score;
|
||||
*out_flags |= ZADD_OUT_ADDED;
|
||||
return 1;
|
||||
@ -1402,17 +1388,12 @@ int zsetAdd(robj *zobj, double score, sds ele, int in_flags, int *out_flags, dou
|
||||
*out_flags |= ZADD_OUT_NOP;
|
||||
return 1;
|
||||
}
|
||||
<<<<<<< HEAD:src/t_zset.cpp
|
||||
} else if (zobj->encoding == OBJ_ENCODING_SKIPLIST) {
|
||||
zset *zs = (zset*)zobj->m_ptr;
|
||||
=======
|
||||
}
|
||||
|
||||
/* Note that the above block handling ziplist would have either returned or
|
||||
* converted the key to skiplist. */
|
||||
if (zobj->encoding == OBJ_ENCODING_SKIPLIST) {
|
||||
zset *zs = zobj->ptr;
|
||||
>>>>>>> 6.2.6:src/t_zset.c
|
||||
zset *zs = (zset*)zobj->m_ptr;
|
||||
zskiplistNode *znode;
|
||||
dictEntry *de;
|
||||
|
||||
@ -3694,18 +3675,13 @@ void zrangeGenericCommand(zrange_result_handler *handler, int argc_start, int st
|
||||
zobj = handler->dstkey ?
|
||||
lookupKeyWrite(c->db,key) :
|
||||
lookupKeyRead(c->db,key);
|
||||
<<<<<<< HEAD:src/t_zset.cpp
|
||||
if (zobj == nullptr) {
|
||||
addReply(c,shared.emptyarray);
|
||||
=======
|
||||
if (zobj == NULL) {
|
||||
if (store) {
|
||||
handler->beginResultEmission(handler);
|
||||
handler->finalizeResultEmission(handler, 0);
|
||||
} else {
|
||||
addReply(c, shared.emptyarray);
|
||||
}
|
||||
>>>>>>> 6.2.6:src/t_zset.c
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -3913,13 +3889,8 @@ void genericZpopCommand(client *c, robj **keyv, int keyc, int where, int emitkey
|
||||
serverAssertWithInfo(c,zobj,zsetDel(zobj,ele));
|
||||
g_pserver->dirty++;
|
||||
|
||||
<<<<<<< HEAD:src/t_zset.cpp
|
||||
if (arraylen == 0) { /* Do this only for the first iteration. */
|
||||
const char *events[2] = {"zpopmin","zpopmax"};
|
||||
=======
|
||||
if (result_count == 0) { /* Do this only for the first iteration. */
|
||||
char *events[2] = {"zpopmin","zpopmax"};
|
||||
>>>>>>> 6.2.6:src/t_zset.c
|
||||
const char *events[2] = {"zpopmin","zpopmax"};
|
||||
notifyKeyspaceEvent(NOTIFY_ZSET,events[where],key,c->db->id);
|
||||
signalModifiedKey(c,c->db,key);
|
||||
}
|
||||
@ -4044,13 +4015,8 @@ void zrandmemberWithCountCommand(client *c, long l, int withscores) {
|
||||
int uniq = 1;
|
||||
robj_roptr zsetobj;
|
||||
|
||||
<<<<<<< HEAD:src/t_zset.cpp
|
||||
if ((zsetobj = lookupKeyReadOrReply(c, c->argv[1], shared.null[c->resp]))
|
||||
== nullptr || checkType(c, zsetobj, OBJ_ZSET)) return;
|
||||
=======
|
||||
if ((zsetobj = lookupKeyReadOrReply(c, c->argv[1], shared.emptyarray))
|
||||
== NULL || checkType(c, zsetobj, OBJ_ZSET)) return;
|
||||
>>>>>>> 6.2.6:src/t_zset.c
|
||||
== nullptr || checkType(c, zsetobj, OBJ_ZSET)) return;
|
||||
size = zsetLength(zsetobj);
|
||||
|
||||
if(l >= 0) {
|
||||
|
@ -1,9 +1,4 @@
|
||||
<<<<<<< HEAD
|
||||
#define KEYDB_REAL_VERSION "255.255.255"
|
||||
#define KEYDB_VERSION_NUM 0x00ffffff
|
||||
extern const char *KEYDB_SET_VERSION; // Unlike real version, this can be overriden by the config
|
||||
|
||||
=======
|
||||
#define REDIS_VERSION "6.2.6"
|
||||
#define REDIS_VERSION_NUM 0x00060206
|
||||
>>>>>>> 6.2.6
|
||||
|
@ -720,14 +720,9 @@ unsigned char *ziplistNew(void) {
|
||||
}
|
||||
|
||||
/* Resize the ziplist. */
|
||||
<<<<<<< HEAD
|
||||
unsigned char *ziplistResize(unsigned char *zl, unsigned int len) {
|
||||
zl = zrealloc(zl,len, MALLOC_SHARED);
|
||||
=======
|
||||
unsigned char *ziplistResize(unsigned char *zl, size_t len) {
|
||||
assert(len < UINT32_MAX);
|
||||
zl = zrealloc(zl,len);
|
||||
>>>>>>> 6.2.6
|
||||
zl = zrealloc(zl,len, MALLOC_SHARED);
|
||||
ZIPLIST_BYTES(zl) = intrev32ifbe(len);
|
||||
zl[len-1] = ZIP_END;
|
||||
return zl;
|
||||
|
Loading…
x
Reference in New Issue
Block a user