Skip to content

Commit 240d688

Browse files
committed
release 0.9.5
2 parents 7153128 + 272d929 commit 240d688

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+3319
-3121
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ All other configuration options behave as you'd expect. Your existing configura
6060
Building KeyDB
6161
--------------
6262

63-
KeyDB can be compiled and is tested for use on Linux. KeyDB currently relies on SO_REUSEADDR's load balancing behavior which is available only in Linux. When we support marshalling connections across threads we plan to support other operating systems such as FreeBSD.
63+
KeyDB can be compiled and is tested for use on Linux. KeyDB currently relies on SO_REUSEPORT's load balancing behavior which is available only in Linux. When we support marshalling connections across threads we plan to support other operating systems such as FreeBSD.
6464

6565
Install dependencies:
6666

src/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ NODEPS:=clean distclean
2121

2222
# Default settings
2323
STD=-std=c99 -pedantic -DREDIS_STATIC=''
24-
CXX_STD=-std=c++14 -pedantic -fno-rtti -fno-exceptions
24+
CXX_STD=-std=c++14 -pedantic -fno-rtti -fno-exceptions -D__STDC_FORMAT_MACROS
2525
ifneq (,$(findstring clang,$(CC)))
2626
ifneq (,$(findstring FreeBSD,$(uname_S)))
2727
STD+=-Wno-c11-extensions

