diff --git a/src/commands.def b/src/commands.def
index 4559c0aefe..cd9f8e2984 100644
--- a/src/commands.def
+++ b/src/commands.def
@@ -5605,6 +5605,28 @@ struct COMMAND_ARG SENTINEL_GET_MASTER_ADDR_BY_NAME_Args[] = {
{MAKE_ARG("primary-name",ARG_TYPE_STRING,-1,NULL,NULL,NULL,CMD_ARG_NONE,0,NULL)},
};
+/********** SENTINEL GET_PRIMARY_ADDR_BY_NAME ********************/
+
+#ifndef SKIP_CMD_HISTORY_TABLE
+/* SENTINEL GET_PRIMARY_ADDR_BY_NAME history */
+#define SENTINEL_GET_PRIMARY_ADDR_BY_NAME_History NULL
+#endif
+
+#ifndef SKIP_CMD_TIPS_TABLE
+/* SENTINEL GET_PRIMARY_ADDR_BY_NAME tips */
+#define SENTINEL_GET_PRIMARY_ADDR_BY_NAME_Tips NULL
+#endif
+
+#ifndef SKIP_CMD_KEY_SPECS_TABLE
+/* SENTINEL GET_PRIMARY_ADDR_BY_NAME key specs */
+#define SENTINEL_GET_PRIMARY_ADDR_BY_NAME_Keyspecs NULL
+#endif
+
+/* SENTINEL GET_PRIMARY_ADDR_BY_NAME argument table */
+struct COMMAND_ARG SENTINEL_GET_PRIMARY_ADDR_BY_NAME_Args[] = {
+{MAKE_ARG("primary-name",ARG_TYPE_STRING,-1,NULL,NULL,NULL,CMD_ARG_NONE,0,NULL)},
+};
+
/********** SENTINEL HELP ********************/
#ifndef SKIP_CMD_HISTORY_TABLE
@@ -5669,6 +5691,31 @@ struct COMMAND_ARG SENTINEL_IS_MASTER_DOWN_BY_ADDR_Args[] = {
{MAKE_ARG("runid",ARG_TYPE_STRING,-1,NULL,NULL,NULL,CMD_ARG_NONE,0,NULL)},
};
+/********** SENTINEL IS_PRIMARY_DOWN_BY_ADDR ********************/
+
+#ifndef SKIP_CMD_HISTORY_TABLE
+/* SENTINEL IS_PRIMARY_DOWN_BY_ADDR history */
+#define SENTINEL_IS_PRIMARY_DOWN_BY_ADDR_History NULL
+#endif
+
+#ifndef SKIP_CMD_TIPS_TABLE
+/* SENTINEL IS_PRIMARY_DOWN_BY_ADDR tips */
+#define SENTINEL_IS_PRIMARY_DOWN_BY_ADDR_Tips NULL
+#endif
+
+#ifndef SKIP_CMD_KEY_SPECS_TABLE
+/* SENTINEL IS_PRIMARY_DOWN_BY_ADDR key specs */
+#define SENTINEL_IS_PRIMARY_DOWN_BY_ADDR_Keyspecs NULL
+#endif
+
+/* SENTINEL IS_PRIMARY_DOWN_BY_ADDR argument table */
+struct COMMAND_ARG SENTINEL_IS_PRIMARY_DOWN_BY_ADDR_Args[] = {
+{MAKE_ARG("ip",ARG_TYPE_STRING,-1,NULL,NULL,NULL,CMD_ARG_NONE,0,NULL)},
+{MAKE_ARG("port",ARG_TYPE_INTEGER,-1,NULL,NULL,NULL,CMD_ARG_NONE,0,NULL)},
+{MAKE_ARG("current-epoch",ARG_TYPE_INTEGER,-1,NULL,NULL,NULL,CMD_ARG_NONE,0,NULL)},
+{MAKE_ARG("runid",ARG_TYPE_STRING,-1,NULL,NULL,NULL,CMD_ARG_NONE,0,NULL)},
+};
+
/********** SENTINEL MASTER ********************/
#ifndef SKIP_CMD_HISTORY_TABLE
@@ -5767,6 +5814,45 @@ struct COMMAND_ARG SENTINEL_MONITOR_Args[] = {
#define SENTINEL_PENDING_SCRIPTS_Keyspecs NULL
#endif
+/********** SENTINEL PRIMARIES ********************/
+
+#ifndef SKIP_CMD_HISTORY_TABLE
+/* SENTINEL PRIMARIES history */
+#define SENTINEL_PRIMARIES_History NULL
+#endif
+
+#ifndef SKIP_CMD_TIPS_TABLE
+/* SENTINEL PRIMARIES tips */
+#define SENTINEL_PRIMARIES_Tips NULL
+#endif
+
+#ifndef SKIP_CMD_KEY_SPECS_TABLE
+/* SENTINEL PRIMARIES key specs */
+#define SENTINEL_PRIMARIES_Keyspecs NULL
+#endif
+
+/********** SENTINEL PRIMARY ********************/
+
+#ifndef SKIP_CMD_HISTORY_TABLE
+/* SENTINEL PRIMARY history */
+#define SENTINEL_PRIMARY_History NULL
+#endif
+
+#ifndef SKIP_CMD_TIPS_TABLE
+/* SENTINEL PRIMARY tips */
+#define SENTINEL_PRIMARY_Tips NULL
+#endif
+
+#ifndef SKIP_CMD_KEY_SPECS_TABLE
+/* SENTINEL PRIMARY key specs */
+#define SENTINEL_PRIMARY_Keyspecs NULL
+#endif
+
+/* SENTINEL PRIMARY argument table */
+struct COMMAND_ARG SENTINEL_PRIMARY_Args[] = {
+{MAKE_ARG("primary-name",ARG_TYPE_STRING,-1,NULL,NULL,NULL,CMD_ARG_NONE,0,NULL)},
+};
+
/********** SENTINEL REMOVE ********************/
#ifndef SKIP_CMD_HISTORY_TABLE
@@ -5942,15 +6028,19 @@ struct COMMAND_STRUCT SENTINEL_Subcommands[] = {
{MAKE_CMD("debug","Lists or updates the current configurable parameters of Sentinel.","O(N) where N is the number of configurable parameters","7.0.0",CMD_DOC_NONE,NULL,NULL,"sentinel",COMMAND_GROUP_SENTINEL,SENTINEL_DEBUG_History,0,SENTINEL_DEBUG_Tips,0,sentinelCommand,-2,CMD_ADMIN|CMD_SENTINEL|CMD_ONLY_SENTINEL,0,SENTINEL_DEBUG_Keyspecs,0,NULL,1),.args=SENTINEL_DEBUG_Args},
{MAKE_CMD("failover","Forces a Sentinel failover.",NULL,"2.8.4",CMD_DOC_NONE,NULL,NULL,"sentinel",COMMAND_GROUP_SENTINEL,SENTINEL_FAILOVER_History,0,SENTINEL_FAILOVER_Tips,0,sentinelCommand,3,CMD_ADMIN|CMD_SENTINEL|CMD_ONLY_SENTINEL,0,SENTINEL_FAILOVER_Keyspecs,0,NULL,1),.args=SENTINEL_FAILOVER_Args},
{MAKE_CMD("flushconfig","Rewrites the Sentinel configuration file.","O(1)","2.8.4",CMD_DOC_NONE,NULL,NULL,"sentinel",COMMAND_GROUP_SENTINEL,SENTINEL_FLUSHCONFIG_History,0,SENTINEL_FLUSHCONFIG_Tips,0,sentinelCommand,2,CMD_ADMIN|CMD_SENTINEL|CMD_ONLY_SENTINEL,0,SENTINEL_FLUSHCONFIG_Keyspecs,0,NULL,0)},
-{MAKE_CMD("get-master-addr-by-name","Returns the port and address of a primary instance.","O(1)","2.8.4",CMD_DOC_NONE,NULL,NULL,"sentinel",COMMAND_GROUP_SENTINEL,SENTINEL_GET_MASTER_ADDR_BY_NAME_History,0,SENTINEL_GET_MASTER_ADDR_BY_NAME_Tips,0,sentinelCommand,3,CMD_ADMIN|CMD_SENTINEL|CMD_ONLY_SENTINEL,0,SENTINEL_GET_MASTER_ADDR_BY_NAME_Keyspecs,0,NULL,1),.args=SENTINEL_GET_MASTER_ADDR_BY_NAME_Args},
+{MAKE_CMD("get-master-addr-by-name","Returns the port and address of a primary instance.","O(1)","2.8.4",CMD_DOC_DEPRECATED,"`SENTINEL GET-PRIMARY-ADDR-BY-NAME`","8.0.0","sentinel",COMMAND_GROUP_SENTINEL,SENTINEL_GET_MASTER_ADDR_BY_NAME_History,0,SENTINEL_GET_MASTER_ADDR_BY_NAME_Tips,0,sentinelCommand,3,CMD_ADMIN|CMD_SENTINEL|CMD_ONLY_SENTINEL,0,SENTINEL_GET_MASTER_ADDR_BY_NAME_Keyspecs,0,NULL,1),.args=SENTINEL_GET_MASTER_ADDR_BY_NAME_Args},
+{MAKE_CMD("get-primary-addr-by-name","Returns the port and address of a primary instance.","O(1)","8.0.0",CMD_DOC_NONE,NULL,NULL,"sentinel",COMMAND_GROUP_SENTINEL,SENTINEL_GET_PRIMARY_ADDR_BY_NAME_History,0,SENTINEL_GET_PRIMARY_ADDR_BY_NAME_Tips,0,sentinelCommand,3,CMD_ADMIN|CMD_SENTINEL|CMD_ONLY_SENTINEL,0,SENTINEL_GET_PRIMARY_ADDR_BY_NAME_Keyspecs,0,NULL,1),.args=SENTINEL_GET_PRIMARY_ADDR_BY_NAME_Args},
{MAKE_CMD("help","Returns helpful text about the different subcommands.","O(1)","6.2.0",CMD_DOC_NONE,NULL,NULL,"sentinel",COMMAND_GROUP_SENTINEL,SENTINEL_HELP_History,0,SENTINEL_HELP_Tips,0,sentinelCommand,2,CMD_LOADING|CMD_STALE|CMD_SENTINEL|CMD_ONLY_SENTINEL,0,SENTINEL_HELP_Keyspecs,0,NULL,0)},
{MAKE_CMD("info-cache","Returns the cached `INFO` replies from the deployment's instances.","O(N) where N is the number of instances","3.2.0",CMD_DOC_NONE,NULL,NULL,"sentinel",COMMAND_GROUP_SENTINEL,SENTINEL_INFO_CACHE_History,0,SENTINEL_INFO_CACHE_Tips,0,sentinelCommand,-3,CMD_ADMIN|CMD_SENTINEL|CMD_ONLY_SENTINEL,0,SENTINEL_INFO_CACHE_Keyspecs,0,NULL,1),.args=SENTINEL_INFO_CACHE_Args},
-{MAKE_CMD("is-master-down-by-addr","Determines whether a primary instance is down.","O(1)","2.8.4",CMD_DOC_NONE,NULL,NULL,"sentinel",COMMAND_GROUP_SENTINEL,SENTINEL_IS_MASTER_DOWN_BY_ADDR_History,0,SENTINEL_IS_MASTER_DOWN_BY_ADDR_Tips,0,sentinelCommand,6,CMD_ADMIN|CMD_SENTINEL|CMD_ONLY_SENTINEL,0,SENTINEL_IS_MASTER_DOWN_BY_ADDR_Keyspecs,0,NULL,4),.args=SENTINEL_IS_MASTER_DOWN_BY_ADDR_Args},
-{MAKE_CMD("master","Returns the state of a primary instance.","O(1)","2.8.4",CMD_DOC_NONE,NULL,NULL,"sentinel",COMMAND_GROUP_SENTINEL,SENTINEL_MASTER_History,0,SENTINEL_MASTER_Tips,0,sentinelCommand,3,CMD_ADMIN|CMD_SENTINEL|CMD_ONLY_SENTINEL,0,SENTINEL_MASTER_Keyspecs,0,NULL,1),.args=SENTINEL_MASTER_Args},
-{MAKE_CMD("masters","Returns a list of monitored primaries.","O(N) where N is the number of primaries","2.8.4",CMD_DOC_NONE,NULL,NULL,"sentinel",COMMAND_GROUP_SENTINEL,SENTINEL_MASTERS_History,0,SENTINEL_MASTERS_Tips,0,sentinelCommand,2,CMD_ADMIN|CMD_SENTINEL|CMD_ONLY_SENTINEL,0,SENTINEL_MASTERS_Keyspecs,0,NULL,0)},
+{MAKE_CMD("is-master-down-by-addr","Determines whether a primary instance is down.","O(1)","2.8.4",CMD_DOC_DEPRECATED,"`SENTINEL IS-PRIMARY-DOWN-BY-ADDR`","8.0.0","sentinel",COMMAND_GROUP_SENTINEL,SENTINEL_IS_MASTER_DOWN_BY_ADDR_History,0,SENTINEL_IS_MASTER_DOWN_BY_ADDR_Tips,0,sentinelCommand,6,CMD_ADMIN|CMD_SENTINEL|CMD_ONLY_SENTINEL,0,SENTINEL_IS_MASTER_DOWN_BY_ADDR_Keyspecs,0,NULL,4),.args=SENTINEL_IS_MASTER_DOWN_BY_ADDR_Args},
+{MAKE_CMD("is-primary-down-by-addr","Determines whether a primary instance is down.","O(1)","8.0.0",CMD_DOC_NONE,NULL,NULL,"sentinel",COMMAND_GROUP_SENTINEL,SENTINEL_IS_PRIMARY_DOWN_BY_ADDR_History,0,SENTINEL_IS_PRIMARY_DOWN_BY_ADDR_Tips,0,sentinelCommand,6,CMD_ADMIN|CMD_SENTINEL|CMD_ONLY_SENTINEL,0,SENTINEL_IS_PRIMARY_DOWN_BY_ADDR_Keyspecs,0,NULL,4),.args=SENTINEL_IS_PRIMARY_DOWN_BY_ADDR_Args},
+{MAKE_CMD("master","Returns the state of a primary instance.","O(1)","2.8.4",CMD_DOC_DEPRECATED,"`SENTINEL PRIMARY`","8.0.0","sentinel",COMMAND_GROUP_SENTINEL,SENTINEL_MASTER_History,0,SENTINEL_MASTER_Tips,0,sentinelCommand,3,CMD_ADMIN|CMD_SENTINEL|CMD_ONLY_SENTINEL,0,SENTINEL_MASTER_Keyspecs,0,NULL,1),.args=SENTINEL_MASTER_Args},
+{MAKE_CMD("masters","Returns a list of monitored primaries.","O(N) where N is the number of primaries","2.8.4",CMD_DOC_DEPRECATED,"`SENTINEL PRIMARIES`","8.0.0","sentinel",COMMAND_GROUP_SENTINEL,SENTINEL_MASTERS_History,0,SENTINEL_MASTERS_Tips,0,sentinelCommand,2,CMD_ADMIN|CMD_SENTINEL|CMD_ONLY_SENTINEL,0,SENTINEL_MASTERS_Keyspecs,0,NULL,0)},
{MAKE_CMD("monitor","Starts monitoring.","O(1)","2.8.4",CMD_DOC_NONE,NULL,NULL,"sentinel",COMMAND_GROUP_SENTINEL,SENTINEL_MONITOR_History,0,SENTINEL_MONITOR_Tips,0,sentinelCommand,6,CMD_ADMIN|CMD_SENTINEL|CMD_ONLY_SENTINEL,0,SENTINEL_MONITOR_Keyspecs,0,NULL,4),.args=SENTINEL_MONITOR_Args},
{MAKE_CMD("myid","Returns the Sentinel instance ID.","O(1)","6.2.0",CMD_DOC_NONE,NULL,NULL,"sentinel",COMMAND_GROUP_SENTINEL,SENTINEL_MYID_History,0,SENTINEL_MYID_Tips,0,sentinelCommand,2,CMD_ADMIN|CMD_SENTINEL|CMD_ONLY_SENTINEL,0,SENTINEL_MYID_Keyspecs,0,NULL,0)},
{MAKE_CMD("pending-scripts","Returns information about pending scripts for Sentinel.",NULL,"2.8.4",CMD_DOC_NONE,NULL,NULL,"sentinel",COMMAND_GROUP_SENTINEL,SENTINEL_PENDING_SCRIPTS_History,0,SENTINEL_PENDING_SCRIPTS_Tips,0,sentinelCommand,2,CMD_ADMIN|CMD_SENTINEL|CMD_ONLY_SENTINEL,0,SENTINEL_PENDING_SCRIPTS_Keyspecs,0,NULL,0)},
+{MAKE_CMD("primaries","Returns a list of monitored primaries.","O(N) where N is the number of primaries","8.0.0",CMD_DOC_NONE,NULL,NULL,"sentinel",COMMAND_GROUP_SENTINEL,SENTINEL_PRIMARIES_History,0,SENTINEL_PRIMARIES_Tips,0,sentinelCommand,2,CMD_ADMIN|CMD_SENTINEL|CMD_ONLY_SENTINEL,0,SENTINEL_PRIMARIES_Keyspecs,0,NULL,0)},
+{MAKE_CMD("primary","Returns the state of a primary instance.","O(1)","8.0.0",CMD_DOC_NONE,NULL,NULL,"sentinel",COMMAND_GROUP_SENTINEL,SENTINEL_PRIMARY_History,0,SENTINEL_PRIMARY_Tips,0,sentinelCommand,3,CMD_ADMIN|CMD_SENTINEL|CMD_ONLY_SENTINEL,0,SENTINEL_PRIMARY_Keyspecs,0,NULL,1),.args=SENTINEL_PRIMARY_Args},
{MAKE_CMD("remove","Stops monitoring.","O(1)","2.8.4",CMD_DOC_NONE,NULL,NULL,"sentinel",COMMAND_GROUP_SENTINEL,SENTINEL_REMOVE_History,0,SENTINEL_REMOVE_Tips,0,sentinelCommand,3,CMD_ADMIN|CMD_SENTINEL|CMD_ONLY_SENTINEL,0,SENTINEL_REMOVE_Keyspecs,0,NULL,1),.args=SENTINEL_REMOVE_Args},
{MAKE_CMD("replicas","Returns a list of the monitored replicas.","O(N) where N is the number of replicas","5.0.0",CMD_DOC_NONE,NULL,NULL,"sentinel",COMMAND_GROUP_SENTINEL,SENTINEL_REPLICAS_History,0,SENTINEL_REPLICAS_Tips,0,sentinelCommand,3,CMD_ADMIN|CMD_SENTINEL|CMD_ONLY_SENTINEL,0,SENTINEL_REPLICAS_Keyspecs,0,NULL,1),.args=SENTINEL_REPLICAS_Args},
{MAKE_CMD("reset","Resets primaries by name matching a pattern.","O(N) where N is the number of monitored primaries","2.8.4",CMD_DOC_NONE,NULL,NULL,"sentinel",COMMAND_GROUP_SENTINEL,SENTINEL_RESET_History,0,SENTINEL_RESET_Tips,0,sentinelCommand,3,CMD_ADMIN|CMD_SENTINEL|CMD_ONLY_SENTINEL,0,SENTINEL_RESET_Keyspecs,0,NULL,1),.args=SENTINEL_RESET_Args},
diff --git a/src/commands/sentinel-get-master-addr-by-name.json b/src/commands/sentinel-get-master-addr-by-name.json
index 2d7fc50eda..9f91fef764 100644
--- a/src/commands/sentinel-get-master-addr-by-name.json
+++ b/src/commands/sentinel-get-master-addr-by-name.json
@@ -7,6 +7,12 @@
"arity": 3,
"container": "SENTINEL",
"function": "sentinelCommand",
+ "deprecated_since": "8.0.0",
+ "replaced_by": "`SENTINEL GET-PRIMARY-ADDR-BY-NAME`",
+ "doc_flags": [
+ "DEPRECATED"
+ ],
+
"command_flags": [
"ADMIN",
"SENTINEL",
diff --git a/src/commands/sentinel-get-primary-addr-by-name.json b/src/commands/sentinel-get-primary-addr-by-name.json
new file mode 100644
index 0000000000..f2d6261931
--- /dev/null
+++ b/src/commands/sentinel-get-primary-addr-by-name.json
@@ -0,0 +1,38 @@
+{
+ "GET-PRIMARY-ADDR-BY-NAME": {
+ "summary": "Returns the port and address of a primary instance.",
+ "complexity": "O(1)",
+ "group": "sentinel",
+ "since": "8.0.0",
+ "arity": 3,
+ "container": "SENTINEL",
+ "function": "sentinelCommand",
+ "command_flags": [
+ "ADMIN",
+ "SENTINEL",
+ "ONLY_SENTINEL"
+ ],
+ "reply_schema": {
+ "type": "array",
+ "minItems": 2,
+ "maxItems": 2,
+ "items": [
+ {
+ "type": "string",
+ "description": "IP addr or hostname."
+ },
+ {
+ "type": "string",
+ "description": "Port.",
+ "pattern": "[0-9]+"
+ }
+ ]
+ },
+ "arguments": [
+ {
+ "name": "primary-name",
+ "type": "string"
+ }
+ ]
+ }
+}
diff --git a/src/commands/sentinel-is-master-down-by-addr.json b/src/commands/sentinel-is-master-down-by-addr.json
index 3ecf8723fb..6f4b305ae0 100644
--- a/src/commands/sentinel-is-master-down-by-addr.json
+++ b/src/commands/sentinel-is-master-down-by-addr.json
@@ -7,6 +7,11 @@
"arity": 6,
"container": "SENTINEL",
"function": "sentinelCommand",
+ "deprecated_since": "8.0.0",
+ "replaced_by": "`SENTINEL IS-PRIMARY-DOWN-BY-ADDR`",
+ "doc_flags": [
+ "DEPRECATED"
+ ],
"command_flags": [
"ADMIN",
"SENTINEL",
diff --git a/src/commands/sentinel-is-primary-down-by-addr.json b/src/commands/sentinel-is-primary-down-by-addr.json
new file mode 100644
index 0000000000..c3c00f1ec0
--- /dev/null
+++ b/src/commands/sentinel-is-primary-down-by-addr.json
@@ -0,0 +1,61 @@
+{
+ "IS-PRIMARY-DOWN-BY-ADDR": {
+ "summary": "Determines whether a primary instance is down.",
+ "complexity": "O(1)",
+ "group": "sentinel",
+ "since": "8.0.0",
+ "arity": 6,
+ "container": "SENTINEL",
+ "function": "sentinelCommand",
+ "command_flags": [
+ "ADMIN",
+ "SENTINEL",
+ "ONLY_SENTINEL"
+ ],
+ "reply_schema": {
+ "type": "array",
+ "minItems": 3,
+ "maxItems": 3,
+ "items": [
+ {
+ "oneOf": [
+ {
+ "const": 0,
+ "description": "Primary is up."
+ },
+ {
+ "const": 1,
+ "description": "Primary is down."
+ }
+ ]
+ },
+ {
+ "type": "string",
+ "description": "Sentinel address."
+ },
+ {
+ "type": "integer",
+ "description": "Port."
+ }
+ ]
+ },
+ "arguments": [
+ {
+ "name": "ip",
+ "type": "string"
+ },
+ {
+ "name": "port",
+ "type": "integer"
+ },
+ {
+ "name": "current-epoch",
+ "type": "integer"
+ },
+ {
+ "name": "runid",
+ "type": "string"
+ }
+ ]
+ }
+}
diff --git a/src/commands/sentinel-master.json b/src/commands/sentinel-master.json
index 3af3227394..6c2d035122 100644
--- a/src/commands/sentinel-master.json
+++ b/src/commands/sentinel-master.json
@@ -7,6 +7,11 @@
"arity": 3,
"container": "SENTINEL",
"function": "sentinelCommand",
+ "deprecated_since": "8.0.0",
+ "replaced_by": "`SENTINEL PRIMARY`",
+ "doc_flags": [
+ "DEPRECATED"
+ ],
"command_flags": [
"ADMIN",
"SENTINEL",
diff --git a/src/commands/sentinel-masters.json b/src/commands/sentinel-masters.json
index b6aa86d02a..2a5a09bfd2 100644
--- a/src/commands/sentinel-masters.json
+++ b/src/commands/sentinel-masters.json
@@ -7,6 +7,11 @@
"arity": 2,
"container": "SENTINEL",
"function": "sentinelCommand",
+ "deprecated_since": "8.0.0",
+ "replaced_by": "`SENTINEL PRIMARIES`",
+ "doc_flags": [
+ "DEPRECATED"
+ ],
"command_flags": [
"ADMIN",
"SENTINEL",
@@ -14,7 +19,7 @@
],
"reply_schema": {
"type": "array",
- "description": "List of monitored primaries, and their state.",
+ "description": "List of monitored primaries, and their states.",
"items": {
"type": "object",
"additionalProperties": {
diff --git a/src/commands/sentinel-primaries.json b/src/commands/sentinel-primaries.json
new file mode 100644
index 0000000000..0885bbf597
--- /dev/null
+++ b/src/commands/sentinel-primaries.json
@@ -0,0 +1,26 @@
+{
+ "PRIMARIES": {
+ "summary": "Returns a list of monitored primaries.",
+ "complexity": "O(N) where N is the number of primaries",
+ "group": "sentinel",
+ "since": "8.0.0",
+ "arity": 2,
+ "container": "SENTINEL",
+ "function": "sentinelCommand",
+ "command_flags": [
+ "ADMIN",
+ "SENTINEL",
+ "ONLY_SENTINEL"
+ ],
+ "reply_schema": {
+ "type": "array",
+ "description": "List of monitored primaries, and their states.",
+ "items": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
+ }
+ }
+ }
+}
diff --git a/src/commands/sentinel-primary.json b/src/commands/sentinel-primary.json
new file mode 100644
index 0000000000..03cf5c9102
--- /dev/null
+++ b/src/commands/sentinel-primary.json
@@ -0,0 +1,29 @@
+{
+ "PRIMARY": {
+ "summary": "Returns the state of a primary instance.",
+ "complexity": "O(1)",
+ "group": "sentinel",
+ "since": "8.0.0",
+ "arity": 3,
+ "container": "SENTINEL",
+ "function": "sentinelCommand",
+ "command_flags": [
+ "ADMIN",
+ "SENTINEL",
+ "ONLY_SENTINEL"
+ ],
+ "reply_schema": {
+ "type": "object",
+ "description": "The state and info of the specified primary.",
+ "additionalProperties": {
+ "type": "string"
+ }
+ },
+ "arguments": [
+ {
+ "name": "primary-name",
+ "type": "string"
+ }
+ ]
+ }
+}
diff --git a/src/sentinel.c b/src/sentinel.c
index 3e2c83a712..84b75db716 100644
--- a/src/sentinel.c
+++ b/src/sentinel.c
@@ -2087,7 +2087,7 @@ void rewriteConfigSentinelOption(struct rewriteConfigState *state) {
ri = dictGetVal(de);
replica_addr = ri->addr;
- /* If primary_addr (obtained using sentinelGetCurrentMasterAddress()
+ /* If primary_addr (obtained using sentinelGetCurrentPrimaryAddress()
* so it may be the address of the promoted replica) is equal to this
* replica's address, a failover is in progress and the replica was
* already successfully promoted. So as the address of this replica
@@ -3688,7 +3688,7 @@ void sentinelCommand(client *c) {
"DEBUG [ ...]",
" Show a list of configurable time parameters and their values (milliseconds).",
" Or update current configurable parameters values (one or more).",
-"GET-MASTER-ADDR-BY-NAME ",
+"GET-PRIMARY-ADDR-BY-NAME ",
" Return the ip and port number of the primary with that name.",
"FAILOVER ",
" Manually failover a primary node without asking for agreement from other",
@@ -3698,12 +3698,12 @@ void sentinelCommand(client *c) {
" Sentinel state.",
"INFO-CACHE ",
" Return last cached INFO output from primaries and all its replicas.",
-"IS-MASTER-DOWN-BY-ADDR ",
+"IS-PRIMARY-DOWN-BY-ADDR ",
" Check if the primary specified by ip:port is down from current Sentinel's",
" point of view.",
-"MASTER ",
+"PRIMARY ",
" Show the state and info of the specified primary.",
-"MASTERS",
+"PRIMARIES",
" Show a list of monitored primaries and their state.",
"MONITOR ",
" Start monitoring a new primary with the specified name, ip, port and quorum.",
@@ -3727,11 +3727,11 @@ NULL
};
/* clang-format on */
addReplyHelp(c, help);
- } else if (!strcasecmp(c->argv[1]->ptr, "masters")) {
+ } else if (!strcasecmp(c->argv[1]->ptr, "primaries") || !strcasecmp(c->argv[1]->ptr, "masters")) {
/* SENTINEL PRIMARIES */
if (c->argc != 2) goto numargserr;
addReplyDictOfValkeyInstances(c, sentinel.primaries);
- } else if (!strcasecmp(c->argv[1]->ptr, "master")) {
+ } else if (!strcasecmp(c->argv[1]->ptr, "primary") || !strcasecmp(c->argv[1]->ptr, "master")) {
/* SENTINEL PRIMARY */
sentinelValkeyInstance *ri;
@@ -3755,7 +3755,8 @@ NULL
} else if (!strcasecmp(c->argv[1]->ptr, "myid") && c->argc == 2) {
/* SENTINEL MYID */
addReplyBulkCBuffer(c, sentinel.myid, CONFIG_RUN_ID_SIZE);
- } else if (!strcasecmp(c->argv[1]->ptr, "is-master-down-by-addr")) {
+ } else if (!strcasecmp(c->argv[1]->ptr, "is-primary-down-by-addr") ||
+ !strcasecmp(c->argv[1]->ptr, "is-master-down-by-addr")) {
/* SENTINEL IS-PRIMARY-DOWN-BY-ADDR
*
* Arguments:
@@ -3807,7 +3808,8 @@ NULL
/* SENTINEL RESET */
if (c->argc != 3) goto numargserr;
addReplyLongLong(c, sentinelResetPrimariesByPattern(c->argv[2]->ptr, SENTINEL_GENERATE_EVENT));
- } else if (!strcasecmp(c->argv[1]->ptr, "get-master-addr-by-name")) {
+ } else if (!strcasecmp(c->argv[1]->ptr, "get-primary-addr-by-name") ||
+ !strcasecmp(c->argv[1]->ptr, "get-master-addr-by-name")) {
/* SENTINEL GET-PRIMARY-ADDR-BY-NAME */
sentinelValkeyInstance *ri;
diff --git a/tests/sentinel/tests/00-base.tcl b/tests/sentinel/tests/00-base.tcl
index c9f23a5c34..e005b240ef 100644
--- a/tests/sentinel/tests/00-base.tcl
+++ b/tests/sentinel/tests/00-base.tcl
@@ -57,8 +57,8 @@ test "SENTINEL PENDING-SCRIPTS returns the information about pending scripts" {
}
test "SENTINEL PRIMARIES returns a list of monitored primaries" {
- assert_match "*mymaster*" [S 0 SENTINEL MASTERS]
- assert_morethan_equal [llength [S 0 SENTINEL MASTERS]] 1
+ assert_match "*mymaster*" [S 0 SENTINEL PRIMARIES]
+ assert_morethan_equal [llength [S 0 SENTINEL PRIMARIES]] 1
}
test "SENTINEL SENTINELS returns a list of sentinel instances" {
@@ -66,7 +66,7 @@ test "SENTINEL SENTINELS returns a list of sentinel instances" {
}
test "SENTINEL SLAVES returns a list of the monitored replicas" {
- assert_morethan_equal [llength [S 0 SENTINEL SLAVES mymaster]] 1
+ assert_morethan_equal [llength [S 0 SENTINEL REPLICAS mymaster]] 1
}
test "SENTINEL SIMULATE-FAILURE HELP list supported flags" {
@@ -77,20 +77,20 @@ test "SENTINEL SIMULATE-FAILURE HELP list supported flags" {
test "Basic failover works if the primary is down" {
set old_port [RPort $master_id]
- set addr [S 0 SENTINEL GET-MASTER-ADDR-BY-NAME mymaster]
+ set addr [S 0 SENTINEL GET-PRIMARY-ADDR-BY-NAME mymaster]
assert {[lindex $addr 1] == $old_port}
kill_instance valkey $master_id
foreach_sentinel_id id {
S $id sentinel debug ping-period 500
S $id sentinel debug ask-period 500
wait_for_condition 1000 100 {
- [lindex [S $id SENTINEL GET-MASTER-ADDR-BY-NAME mymaster] 1] != $old_port
+ [lindex [S $id SENTINEL GET-PRIMARY-ADDR-BY-NAME mymaster] 1] != $old_port
} else {
fail "At least one Sentinel did not receive failover info"
}
}
restart_instance valkey $master_id
- set addr [S 0 SENTINEL GET-MASTER-ADDR-BY-NAME mymaster]
+ set addr [S 0 SENTINEL GET-PRIMARY-ADDR-BY-NAME mymaster]
set master_id [get_instance_id_by_port valkey [lindex $addr 1]]
}
@@ -123,12 +123,12 @@ test "ODOWN is not possible without N (quorum) Sentinels reports" {
S $id SENTINEL SET mymaster quorum [expr $sentinels+1]
}
set old_port [RPort $master_id]
- set addr [S 0 SENTINEL GET-MASTER-ADDR-BY-NAME mymaster]
+ set addr [S 0 SENTINEL GET-PRIMARY-ADDR-BY-NAME mymaster]
assert {[lindex $addr 1] == $old_port}
kill_instance valkey $master_id
# Make sure failover did not happened.
- set addr [S 0 SENTINEL GET-MASTER-ADDR-BY-NAME mymaster]
+ set addr [S 0 SENTINEL GET-PRIMARY-ADDR-BY-NAME mymaster]
assert {[lindex $addr 1] == $old_port}
restart_instance valkey $master_id
}
@@ -147,7 +147,7 @@ test "Failover is not possible without majority agreement" {
kill_instance valkey $master_id
# Make sure failover did not happened.
- set addr [S $quorum SENTINEL GET-MASTER-ADDR-BY-NAME mymaster]
+ set addr [S $quorum SENTINEL GET-PRIMARY-ADDR-BY-NAME mymaster]
assert {[lindex $addr 1] == $old_port}
restart_instance valkey $master_id
@@ -165,9 +165,9 @@ test "Failover works if we configure for absolute agreement" {
# Wait for Sentinels to monitor the master again
foreach_sentinel_id id {
wait_for_condition 1000 100 {
- [dict get [S $id SENTINEL MASTER mymaster] info-refresh] < 100000
+ [dict get [S $id SENTINEL PRIMARY mymaster] info-refresh] < 100000
} else {
- fail "At least one Sentinel is not monitoring the master"
+ fail "At least one Sentinel is not monitoring the primary"
}
}
@@ -175,13 +175,13 @@ test "Failover works if we configure for absolute agreement" {
foreach_sentinel_id id {
wait_for_condition 1000 100 {
- [lindex [S $id SENTINEL GET-MASTER-ADDR-BY-NAME mymaster] 1] != $old_port
+ [lindex [S $id SENTINEL GET-PRIMARY-ADDR-BY-NAME mymaster] 1] != $old_port
} else {
fail "At least one Sentinel did not receive failover info"
}
}
restart_instance valkey $master_id
- set addr [S 0 SENTINEL GET-MASTER-ADDR-BY-NAME mymaster]
+ set addr [S 0 SENTINEL GET-PRIMARY-ADDR-BY-NAME mymaster]
set master_id [get_instance_id_by_port valkey [lindex $addr 1]]
# Set the min ODOWN agreement back to strict majority.
diff --git a/tests/sentinel/tests/01-conf-update.tcl b/tests/sentinel/tests/01-conf-update.tcl
index e8550e9e33..a9a2e9e062 100644
--- a/tests/sentinel/tests/01-conf-update.tcl
+++ b/tests/sentinel/tests/01-conf-update.tcl
@@ -4,7 +4,7 @@ source "../tests/includes/init-tests.tcl"
test "We can failover with Sentinel 1 crashed" {
set old_port [RPort $master_id]
- set addr [S 0 SENTINEL GET-MASTER-ADDR-BY-NAME mymaster]
+ set addr [S 0 SENTINEL GET-PRIMARY-ADDR-BY-NAME mymaster]
assert {[lindex $addr 1] == $old_port}
# Crash Sentinel 1
@@ -14,21 +14,21 @@ test "We can failover with Sentinel 1 crashed" {
foreach_sentinel_id id {
if {$id != 1} {
wait_for_condition 1000 50 {
- [lindex [S $id SENTINEL GET-MASTER-ADDR-BY-NAME mymaster] 1] != $old_port
+ [lindex [S $id SENTINEL GET-PRIMARY-ADDR-BY-NAME mymaster] 1] != $old_port
} else {
fail "Sentinel $id did not receive failover info"
}
}
}
restart_instance valkey $master_id
- set addr [S 0 SENTINEL GET-MASTER-ADDR-BY-NAME mymaster]
+ set addr [S 0 SENTINEL GET-PRIMARY-ADDR-BY-NAME mymaster]
set master_id [get_instance_id_by_port valkey [lindex $addr 1]]
}
test "After Sentinel 1 is restarted, its config gets updated" {
restart_instance sentinel 1
wait_for_condition 1000 50 {
- [lindex [S 1 SENTINEL GET-MASTER-ADDR-BY-NAME mymaster] 1] != $old_port
+ [lindex [S 1 SENTINEL GET-PRIMARY-ADDR-BY-NAME mymaster] 1] != $old_port
} else {
fail "Restarted Sentinel did not receive failover info"
}
diff --git a/tests/sentinel/tests/02-slaves-reconf.tcl b/tests/sentinel/tests/02-replicas-reconf.tcl
similarity index 88%
rename from tests/sentinel/tests/02-slaves-reconf.tcl
rename to tests/sentinel/tests/02-replicas-reconf.tcl
index 7fb2e615a9..4bf2a35d26 100644
--- a/tests/sentinel/tests/02-slaves-reconf.tcl
+++ b/tests/sentinel/tests/02-replicas-reconf.tcl
@@ -29,18 +29,18 @@ proc 02_crash_and_failover {} {
uplevel 1 {
test "Crash the primary and force a failover" {
set old_port [RPort $master_id]
- set addr [S 0 SENTINEL GET-MASTER-ADDR-BY-NAME mymaster]
+ set addr [S 0 SENTINEL GET-PRIMARY-ADDR-BY-NAME mymaster]
assert {[lindex $addr 1] == $old_port}
kill_instance valkey $master_id
foreach_sentinel_id id {
wait_for_condition 1000 50 {
- [lindex [S $id SENTINEL GET-MASTER-ADDR-BY-NAME mymaster] 1] != $old_port
+ [lindex [S $id SENTINEL GET-PRIMARY-ADDR-BY-NAME mymaster] 1] != $old_port
} else {
fail "At least one Sentinel did not receive failover info"
}
}
restart_instance valkey $master_id
- set addr [S 0 SENTINEL GET-MASTER-ADDR-BY-NAME mymaster]
+ set addr [S 0 SENTINEL GET-PRIMARY-ADDR-BY-NAME mymaster]
set master_id [get_instance_id_by_port valkey [lindex $addr 1]]
}
}
@@ -74,7 +74,7 @@ test "Wait for failover to end" {
while {$inprogress} {
set inprogress 0
foreach_sentinel_id id {
- if {[dict exists [S $id SENTINEL MASTER mymaster] failover-state]} {
+ if {[dict exists [S $id SENTINEL PRIMARY mymaster] failover-state]} {
incr inprogress
}
}
diff --git a/tests/sentinel/tests/03-runtime-reconf.tcl b/tests/sentinel/tests/03-runtime-reconf.tcl
index 46043adf1f..ac51aeecb3 100644
--- a/tests/sentinel/tests/03-runtime-reconf.tcl
+++ b/tests/sentinel/tests/03-runtime-reconf.tcl
@@ -50,7 +50,7 @@ proc verify_sentinel_connect_replicas {id} {
proc wait_for_sentinels_connect_servers { {is_connect 1} } {
foreach_sentinel_id id {
wait_for_condition 1000 50 {
- [string match "*disconnected*" [dict get [S $id SENTINEL MASTER mymaster] flags]] != $is_connect
+ [string match "*disconnected*" [dict get [S $id SENTINEL PRIMARY mymaster] flags]] != $is_connect
} else {
fail "At least some sentinel can't connect to master"
}
@@ -80,7 +80,7 @@ test "Sentinels (re)connection following SENTINEL SET myprimary auth-pass" {
# Verify sentinel that restarted failed to connect master
wait_for_condition 100 50 {
- [string match "*disconnected*" [dict get [S $sent2re SENTINEL MASTER mymaster] flags]] != 0
+ [string match "*disconnected*" [dict get [S $sent2re SENTINEL PRIMARY mymaster] flags]] != 0
} else {
fail "Expected to be disconnected from master due to wrong password"
}
@@ -124,21 +124,21 @@ test "Sentinels (re)connection following primary ACL change" {
# Verify sentinel that restarted failed to reconnect master
wait_for_condition 100 50 {
- [string match "*disconnected*" [dict get [S $sent2re SENTINEL MASTER mymaster] flags]] != 0
+ [string match "*disconnected*" [dict get [S $sent2re SENTINEL PRIMARY mymaster] flags]] != 0
} else {
fail "Expected: Restarted sentinel to be disconnected from master due to obsolete password"
}
# Verify sentinel with updated password managed to connect (wait for sentinelTimer to reconnect)
wait_for_condition 100 50 {
- [string match "*disconnected*" [dict get [S $sent2up SENTINEL MASTER mymaster] flags]] == 0
+ [string match "*disconnected*" [dict get [S $sent2up SENTINEL PRIMARY mymaster] flags]] == 0
} else {
fail "Expected: Sentinel to be connected to master"
}
# Verify sentinel untouched gets failed to connect master
wait_for_condition 100 50 {
- [string match "*disconnected*" [dict get [S $sent2un SENTINEL MASTER mymaster] flags]] != 0
+ [string match "*disconnected*" [dict get [S $sent2un SENTINEL PRIMARY mymaster] flags]] != 0
} else {
fail "Expected: Sentinel to be disconnected from master due to obsolete password"
}
@@ -164,7 +164,7 @@ test "Sentinels (re)connection following primary ACL change" {
test "Set parameters in normal case" {
- set info [S 0 SENTINEL master mymaster]
+ set info [S 0 SENTINEL primary mymaster]
set origin_quorum [dict get $info quorum]
set origin_down_after_milliseconds [dict get $info down-after-milliseconds]
set update_quorum [expr $origin_quorum+1]
@@ -173,7 +173,7 @@ test "Set parameters in normal case" {
assert_equal [S 0 SENTINEL SET mymaster quorum $update_quorum] "OK"
assert_equal [S 0 SENTINEL SET mymaster down-after-milliseconds $update_down_after_milliseconds] "OK"
- set update_info [S 0 SENTINEL master mymaster]
+ set update_info [S 0 SENTINEL primary mymaster]
assert {[dict get $update_info quorum] != $origin_quorum}
assert {[dict get $update_info down-after-milliseconds] != $origin_down_after_milliseconds}
@@ -184,13 +184,13 @@ test "Set parameters in normal case" {
test "Set parameters in normal case with bad format" {
- set info [S 0 SENTINEL master mymaster]
+ set info [S 0 SENTINEL primary mymaster]
set origin_down_after_milliseconds [dict get $info down-after-milliseconds]
assert_error "ERR Invalid argument '-20' for SENTINEL SET 'down-after-milliseconds'*" {S 0 SENTINEL SET mymaster down-after-milliseconds -20}
assert_error "ERR Invalid argument 'abc' for SENTINEL SET 'down-after-milliseconds'*" {S 0 SENTINEL SET mymaster down-after-milliseconds "abc"}
- set current_info [S 0 SENTINEL master mymaster]
+ set current_info [S 0 SENTINEL primary mymaster]
assert {[dict get $current_info down-after-milliseconds] == $origin_down_after_milliseconds}
}
@@ -206,7 +206,7 @@ test "Sentinel Set with other error situations" {
assert_error "ERR Unknown option or number of arguments for SENTINEL SET 'fakeoption'" {S 0 SENTINEL SET mymaster fakeoption fakevalue}
# save new config to disk failed
- set info [S 0 SENTINEL master mymaster]
+ set info [S 0 SENTINEL primary mymaster]
set origin_quorum [dict get $info quorum]
set update_quorum [expr $origin_quorum+1]
set sentinel_id 0
diff --git a/tests/sentinel/tests/05-manual.tcl b/tests/sentinel/tests/05-manual.tcl
index ba5572c1a9..7f5485c42c 100644
--- a/tests/sentinel/tests/05-manual.tcl
+++ b/tests/sentinel/tests/05-manual.tcl
@@ -10,7 +10,7 @@ foreach_sentinel_id id {
test "Manual failover works" {
set old_port [RPort $master_id]
- set addr [S 0 SENTINEL GET-MASTER-ADDR-BY-NAME mymaster]
+ set addr [S 0 SENTINEL GET-PRIMARY-ADDR-BY-NAME mymaster]
assert {[lindex $addr 1] == $old_port}
# Since we reduced the info-period (default 10000) above immediately,
@@ -29,12 +29,12 @@ test "Manual failover works" {
foreach_sentinel_id id {
wait_for_condition 1000 50 {
- [lindex [S $id SENTINEL GET-MASTER-ADDR-BY-NAME mymaster] 1] != $old_port
+ [lindex [S $id SENTINEL GET-PRIMARY-ADDR-BY-NAME mymaster] 1] != $old_port
} else {
fail "At least one Sentinel did not receive failover info"
}
}
- set addr [S 0 SENTINEL GET-MASTER-ADDR-BY-NAME mymaster]
+ set addr [S 0 SENTINEL GET-PRIMARY-ADDR-BY-NAME mymaster]
set master_id [get_instance_id_by_port valkey [lindex $addr 1]]
}
diff --git a/tests/sentinel/tests/07-down-conditions.tcl b/tests/sentinel/tests/07-down-conditions.tcl
index 1068cd18fb..fbc1924816 100644
--- a/tests/sentinel/tests/07-down-conditions.tcl
+++ b/tests/sentinel/tests/07-down-conditions.tcl
@@ -18,7 +18,7 @@ proc ensure_master_up {} {
S $::alive_sentinel sentinel debug ask-period 100
S $::alive_sentinel sentinel debug publish-period 100
wait_for_condition 1000 50 {
- [dict get [S $::alive_sentinel sentinel master mymaster] flags] eq "master"
+ [dict get [S $::alive_sentinel sentinel primary mymaster] flags] eq "master"
} else {
fail "Master flags are not just 'master'"
}
@@ -31,7 +31,7 @@ proc ensure_master_down {} {
S $::alive_sentinel sentinel debug publish-period 100
wait_for_condition 1000 50 {
[string match *down* \
- [dict get [S $::alive_sentinel sentinel master mymaster] flags]]
+ [dict get [S $::alive_sentinel sentinel primary mymaster] flags]]
} else {
fail "Master is not flagged SDOWN"
}
@@ -45,7 +45,7 @@ test "Crash the majority of Sentinels to prevent failovers for this unit" {
test "SDOWN is triggered by non-responding but not crashed instance" {
ensure_master_up
- set master_addr [S $::alive_sentinel SENTINEL GET-MASTER-ADDR-BY-NAME mymaster]
+ set master_addr [S $::alive_sentinel SENTINEL GET-PRIMARY-ADDR-BY-NAME mymaster]
set master_id [get_instance_id_by_port valkey [lindex $master_addr 1]]
set pid [get_instance_attrib valkey $master_id pid]
@@ -56,7 +56,7 @@ test "SDOWN is triggered by non-responding but not crashed instance" {
}
test "SDOWN is triggered by crashed instance" {
- lassign [S $::alive_sentinel SENTINEL GET-MASTER-ADDR-BY-NAME mymaster] host port
+ lassign [S $::alive_sentinel SENTINEL GET-PRIMARY-ADDR-BY-NAME mymaster] host port
ensure_master_up
kill_instance valkey 0
ensure_master_down
diff --git a/tests/sentinel/tests/08-hostname-conf.tcl b/tests/sentinel/tests/08-hostname-conf.tcl
index 4a551cf856..6362e81253 100644
--- a/tests/sentinel/tests/08-hostname-conf.tcl
+++ b/tests/sentinel/tests/08-hostname-conf.tcl
@@ -35,7 +35,7 @@ source "../tests/includes/init-tests.tcl"
proc verify_hostname_announced {hostname} {
foreach_sentinel_id id {
# Master is reported with its hostname
- if {![string equal [lindex [S $id SENTINEL GET-MASTER-ADDR-BY-NAME mymaster] 0] $hostname]} {
+ if {![string equal [lindex [S $id SENTINEL GET-PRIMARY-ADDR-BY-NAME mymaster] 0] $hostname]} {
return 0
}
@@ -66,4 +66,4 @@ test "(post-cleanup) Configure instances and sentinel for IPs" {
set_redis_announce_ip $::host
set_sentinel_config resolve-hostnames no
set_sentinel_config announce-hostnames no
-}
\ No newline at end of file
+}
diff --git a/tests/sentinel/tests/11-port-0.tcl b/tests/sentinel/tests/11-port-0.tcl
index a3e8bdba1c..a3a1fa1514 100644
--- a/tests/sentinel/tests/11-port-0.tcl
+++ b/tests/sentinel/tests/11-port-0.tcl
@@ -13,7 +13,7 @@ test "Start/Stop sentinel on same port with a different runID should not change
delete_lines_with_pattern $orgfilename $tmpfilename "myid"
# Get count of total sentinels
- set a [S 0 SENTINEL master mymaster]
+ set a [S 0 SENTINEL primary mymaster]
set original_count [lindex $a 33]
# Restart sentinel with the modified config file
@@ -23,7 +23,7 @@ test "Start/Stop sentinel on same port with a different runID should not change
after 1000
# Get new count of total sentinel
- set b [S 0 SENTINEL master mymaster]
+ set b [S 0 SENTINEL primary mymaster]
set curr_count [lindex $b 33]
# If the count is not the same then fail the test
diff --git a/tests/sentinel/tests/12-master-reboot.tcl b/tests/sentinel/tests/12-primary-reboot.tcl
similarity index 92%
rename from tests/sentinel/tests/12-master-reboot.tcl
rename to tests/sentinel/tests/12-primary-reboot.tcl
index 3d7c7c6ecb..3fb993564c 100644
--- a/tests/sentinel/tests/12-master-reboot.tcl
+++ b/tests/sentinel/tests/12-primary-reboot.tcl
@@ -37,7 +37,7 @@ proc reboot_instance {type id} {
test "Primary reboot in very short time" {
set old_port [RPort $master_id]
- set addr [S 0 SENTINEL GET-MASTER-ADDR-BY-NAME mymaster]
+ set addr [S 0 SENTINEL GET-PRIMARY-ADDR-BY-NAME mymaster]
assert {[lindex $addr 1] == $old_port}
R $master_id debug populate 10000
@@ -59,13 +59,13 @@ test "Primary reboot in very short time" {
foreach_sentinel_id id {
wait_for_condition 1000 100 {
- [lindex [S $id SENTINEL GET-MASTER-ADDR-BY-NAME mymaster] 1] != $old_port
+ [lindex [S $id SENTINEL GET-PRIMARY-ADDR-BY-NAME mymaster] 1] != $old_port
} else {
fail "At least one Sentinel did not receive failover info"
}
}
- set addr [S 0 SENTINEL GET-MASTER-ADDR-BY-NAME mymaster]
+ set addr [S 0 SENTINEL GET-PRIMARY-ADDR-BY-NAME mymaster]
set master_id [get_instance_id_by_port valkey [lindex $addr 1]]
# Make sure the instance load all the dataset
@@ -90,7 +90,7 @@ test "All the other slaves now point to the new primary" {
wait_for_condition 1000 50 {
[RI $id master_port] == [lindex $addr 1]
} else {
- fail "Valkey ID $id not configured to replicate with new master"
+ fail "Valkey ID $id not configured to replicate with new primary"
}
}
}
diff --git a/tests/sentinel/tests/15-sentinel-deprecated-commands.tcl b/tests/sentinel/tests/15-sentinel-deprecated-commands.tcl
new file mode 100644
index 0000000000..38eadcdfdf
--- /dev/null
+++ b/tests/sentinel/tests/15-sentinel-deprecated-commands.tcl
@@ -0,0 +1,27 @@
+# Test Sentinel configuration consistency after partitions heal.
+source "../tests/includes/init-tests.tcl"
+
+test "SENTINEL MASTERS returns a list of monitored masters (SENTINEL MASTERS as a deprecated command)" {
+ assert_match "*mymaster*" [S 0 SENTINEL MASTERS]
+ assert_morethan_equal [llength [S 0 SENTINEL MASTERS]] 1
+}
+
+test "SENTINEL SLAVES returns a list of the monitored slaves (SENTINEL SLAVES as a deprecated command)" {
+ assert_morethan_equal [llength [S 0 SENTINEL SLAVES mymaster]] 1
+}
+
+test "SENTINEL MASTER returns the information list of the monitored master (SENTINEL MASTER as a deprecated command)" {
+ set info [S 0 SENTINEL MASTER mymaster]
+ assert_equal mymaster [dict get $info name]
+}
+
+test "SENTINEL IS-MASTER-DOWN-BY-ADDR checks if the primary is down (SENTINEL IS-MASTER-DOWN-BY-ADDR as a deprecated command)" {
+ set sentinel_id [S 0 SENTINEL MYID]
+ set master_ip_port [S 0 SENTINEL GET-MASTER-ADDR-BY-NAME mymaster]
+ set master_ip [lindex $master_ip_port 0]
+ set master_port [lindex $master_ip_port 1]
+ set result [S 0 SENTINEL IS-MASTER-DOWN-BY-ADDR $master_ip $master_port 99 $sentinel_id]
+ assert_equal $sentinel_id [lindex $result 1]
+ assert_equal {99} [lindex $result 2]
+}
+
diff --git a/tests/sentinel/tests/15-config-set-config-get.tcl b/tests/sentinel/tests/16-config-set-config-get.tcl
similarity index 100%
rename from tests/sentinel/tests/15-config-set-config-get.tcl
rename to tests/sentinel/tests/16-config-set-config-get.tcl
diff --git a/tests/sentinel/tests/includes/init-tests.tcl b/tests/sentinel/tests/includes/init-tests.tcl
index 8635e0e255..456a810c5d 100644
--- a/tests/sentinel/tests/includes/init-tests.tcl
+++ b/tests/sentinel/tests/includes/init-tests.tcl
@@ -12,7 +12,7 @@ test "(init) Remove old primary entry from sentinels" {
}
set redis_slaves [expr $::instances_count - 1]
-test "(init) Create a primary-slaves cluster of [expr $redis_slaves+1] instances" {
+test "(init) Create a primary-replicas cluster of [expr $redis_slaves+1] instances" {
create_valkey_master_slave_cluster [expr {$redis_slaves+1}]
}
set master_id 0
@@ -26,7 +26,7 @@ test "(init) Sentinels can start monitoring a primary" {
[get_instance_attrib valkey $master_id port] $quorum
}
foreach_sentinel_id id {
- assert {[S $id sentinel master mymaster] ne {}}
+ assert {[S $id sentinel primary mymaster] ne {}}
S $id SENTINEL SET mymaster down-after-milliseconds 2000
S $id SENTINEL SET mymaster failover-timeout 10000
S $id SENTINEL debug tilt-period 5000
@@ -41,9 +41,9 @@ test "(init) Sentinels can start monitoring a primary" {
test "(init) Sentinels can talk with the primary" {
foreach_sentinel_id id {
wait_for_condition 1000 50 {
- [catch {S $id SENTINEL GET-MASTER-ADDR-BY-NAME mymaster}] == 0
+ [catch {S $id SENTINEL GET-PRIMARY-ADDR-BY-NAME mymaster}] == 0
} else {
- fail "Sentinel $id can't talk with the master."
+ fail "Sentinel $id can't talk with the primary."
}
}
}
@@ -52,12 +52,12 @@ test "(init) Sentinels are able to auto-discover other sentinels" {
verify_sentinel_auto_discovery
}
-test "(init) Sentinels are able to auto-discover slaves" {
+test "(init) Sentinels are able to auto-discover replicas" {
foreach_sentinel_id id {
wait_for_condition 1000 50 {
- [dict get [S $id SENTINEL MASTER mymaster] num-slaves] == $redis_slaves
+ [dict get [S $id SENTINEL PRIMARY mymaster] num-slaves] == $redis_slaves
} else {
- fail "At least some sentinel can't detect some slave"
+ fail "At least some sentinels can't detect some replicas"
}
}
}
diff --git a/tests/sentinel/tests/includes/utils.tcl b/tests/sentinel/tests/includes/utils.tcl
index 5909ab0cd9..7d963de19d 100644
--- a/tests/sentinel/tests/includes/utils.tcl
+++ b/tests/sentinel/tests/includes/utils.tcl
@@ -14,7 +14,7 @@ proc verify_sentinel_auto_discovery {} {
set sentinels [llength $::sentinel_instances]
foreach_sentinel_id id {
wait_for_condition 1000 50 {
- [dict get [S $id SENTINEL MASTER mymaster] num-other-sentinels] == ($sentinels-1)
+ [dict get [S $id SENTINEL PRIMARY mymaster] num-other-sentinels] == ($sentinels-1)
} else {
fail "At least some sentinel can't detect some other sentinel"
}