From a3a415e8435755b099e9b9864d0cc4a8232fe474 Mon Sep 17 00:00:00 2001 From: Sandeep Kumawat <2025sandeepkumawat@gmail.com> Date: Thu, 12 Oct 2023 16:42:57 +0530 Subject: [PATCH 1/2] Add a new GitHub workflow check designed to execute JDBC tests in parallel query mode (#1898) This pull request introduces a new GitHub workflow check designed to execute JDBC tests in parallel query mode. The primary objective of this GitHub check is to verify the execution of JDBC tests with parallel query mode enabled. Presently, certain JDBC tests are encountering issues, such as crashes, failures, or timeouts when executed with parallel query mode enabled. These problematic tests have been excluded from this workflow check. As we work towards resolving these issues in the future, we will gradually remove these excluded tests from the scheduling file. Task: BABEL-4451 Signed-off-by: Sandeep Kumawat --- .../install-extensions/action.yml | 6 +- .github/scripts/create_extension.sql | 10 + .../jdbc-tests-with-parallel-query.yml | 100 +++++ test/JDBC/README.md | 32 ++ test/JDBC/init.sh | 51 ++- test/JDBC/parallel_query_jdbc_schedule | 364 ++++++++++++++++++ .../src/main/java/com/sqlsamples/Config.java | 2 + test/JDBC/src/main/resources/config.txt | 4 + .../java/com/sqlsamples/TestQueryFile.java | 14 + 9 files changed, 580 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/jdbc-tests-with-parallel-query.yml create mode 100644 test/JDBC/parallel_query_jdbc_schedule diff --git a/.github/composite-actions/install-extensions/action.yml b/.github/composite-actions/install-extensions/action.yml index b5fff221fb..cf84f3402d 100644 --- a/.github/composite-actions/install-extensions/action.yml +++ b/.github/composite-actions/install-extensions/action.yml @@ -9,6 +9,10 @@ inputs: description: 'Database migration mode' required: no default: "single-db" + parallel_query_mode: + description: 'Postgres Parallel Query Mode' + required: no + default: false runs: using: "composite" @@ -26,6 +30,6 @@ runs: sudo echo "host all all $ipaddress/32 trust" >> pg_hba.conf ~/${{inputs.install_dir}}/bin/pg_ctl -D ~/${{inputs.install_dir}}/data/ -l logfile restart cd ~/work/babelfish_extensions/babelfish_extensions/ - sudo ~/${{inputs.install_dir}}/bin/psql -d postgres -U runner -v user="jdbc_user" -v db="jdbc_testdb" -v migration_mode=${{inputs.migration_mode}} -f .github/scripts/create_extension.sql + sudo ~/${{inputs.install_dir}}/bin/psql -d postgres -U runner -v user="jdbc_user" -v db="jdbc_testdb" -v migration_mode=${{inputs.migration_mode}} -v parallel_query_mode=${{inputs.parallel_query_mode}} -f .github/scripts/create_extension.sql sqlcmd -S localhost -U "jdbc_user" -P 12345678 -Q "SELECT @@version GO" shell: bash diff --git a/.github/scripts/create_extension.sql b/.github/scripts/create_extension.sql index 1849f88b28..2b8c18449e 100644 --- a/.github/scripts/create_extension.sql +++ b/.github/scripts/create_extension.sql @@ -8,5 +8,15 @@ GRANT ALL ON SCHEMA sys to :user; ALTER USER :user CREATEDB; ALTER SYSTEM SET babelfishpg_tsql.database_name = :db; ALTER SYSTEM SET babelfishpg_tsql.migration_mode = :'migration_mode'; + +\if :parallel_query_mode + ALTER SYSTEM SET parallel_setup_cost = 0; + ALTER SYSTEM SET parallel_tuple_cost = 0; + ALTER SYSTEM SET min_parallel_index_scan_size = 0; + ALTER SYSTEM SET min_parallel_table_scan_size = 0; + ALTER SYSTEM SET force_parallel_mode = 1; + ALTER SYSTEM SET max_parallel_workers_per_gather = 4; +\endif + SELECT pg_reload_conf(); CALL SYS.INITIALIZE_BABELFISH(:'user'); diff --git a/.github/workflows/jdbc-tests-with-parallel-query.yml b/.github/workflows/jdbc-tests-with-parallel-query.yml new file mode 100644 index 0000000000..90c1e5b1ae --- /dev/null +++ b/.github/workflows/jdbc-tests-with-parallel-query.yml @@ -0,0 +1,100 @@ +name: JDBC Tests With Parallel Query +on: [push, pull_request] + +jobs: + run-babelfish-jdbc-tests-with-parallel-query-mode: + env: + INSTALL_DIR: psql + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + id: checkout + + - name: Install Dependencies + id: install-dependencies + if: always() + uses: ./.github/composite-actions/install-dependencies + + - name: Build Modified Postgres + id: build-modified-postgres + if: always() && steps.install-dependencies.outcome == 'success' + uses: ./.github/composite-actions/build-modified-postgres + + - name: Compile ANTLR + id: compile-antlr + if: always() && steps.build-modified-postgres.outcome == 'success' + uses: ./.github/composite-actions/compile-antlr + + - name: Build Extensions + id: build-extensions + if: always() && steps.compile-antlr.outcome == 'success' + uses: ./.github/composite-actions/build-extensions + + - name: Build tds_fdw Extension + id: build-tds_fdw-extension + if: always() && steps.build-extensions.outcome == 'success' + uses: ./.github/composite-actions/build-tds_fdw-extension + + - name: Build PostGIS Extension + id: build-postgis-extension + if: always() && steps.build-tds_fdw-extension.outcome == 'success' + uses: ./.github/composite-actions/build-postgis-extension + + - name: Install Extensions + id: install-extensions + if: always() && steps.build-postgis-extension.outcome == 'success' + uses: ./.github/composite-actions/install-extensions + with: + parallel_query_mode: true + + - name: Run JDBC Tests + id: jdbc + if: always() && steps.install-extensions.outcome == 'success' + timeout-minutes: 120 + run: | + export PATH=~/${{env.INSTALL_DIR}}/bin:$PATH + export PG_SRC=~/work/babelfish_extensions/postgresql_modified_for_babelfish + cd test/JDBC/ + # set env variable isParallelQueryMode to true to let jdbc know not to run tests of file parallel_query_jdbc_schedule + export isParallelQueryMode=true + mvn test + # reset env variable + unset isParallelQueryMode + + - name: Cleanup babelfish database + id: cleanup + if: always() && steps.install-extensions.outcome == 'success' + run: | + sudo ~/psql/bin/psql -d postgres -U runner -v user="jdbc_user" -v db="jdbc_testdb" -f .github/scripts/cleanup_babelfish_database.sql + + - name: Upload Log + if: always() && steps.jdbc.outcome == 'failure' + uses: actions/upload-artifact@v2 + with: + name: postgres-log + path: ~/psql/data/logfile + + # The test summary files contain paths with ':' characters, which is not allowed with the upload-artifact actions + - name: Rename Test Summary Files + id: test-file-rename + if: always() && steps.jdbc.outcome == 'failure' + run: | + cd test/JDBC/Info + timestamp=`ls -Art | tail -n 1` + cd $timestamp + mv $timestamp.diff ../output-diff.diff + mv "$timestamp"_runSummary.log ../run-summary.log + + - name: Upload Run Summary + if: always() && steps.test-file-rename == 'success' + uses: actions/upload-artifact@v2 + with: + name: run-summary.log + path: test/JDBC/Info/run-summary.log + + - name: Upload Output Diff + if: always() && steps.jdbc.outcome == 'failure' + uses: actions/upload-artifact@v2 + with: + name: output-diff.diff + path: test/JDBC/Info/output-diff.diff diff --git a/test/JDBC/README.md b/test/JDBC/README.md index 6c793d5944..00515ff4a6 100644 --- a/test/JDBC/README.md +++ b/test/JDBC/README.md @@ -18,6 +18,7 @@ The JDBC test framework for Babelfish uses the JDBC Driver for SQL Server for da - [IMPORTANT](#important) - [Adding the test cases](#adding-the-test-cases) - [Reading the console output and diff](#reading-the-console-output-and-diff) +- [Running Tests with Parallel Query Enabled](#running-tests-with-parallel-query-enabled) ## Running the test framework @@ -382,3 +383,34 @@ You will also be provided with the location of the `.diff` file containing the d - `mm` → minutes - `ss` → seconds - `SSS` → milliseconds + + +## Running Tests with Parallel Query Enabled + +After building the modified PostgreSQL engine and Babelfish extensions using the [online instructions](../../contrib/README.md), you must: +1. Create a PostgreSQL database and initialize Babelfish (if you already have a database with Babelfish initialized, you can omit this step or perform the cleanup steps before you initialize) to enable parallel query mode pass -enable_parallel_query flag when running ./init.sh + + ```bash + ./init.sh -enable_parallel_query + ``` +3. Before running JDBC tests, please take note that currently not all JDBC tests runs sucessfully with parallel query mode on. Certain JDBC tests are encountering issues, such as crashes, failures, or timeouts when executed with parallel query mode enabled. So we need these problematic tests to be excluded from running via jdbc framework. File `parallel_query_jdbc_schedule` contains test-cases names with prefix `ignore#!#` that are problematic and needs to be avoided from being run. To exclude these problematic tests from running via the JDBC framework, use the `isParallelQueryMode` environment variable. You can set it to `true`: + + ```bash + export isParallelQueryMode=true + # Verify if isParallelQueryMode is set to true + echo $isParallelQueryMode + ``` +4. Now Run the tests: + ```bash + mvn test + ``` +5. Cleanup all the objects, users, roles and databases created while running the tests: + ```bash + ./cleanup.sh + ``` +6. Please note that when you have completed testing with parallel query mode enabled, you should unset the `isParallelQueryMode` environment variable that was previously set to `true`. This ensures that all tests run in the normal Babelfish mode (without parallel query): + + ```bash + unset isParallelQueryMode + ``` +If you encounter failing or crashing tests in the "JDBC tests with parallel query" GitHub workflow, consider adding the names of these problematic test cases to the `parallel_query_jdbc_schedule` file. Prefix these test case names with `ignore#!#`. As we work towards resolving these issues in the future, we will gradually remove these excluded tests from the `parallel_query_jdbc_schedule` scheduling file. diff --git a/test/JDBC/init.sh b/test/JDBC/init.sh index 21ae67cede..89d65574cc 100755 --- a/test/JDBC/init.sh +++ b/test/JDBC/init.sh @@ -1,5 +1,24 @@ - -#create test user and database from psql terminal +# Default values +parallel_query_mode=false + +# Parse command-line flags/arguments +while [[ $# -gt 0 ]]; do + key="$1" + case $key in + -enable_parallel_query) + parallel_query_mode=true + shift + ;; + *) + # Unknown option + exit 1 + ;; + esac + shift +done + +# create test user and database from psql terminal +if [[ $parallel_query_mode = false ]]; then echo "============================== CREATING USER AND DATABASE ==============================" psql -U "$USER" -d postgres -a << EOF CREATE USER jdbc_user WITH SUPERUSER CREATEDB CREATEROLE PASSWORD '12345678' INHERIT; @@ -17,3 +36,31 @@ show babelfishpg_tsql.database_name; CALL sys.initialize_babelfish('jdbc_user'); EOF echo "============================= BUILDING JDBC TEST FRAMEWORK =============================" +fi + +# create test user and database from psql terminal when parallel query mode is on +if [[ $parallel_query_mode = true ]]; then +echo "============================== CREATING USER AND DATABASE ==============================" +psql -U "$USER" -d postgres -a << EOF +CREATE USER jdbc_user WITH SUPERUSER CREATEDB CREATEROLE PASSWORD '12345678' INHERIT; +DROP DATABASE IF EXISTS jdbc_testdb; +CREATE DATABASE jdbc_testdb OWNER jdbc_user; +\c jdbc_testdb +CREATE EXTENSION IF NOT EXISTS "babelfishpg_tds" CASCADE; +GRANT ALL ON SCHEMA sys to jdbc_user; +ALTER USER jdbc_user CREATEDB; +\c jdbc_testdb +ALTER SYSTEM SET babelfishpg_tsql.database_name = 'jdbc_testdb'; +ALTER SYSTEM SET parallel_setup_cost = 0; +ALTER SYSTEM SET parallel_tuple_cost = 0; +ALTER SYSTEM SET min_parallel_index_scan_size = 0; +ALTER SYSTEM SET min_parallel_table_scan_size = 0; +ALTER SYSTEM SET force_parallel_mode = 1; +ALTER SYSTEM SET max_parallel_workers_per_gather = 4; +SELECT pg_reload_conf(); +\c jdbc_testdb +show babelfishpg_tsql.database_name; +CALL sys.initialize_babelfish('jdbc_user'); +EOF +echo "============================= BUILDING JDBC TEST FRAMEWORK =============================" +fi diff --git a/test/JDBC/parallel_query_jdbc_schedule b/test/JDBC/parallel_query_jdbc_schedule new file mode 100644 index 0000000000..a4abceef5c --- /dev/null +++ b/test/JDBC/parallel_query_jdbc_schedule @@ -0,0 +1,364 @@ +# Schedule File for JDBC Test Framework for local run +# 1. Lines starting with '#' will be treated as comments +# 2. To run a postgres command: cmd#!#postgresql#!# +# 3. To run a T-SQL command: cmd#!#sqlserver#!# +# 4. Keyword "all" is equivalent to running all test files in input folder +# 5. To add a test, add test name (without extension, , and . For example if test file name is TestBigInt.txt write TestBigInt) on a new line +# These tests are crashing/failing with parallel query mode is on. + +# Group 1: lost connection to parallel worker BABEL-4393 +ignore#!#BABEL-3702-vu-verify +ignore#!#BABEL-728-vu-verify +ignore#!#BABEL-728 +ignore#!#BABEL-735 +ignore#!#BABEL-OPENJSON +ignore#!#Test-sp_addrolemember-vu-prepare +ignore#!#Test-sp_addrolemember-vu-verify +ignore#!#Test-sp_addrolemember-vu-cleanup +ignore#!#Test-sp_droprolemember-vu-prepare +ignore#!#Test-sp_droprolemember-vu-verify +ignore#!#Test-sp_droprolemember-vu-cleanup +ignore#!#TestDatetime-numeric-dateaddfunction-vu-prepare +ignore#!#TestDatetime-numeric-dateaddfunction-vu-verify +ignore#!#TestDatetime-numeric-representation-vu-prepare +ignore#!#TestDatetime-numeric-representation-vu-verify +ignore#!#babel_datatype_sqlvariant-vu-verify +ignore#!#babel_datatype_sqlvariant +ignore#!#babel_function +ignore#!#babel_function_string-vu-verify +ignore#!#babel_function_string +ignore#!#cast_numeric_types_to_datetime-vu-verify +ignore#!#cast_numeric_types_to_smalldatetime-vu-verify +ignore#!#sys-eomonth-vu-verify +ignore#!#babel_datetime2 +ignore#!#babel_collation + +# Group 2: cannot start subtransactions during a parallel operation BABEL-4394 +ignore#!#babel_format_standard_date_time +ignore#!#babel_format_standard_numeric +ignore#!#format-vu-verify + +# Group 3: “could not access file "pg_hint_plan": No such file or directory" BABEL-4395 +ignore#!#BABEL-3291 +ignore#!#BABEL-3292 +ignore#!#BABEL-3293 +ignore#!#BABEL-3294 +ignore#!#BABEL-3512 +ignore#!#BABEL-3592 +ignore#!#BABEL-4294-vu-verify + +# Group 4: Incorrect precision BABEL-4396 +ignore#!#BABEL-3943 +ignore#!#BABEL-785 +ignore#!#TestDecimal-vu-verify +ignore#!#TestNumeric-vu-verify +ignore#!#babel_613 +ignore#!#babel_datatype +ignore#!#babel_isnull +ignore#!#BABEL-3006 +ignore#!#BABEL-3147-vu-verify + +# Group 5: Need ORDER BY +ignore#!#BABEL-2514 +ignore#!#BABEL-2998 +ignore#!#BABEL-328-vu-verify +ignore#!#TestSQLQueries + +# Query plan change (needs verification) +ignore#!#BABEL-1363 +ignore#!#BABEL-2843 +ignore#!#BABEL-2844 +ignore#!#BABEL-2902 +ignore#!#BABEL-2903 +ignore#!#BABEL-3248 +ignore#!#BABEL-3295 +ignore#!#BABEL-3513-vu-prepare +ignore#!#BABEL-3513-vu-verify +ignore#!#BABEL-4261 +ignore#!#babel_collection +ignore#!#binary-index-vu-verify +ignore#!#pgr_select_into + +# Other or mixed issues +ignore#!#545_1 +ignore#!#8107_1 +ignore#!#8143_1 +ignore#!#BABEL-741-vu-verify +ignore#!#BABEL-1444 +ignore#!#BABEL-1621 +ignore#!#BABEL-2416 +ignore#!#BABEL-2812-vu-verify +ignore#!#BABEL-2833 +ignore#!#BABEL-4168-vu-prepare +ignore#!#BABEL-4168-vu-verify +ignore#!#BABEL-4168-vu-cleanup +ignore#!#BABEL-ROLE-MEMBER-vu-verify +ignore#!#BABEL-ROLE-MEMBER +ignore#!#BABEL-SP_PKEYS +ignore#!#BABEL-SP_STATISTICS +ignore#!#Test-sp_execute_postgresql +ignore#!#babel_datetime-vu-verify +ignore#!#babel_datetime +ignore#!#babel_extra_join_test_cases +ignore#!#babelfish_migration_mode-vu-verify +ignore#!#bbf_view_def +ignore#!#case_insensitive_collation-vu-prepare +ignore#!#case_insensitive_collation-vu-verify +ignore#!#four-part-names-vu-prepare +ignore#!#four-part-names-vu-verify +ignore#!#four-part-names-vu-cleanup +ignore#!#linked_servers-vu-prepare +ignore#!#linked_servers-vu-verify +ignore#!#linked_servers-vu-cleanup +ignore#!#linked_srv_4229-vu-prepare +ignore#!#linked_srv_4229-vu-verify +ignore#!#linked_srv_4229-vu-cleanup +ignore#!#openquery-vu-prepare +ignore#!#openquery-vu-verify +ignore#!#openquery-vu-cleanup +ignore#!#pg_stat_statements_tsql +ignore#!#pgr_select +ignore#!#pgr_select_distinct +ignore#!#sp_statistics_100 +ignore#!#sys-sp_pkeys-dep-vu-verify +ignore#!#sys-sp_statistics_100-vu-prepare +ignore#!#sys-sp_statistics_100-vu-verify +ignore#!#sys-sp_statistics_100-vu-cleanup +ignore#!#sys-sp_statistics_100-dep-vu-verify +ignore#!#BABEL-4264 + +# Test failures caused by babel_extra_join_test_cases_northwind failure +ignore#!#babelfish_sysdatabases-vu-prepare +ignore#!#babelfish_sysdatabases-vu-verify +ignore#!#babelfish_sysdatabases-vu-cleanup +ignore#!#column_domain_usage-vu-prepare +ignore#!#column_domain_usage-vu-verify +ignore#!#column_domain_usage-vu-cleanup +ignore#!#constraint_column_usage-vu-prepare +ignore#!#constraint_column_usage-vu-verify +ignore#!#constraint_column_usage-vu-cleanup +ignore#!#create_function_default_stable-vu-prepare +ignore#!#create_function_default_stable-vu-verify +ignore#!#create_function_default_stable-vu-cleanup +ignore#!#drop_database +ignore#!#jira-BABEL-3504-vu-prepare +ignore#!#jira-BABEL-3504-vu-verify +ignore#!#jira-BABEL-3504-vu-cleanup +ignore#!#objectproperty +ignore#!#objectpropertyex +ignore#!#ownership_restrictions_from_pg +ignore#!#ownership_restrictions_from_pg_su_user +ignore#!#psql_logical_babelfish_db +ignore#!#routines_definition-vu-prepare +ignore#!#routines_definition-vu-verify +ignore#!#routines_definition-vu-cleanup +ignore#!#routines_definition +ignore#!#schema_resolution_func-vu-prepare +ignore#!#schema_resolution_func-vu-verify +ignore#!#schema_resolution_func-vu-cleanup +ignore#!#sp_columns_100 +ignore#!#sp_proc +ignore#!#sys-all_sql_modules-vu-prepare +ignore#!#sys-all_sql_modules-vu-verify +ignore#!#sys-all_sql_modules-vu-cleanup +ignore#!#sys-configurations +ignore#!#sys-databases-vu-prepare +ignore#!#sys-databases-vu-verify +ignore#!#sys-databases-vu-cleanup +ignore#!#sys-databases-dep-vu-prepare +ignore#!#sys-databases-dep-vu-verify +ignore#!#sys-databases-dep-vu-cleanup +ignore#!#sys-events-vu-prepare +ignore#!#sys-events-vu-verify +ignore#!#sys-events-vu-cleanup +ignore#!#sys-foreign_key_columns-vu-prepare +ignore#!#sys-foreign_key_columns-vu-verify +ignore#!#sys-foreign_key_columns-vu-cleanup +ignore#!#sys-foreign_key_columns +ignore#!#sys-foreign_key_columns-dep-vu-prepare +ignore#!#sys-foreign_key_columns-dep-vu-verify +ignore#!#sys-foreign_key_columns-dep-vu-cleanup +ignore#!#sys-foreign_keys-vu-prepare +ignore#!#sys-foreign_keys-vu-verify +ignore#!#sys-foreign_keys-vu-cleanup +ignore#!#sys-foreign_keys +ignore#!#sys-foreign_keys-dep-vu-prepare +ignore#!#sys-foreign_keys-dep-vu-verify +ignore#!#sys-foreign_keys-dep-vu-cleanup +ignore#!#sys-has_perms_by_name-vu-prepare +ignore#!#sys-has_perms_by_name-vu-verify +ignore#!#sys-has_perms_by_name-vu-cleanup +ignore#!#sys-identity_columns-vu-prepare +ignore#!#sys-identity_columns-vu-verify +ignore#!#sys-identity_columns-vu-cleanup +ignore#!#sys-identity_columns-dep-vu-prepare +ignore#!#sys-identity_columns-dep-vu-verify +ignore#!#sys-identity_columns-dep-vu-cleanup +ignore#!#sys-index_columns-vu-prepare +ignore#!#sys-index_columns-vu-verify +ignore#!#sys-index_columns-vu-cleanup +ignore#!#sys-index_columns +ignore#!#sys-indexes-vu-prepare +ignore#!#sys-indexes-vu-verify +ignore#!#sys-indexes-vu-cleanup +ignore#!#sys-indexes +ignore#!#sys-key_constraints-vu-prepare +ignore#!#sys-key_constraints-vu-verify +ignore#!#sys-key_constraints-vu-cleanup +ignore#!#sys-key_constraints +ignore#!#sys-key_constraints-dep-vu-prepare +ignore#!#sys-key_constraints-dep-vu-verify +ignore#!#sys-key_constraints-dep-vu-cleanup +ignore#!#sys-nestlevel +ignore#!#sys-nestlevel-dep-vu-prepare +ignore#!#sys-nestlevel-dep-vu-verify +ignore#!#sys-nestlevel-dep-vu-cleanup +ignore#!#sys-objects-vu-prepare +ignore#!#sys-objects-vu-verify +ignore#!#sys-objects-vu-cleanup +ignore#!#sys-procedures-vu-prepare +ignore#!#sys-procedures-vu-verify +ignore#!#sys-procedures-vu-cleanup +ignore#!#sys-sp_databases-vu-prepare +ignore#!#sys-sp_databases-vu-verify +ignore#!#sys-sp_databases-vu-cleanup +ignore#!#sys-sp_databases-dep-vu-prepare +ignore#!#sys-sp_databases-dep-vu-verify +ignore#!#sys-sp_databases-dep-vu-cleanup +ignore#!#sys-sp_pkeys-vu-prepare +ignore#!#sys-sp_pkeys-vu-verify +ignore#!#sys-sp_pkeys-vu-cleanup +ignore#!#sys-sp_statistics-vu-prepare +ignore#!#sys-sp_statistics-vu-verify +ignore#!#sys-sp_statistics-vu-cleanup +ignore#!#sys-sp_statistics-dep-vu-prepare +ignore#!#sys-sp_statistics-dep-vu-verify +ignore#!#sys-sp_statistics-dep-vu-cleanup +ignore#!#sys-sp_tables_view-vu-prepare +ignore#!#sys-sp_tables_view-vu-verify +ignore#!#sys-sp_tables_view-vu-cleanup +ignore#!#sys-sp_tables_view +ignore#!#sys-sp_tables_view-dep-vu-prepare +ignore#!#sys-sp_tables_view-dep-vu-verify +ignore#!#sys-sp_tables_view-dep-vu-cleanup +ignore#!#sys-sql_modules-vu-prepare +ignore#!#sys-sql_modules-vu-verify +ignore#!#sys-sql_modules-vu-cleanup +ignore#!#sys-syscolumns-vu-prepare +ignore#!#sys-syscolumns-vu-verify +ignore#!#sys-syscolumns-vu-cleanup +ignore#!#sys-syscolumns +ignore#!#sys-sysdatabases-vu-prepare +ignore#!#sys-sysdatabases-vu-verify +ignore#!#sys-sysdatabases-vu-cleanup +ignore#!#sys-sysforeignkeys-vu-prepare +ignore#!#sys-sysforeignkeys-vu-verify +ignore#!#sys-sysforeignkeys-vu-cleanup +ignore#!#sys-sysforeignkeys +ignore#!#sys-sysindexes-vu-prepare +ignore#!#sys-sysindexes-vu-verify +ignore#!#sys-sysindexes-vu-cleanup +ignore#!#sys-syslanguages +ignore#!#sys-sysobjects-vu-prepare +ignore#!#sys-sysobjects-vu-verify +ignore#!#sys-sysobjects-vu-cleanup +ignore#!#sys-system_sql_modules-vu-prepare +ignore#!#sys-system_sql_modules-vu-verify +ignore#!#sys-system_sql_modules-vu-cleanup +ignore#!#sys-system_sql_modules-dep-vu-prepare +ignore#!#sys-system_sql_modules-dep-vu-verify +ignore#!#sys-system_sql_modules-dep-vu-cleanup +ignore#!#sys-systypes-vu-prepare +ignore#!#sys-systypes-vu-verify +ignore#!#sys-systypes-vu-cleanup +ignore#!#sys-table_types_internal-vu-prepare +ignore#!#sys-table_types_internal-vu-verify +ignore#!#sys-table_types_internal-vu-cleanup +ignore#!#sys-tables-vu-prepare +ignore#!#sys-tables-vu-verify +ignore#!#sys-tables-vu-cleanup +ignore#!#sys-tables +ignore#!#sys-tables-dep-vu-prepare +ignore#!#sys-tables-dep-vu-verify +ignore#!#sys-tables-dep-vu-cleanup +ignore#!#sys-trigger_events-vu-prepare +ignore#!#sys-trigger_events-vu-verify +ignore#!#sys-trigger_events-vu-cleanup +ignore#!#sys-triggers-vu-prepare +ignore#!#sys-triggers-vu-verify +ignore#!#sys-triggers-vu-cleanup +ignore#!#sys-triggers +ignore#!#sys-types-vu-prepare +ignore#!#sys-types-vu-verify +ignore#!#sys-types-vu-cleanup +ignore#!#sys-types +ignore#!#sys-types-dep-vu-prepare +ignore#!#sys-types-dep-vu-verify +ignore#!#sys-types-dep-vu-cleanup +ignore#!#sys-views-vu-prepare +ignore#!#sys-views-vu-verify +ignore#!#sys-views-vu-cleanup +ignore#!#sys-views +ignore#!#sys_syslogins_dep-vu-prepare +ignore#!#sys_syslogins_dep-vu-verify +ignore#!#sys_syslogins_dep-vu-cleanup +ignore#!#sys_sysusers_dep-vu-prepare +ignore#!#sys_sysusers_dep-vu-verify +ignore#!#sys_sysusers_dep-vu-cleanup +ignore#!#table-variable-vu-prepare +ignore#!#table-variable-vu-verify +ignore#!#table-variable-vu-cleanup +ignore#!#table_variable_xact_nested_2 +ignore#!#test_windows_alter_login-vu-prepare +ignore#!#test_windows_alter_login-vu-verify +ignore#!#test_windows_alter_login-vu-cleanup +ignore#!#test_windows_login-vu-prepare +ignore#!#test_windows_login-vu-verify +ignore#!#test_windows_login-vu-cleanup + +# JIRA - BABEL-4419 +ignore#!#BABEL-1056 +ignore#!#BABEL-GUC-PLAN +ignore#!#BABEL-3092 +ignore#!#BABEL-COLUMN-CONSTRAINT +ignore#!#BABEL-1251-vu-verify +ignore#!#BABEL-1251 + +# JIRA - BABEL-4421 +ignore#!#Test-sp_addrolemember-dep-vu-verify +ignore#!#Test-sp_droprolemember-dep-vu-verify +ignore#!#babel_table_type + +# BABEL-4422 +ignore#!#babel_money + +# BABEL-4423 +ignore#!#BABEL-IDENTITY + +# BABEL-4424 +ignore#!#TestDecimal +ignore#!#TestNumeric +ignore#!#numericOverflow + +# BABEL-4425 - Taking too much time to run. +ignore#!#getdate-vu-prepare +ignore#!#getdate-vu-verify +ignore#!#getdate-vu-cleanup +ignore#!#getdatetest + +# Taking too much time to complete. (TIME-OUT FAILURES) +ignore#!#BABEL-SP_TABLE_PRIVILIGES-vu-verify +ignore#!#BABEL-SP_COLUMNS_MANAGED-dep-vu-verify +ignore#!#BABEL-SP_TABLES +ignore#!#ISC-Domains-vu-verify +ignore#!#Test-sp_rename-vu-prepare +ignore#!#Test-sp_rename-vu-verify +ignore#!#Test-sp_rename-vu-cleanup +ignore#!#BABEL-3013 +ignore#!#BABEL-SP_COLUMN_PRIVILEGES +ignore#!#BABEL-SP_TABLE_PRIVILEGES +ignore#!#ISC-Columns-vu-verify +ignore#!#TestSimpleErrors +ignore#!#ISC-Views +ignore#!#TestSimpleErrorsWithXactAbort +ignore#!#BABEL-2513 diff --git a/test/JDBC/src/main/java/com/sqlsamples/Config.java b/test/JDBC/src/main/java/com/sqlsamples/Config.java index d7c77e97bf..e814f9540a 100644 --- a/test/JDBC/src/main/java/com/sqlsamples/Config.java +++ b/test/JDBC/src/main/java/com/sqlsamples/Config.java @@ -25,6 +25,8 @@ public class Config { static boolean outputColumnName = Boolean.parseBoolean(properties.getProperty("outputColumnName")); static boolean outputErrorCode = Boolean.parseBoolean(properties.getProperty("outputErrorCode")); static String scheduleFileName = properties.getProperty("scheduleFile"); + static boolean isParallelQueryMode = Boolean.parseBoolean(properties.getProperty("isParallelQueryMode")); + static String parallelQueryTestIgnoreFileName = "./parallel_query_jdbc_schedule"; static String testFileRoot = properties.getProperty("testFileRoot"); static boolean isUpgradeTestMode = Boolean.parseBoolean(properties.getProperty("isUpgradeTestMode")); static long defaultSLA = Long.parseLong(properties.getProperty("defaultSLA")); diff --git a/test/JDBC/src/main/resources/config.txt b/test/JDBC/src/main/resources/config.txt index 32ea7d2c8a..8942b711e5 100644 --- a/test/JDBC/src/main/resources/config.txt +++ b/test/JDBC/src/main/resources/config.txt @@ -36,6 +36,10 @@ outputErrorCode = true # PLEASE LOOK AT THE jdbc_schedule FILE scheduleFile = ./jdbc_schedule +# WHETHER TEST MODE IS PARALLEL QUERY MODE ON +isParallelQueryMode = false + + # Where to find the input, output, expected, etc. testFileRoot = ./ diff --git a/test/JDBC/src/test/java/com/sqlsamples/TestQueryFile.java b/test/JDBC/src/test/java/com/sqlsamples/TestQueryFile.java index a1ef41a453..725714ac19 100644 --- a/test/JDBC/src/test/java/com/sqlsamples/TestQueryFile.java +++ b/test/JDBC/src/test/java/com/sqlsamples/TestQueryFile.java @@ -161,6 +161,7 @@ static void selectDriver() throws ClassNotFoundException { static Stream inputFileNames() { File dir = new File(inputFilesDirectoryPath); File scheduleFile = new File(scheduleFileName); + File parallelQueryTestIgnoreFile = new File(parallelQueryTestIgnoreFileName); try (BufferedReader br = new BufferedReader(new FileReader(scheduleFile))) { String line; @@ -171,6 +172,19 @@ static Stream inputFileNames() { } catch (IOException e) { e.printStackTrace(); } + + /* Ignore tests in case of parallel query mode on */ + if (isParallelQueryMode) { + try (BufferedReader br = new BufferedReader(new FileReader(parallelQueryTestIgnoreFile))) { + String line; + while ((line = br.readLine()) != null) { + if (!line.startsWith("#") && line.trim().length() > 0 && line.startsWith("ignore#!#")) + testsToIgnore.add(line.split("#!#", -1)[1]); + } + } catch (IOException e) { + e.printStackTrace(); + } + } createTestFilesList(dir.getAbsolutePath()); From 60e686aca7cd2aa0a66a1cb60a9d6f9f2d55621d Mon Sep 17 00:00:00 2001 From: Sandeep Kumawat Date: Tue, 17 Oct 2023 17:58:00 +0000 Subject: [PATCH 2/2] add workflow for running jdbc-tests with enabled parallel query --- .../jdbc-tests-with-parallel-query.yml | 20 +++---------------- test/JDBC/parallel_query_jdbc_schedule | 2 ++ test/JDBC/src/main/resources/config.txt | 2 +- 3 files changed, 6 insertions(+), 18 deletions(-) diff --git a/.github/workflows/jdbc-tests-with-parallel-query.yml b/.github/workflows/jdbc-tests-with-parallel-query.yml index 90c1e5b1ae..4f7dde93f8 100644 --- a/.github/workflows/jdbc-tests-with-parallel-query.yml +++ b/.github/workflows/jdbc-tests-with-parallel-query.yml @@ -3,8 +3,6 @@ on: [push, pull_request] jobs: run-babelfish-jdbc-tests-with-parallel-query-mode: - env: - INSTALL_DIR: psql runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 @@ -30,19 +28,9 @@ jobs: if: always() && steps.compile-antlr.outcome == 'success' uses: ./.github/composite-actions/build-extensions - - name: Build tds_fdw Extension - id: build-tds_fdw-extension - if: always() && steps.build-extensions.outcome == 'success' - uses: ./.github/composite-actions/build-tds_fdw-extension - - - name: Build PostGIS Extension - id: build-postgis-extension - if: always() && steps.build-tds_fdw-extension.outcome == 'success' - uses: ./.github/composite-actions/build-postgis-extension - - name: Install Extensions id: install-extensions - if: always() && steps.build-postgis-extension.outcome == 'success' + if: always() && steps.build-extensions.outcome == 'success' uses: ./.github/composite-actions/install-extensions with: parallel_query_mode: true @@ -50,10 +38,8 @@ jobs: - name: Run JDBC Tests id: jdbc if: always() && steps.install-extensions.outcome == 'success' - timeout-minutes: 120 + timeout-minutes: 60 run: | - export PATH=~/${{env.INSTALL_DIR}}/bin:$PATH - export PG_SRC=~/work/babelfish_extensions/postgresql_modified_for_babelfish cd test/JDBC/ # set env variable isParallelQueryMode to true to let jdbc know not to run tests of file parallel_query_jdbc_schedule export isParallelQueryMode=true @@ -65,7 +51,7 @@ jobs: id: cleanup if: always() && steps.install-extensions.outcome == 'success' run: | - sudo ~/psql/bin/psql -d postgres -U runner -v user="jdbc_user" -v db="jdbc_testdb" -f .github/scripts/cleanup_babelfish_database.sql + sudo ~/postgres/bin/psql -d postgres -U runner -v user="jdbc_user" -v db="jdbc_testdb" -f .github/scripts/cleanup_babelfish_database.sql - name: Upload Log if: always() && steps.jdbc.outcome == 'failure' diff --git a/test/JDBC/parallel_query_jdbc_schedule b/test/JDBC/parallel_query_jdbc_schedule index a4abceef5c..493c30dfc3 100644 --- a/test/JDBC/parallel_query_jdbc_schedule +++ b/test/JDBC/parallel_query_jdbc_schedule @@ -362,3 +362,5 @@ ignore#!#TestSimpleErrors ignore#!#ISC-Views ignore#!#TestSimpleErrorsWithXactAbort ignore#!#BABEL-2513 + + diff --git a/test/JDBC/src/main/resources/config.txt b/test/JDBC/src/main/resources/config.txt index 8942b711e5..8d32f860c1 100644 --- a/test/JDBC/src/main/resources/config.txt +++ b/test/JDBC/src/main/resources/config.txt @@ -47,4 +47,4 @@ testFileRoot = ./ isUpgradeTestMode = false # Default SLA in milliseconds -defaultSLA = 15000 +defaultSLA = 40000