Skip to content

Commit

Permalink
[pg15] test: add yb_use_hash_splitting_by_default=false
Browse files Browse the repository at this point in the history
Summary:
For ported regress tests, set yb_use_hash_splitting_by_default=false by
default.  Borrow off the existing BasePgRegressTestSequentialYbrowid
class to add the additional setting.  Since this class now sets two
different flags, rename it to BasePgRegressTestPorted.  Add
documentation about its purpose as well.

Fix some tests that fail due to this option change:

- split yb_table_serial_schedule to yb_table_schedule and
  yb_pg_table_schedule.  Split the Java test similarly.  Update some
  test output where appropriate.
- split yb_pg_types_udt_serial_schedule to yb_types_udt_serial_schedule
  and yb_pg_types_udt_serial_schedule.  Split the Java test similarly.

In the future, workarounds from the lack of this can be reverted, such
as the explicit setting of "ASC" for key constraints in yb_dep_onek2 and
the addition of ORDER BY due to lack of ASC in yb_pg_rowsecurity.

Test Plan:
On Almalinux 8:

    #!/usr/bin/env bash
    set -eu
    ./yb_build.sh fastdebug --gcc11
    grep JAVA pg15_tests/passing_tests.tsv | grep TestPgRegress | pg15_tests/run_tests.sh

Jenkins: rebase: pg15, test regex: TestPgRegress

Reviewers: aagrawal, fizaa, tfoucher

Reviewed By: fizaa

Subscribers: yql

Differential Revision: https://phorge.dev.yugabyte.com/D36352
  • Loading branch information
jaki committed Jul 3, 2024
1 parent 0103f24 commit 5e40db0
Show file tree
Hide file tree
Showing 22 changed files with 141 additions and 70 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,19 @@

import java.util.Map;

