MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / sentinelResetMastersByPattern

Function sentinelResetMastersByPattern

src/sentinel.cpp:1604–1622  ·  view source on GitHub ↗

Call sentinelResetMaster() on every master with a name matching the specified * pattern. */

Source from the content-addressed store, hash-verified

1602/* Call sentinelResetMaster() on every master with a name matching the specified
1603 * pattern. */
1604int sentinelResetMastersByPattern(char *pattern, int flags) {
1605 dictIterator *di;
1606 dictEntry *de;
1607 int reset = 0;
1608
1609 di = dictGetIterator(sentinel.masters);
1610 while((de = dictNext(di)) != NULL) {
1611 sentinelRedisInstance *ri = (sentinelRedisInstance*)dictGetVal(de);
1612
1613 if (ri->name) {
1614 if (stringmatch(pattern,ri->name,0)) {
1615 sentinelResetMaster(ri,flags);
1616 reset++;
1617 }
1618 }
1619 }
1620 dictReleaseIterator(di);
1621 return reset;
1622}
1623
1624/* Reset the specified master with sentinelResetMaster(), and also change
1625 * the ip:port address, but take the name of the instance unmodified.

Callers 1

sentinelCommandFunction · 0.85

Calls 5

stringmatchFunction · 0.85
sentinelResetMasterFunction · 0.85
dictGetIteratorFunction · 0.70
dictNextFunction · 0.70
dictReleaseIteratorFunction · 0.70

Tested by

no test coverage detected