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

Function rewriteConfigSlaveofOption

src/config.cpp:1696–1717  ·  view source on GitHub ↗

Rewrite the slaveof option. */

Source from the content-addressed store, hash-verified

1694
1695/* Rewrite the slaveof option. */
1696void rewriteConfigSlaveofOption(struct rewriteConfigState *state, const char *option) {
1697 /* If this is a master, we want all the slaveof config options
1698 * in the file to be removed. Note that if this is a cluster instance
1699 * we don't want a slaveof directive inside keydb.conf. */
1700 if (g_pserver->cluster_enabled || listLength(g_pserver->masters) == 0) {
1701 rewriteConfigMarkAsProcessed(state,option);
1702 return;
1703 }
1704
1705 listIter li;
1706 listNode *ln;
1707 listRewind(g_pserver->masters, &li);
1708 while ((ln = listNext(&li)))
1709 {
1710 struct redisMaster *mi = (struct redisMaster*)listNodeValue(ln);
1711 sds line;
1712
1713 line = sdscatprintf(sdsempty(),"%s %s %d", option,
1714 mi->masterhost, mi->masterport);
1715 rewriteConfigRewriteLine(state,option,line,1);
1716 }
1717}
1718
1719/* Rewrite the notify-keyspace-events option. */
1720void rewriteConfigNotifykeyspaceeventsOption(struct rewriteConfigState *state) {

Callers 1

rewriteConfigFunction · 0.85

Calls 6

listRewindFunction · 0.85
listNextFunction · 0.85
sdscatprintfFunction · 0.85
sdsemptyFunction · 0.85
rewriteConfigRewriteLineFunction · 0.85

Tested by

no test coverage detected