Cluster tests shouldn't crash (note: still not passing either)
Former-commit-id: e63b2880b050d64849daf17d81cd0d4cabf2277a
This commit is contained in:
parent
c53b8125df
commit
5edc61dfd5
@ -79,7 +79,9 @@ void moduleCallClusterReceivers(const char *sender_id, uint64_t module_id, uint8
|
||||
|
||||
struct redisMaster *getFirstMaster()
|
||||
{
|
||||
serverAssert(listLength(server.masters) == 1);
|
||||
serverAssert(listLength(server.masters) <= 1);
|
||||
if (!listLength(server.masters))
|
||||
return NULL;
|
||||
return listFirst(server.masters)->value;
|
||||
}
|
||||
|
||||
@ -3578,7 +3580,9 @@ void clusterCron(void) {
|
||||
myself->slaveof &&
|
||||
nodeHasAddr(myself->slaveof))
|
||||
{
|
||||
replicationUnsetMaster(getFirstMaster());
|
||||
struct redisMaster *mi = getFirstMaster();
|
||||
if (mi != NULL)
|
||||
replicationUnsetMaster(mi);
|
||||
replicationAddMaster(myself->slaveof->ip, myself->slaveof->port);
|
||||
}
|
||||
|
||||
|
@ -2796,7 +2796,7 @@ void processClientsWaitingReplicas(void) {
|
||||
long long replicationGetSlaveOffset(redisMaster *mi) {
|
||||
long long offset = 0;
|
||||
|
||||
if (mi->masterhost != NULL) {
|
||||
if (mi != NULL && mi->masterhost != NULL) {
|
||||
if (mi->master) {
|
||||
offset = mi->master->reploff;
|
||||
} else if (mi->cached_master) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user