Skip to content

Commit

Permalink
[PLAT-16250] Retry of edit universe blacklists the already added or j…
Browse files Browse the repository at this point in the history
…oined tservers

Summary: By the time a new tserver is started, it is already blacklisted. This state is used to not blacklist the node again on retry if it is already started.

Test Plan:
Manually tested by aborting and retrying the task at
1. Before blacklisting.
2. After blacklisting but before it is removed from the blacklist.
3. Retry to have it removed from the blacklist.

Reviewers: cwang, yshchetinin, sanketh

Reviewed By: cwang

Subscribers: yugaware

Differential Revision: https://phorge.dev.yugabyte.com/D40738
  • Loading branch information
nkhogen committed Dec 18, 2024
1 parent d7202ab commit d0bfa4d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
package com.yugabyte.yw.commissioner.tasks;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.Sets;
import com.yugabyte.yw.commissioner.BaseTaskDependencies;
import com.yugabyte.yw.commissioner.TaskExecutor;
import com.yugabyte.yw.commissioner.UpgradeTaskBase;
Expand All @@ -26,6 +27,7 @@
import java.util.Collection;
import java.util.Collections;
import java.util.EnumSet;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -282,11 +284,19 @@ protected void editCluster(

Set<NodeDetails> newTservers = PlacementInfoUtil.getTserversToProvision(nodes);
if (!newTservers.isEmpty()) {
// Blacklist all the new tservers before starting so that they do not join.
// Idempotent as same set of servers are blacklisted.
createModifyBlackListTask(
newTservers /* addNodes */, null /* removeNodes */, false /* isLeaderBlacklist */)
.setSubTaskGroupType(SubTaskGroupType.ConfigureUniverse);
Set<NodeDetails> nonLiveNewTservers =
isFirstTry()
? newTservers
: new HashSet<>(Sets.difference(newTservers, getLiveTserverNodes(universe)));
if (!nonLiveNewTservers.isEmpty()) {
// Blacklist all the new stopped tservers before starting so that they do not join.
// Idempotent as same set of servers are blacklisted.
createModifyBlackListTask(
nonLiveNewTservers /* addNodes */,
null /* removeNodes */,
false /* isLeaderBlacklist */)
.setSubTaskGroupType(SubTaskGroupType.ConfigureUniverse);
}

// Make sure clock skew is low enough.
createWaitForClockSyncTasks(universe, newTservers)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
import org.yb.client.ChangeMasterClusterConfigResponse;
import org.yb.client.GetLoadMovePercentResponse;
import org.yb.client.GetMasterClusterConfigResponse;
import org.yb.client.ListLiveTabletServersResponse;
import org.yb.client.ListMasterRaftPeersResponse;
import org.yb.client.ListTabletServersResponse;
import org.yb.master.CatalogEntityInfo;
Expand Down Expand Up @@ -218,9 +219,12 @@ public void setUp() {
when(mockClient.waitForAreLeadersOnPreferredOnlyCondition(anyLong())).thenReturn(true);
mockClockSyncResponse(mockNodeUniverseManager);
mockLocaleCheckResponse(mockNodeUniverseManager);

when(mockClient.getLoadMoveCompletion())
.thenReturn(new GetLoadMovePercentResponse(0, "", 100.0, 0, 0, null));
ListLiveTabletServersResponse mockListLiveTabletServersResponse =
mock(ListLiveTabletServersResponse.class);
when(mockListLiveTabletServersResponse.getTabletServers()).thenReturn(new ArrayList<>());
when(mockClient.listLiveTabletServers()).thenReturn(mockListLiveTabletServersResponse);
} catch (Exception e) {
fail();
}
Expand Down

0 comments on commit d0bfa4d

Please sign in to comment.