diff --git a/src/module.cpp b/src/module.cpp index c66701a9a..60420686e 100644 --- a/src/module.cpp +++ b/src/module.cpp @@ -1775,15 +1775,15 @@ int modulePopulateReplicationInfoStructure(void *ri, int structver) { memset(ri1,0,sizeof(*ri1)); ri1->version = structver; ri1->master = listLength(g_pserver->masters) == 0; - if (ri1->master) + if (!ri1->master) { - redisMaster *mi = (redisMaster*)listFirst(g_pserver->masters); + redisMaster *mi = (redisMaster*)listNodeValue(listFirst(g_pserver->masters)); ri1->masterhost = (char*)(mi->masterhost? mi->masterhost: ""); ri1->masterport = mi->masterport; } else { - ri1->masterhost = nullptr; + ri1->masterhost = ""; ri1->masterport = -1; } ri1->repl1_offset = g_pserver->master_repl_offset; @@ -7765,8 +7765,12 @@ int RM_GetLFU(RedisModuleKey *key, long long *lfu_freq) { *lfu_freq = -1; if (!key->value) return REDISMODULE_ERR; + serverLog(LL_WARNING, "MAXMEMORY_POLICY: %X", g_pserver->maxmemory_policy); if (g_pserver->maxmemory_policy & MAXMEMORY_FLAG_LFU) + { *lfu_freq = LFUDecrAndReturn(key->value); + serverLog(LL_WARNING, "lfu_freq: %lld", lfu_freq); + } return REDISMODULE_OK; } diff --git a/src/redismodule.h b/src/redismodule.h index fcd12e66a..3f08df509 100644 --- a/src/redismodule.h +++ b/src/redismodule.h @@ -324,7 +324,7 @@ typedef struct RedisModuleReplicationInfo { from the module to the core right now. Here for future compatibility. */ int master; /* true if master, false if replica */ - char *masterhost; /* master instance hostname for NOW_REPLICA */ + const char *masterhost; /* master instance hostname for NOW_REPLICA */ int masterport; /* master instance port for NOW_REPLICA */ char *replid1; /* Main replication ID */ char *replid2; /* Secondary replication ID */