Skip to content

Commit

Permalink
[PLAT-13827][PLAT-13933]Software installation must be skipped if a ma…
Browse files Browse the repository at this point in the history
…ster node is already configured on retry and Start node uses the wrong flag to check if ysql is enabled

Summary: Install software for master only if it is not yet configured.

Test Plan: Trivial change + itests

Reviewers: cwang, sanketh, yshchetinin

Reviewed By: cwang

Subscribers: yugaware

Differential Revision: https://phorge.dev.yugabyte.com/D34961
  • Loading branch information
nkhogen committed May 11, 2024
1 parent b430fa3 commit 7c9b8d5
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public void run() {
createConfigureServerTasks(nodeCollection, params -> params.updateMasterAddrsOnly = true)
.setSubTaskGroupType(SubTaskGroupType.StartingNodeProcesses);
// Start tservers on tserver nodes.
createStartTserverProcessTasks(nodeCollection, cluster.userIntent.isYSQLAuthEnabled());
createStartTserverProcessTasks(nodeCollection, cluster.userIntent.enableYSQL);

if (followerLagCheckEnabled) {
createCheckFollowerLagTask(currentNode, ServerType.TSERVER)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -632,12 +632,11 @@ public void createStartMasterOnNodeTasks(
boolean ignoreStopError) {

Set<NodeDetails> nodeSet = ImmutableSet.of(currentNode);

// Check that installed MASTER software version is consistent.
createSoftwareInstallTasks(
nodeSet, ServerType.MASTER, null, SubTaskGroupType.InstallingSoftware);

if (currentNode.masterState != MasterState.Configured) {
// Check that installed MASTER software version is consistent.
createSoftwareInstallTasks(
nodeSet, ServerType.MASTER, null, SubTaskGroupType.InstallingSoftware);

// TODO Configuration subtasks may be skipped if it is already a master.
// Update master configuration on the node.
createConfigureServerTasks(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyLong;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.net.HostAndPort;
Expand Down Expand Up @@ -130,6 +132,14 @@ public void setUp() {

setFollowerLagMock();
when(mockClient.getLeaderMasterHostAndPort()).thenReturn(HostAndPort.fromHost("10.0.0.1"));
doAnswer(
inv -> {
ObjectNode res = Json.mapper().createObjectNode();
res.put("response", "success");
return res;
})
.when(mockYsqlQueryExecutor)
.executeQueryInNodeShell(any(), any(), any(), anyBoolean());
}

private TaskInfo submitTask(NodeTaskParams taskParams, String nodeName) {
Expand Down Expand Up @@ -168,6 +178,7 @@ private Universe setMasters(Universe universe, String... nodeNames) {
TaskType.AnsibleConfigureServers,
TaskType.AnsibleClusterServerCtl,
TaskType.WaitForServer,
TaskType.WaitForServer,
TaskType.CheckFollowerLag,
TaskType.SetNodeState,
TaskType.SwamperTargetsFileUpdate,
Expand All @@ -180,7 +191,8 @@ private Universe setMasters(Universe universe, String... nodeNames) {
Json.toJson(ImmutableMap.of()),
Json.toJson(ImmutableMap.of()),
Json.toJson(ImmutableMap.of("process", "tserver", "command", "start")),
Json.toJson(ImmutableMap.of()),
Json.toJson(ImmutableMap.of("serverType", "TSERVER")),
Json.toJson(ImmutableMap.of("serverType", "YSQLSERVER")),
Json.toJson(ImmutableMap.of()),
Json.toJson(ImmutableMap.of("state", "Live")),
Json.toJson(ImmutableMap.of()),
Expand Down Expand Up @@ -211,6 +223,7 @@ private Universe setMasters(Universe universe, String... nodeNames) {
TaskType.AnsibleConfigureServers,
TaskType.AnsibleClusterServerCtl,
TaskType.WaitForServer,
TaskType.WaitForServer,
TaskType.CheckFollowerLag,
TaskType.SetNodeState,
TaskType.SwamperTargetsFileUpdate,
Expand All @@ -236,6 +249,7 @@ private Universe setMasters(Universe universe, String... nodeNames) {
Json.toJson(ImmutableMap.of()),
Json.toJson(ImmutableMap.of("process", "tserver", "command", "start")),
Json.toJson(ImmutableMap.of("serverType", "TSERVER")),
Json.toJson(ImmutableMap.of("serverType", "YSQLSERVER")),
Json.toJson(ImmutableMap.of()),
Json.toJson(ImmutableMap.of("state", "Live")),
Json.toJson(ImmutableMap.of()),
Expand Down

0 comments on commit 7c9b8d5

Please sign in to comment.