Skip to content

Commit

Permalink
release 0.9.5
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnSully committed May 10, 2019
2 parents 7153128 + 272d929 commit 240d688
Show file tree
Hide file tree
Showing 48 changed files with 3,319 additions and 3,121 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ All other configuration options behave as you'd expect. Your existing configura
Building KeyDB
--------------

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.
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.

Install dependencies:

Expand Down
2 changes: 1 addition & 1 deletion src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ NODEPS:=clean distclean

# Default settings
STD=-std=c99 -pedantic -DREDIS_STATIC=''
CXX_STD=-std=c++14 -pedantic -fno-rtti -fno-exceptions
CXX_STD=-std=c++14 -pedantic -fno-rtti -fno-exceptions -D__STDC_FORMAT_MACROS
ifneq (,$(findstring clang,$(CC)))
ifneq (,$(findstring FreeBSD,$(uname_S)))
STD+=-Wno-c11-extensions
Expand Down
30 changes: 15 additions & 15 deletions src/acl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ void ACLFreeUser(user *u) {
void ACLFreeUserAndKillClients(user *u) {
listIter li;
listNode *ln;
listRewind(server.clients,&li);
listRewind(g_pserver->clients,&li);
while ((ln = listNext(&li)) != NULL) {
client *c = (client*)listNodeValue(ln);
if (c->puser == u) {
Expand Down Expand Up @@ -334,7 +334,7 @@ void ACLSetUserCommandBit(user *u, unsigned long id, int value) {
int ACLSetUserCommandBitsForCategory(user *u, const char *category, int value) {
uint64_t cflag = ACLGetCommandCategoryFlagByName(category);
if (!cflag) return C_ERR;
dictIterator *di = dictGetIterator(server.orig_commands);
dictIterator *di = dictGetIterator(g_pserver->orig_commands);
dictEntry *de;
while ((de = dictNext(di)) != NULL) {
struct redisCommand *cmd = (redisCommand*)dictGetVal(de);
Expand All @@ -359,7 +359,7 @@ int ACLCountCategoryBitsForUser(user *u, unsigned long *on, unsigned long *off,
if (!cflag) return C_ERR;

*on = *off = 0;
dictIterator *di = dictGetIterator(server.orig_commands);
dictIterator *di = dictGetIterator(g_pserver->orig_commands);
dictEntry *de;
while ((de = dictNext(di)) != NULL) {
struct redisCommand *cmd = (redisCommand*)dictGetVal(de);
Expand Down Expand Up @@ -428,7 +428,7 @@ sds ACLDescribeUserCommandRules(user *u) {
}

/* Fix the final ACLs with single commands differences. */
dictIterator *di = dictGetIterator(server.orig_commands);
dictIterator *di = dictGetIterator(g_pserver->orig_commands);
dictEntry *de;
while ((de = dictNext(di)) != NULL) {
struct redisCommand *cmd = (redisCommand*)dictGetVal(de);
Expand Down Expand Up @@ -533,7 +533,7 @@ sds ACLDescribeUser(user *u) {
struct redisCommand *ACLLookupCommand(const char *name) {
struct redisCommand *cmd;
sds sdsname = sdsnew(name);
cmd = (redisCommand*)dictFetchValue(server.orig_commands, sdsname);
cmd = (redisCommand*)dictFetchValue(g_pserver->orig_commands, sdsname);
sdsfree(sdsname);
return cmd;
}
Expand Down Expand Up @@ -1194,7 +1194,7 @@ sds ACLLoadFromFile(const char *filename) {
if (argv == NULL) {
errors = sdscatprintf(errors,
"%s:%d: unbalanced quotes in acl line. ",
server.acl_filename, linenum);
g_pserver->acl_filename, linenum);
continue;
}

Expand All @@ -1208,7 +1208,7 @@ sds ACLLoadFromFile(const char *filename) {
if (strcmp(argv[0],"user") || argc < 2) {
errors = sdscatprintf(errors,
"%s:%d should start with user keyword followed "
"by the username. ", server.acl_filename,
"by the username. ", g_pserver->acl_filename,
linenum);
sdsfreesplitres(argv,argc);
continue;
Expand All @@ -1223,7 +1223,7 @@ sds ACLLoadFromFile(const char *filename) {
const char *errmsg = ACLSetUserStringError();
errors = sdscatprintf(errors,
"%s:%d: %s. ",
server.acl_filename, linenum, errmsg);
g_pserver->acl_filename, linenum, errmsg);
continue;
}
}
Expand Down Expand Up @@ -1349,7 +1349,7 @@ int ACLSaveToFile(const char *filename) {
* The function will just exit with an error if the user is trying to mix
* both the loading methods. */
void ACLLoadUsersAtStartup(void) {
if (server.acl_filename[0] != '\0' && listLength(UsersToLoad) != 0) {
if (g_pserver->acl_filename[0] != '\0' && listLength(UsersToLoad) != 0) {
serverLog(LL_WARNING,
"Configuring Redis with users defined in redis.conf and at "
"the same setting an ACL file path is invalid. This setup "
Expand All @@ -1365,8 +1365,8 @@ void ACLLoadUsersAtStartup(void) {
exit(1);
}

if (server.acl_filename[0] != '\0') {
sds errors = ACLLoadFromFile(server.acl_filename);
if (g_pserver->acl_filename[0] != '\0') {
sds errors = ACLLoadFromFile(g_pserver->acl_filename);
if (errors) {
serverLog(LL_WARNING,
"Aborting Redis startup because of ACL errors: %s", errors);
Expand Down Expand Up @@ -1526,21 +1526,21 @@ void aclCommand(client *c) {
} else {
addReplyNull(c);
}
} else if (server.acl_filename[0] == '\0' &&
} else if (g_pserver->acl_filename[0] == '\0' &&
(!strcasecmp(sub,"load") || !strcasecmp(sub,"save")))
{
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.");
return;
} else if (!strcasecmp(sub,"load") && c->argc == 2) {
sds errors = ACLLoadFromFile(server.acl_filename);
sds errors = ACLLoadFromFile(g_pserver->acl_filename);
if (errors == NULL) {
addReply(c,shared.ok);
} else {
addReplyError(c,errors);
sdsfree(errors);
}
} else if (!strcasecmp(sub,"save") && c->argc == 2) {
if (ACLSaveToFile(server.acl_filename) == C_OK) {
if (ACLSaveToFile(g_pserver->acl_filename) == C_OK) {
addReply(c,shared.ok);
} else {
addReplyError(c,"There was an error trying to save the ACLs. "
Expand All @@ -1561,7 +1561,7 @@ void aclCommand(client *c) {
}
int arraylen = 0;
void *dl = addReplyDeferredLen(c);
dictIterator *di = dictGetIterator(server.orig_commands);
dictIterator *di = dictGetIterator(g_pserver->orig_commands);
dictEntry *de;
while ((de = dictNext(di)) != NULL) {
struct redisCommand *cmd = (redisCommand*)dictGetVal(de);
Expand Down
8 changes: 3 additions & 5 deletions src/ae.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,8 @@

#include "ae.h"
#include "fastlock.h"
extern "C" {
#include "zmalloc.h"
#include "config.h"
}

#ifdef USE_MUTEX
thread_local int cOwnLock = 0;
Expand Down Expand Up @@ -209,7 +207,7 @@ int aeCreateRemoteFileEvent(aeEventLoop *eventLoop, int fd, int mask,
cmd.clientData = clientData;
cmd.pctl = nullptr;
if (fSynchronous)
cmd.pctl = new aeCommandControl();
cmd.pctl = new (MALLOC_LOCAL) aeCommandControl();

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

aeCommand cmd;
cmd.op = AE_ASYNC_OP::PostCppFunction;
cmd.pfn = new std::function<void()>(fn);
cmd.pfn = new (MALLOC_LOCAL) std::function<void()>(fn);
cmd.pctl = nullptr;
if (fSynchronous)
cmd.pctl = new aeCommandControl();
cmd.pctl = new (MALLOC_LOCAL) aeCommandControl();
std::unique_lock<std::mutex> ulock(cmd.pctl->mutexcv, std::defer_lock);
if (fSynchronous)
cmd.pctl->mutexcv.lock();
Expand Down
Loading

0 comments on commit 240d688

Please sign in to comment.