Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#20393][conn-mgr] Enabled testRevokeLoginMidSession test with conn-mgr
Summary: This diff enables `TestPgAuthorization.testRevokeLoginMidSession` to run with connection manager. **What this test do** - Creates a custom role `test_role` with login permission. - Create a PG session with role `test_role` - Then Alters the `test_role` to from LOGIN perm to NOLOGIN. - The existing session created before ALTER command should work while any attempt to create new session should fail. **Why it was failing with connection manager** This test was failing flakily with connection manager because in test setup, `ysql_conn_mgr_dowarmup_all_pools_mode` is set to random which we create `ysql_conn_mgr_min_conns_per_db` (default: 3) number of server connections in any pool whenever there is a requirement to create the first backend process in that particular pool. The first backend is created before ALTER ROLE is done at this line. ``` Connection connection2 = getConnectionBuilder().withTServer(1) .withUser("test_role").connect(); ``` So there one backend created but 3 server connection objects in server pool for this route (yugabyte, test_role). To get server connection for query after ALTER command. ``` // Open session is still usable, even after the alter. statement2.execute("SELECT count(*) FROM pg_class"); ``` So there is a probability that there would be an attempt to spawn a new backend but that would fail as login permission is revoked. **Fix added ** Diff D40621 enabled complete TestPgAuthorization test suite to run with version matching routing. Due to this now the server connection corresponding to the spawned backend will be selected to run the query instead of selecting randomly. Side fix: Fixes a debug log in odyssey ``` od_debug(&instance->logger, "auth backend", client, server, "auth's backend logical client version = %d", server->logical_client_version); client->logical_client_version = server->logical_client_version; ``` Test Plan: Jenkins: enable connection manager, all tests ./yb_build.sh release --enable-ysql-conn-mgr-test --java-test org.yb.pgsql.TestPgAuthorization#testRevokeLoginMidSession -n 50 Reviewers: mkumar, rbarigidad, skumar Reviewed By: rbarigidad Subscribers: yql Differential Revision: https://phorge.dev.yugabyte.com/D40701
- Loading branch information