public class BasePgRegressTestSequentialYbrowid extends BasePgRegressTest {
/**
* Regress test schedules should either contain only YB original tests or upstream PG ported tests.
* Subclass this class in case of ported tests in order to provide a similar environment to upstream
* PG and reduce differences with upstream's expectations. At the time of writing (2024-07-02),
* some schedules hav a mix of test types, and the subclassing has yet to be applied for certain
* schedules.
*/
public class BasePgRegressTestPorted extends BasePgRegressTest {
@Override
protected Map<String, String> getTServerFlags() {
Map<String, String> flagMap = super.getTServerFlags();
flagMap.put("TEST_generate_ybrowid_sequentially", "true");
appendToYsqlPgConf(flagMap, "yb_use_hash_splitting_by_default=false");
return flagMap;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* Runs the pg_regress test suite on YB code.
*/
@RunWith(value=YBTestRunner.class)
public class TestPgRegressArrays extends BasePgRegressTestSequentialYbrowid {
public class TestPgRegressArrays extends BasePgRegressTestPorted {
@Override
public int getTestMethodTimeoutSec() {
return 1800;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* Runs the pg_regress authorization-related tests on YB code.
*/
@RunWith(value = YBTestRunner.class)
public class TestPgRegressAuthorization extends BasePgRegressTestSequentialYbrowid {
public class TestPgRegressAuthorization extends BasePgRegressTestPorted {
@Override
public int getTestMethodTimeoutSec() {
return 1800;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* Runs the pg_regress test suite on YB code.
*/
@RunWith(value=YBTestRunner.class)
public class TestPgRegressPgDml extends BasePgRegressTestSequentialYbrowid {
public class TestPgRegressPgDml extends BasePgRegressTestPorted {
@Override
public int getTestMethodTimeoutSec() {
return 1800;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* Runs the pg_regress test suite on YB code.
*/
@RunWith(value=YBTestRunner.class)
public class TestPgRegressPgForeignData extends BasePgRegressTestSequentialYbrowid {
public class TestPgRegressPgForeignData extends BasePgRegressTestPorted {
@Override
public int getTestMethodTimeoutSec() {
return 1800;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* Runs the pg_regress test suite on YB code.
*/
@RunWith(value=YBTestRunner.class)
public class TestPgRegressPgMisc extends BasePgRegressTestSequentialYbrowid {
public class TestPgRegressPgMisc extends BasePgRegressTestPorted {
@Override
public int getTestMethodTimeoutSec() {
return 1800;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* Runs the pg_regress test suite on YB code.
*/
@RunWith(value=YBTestRunner.class)
public class TestPgRegressPgMiscIndependent extends BasePgRegressTestSequentialYbrowid {
public class TestPgRegressPgMiscIndependent extends BasePgRegressTestPorted {

private static final int TURN_OFF_SEQUENCE_CACHE_FLAG = 0;

Expand Down
33 changes: 33 additions & 0 deletions java/yb-pgsql/src/test/java/org/yb/pgsql/TestPgRegressPgTable.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Copyright (c) YugabyteDB, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
// in compliance with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed under the License
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
// or implied. See the License for the specific language governing permissions and limitations
// under the License.
//
package org.yb.pgsql;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.yb.util.YBTestRunnerNonTsanOnly;

/**
* Runs the pg_regress test suite on YB code.
*/
@RunWith(value=YBTestRunnerNonTsanOnly.class)
public class TestPgRegressPgTable extends BasePgRegressTestPorted {
@Override
public int getTestMethodTimeoutSec() {
return 1800;
}

@Test
public void schedule() throws Exception {
runPgRegressTest("yb_pg_table_schedule");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* Runs the pg_regress test suite on YB code.
*/
@RunWith(value=YBTestRunner.class)
public class TestPgRegressPgTransactions extends BasePgRegressTestSequentialYbrowid {
public class TestPgRegressPgTransactions extends BasePgRegressTestPorted {
private static final String TURN_OFF_COPY_FROM_BATCH_TRANSACTION =
"yb_default_copy_from_rows_per_transaction=0";

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Copyright (c) YugabyteDB, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
// in compliance with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed under the License
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
// or implied. See the License for the specific language governing permissions and limitations
// under the License.
//
package org.yb.pgsql;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.yb.YBTestRunner;

/**
* Runs the pg_regress test suite on YB code.
*/
@RunWith(value=YBTestRunner.class)
public class TestPgRegressPgTypesUDT extends BasePgRegressTestPorted {
@Override
public int getTestMethodTimeoutSec() {
return 1800;
}

@Test
public void schedule() throws Exception {
runPgRegressTest("yb_pg_types_udt_serial_schedule");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* Runs the pg_regress test suite on YB code.
*/
@RunWith(value=YBTestRunner.class)
public class TestPgRegressPlpgsql extends BasePgRegressTestSequentialYbrowid {
public class TestPgRegressPlpgsql extends BasePgRegressTestPorted {
@Override
public int getTestMethodTimeoutSec() {
return 1800;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) YugaByte, Inc.
// Copyright (c) YugabyteDB, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
// in compliance with the License. You may obtain a copy of the License at
Expand All @@ -20,14 +20,14 @@
* Runs the pg_regress test suite on YB code.
*/
@RunWith(value=YBTestRunnerNonTsanOnly.class)
public class TestPgRegressTable extends BasePgRegressTestSequentialYbrowid {
public class TestPgRegressTable extends BasePgRegressTest {
@Override
public int getTestMethodTimeoutSec() {
return 1800;
}

@Test
public void testPgRegressTable() throws Exception {
runPgRegressTest("yb_table_serial_schedule");
public void schedule() throws Exception {
runPgRegressTest("yb_table_schedule");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* Runs the pg_regress test suite on YB code.
*/
@RunWith(value=YBTestRunner.class)
public class TestPgRegressTypesGeo extends BasePgRegressTestSequentialYbrowid {
public class TestPgRegressTypesGeo extends BasePgRegressTestPorted {
@Override
public int getTestMethodTimeoutSec() {
return 1800;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* Runs the pg_regress test suite on YB code.
*/
@RunWith(value=YBTestRunner.class)
public class TestPgRegressTypesNumeric extends BasePgRegressTestSequentialYbrowid {
public class TestPgRegressTypesNumeric extends BasePgRegressTestPorted {
@Override
public int getTestMethodTimeoutSec() {
return 1800;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) YugaByte, Inc.
// Copyright (c) YugabyteDB, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
// in compliance with the License. You may obtain a copy of the License at
Expand All @@ -20,14 +20,14 @@
* Runs the pg_regress test suite on YB code.
*/
@RunWith(value=YBTestRunner.class)
public class TestPgRegressTypesUDT extends BasePgRegressTestSequentialYbrowid {
public class TestPgRegressTypesUDT extends BasePgRegressTest {
@Override
public int getTestMethodTimeoutSec() {
return 1800;
}

@Test
public void testPgRegressTypesUDT() throws Exception {
runPgRegressTest("yb_pg_types_udt_serial_schedule");
public void schedule() throws Exception {
runPgRegressTest("yb_types_udt_serial_schedule");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ CREATE TABLE like_constraint_rename_cache
--------+---------+-----------+----------+---------
a | integer | | not null |
Indexes:
"like_constraint_rename_cache_pkey" PRIMARY KEY, lsm (a HASH)
"like_constraint_rename_cache_pkey" PRIMARY KEY, lsm (a ASC)
Check constraints:
"chk_a_new" CHECK (a > 0)

Expand Down
20 changes: 10 additions & 10 deletions src/postgres/src/test/regress/expected/yb_pg_create_table_like.out
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ CREATE TABLE inhz (x text REFERENCES inhz, LIKE inhx INCLUDING INDEXES);
x | text | | |
xx | text | | not null |
Indexes:
"inhz_pkey" PRIMARY KEY, lsm (xx HASH)
"inhz_pkey" PRIMARY KEY, lsm (xx ASC)
Foreign-key constraints:
"inhz_x_fkey" FOREIGN KEY (x) REFERENCES inhz(xx)
Referenced by:
Expand Down Expand Up @@ -303,9 +303,9 @@ CREATE TABLE ctlt_all (LIKE ctlt1 INCLUDING ALL);
a | text | | not null | | extended | | A
b | text | | | | extended | | B
Indexes:
"ctlt_all_pkey" PRIMARY KEY, lsm (a HASH)
"ctlt_all_b_idx" lsm (b HASH)
"ctlt_all_expr_idx" lsm ((a || b) HASH)
"ctlt_all_pkey" PRIMARY KEY, lsm (a ASC)
"ctlt_all_b_idx" lsm (b ASC)
"ctlt_all_expr_idx" lsm ((a || b) ASC)
Check constraints:
"ctlt1_a_check" CHECK (length(a) > 2)
Statistics objects:
Expand Down Expand Up @@ -342,9 +342,9 @@ CREATE TABLE pg_attrdef (LIKE ctlt1 INCLUDING ALL);
a | text | | not null | | extended | | A
b | text | | | | extended | | B
Indexes:
"pg_attrdef_pkey" PRIMARY KEY, lsm (a HASH)
"pg_attrdef_b_idx" lsm (b HASH)
"pg_attrdef_expr_idx" lsm ((a || b) HASH)
"pg_attrdef_pkey" PRIMARY KEY, lsm (a ASC)
"pg_attrdef_b_idx" lsm (b ASC)
"pg_attrdef_expr_idx" lsm ((a || b) ASC)
Check constraints:
"ctlt1_a_check" CHECK (length(a) > 2)
Statistics objects:
Expand All @@ -364,9 +364,9 @@ CREATE TABLE ctlt1 (LIKE ctlt1 INCLUDING ALL);
a | text | | not null | | extended | | A
b | text | | | | extended | | B
Indexes:
"ctlt1_pkey" PRIMARY KEY, lsm (a HASH)
"ctlt1_b_idx" lsm (b HASH)
"ctlt1_expr_idx" lsm ((a || b) HASH)
"ctlt1_pkey" PRIMARY KEY, lsm (a ASC)
"ctlt1_b_idx" lsm (b ASC)
"ctlt1_expr_idx" lsm ((a || b) ASC)
Check constraints:
"ctlt1_a_check" CHECK (length(a) > 2)
Statistics objects:
Expand Down
13 changes: 13 additions & 0 deletions src/postgres/src/test/regress/yb_pg_table_schedule
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# src/test/regress/yb_pg_table_schedule
# This schedule is for ported tests only.

# Dependencies for yb_pg_alter_table
test: yb_dep_onek
test: yb_dep_part_test_int4_ops
# TODO(jason): yb_pg_insert is no longer a dependency, so move it to
# yb_pg_dml_serial_schedule. (Note: yb_dep_part_test_int4_ops is a dependency
# for yb_pg_insert.)
test: yb_pg_insert

test: yb_pg_create_table_like
test: yb_pg_alter_table
19 changes: 2 additions & 17 deletions src/postgres/src/test/regress/yb_pg_types_udt_serial_schedule
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# src/test/regress/yb_pg_types_udt_serial_schedule
#
####################################################################################################
# Postgres Testsuites: Porting from PostgreSQL original tests.
# This suite includes all tests on user defined types that are enabled for YugaByte.
####################################################################################################
# This schedule is for ported tests only.

# Dependency for yb_pg_rangetypes, yb_pg_rowtypes
test: yb_pg_test_setup
# Dependency for yb_pg_rowtypes
Expand All @@ -14,17 +11,5 @@ test: yb_pg_enum
# Range types
test: yb_pg_rangetypes

# Dependency for `yb_base_type`
test: yb_create_function

# Overall UDTs
test: yb_create_type
test: yb_alter_type

# Composite types
test: yb_pg_rowtypes
# Base types
test: yb_base_type

# Operator Class
test: yb_operator_class
7 changes: 7 additions & 0 deletions src/postgres/src/test/regress/yb_table_schedule
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# src/test/regress/yb_table_schedule
# This schedule is for non-ported tests only.

test: yb_alter_table
test: yb_alter_table_rewrite
test: yb_create_table
test: yb_drop_table
23 changes: 0 additions & 23 deletions src/postgres/src/test/regress/yb_table_serial_schedule

This file was deleted.

15 changes: 15 additions & 0 deletions src/postgres/src/test/regress/yb_types_udt_serial_schedule
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# src/test/regress/yb_types_udt_serial_schedule
# This schedule is for non-ported tests only.

# Dependency for `yb_base_type`
test: yb_create_function

# Overall UDTs
test: yb_create_type
test: yb_alter_type

# Base types
test: yb_base_type

# Operator Class
test: yb_operator_class

0 comments on commit 5e40db0

Please sign in to comment.