Skip to content

Commit

Permalink
[#25578] YSQL: Move enable_ysql_conn_mgr out of preview
Browse files Browse the repository at this point in the history
Summary:
Move `enable_ysql_conn_mgr` out of preview. Removed `enable_ysql_conn_mgr` gflag from preview, and ported all the related tests.

By default this flag would remain set to false. Setting it to true would be done for GA.
Jira: DB-14832

Test Plan: Jenkins: enable connection manager, all tests

Reviewers: skumar, rbarigidad, hsunder, skurapati, shikhar.sahay

Reviewed By: hsunder

Subscribers: ybase, yugaware

Differential Revision: https://phorge.dev.yugabyte.com/D41158
  • Loading branch information
Devansh Saxena committed Jan 13, 2025
1 parent ca6dfe4 commit 2baf0ea
Show file tree
Hide file tree
Showing 16 changed files with 7 additions and 68 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,6 @@ public void startTServer(Map<String, String> tserverFlags,
if (clusterParameters.startYsqlConnMgr) {
tsCmdLine.add("--ysql_conn_mgr_port=" + Integer.toString(ysqlConnMgrPort));
tsCmdLine.add("--enable_ysql_conn_mgr=true");
tsCmdLine.add("--allowed_preview_flags_csv=enable_ysql_conn_mgr");
}

if (tserverFlags != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,6 @@
public class TestPgAlterTable extends BasePgSQLTest {
private static final Logger LOG = LoggerFactory.getLogger(TestPgAlterTable.class);

@Override
protected Map<String, String> getTServerFlags() {
Map<String, String> flagMap = super.getTServerFlags();
if (isTestRunningWithConnectionManager())
flagMap.put("allowed_preview_flags_csv", "enable_ysql_conn_mgr");
return flagMap;
}

@Test
public void testAddColumnIfNotExists() throws Exception {
testAddColumnIfNotExistsInternal(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ protected Map<String, String> getTServerFlags() {
flags.put("ysql_hba_conf", CUSTOM_PG_HBA_CONFIG);
if(isTestRunningWithConnectionManager()) {
flags.put("allowed_preview_flags_csv",
",enable_ysql_conn_mgr,ysql_conn_mgr_version_matching,"
"ysql_conn_mgr_version_matching,"
+ "ysql_conn_mgr_version_matching_connect_higher_version");
flags.put("enable_ysql_conn_mgr", "true");
flags.put("ysql_conn_mgr_version_matching", "true");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,6 @@ protected void customizeMiniClusterBuilder(MiniYBClusterBuilder builder) {
@Override
protected Map<String, String> getTServerFlags() {
Map<String, String> flagMap = super.getTServerFlags();
if (isTestRunningWithConnectionManager()) {
flagMap.put("allowed_preview_flags_csv", "enable_ysql_conn_mgr");
}
flagMap.put("ysql_enable_colocated_tables_with_tablespaces", "true");
return flagMap;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,6 @@
*/
@RunWith(value = YBTestRunner.class)
public class TestPgRegressPublication extends BasePgRegressTest {
@Override
protected Map<String, String> getTServerFlags() {
Map<String, String> flagMap = super.getTServerFlags();
if (isTestRunningWithConnectionManager()) {
flagMap.put("allowed_preview_flags_csv", "enable_ysql_conn_mgr");
}
return flagMap;
}

@Override
public int getTestMethodTimeoutSec() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,6 @@ public int getTestMethodTimeoutSec() {
return 1800;
}

@Override
protected Map<String, String> getTServerFlags() {
Map<String, String> flagMap = super.getTServerFlags();
if (isTestRunningWithConnectionManager())
flagMap.put("allowed_preview_flags_csv", "enable_ysql_conn_mgr");
return flagMap;
}

@Test
public void testPgRegressTable() throws Exception {
runPgRegressTest("yb_replica_identity_schedule");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ protected Map<String, String> getTServerFlags() {
Map<String, String> flagMap = super.getTServerFlags();

if (isTestRunningWithConnectionManager()) {
flagMap.put("allowed_preview_flags_csv",
"enable_ysql_conn_mgr");
flagMap.put("enable_ysql_conn_mgr", "true");
}
flagMap.put(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ protected Map<String, String> getMasterFlags() {
@Override
protected Map<String, String> getTServerFlags() {
Map<String, String> flagMap = super.getTServerFlags();
if (isTestRunningWithConnectionManager()) {
flagMap.put("allowed_preview_flags_csv", "enable_ysql_conn_mgr");
}
flagMap.put("enable_pg_cron", "true");
return flagMap;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ protected int getInitialNumTServers() {
protected Map<String, String> getTServerFlags() {
Map<String, String> flagMap = super.getTServerFlags();
if (isTestRunningWithConnectionManager()) {
String preview_flags = "enable_ysql_conn_mgr";
flagMap.put("allowed_preview_flags_csv",preview_flags);
flagMap.put("ysql_conn_mgr_stats_interval", "1");
}
flagMap.put(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -401,12 +401,6 @@ public void createIndexViolatingUniqueness() throws Exception {
assertTrue(miniCluster.getClient().setFlag(hp,
"enable_transactional_ddl_gc", "false"));
}
if (isTestRunningWithConnectionManager()) {
for (HostAndPort hp : miniCluster.getTabletServers().keySet()) {
assertTrue(miniCluster.getClient().setFlag(hp,
"allowed_preview_flags_csv", "enable_ysql_conn_mgr"));
}
}
try (Statement stmt = connection.createStatement()) {
runInvalidQuery(
stmt,
Expand Down
12 changes: 2 additions & 10 deletions java/yb-pgsql/src/test/java/org/yb/pgsql/TestYbAsh.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,9 @@ public class TestYbAsh extends BasePgSQLTest {
private static final int ASH_SAMPLE_SIZE = 500;
private static final String ASH_VIEW = "yb_active_session_history";

private Map<String, String> getTServerFlagMapWithPreviewFlags() throws Exception {
Map<String, String> flagMap = super.getTServerFlags();
if (isTestRunningWithConnectionManager()) {
flagMap.put("allowed_preview_flags_csv", "enable_ysql_conn_mgr");
}
return flagMap;
}

private void setAshConfigAndRestartCluster(
int sampling_interval, int sample_size, int circular_buffer_size) throws Exception {
Map<String, String> flagMap = getTServerFlagMapWithPreviewFlags();
Map<String, String> flagMap = super.getTServerFlags();
flagMap.put("ysql_yb_enable_ash", "true");
flagMap.put("ysql_yb_ash_sampling_interval_ms", String.valueOf(sampling_interval));
flagMap.put("ysql_yb_ash_sample_size", String.valueOf(sample_size));
Expand All @@ -64,7 +56,7 @@ private void setAshConfigAndRestartCluster(
}

private void resetAshConfigAndRestartCluster() throws Exception {
Map<String, String> flagMap = getTServerFlagMapWithPreviewFlags();
Map<String, String> flagMap = super.getTServerFlags();
flagMap.put("ysql_yb_enable_ash", "false");
restartClusterWithFlags(Collections.emptyMap(), flagMap);
}
Expand Down
1 change: 0 additions & 1 deletion java/yb-pgsql/src/test/java/org/yb/pgsql/TestYsqlDump.java
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ public void ysqlDumpColocatedDB() throws Exception {
public void ysqlDumpColocatedTablesWithTablespaces() throws Exception {
markClusterNeedsRecreation();
restartClusterWithClusterBuilder(cb -> {
cb.addCommonFlag("allowed_preview_flags_csv", "enable_ysql_conn_mgr");
cb.addCommonFlag("ysql_enable_colocated_tables_with_tablespaces", "true");
cb.addCommonTServerFlag("placement_cloud", "testCloud");
cb.addCommonTServerFlag("placement_region", "testRegion");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ protected Map<String, String> getTServerFlags() {
Map<String, String> flagMap = super.getTServerFlags();

flagMap.put("enable_ysql_conn_mgr", "true");
flagMap.put("allowed_preview_flags_csv", "enable_ysql_conn_mgr");
flagMap.put("ysql_conn_mgr_dowarmup", "false");
if (warmup_random_mode) {
flagMap.put("TEST_ysql_conn_mgr_dowarmup_all_pools_mode", "random");
Expand Down Expand Up @@ -139,18 +138,18 @@ protected void enableVersionMatchingAndRestartCluster(boolean higher_version_mat
throws Exception {
Map<String, String> tsFlagMap = new HashMap<>();
tsFlagMap.put("allowed_preview_flags_csv",
",enable_ysql_conn_mgr,ysql_conn_mgr_version_matching");
"ysql_conn_mgr_version_matching");
tsFlagMap.put("enable_ysql_conn_mgr", "true");
tsFlagMap.put("ysql_conn_mgr_version_matching", "true");

if (higher_version_matching) {
tsFlagMap.put("allowed_preview_flags_csv",
",enable_ysql_conn_mgr,ysql_conn_mgr_version_matching,"
"ysql_conn_mgr_version_matching,"
+ "ysql_conn_mgr_version_matching_connect_higher_version");
tsFlagMap.put("ysql_conn_mgr_version_matching_connect_higher_version", "true");
} else {
tsFlagMap.put("allowed_preview_flags_csv",
",enable_ysql_conn_mgr,ysql_conn_mgr_version_matching,"
"ysql_conn_mgr_version_matching,"
+ "ysql_conn_mgr_version_matching_connect_higher_version");
tsFlagMap.put("ysql_conn_mgr_version_matching_connect_higher_version", "false");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ public TestYugabytedConnMgr() {
clusterConfigurations = new ArrayList<>();
Map<String, String> tserverFlags = new HashMap<>();
tserverFlags.put("enable_ysql_conn_mgr", "true");
tserverFlags.put("allowed_preview_flags_csv", "{enable_ysql_conn_mgr}");

for (int i = 0; i < clusterParameters.numNodes; i++) {
MiniYugabytedNodeConfigurations nodeConfigurations =
Expand Down Expand Up @@ -59,25 +58,17 @@ public void testConnMgr() throws Exception {
JSONObject jsonObject = new JSONObject(jsonResponse);
JSONArray flags = jsonObject.getJSONArray("flags");

boolean allowedPreviewFlagsCsvFound = false;
boolean enableYsqlConnMgrFound = false;

for (int i = 0; i < flags.length(); i++) {
JSONObject flag = flags.getJSONObject(i);
if (flag.getString("name").equals("allowed_preview_flags_csv") &&
flag.getString("value").equals("enable_ysql_conn_mgr") &&
flag.getString("type").equals("Custom")) {
allowedPreviewFlagsCsvFound = true;
}
if (flag.getString("name").equals("enable_ysql_conn_mgr") &&
flag.getString("value").equals("true") &&
flag.getString("type").equals("Custom")) {
enableYsqlConnMgrFound = true;
}
}

assertTrue("allowed_preview_flags_csv flag should be found",
allowedPreviewFlagsCsvFound);
assertTrue("enable_ysql_conn_mgr flag should be found",
enableYsqlConnMgrFound);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1258,7 +1258,6 @@ private String generateHelmOverride() {
// If given, use it as an override.
int internalYsqlServerRpcPort = DEFAULT_INTERNAL_YSQL_SERVER_RPC_PORT;
tserverGFlags.put("enable_ysql_conn_mgr", "true");
tserverGFlags.put("allowed_preview_flags_csv", "enable_ysql_conn_mgr");
tserverGFlags.put("ysql_conn_mgr_port", String.valueOf(ysqlServerRpcPort));
tserverGFlags.put(
"pgsql_proxy_bind_address",
Expand Down
2 changes: 1 addition & 1 deletion src/yb/tserver/tablet_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ DEFINE_UNKNOWN_int32(cql_proxy_webserver_port, 0, "Webserver port for CQL proxy"
DEFINE_NON_RUNTIME_string(pgsql_proxy_bind_address, "", "Address to bind the PostgreSQL proxy to");
DECLARE_int32(pgsql_proxy_webserver_port);

DEFINE_NON_RUNTIME_PREVIEW_bool(enable_ysql_conn_mgr, false,
DEFINE_NON_RUNTIME_bool(enable_ysql_conn_mgr, false,
"Enable Ysql Connection Manager for the cluster. Tablet Server will start a "
"Ysql Connection Manager process as a child process.");

Expand Down

0 comments on commit 2baf0ea

Please sign in to comment.