Sentinel: INFO-CACHE comments reworked a bit.

Changed in order to make them more review friendly, based on the
experience of reviewing the code myself.
This commit is contained in:
antirez 2014-12-10 11:15:13 +01:00
parent c83a917286
commit d8158771b5

View File

@ -2786,14 +2786,10 @@ void sentinelCommand(redisClient *c) {
sentinelSetCommand(c); sentinelSetCommand(c);
} else if (!strcasecmp(c->argv[1]->ptr,"info-cache")) { } else if (!strcasecmp(c->argv[1]->ptr,"info-cache")) {
if (c->argc < 2) goto numargserr; if (c->argc < 2) goto numargserr;
/* Reply format:
* 1.) master name /* Create an ad-hoc dictionary type so that we can iterate
* 2.) 1.) info from master * a dictionary composed of just the master groups the user
* 2.) info from replica * requested. */
* ...
* 3.) other master name
* ...
*/
dictType copy_keeper = instancesDictType; dictType copy_keeper = instancesDictType;
copy_keeper.valDestructor = NULL; copy_keeper.valDestructor = NULL;
dict *masters_local = sentinel.masters; dict *masters_local = sentinel.masters;
@ -2808,8 +2804,14 @@ void sentinelCommand(redisClient *c) {
} }
} }
/* Now we can iterate over individually requested masters the /* Reply format:
* same way we iterate over the entire sentinel->masters dict. */ * 1.) master name
* 2.) 1.) info from master
* 2.) info from replica
* ...
* 3.) other master name
* ...
*/
addReplyMultiBulkLen(c,dictSize(masters_local) * 2); addReplyMultiBulkLen(c,dictSize(masters_local) * 2);
dictIterator *di; dictIterator *di;