Skip to content

Commit

Permalink
[#25042] YSQL: Fix yb_lock_status test for ASAN/TSAN
Browse files Browse the repository at this point in the history
Summary:
`yb_lock_status` in `testPgRegressProc` has been failing in ASAN and TSAN consistently.
The cause of failure is a change in output between PG 11 and PG 15 for queries of the form: `SELECT <constant> FROM <relation>;`
In PG 11, this produced an output in the following format:
```
yugabyte=# SELECT true FROM test;
 bool
------
(0 rows)
```
while in PG 15, the output was as follows:
```
yugabyte=# SELECT true FROM test;
 ?column?
----------
(0 rows)
```
In other words, in PG 15, the name of the column is no longer set to be the data type of the constant, if the data type is not explicitly specified.

D31424 fixed the output in the PG 15 branch for the output files: `yb_lock_status.out` and `yb_lock_status_1.out`
Later, D32492 introduced a new output file with the PG 11 style output: `yb_lock_status_2.out`

The files correspond to the following build types/configurations:
 - yb_lock_status_2.out: ASAN, TSAN
 - yb_lock_status_1.out: All other build types
 - yb_lock_status.out: All build types when READ COMMITTED isolation level is not enabled.

This revision modifies the queries to explicitly specify the data type for queries of the form `SELECT <constant> FROM <relation>;`
This will also prevent the test from failing again if the name of the column in the output changes again in the future.

Note that `testPgRegressProc` will continue to fail on Mac due to a different regress test (yb_get_current_transaction_priority).
Jira: DB-14176

Test Plan:
Run the following test:
```
./yb_build.sh --java-test 'org.yb.pgsql.TestPgRegressProc#testPgRegressProc'
```

Reviewers: patnaik.balivada

Reviewed By: patnaik.balivada

Subscribers: yql

Tags: #jenkins-ready

Differential Revision: https://phorge.dev.yugabyte.com/D41136
  • Loading branch information
karthik-ramanathan-3006 committed Jan 10, 2025
1 parent ff7dbba commit a0424e1
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 50 deletions.
36 changes: 18 additions & 18 deletions src/postgres/src/test/regress/expected/yb_lock_status.out
Original file line number Diff line number Diff line change
Expand Up @@ -112,33 +112,33 @@ BEGIN
END ;
$$ LANGUAGE plpgsql;
-- Basic queries
SELECT true FROM yb_lock_status(null, null);
?column?
----------
SELECT true::bool FROM yb_lock_status(null, null);
bool
------
(0 rows)

SELECT true FROM yb_lock_status('yb_lock_tests'::regclass, null);
?column?
----------
SELECT true::bool FROM yb_lock_status('yb_lock_tests'::regclass, null);
bool
------
(0 rows)

SELECT true FROM yb_lock_status('yb_lock_tests'::regclass::int4, null);
?column?
----------
SELECT true::bool FROM yb_lock_status('yb_lock_tests'::regclass::int4, null);
bool
------
(0 rows)

SELECT true FROM yb_lock_status(null, 'bogus');
SELECT true::bool FROM yb_lock_status(null, 'bogus');
ERROR: invalid input syntax for type uuid: "bogus"
LINE 1: SELECT true FROM yb_lock_status(null, 'bogus');
^
SELECT true FROM yb_lock_status(null, '10000000-2000-3000-1000-400000000000');
?column?
----------
LINE 1: SELECT true::bool FROM yb_lock_status(null, 'bogus');
^
SELECT true::bool FROM yb_lock_status(null, '10000000-2000-3000-1000-400000000000');
bool
------
(0 rows)

SELECT true FROM yb_lock_status('yb_lock_tests'::regclass, '10000000-2000-3000-1000-400000000000');
?column?
----------
SELECT true::bool FROM yb_lock_status('yb_lock_tests'::regclass, '10000000-2000-3000-1000-400000000000');
bool
------
(0 rows)

-- READ COMMITTED
Expand Down
36 changes: 18 additions & 18 deletions src/postgres/src/test/regress/expected/yb_lock_status_1.out
Original file line number Diff line number Diff line change
Expand Up @@ -112,33 +112,33 @@ BEGIN
END ;
$$ LANGUAGE plpgsql;
-- Basic queries
SELECT true FROM yb_lock_status(null, null);
?column?
----------
SELECT true::bool FROM yb_lock_status(null, null);
bool
------
(0 rows)

SELECT true FROM yb_lock_status('yb_lock_tests'::regclass, null);
?column?
----------
SELECT true::bool FROM yb_lock_status('yb_lock_tests'::regclass, null);
bool
------
(0 rows)

SELECT true FROM yb_lock_status('yb_lock_tests'::regclass::int4, null);
?column?
----------
SELECT true::bool FROM yb_lock_status('yb_lock_tests'::regclass::int4, null);
bool
------
(0 rows)

SELECT true FROM yb_lock_status(null, 'bogus');
SELECT true::bool FROM yb_lock_status(null, 'bogus');
ERROR: invalid input syntax for type uuid: "bogus"
LINE 1: SELECT true FROM yb_lock_status(null, 'bogus');
^
SELECT true FROM yb_lock_status(null, '10000000-2000-3000-1000-400000000000');
?column?
----------
LINE 1: SELECT true::bool FROM yb_lock_status(null, 'bogus');
^
SELECT true::bool FROM yb_lock_status(null, '10000000-2000-3000-1000-400000000000');
bool
------
(0 rows)

SELECT true FROM yb_lock_status('yb_lock_tests'::regclass, '10000000-2000-3000-1000-400000000000');
?column?
----------
SELECT true::bool FROM yb_lock_status('yb_lock_tests'::regclass, '10000000-2000-3000-1000-400000000000');
bool
------
(0 rows)

-- READ COMMITTED
Expand Down
16 changes: 8 additions & 8 deletions src/postgres/src/test/regress/expected/yb_lock_status_2.out
Original file line number Diff line number Diff line change
Expand Up @@ -112,31 +112,31 @@ BEGIN
END ;
$$ LANGUAGE plpgsql;
-- Basic queries
SELECT true FROM yb_lock_status(null, null);
SELECT true::bool FROM yb_lock_status(null, null);
bool
------
(0 rows)

SELECT true FROM yb_lock_status('yb_lock_tests'::regclass, null);
SELECT true::bool FROM yb_lock_status('yb_lock_tests'::regclass, null);
bool
------
(0 rows)

SELECT true FROM yb_lock_status('yb_lock_tests'::regclass::int4, null);
SELECT true::bool FROM yb_lock_status('yb_lock_tests'::regclass::int4, null);
bool
------
(0 rows)

SELECT true FROM yb_lock_status(null, 'bogus');
SELECT true::bool FROM yb_lock_status(null, 'bogus');
ERROR: invalid input syntax for type uuid: "bogus"
LINE 1: SELECT true FROM yb_lock_status(null, 'bogus');
^
SELECT true FROM yb_lock_status(null, '10000000-2000-3000-1000-400000000000');
LINE 1: SELECT true::bool FROM yb_lock_status(null, 'bogus');
^
SELECT true::bool FROM yb_lock_status(null, '10000000-2000-3000-1000-400000000000');
bool
------
(0 rows)

SELECT true FROM yb_lock_status('yb_lock_tests'::regclass, '10000000-2000-3000-1000-400000000000');
SELECT true::bool FROM yb_lock_status('yb_lock_tests'::regclass, '10000000-2000-3000-1000-400000000000');
bool
------
(0 rows)
Expand Down
12 changes: 6 additions & 6 deletions src/postgres/src/test/regress/sql/yb_lock_status.sql
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,12 @@ END ;
$$ LANGUAGE plpgsql;

-- Basic queries
SELECT true FROM yb_lock_status(null, null);
SELECT true FROM yb_lock_status('yb_lock_tests'::regclass, null);
SELECT true FROM yb_lock_status('yb_lock_tests'::regclass::int4, null);
SELECT true FROM yb_lock_status(null, 'bogus');
SELECT true FROM yb_lock_status(null, '10000000-2000-3000-1000-400000000000');
SELECT true FROM yb_lock_status('yb_lock_tests'::regclass, '10000000-2000-3000-1000-400000000000');
SELECT true::bool FROM yb_lock_status(null, null);
SELECT true::bool FROM yb_lock_status('yb_lock_tests'::regclass, null);
SELECT true::bool FROM yb_lock_status('yb_lock_tests'::regclass::int4, null);
SELECT true::bool FROM yb_lock_status(null, 'bogus');
SELECT true::bool FROM yb_lock_status(null, '10000000-2000-3000-1000-400000000000');
SELECT true::bool FROM yb_lock_status('yb_lock_tests'::regclass, '10000000-2000-3000-1000-400000000000');

-- READ COMMITTED
-- Basic insert
Expand Down

0 comments on commit a0424e1

Please sign in to comment.