Skip to content

Commit

Permalink
[ #21499] YSQL: Skipping the test with connection manager as they are…
Browse files Browse the repository at this point in the history
… unsuitable

Summary:
This diff fixes the following tests with ysql connection manager by skipping them from running with connection manager.

  # `org.yb.pgsql.TestDropTableWithConcurrentTxn#testDmlTxnDrop`
  # `org.yb.pgsql.TestDropTableWithConcurrentTxn#testDmlTxnDropWithReadCommitted`
  # `org.yb.pgsql.TestAlterTableWithConcurrentTxn#testDmlTransactionAfterAlterOnCurrentResourceWithCachedMetadata`

Above tests are not suitable while running with ysql connection manager. The tests are designed in a way which requires each client connection to have a dedicated backend process associated which is not the case with ysql connection manager. On executing any DML on a particular backend process the meta data of the object is cached onto the backend process. The test is designed with the following premise:

  # when withCachedMetadata is true, then the same backend processes the queries in a session
  # withCachedMetadata is false, a new backend processes queries for a new connection (session)

In both above cases, the premise cannot be guaranteed when run with Connection Manager, hence rendering the tests unsuitable for running with Connection Manager.
Jira: DB-10383

Test Plan:
Jenkins: all tests, enable connection manager

Ensure below test runs successfully with ysql connection manager:

  # `./yb_build.sh --enable-ysql-conn-mgr-test --java-test org.yb.pgsql.TestDropTableWithConcurrentTxn#testDmlTxnDrop`
  #  `./yb_build.sh --enable-ysql-conn-mgr-test --java-test org.yb.pgsql.TestDropTableWithConcurrentTxn#testDmlTxnDropWithReadCommitted`
  # `./yb_build.sh --enable-ysql-conn-mgr-test --java-test org.yb.pgsql.TestAlterTableWithConcurrentTxn#testDmlTransactionAfterAlterOnCurrentResourceWithCachedMetadata`

Reviewers: skumar, asrinivasan

Reviewed By: asrinivasan

Differential Revision: https://phorge.dev.yugabyte.com/D36766
  • Loading branch information
Manav Kumar committed Jul 24, 2024
1 parent fdffc33 commit f0b3c46
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
9 changes: 9 additions & 0 deletions java/yb-pgsql/src/test/java/org/yb/pgsql/BasePgSQLTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,15 @@ public class BasePgSQLTest extends BaseMiniClusterTest {
" connections will share the same physical connection in a single threaded test if" +
" no active transactions are there on the first connection";

protected static final String CANNOT_GURANTEE_EXPECTED_PHYSICAL_CONN_FOR_CACHE =
"Test is designed in a way which requires every logical connection to have a dedicated " +
"physical connection. In the test backends are loaded with meta data of the object " +
"(tables) on executing DML with the premise (a) when withCachedMetadata is true, then " +
"the same backend processes the queries in a session (b) when withCachedMetadata is " +
"false, a new backend processes queries for a new connection (session). in both these " +
"cases the premise cannot be guaranteed when run with Connection Manager, hence skipping " +
"the tests with connection manager";

protected static final String LESSER_PHYSICAL_CONNS =
"Skipping this test with Ysql Connection Manager as logical connections " +
"created are lesser than physical connections and the real maximum limit for creating " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,8 @@ public void testDmlTransactionBeforeAlterOnCurrentResource() throws Exception {

@Test
public void testDmlTransactionAfterAlterOnCurrentResourceWithCachedMetadata() throws Exception {
assumeFalse(BasePgSQLTest.CANNOT_GURANTEE_EXPECTED_PHYSICAL_CONN_FOR_CACHE,
isTestRunningWithConnectionManager());
// Scenario 2. Execute any DML type after DDL.
// a) For PG metadata cached table:
// Transaction should conflict since we are using
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
//
package org.yb.pgsql;

import static org.junit.Assume.assumeFalse;
import static org.yb.AssertionWrappers.assertEquals;
import static org.yb.AssertionWrappers.assertTrue;

Expand Down Expand Up @@ -395,11 +396,15 @@ public void testDmlTxnDropInternal() throws Exception {

@Test
public void testDmlTxnDrop() throws Exception {
assumeFalse(BasePgSQLTest.CANNOT_GURANTEE_EXPECTED_PHYSICAL_CONN_FOR_CACHE,
isTestRunningWithConnectionManager());
testDmlTxnDropInternal();
}

@Test
public void testDmlTxnDropWithReadCommitted() throws Exception {
assumeFalse(BasePgSQLTest.CANNOT_GURANTEE_EXPECTED_PHYSICAL_CONN_FOR_CACHE,
isTestRunningWithConnectionManager());
restartClusterWithFlags(Collections.emptyMap(),
Collections.singletonMap("yb_enable_read_committed_isolation",
"true"));
Expand Down

0 comments on commit f0b3c46

Please sign in to comment.