src/acl.cpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ void ACLFreeUser(user *u) {
227227
void ACLFreeUserAndKillClients(user *u) {
228228
listIter li;
229229
listNode *ln;
230-
listRewind(server.clients,&li);
230+
listRewind(g_pserver->clients,&li);
231231
while ((ln = listNext(&li)) != NULL) {
232232
client *c = (client*)listNodeValue(ln);
233233
if (c->puser == u) {
@@ -334,7 +334,7 @@ void ACLSetUserCommandBit(user *u, unsigned long id, int value) {
334334
int ACLSetUserCommandBitsForCategory(user *u, const char *category, int value) {
335335
uint64_t cflag = ACLGetCommandCategoryFlagByName(category);
336336
if (!cflag) return C_ERR;
337-
dictIterator *di = dictGetIterator(server.orig_commands);
337+
dictIterator *di = dictGetIterator(g_pserver->orig_commands);
338338
dictEntry *de;
339339
while ((de = dictNext(di)) != NULL) {
340340
struct redisCommand *cmd = (redisCommand*)dictGetVal(de);
@@ -359,7 +359,7 @@ int ACLCountCategoryBitsForUser(user *u, unsigned long *on, unsigned long *off,
359359
if (!cflag) return C_ERR;
360360

361361
*on = *off = 0;
362-
dictIterator *di = dictGetIterator(server.orig_commands);
362+
dictIterator *di = dictGetIterator(g_pserver->orig_commands);
363363
dictEntry *de;
364364
while ((de = dictNext(di)) != NULL) {
365365
struct redisCommand *cmd = (redisCommand*)dictGetVal(de);
@@ -428,7 +428,7 @@ sds ACLDescribeUserCommandRules(user *u) {
428428
}
429429

430430
/* Fix the final ACLs with single commands differences. */
431-
dictIterator *di = dictGetIterator(server.orig_commands);
431+
dictIterator *di = dictGetIterator(g_pserver->orig_commands);
432432
dictEntry *de;
433433
while ((de = dictNext(di)) != NULL) {
434434
struct redisCommand *cmd = (redisCommand*)dictGetVal(de);
@@ -533,7 +533,7 @@ sds ACLDescribeUser(user *u) {
533533
struct redisCommand *ACLLookupCommand(const char *name) {
534534
struct redisCommand *cmd;
535535
sds sdsname = sdsnew(name);
536-
cmd = (redisCommand*)dictFetchValue(server.orig_commands, sdsname);
536+
cmd = (redisCommand*)dictFetchValue(g_pserver->orig_commands, sdsname);
537537
sdsfree(sdsname);
538538
return cmd;
539539
}
@@ -1194,7 +1194,7 @@ sds ACLLoadFromFile(const char *filename) {
11941194
if (argv == NULL) {
11951195
errors = sdscatprintf(errors,
11961196
"%s:%d: unbalanced quotes in acl line. ",
1197-
server.acl_filename, linenum);
1197+
g_pserver->acl_filename, linenum);
11981198
continue;
11991199
}
12001200

@@ -1208,7 +1208,7 @@ sds ACLLoadFromFile(const char *filename) {
12081208
if (strcmp(argv[0],"user") || argc < 2) {
12091209
errors = sdscatprintf(errors,
12101210
"%s:%d should start with user keyword followed "
1211-
"by the username. ", server.acl_filename,
1211+
"by the username. ", g_pserver->acl_filename,
12121212
linenum);
12131213
sdsfreesplitres(argv,argc);
12141214
continue;
@@ -1223,7 +1223,7 @@ sds ACLLoadFromFile(const char *filename) {
12231223
const char *errmsg = ACLSetUserStringError();
12241224
errors = sdscatprintf(errors,
12251225
"%s:%d: %s. ",
1226-
server.acl_filename, linenum, errmsg);
1226+
g_pserver->acl_filename, linenum, errmsg);
12271227
continue;
12281228
}
12291229
}
@@ -1349,7 +1349,7 @@ int ACLSaveToFile(const char *filename) {
13491349
* The function will just exit with an error if the user is trying to mix
13501350
* both the loading methods. */
13511351
void ACLLoadUsersAtStartup(void) {
1352-
if (server.acl_filename[0] != '\0' && listLength(UsersToLoad) != 0) {
1352+
if (g_pserver->acl_filename[0] != '\0' && listLength(UsersToLoad) != 0) {
13531353
serverLog(LL_WARNING,
13541354
"Configuring Redis with users defined in redis.conf and at "
13551355
"the same setting an ACL file path is invalid. This setup "
@@ -1365,8 +1365,8 @@ void ACLLoadUsersAtStartup(void) {
13651365
exit(1);
13661366
}
13671367

1368-
if (server.acl_filename[0] != '\0') {
1369-
sds errors = ACLLoadFromFile(server.acl_filename);
1368+
if (g_pserver->acl_filename[0] != '\0') {
1369+
sds errors = ACLLoadFromFile(g_pserver->acl_filename);
13701370
if (errors) {
13711371
serverLog(LL_WARNING,
13721372
"Aborting Redis startup because of ACL errors: %s", errors);
@@ -1526,21 +1526,21 @@ void aclCommand(client *c) {
15261526
} else {
15271527
addReplyNull(c);
15281528
}
1529-
} else if (server.acl_filename[0] == '\0' &&
1529+
} else if (g_pserver->acl_filename[0] == '\0' &&
15301530
(!strcasecmp(sub,"load") || !strcasecmp(sub,"save")))
15311531
{
15321532
addReplyError(c,"This Redis instance is not configured to use an ACL file. You may want to specify users via the ACL SETUSER command and then issue a CONFIG REWRITE (assuming you have a Redis configuration file set) in order to store users in the Redis configuration.");
15331533
return;
15341534
} else if (!strcasecmp(sub,"load") && c->argc == 2) {
1535-
sds errors = ACLLoadFromFile(server.acl_filename);
1535+
sds errors = ACLLoadFromFile(g_pserver->acl_filename);
15361536
if (errors == NULL) {
15371537
addReply(c,shared.ok);
15381538
} else {
15391539
addReplyError(c,errors);
15401540
sdsfree(errors);
15411541
}
15421542
} else if (!strcasecmp(sub,"save") && c->argc == 2) {
1543-
if (ACLSaveToFile(server.acl_filename) == C_OK) {
1543+
if (ACLSaveToFile(g_pserver->acl_filename) == C_OK) {
15441544
addReply(c,shared.ok);
15451545
} else {
15461546
addReplyError(c,"There was an error trying to save the ACLs. "
@@ -1561,7 +1561,7 @@ void aclCommand(client *c) {
15611561
}
15621562
int arraylen = 0;
15631563
void *dl = addReplyDeferredLen(c);
1564-
dictIterator *di = dictGetIterator(server.orig_commands);
1564+
dictIterator *di = dictGetIterator(g_pserver->orig_commands);
15651565
dictEntry *de;
15661566
while ((de = dictNext(di)) != NULL) {
15671567
struct redisCommand *cmd = (redisCommand*)dictGetVal(de);

src/ae.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,8 @@
4646

4747
#include "ae.h"
4848
#include "fastlock.h"
49-
extern "C" {
5049
#include "zmalloc.h"
5150
#include "config.h"
52-
}
5351

5452
#ifdef USE_MUTEX
5553
thread_local int cOwnLock = 0;
@@ -209,7 +207,7 @@ int aeCreateRemoteFileEvent(aeEventLoop *eventLoop, int fd, int mask,
209207
cmd.clientData = clientData;
210208
cmd.pctl = nullptr;
211209
if (fSynchronous)
212-
cmd.pctl = new aeCommandControl();
210+
cmd.pctl = new (MALLOC_LOCAL) aeCommandControl();
213211

214212
std::unique_lock<std::mutex> ulock(cmd.pctl->mutexcv, std::defer_lock);
215213
if (fSynchronous)
@@ -257,10 +255,10 @@ int aePostFunction(aeEventLoop *eventLoop, std::function<void()> fn, bool fSynch
257255

258256
aeCommand cmd;
259257
cmd.op = AE_ASYNC_OP::PostCppFunction;
260-
cmd.pfn = new std::function<void()>(fn);
258+
cmd.pfn = new (MALLOC_LOCAL) std::function<void()>(fn);
261259
cmd.pctl = nullptr;
262260
if (fSynchronous)
263-
cmd.pctl = new aeCommandControl();
261+
cmd.pctl = new (MALLOC_LOCAL) aeCommandControl();
264262
std::unique_lock<std::mutex> ulock(cmd.pctl->mutexcv, std::defer_lock);
265263
if (fSynchronous)
266264
cmd.pctl->mutexcv.lock();

0 commit comments

Comments
 (0)