Helper function for sentinelGetLeader, increment the counter * relative to the specified runid. */
| 4422 | /* Helper function for sentinelGetLeader, increment the counter |
| 4423 | * relative to the specified runid. */ |
| 4424 | int sentinelLeaderIncr(dict *counters, char *runid) { |
| 4425 | dictEntry *existing, *de; |
| 4426 | uint64_t oldval; |
| 4427 | |
| 4428 | de = dictAddRaw(counters,runid,&existing); |
| 4429 | if (existing) { |
| 4430 | oldval = dictGetUnsignedIntegerVal(existing); |
| 4431 | dictSetUnsignedIntegerVal(existing,oldval+1); |
| 4432 | return oldval+1; |
| 4433 | } else { |
| 4434 | serverAssert(de != NULL); |
| 4435 | dictSetUnsignedIntegerVal(de,1); |
| 4436 | return 1; |
| 4437 | } |
| 4438 | } |
| 4439 | |
| 4440 | /* Scan all the Sentinels attached to this master to check if there |
| 4441 | * is a leader for the specified epoch. |
no test coverage detected