Skip to content

Commit

Permalink
Merge branch 'unstable' into wip-multimaster
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnSully committed Apr 3, 2019
2 parents e63b288 + 161d3a3 commit 4326d22
Show file tree
Hide file tree
Showing 16 changed files with 582 additions and 21 deletions.
2 changes: 2 additions & 0 deletions README.md
Expand Up @@ -14,6 +14,8 @@ Try our docker container: https://hub.docker.com/r/eqalpha/keydb

Talk on Gitter: https://gitter.im/KeyDB

Management GUI: We recommend [FastoNoSQL](https://fastonosql.com/) which has official KeyDB support.

New: Active Replica Support
---------------------------

Expand Down
2 changes: 2 additions & 0 deletions src/Makefile
Expand Up @@ -230,6 +230,7 @@ persist-settings: distclean
echo REDIS_LDFLAGS=$(REDIS_LDFLAGS) >> .make-settings
echo PREV_FINAL_CFLAGS=$(FINAL_CFLAGS) >> .make-settings
echo PREV_FINAL_LDFLAGS=$(FINAL_LDFLAGS) >> .make-settings
-(cd modules && $(MAKE))
-(cd ../deps && $(MAKE) $(DEPENDENCY_TARGETS))

.PHONY: persist-settings
Expand Down Expand Up @@ -291,6 +292,7 @@ clean:

distclean: clean
-(cd ../deps && $(MAKE) distclean)
-(cd modules && $(MAKE) clean)
-(rm -f .make-*)

.PHONY: distclean
Expand Down
7 changes: 6 additions & 1 deletion src/db.c
Expand Up @@ -83,6 +83,7 @@ robj *lookupKey(redisDb *db, robj *key, int flags) {
* 1. A key gets expired if it reached it's TTL.
* 2. The key last access time is updated.
* 3. The global keys hits/misses stats are updated (reported in INFO).
* 4. If keyspace notifications are enabled, a "keymiss" notification is fired.
*
* This API should not be used when we write to the key after obtaining
* the object linked to the key, but only for read only operations.
Expand All @@ -107,6 +108,7 @@ robj *lookupKeyReadWithFlags(redisDb *db, robj *key, int flags) {
* to return NULL ASAP. */
if (listLength(server.masters) == 0) {
server.stat_keyspace_misses++;
notifyKeyspaceEvent(NOTIFY_KEY_MISS, "keymiss", key, db->id);
return NULL;
}

Expand All @@ -128,12 +130,15 @@ robj *lookupKeyReadWithFlags(redisDb *db, robj *key, int flags) {
server.current_client->cmd->flags & CMD_READONLY)
{
server.stat_keyspace_misses++;
notifyKeyspaceEvent(NOTIFY_KEY_MISS, "keymiss", key, db->id);
return NULL;
}
}
val = lookupKey(db,key,flags);
if (val == NULL)
if (val == NULL) {
server.stat_keyspace_misses++;
notifyKeyspaceEvent(NOTIFY_KEY_MISS, "keymiss", key, db->id);
}
else
server.stat_keyspace_hits++;
return val;
Expand Down

0 comments on commit 4326d22

Please sign in to comment.