Skip to content

Commit

Permalink
One more Sentinel deadlock fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
attipaci committed Jan 12, 2025
1 parent 01fe5e7 commit aa275e7
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/redisx-sentinel.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,10 @@ int rConfirmMasterRoleAsync(Redis *redis) {
prop_error(fn, status);

if(redisxCheckDestroyRESP(reply, RESP_ARRAY, 0) != X_SUCCESS) {
// Fallback to using INFO replication...
XLookupTable *info;
const XField *role;

// Fallback to using INFO replication...
status = redisxSendRequestAsync(redis->interactive, "INFO", "replication", NULL, NULL);
prop_error(fn, status);

Expand Down Expand Up @@ -174,16 +174,14 @@ int rConfirmMasterRoleAsync(Redis *redis) {

redisxDestroyRESP(reply);

if(status) return x_error(X_FAILURE, EAGAIN, fn, "server is a replica, not the master");

// Make sure the current master is included at the top of the sentinels server list
if(rConfigLock(redis) == X_SUCCESS) {
if(status == X_SUCCESS) {
RedisPrivate *p = (RedisPrivate *) redis->priv;
xvprintf("Redis-X> Confirmed master at %s:%d.\n", p->hostname, p->port);
if(p->sentinel) rIncludeMasterAsync(p->sentinel, p->hostname, p->port);
return X_SUCCESS;
}

return X_SUCCESS;
return x_error(X_FAILURE, EAGAIN, fn, "server is a replica, not the master");
}

/**
Expand Down

0 comments on commit aa275e7

Please sign in to comment.