Skip to content

Commit

Permalink
[PLAT-14783] [PGParity] After Edit RR cores scale up on PG Parity ena…
Browse files Browse the repository at this point in the history
…bled cluster, the RR node does not have PGP gflags

Summary:
Fixed clone method for SpecificGFlags which was omiting pg groups. This led to incorrect calculation of previous
gflags (and thus incorrect behavior of resize node)

Test Plan: sbt test

Reviewers: nbhatia, cwang

Reviewed By: nbhatia

Subscribers: yugaware

Differential Revision: https://phorge.dev.yugabyte.com/D36960
  • Loading branch information
yorq committed Aug 1, 2024
1 parent 63f471a commit 3040472
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -793,8 +793,9 @@ private void writeGFlagsToFile(
if (additionalGFlags != null && serverType != UniverseTaskBase.ServerType.CONTROLLER) {
gflagsToWrite.putAll(additionalGFlags.getPerProcessFlags().value.get(serverType));
}
log.debug("Write gflags {} to file {}", gflagsToWrite, serverType);
File flagFileTmpPath = new File(getNodeGFlagsFile(userIntent, serverType, nodeInfo));
String fileName = getNodeGFlagsFile(userIntent, serverType, nodeInfo);
log.debug("Write gflags {} for {} to file {}", gflagsToWrite, serverType, fileName);
File flagFileTmpPath = new File(fileName);
if (!flagFileTmpPath.exists()) {
flagFileTmpPath.getParentFile().mkdirs();
flagFileTmpPath.createNewFile();
Expand Down Expand Up @@ -898,7 +899,11 @@ private ShellResponse successResponse(JsonNode jsonNode) {

public String getNodeRoot(UniverseDefinitionTaskParams.UserIntent userIntent, NodeInfo nodeInfo) {
String binDir = getCloudInfo(userIntent).getDataHomeDir();
return binDir + "/" + nodeInfo.ip + "-" + nodeInfo.name.substring(nodeInfo.name.length() - 2);
String suffix = nodeInfo.name.substring(nodeInfo.name.length() - 2);
if (nodeInfo.name.contains("readonly")) {
suffix = "rr-" + suffix;
}
return binDir + "/" + nodeInfo.ip + "-" + suffix;
}

public String getNodeRoot(UniverseDefinitionTaskParams.UserIntent userIntent, String nodeName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ public SpecificGFlags clone() {
newValue.perAZ.put(k, clone(v));
});
}
newValue.gflagGroups = new ArrayList<>(gflagGroups == null ? new ArrayList<>() : gflagGroups);
return newValue;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ public class ResizeNodeParams extends UpgradeWithGFlags {
Common.CloudType.gcp,
Common.CloudType.aws,
Common.CloudType.kubernetes,
Common.CloudType.azu);
Common.CloudType.azu,
Common.CloudType.local);

private boolean forceResizeNode;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,22 @@
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsString;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;

import com.yugabyte.yw.commissioner.tasks.CommissionerBaseTest;
import com.yugabyte.yw.commissioner.tasks.UniverseTaskBase;
import com.yugabyte.yw.common.LocalNodeManager;
import com.yugabyte.yw.common.PlacementInfoUtil;
import com.yugabyte.yw.common.config.UniverseConfKeys;
import com.yugabyte.yw.common.gflags.GFlagGroup;
import com.yugabyte.yw.common.gflags.GFlagsUtil;
import com.yugabyte.yw.common.gflags.SpecificGFlags;
import com.yugabyte.yw.common.utils.Pair;
import com.yugabyte.yw.controllers.UniverseControllerRequestBinder;
import com.yugabyte.yw.forms.GFlagsUpgradeParams;
import com.yugabyte.yw.forms.ResizeNodeParams;
import com.yugabyte.yw.forms.UniverseDefinitionTaskParams;
import com.yugabyte.yw.forms.UniverseResp;
import com.yugabyte.yw.forms.UpgradeTaskParams;
Expand Down Expand Up @@ -108,6 +112,55 @@ public void testRollingUpgradeWithRRInherited() throws InterruptedException {
verifyPayload();
}

@Test
public void testResizeWithRR() throws InterruptedException {
UniverseDefinitionTaskParams.UserIntent userIntent = getDefaultUserIntent();
userIntent.specificGFlags.setGflagGroups(
Collections.singletonList(GFlagGroup.GroupName.ENHANCED_POSTGRES_COMPATIBILITY));
Universe universe = createUniverse(userIntent);
UniverseDefinitionTaskParams.UserIntent rrIntent = getDefaultUserIntent();
rrIntent.numNodes = 1;
rrIntent.replicationFactor = 1;
rrIntent.specificGFlags =
SpecificGFlags.construct(
Collections.singletonMap("max_log_size", "1805"),
Collections.singletonMap("log_max_seconds_to_retain", "86333"));
addReadReplica(universe, rrIntent);
universe = Universe.getOrBadRequest(universe.getUniverseUUID());
UniverseDefinitionTaskParams.Cluster rrCluster =
universe.getUniverseDetails().getReadOnlyClusters().get(0);
NodeDetails primary =
universe.getNodesByCluster(universe.getUniverseDetails().getPrimaryCluster().uuid).get(0);
NodeDetails rrNode = universe.getNodesByCluster(rrCluster.uuid).get(0);

assertTrue(
getVarz(primary, universe, UniverseTaskBase.ServerType.TSERVER)
.containsKey("yb_enable_read_committed_isolation"));
assertTrue(
getVarz(rrNode, universe, UniverseTaskBase.ServerType.TSERVER)
.containsKey("yb_enable_read_committed_isolation"));

ResizeNodeParams resizeParams =
getUpgradeParams(
universe, UpgradeTaskParams.UpgradeOption.ROLLING_UPGRADE, ResizeNodeParams.class);
resizeParams.clusters = Collections.singletonList(rrCluster);
rrCluster.userIntent.instanceType = instanceType2.getInstanceTypeCode();
GFlagsUtil.removeGFlag(
rrCluster.userIntent, "log_max_seconds_to_retain", UniverseTaskBase.ServerType.TSERVER);

TaskInfo taskInfo =
waitForTask(
upgradeUniverseHandler.resizeNode(
resizeParams, customer, Universe.getOrBadRequest(universe.getUniverseUUID())),
universe);
assertEquals(TaskInfo.State.Success, taskInfo.getTaskState());
universe = Universe.getOrBadRequest(universe.getUniverseUUID());
Map<String, String> newValues =
getDiskFlags(rrNode, universe, UniverseTaskBase.ServerType.TSERVER);
assertTrue(newValues.containsKey("yb_enable_read_committed_isolation"));
assertFalse(newValues.containsKey("log_max_seconds_to_retain"));
}

@Test
public void testRollingUpgradeWithRR() throws InterruptedException {
Universe universe = createUniverse(getDefaultUserIntent());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,13 @@ public abstract class LocalProviderUniverseTestBase extends PlatformGuiceApplica

private static final String DEFAULT_BASE_DIR = "/tmp/local";
protected static String YBC_VERSION;
public static String DB_VERSION = "2.20.5.0-b72";
public static String DB_VERSION = "2024.1.0.0-b129";
private static final String DOWNLOAD_URL =
"https://downloads.yugabyte.com/releases/2.20.5.0/" + "yugabyte-2.20.5.0-b72-%s-%s.tar.gz";
"https://downloads.yugabyte.com/releases/2024.1.0.0/"
+ "yugabyte-"
+ DB_VERSION
+ "-%s-%s.tar.gz";

private static final String YBC_BASE_S3_URL = "https://downloads.yugabyte.com/ybc/";
private static final String YBC_BIN_ENV_KEY = "YBC_PATH";
private static final boolean KEEP_FAILED_UNIVERSE = true;
Expand Down

0 comments on commit 3040472

Please sign in to comment.