Skip to content

Commit

Permalink
Fix cherry-picks.
Browse files Browse the repository at this point in the history
Authored-by: Zhang Mingli [email protected]
  • Loading branch information
avamingli committed Jan 17, 2025
1 parent a35742c commit 7618411
Show file tree
Hide file tree
Showing 8 changed files with 4 additions and 115 deletions.
2 changes: 1 addition & 1 deletion src/backend/optimizer/plan/createplan.c
Original file line number Diff line number Diff line change
Expand Up @@ -1081,7 +1081,7 @@ use_physical_tlist(PlannerInfo *root, Path *path, int flags)
* overhead and impact performance, so in this case we let the tlist apply
* to the projection to avoid unnecessory column fetches.
*/
if (rel->relam == AO_ROW_TABLE_AM_OID || rel->relam == AO_COLUMN_TABLE_AM_OID)
if (AMHandlerIsAO(rel->amhandler))
return false;

return true;
Expand Down
2 changes: 1 addition & 1 deletion src/backend/utils/resgroup/cgroup_io_limit.c
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ io_limit_dump(List *limit_list)
appendStringInfo(result, ",");
}

if (cell != limit_list->tail)
if (cell != list_tail(limit_list))
appendStringInfo(result, ";");
}

Expand Down
105 changes: 0 additions & 105 deletions src/test/isolation2/expected/lockmodes.out
Original file line number Diff line number Diff line change
Expand Up @@ -2182,111 +2182,6 @@ UPDATE 1
ROLLBACK
1q: ... <quitting>

<<<<<<< HEAD
=======
1: BEGIN;
BEGIN
1: INSERT INTO t_lockmods_part_tbl_dml SELECT i, 1, i FROM generate_series(1,10)i;
INSERT 10
-- With GDD enabled, QD will only hold lock on root for insert
1: select * from show_locks_lockmodes;
locktype | mode | granted | relation
----------+------------------+---------+-------------------------
relation | RowExclusiveLock | t | t_lockmods_part_tbl_dml
(1 row)
1: ROLLBACK;
ROLLBACK
1q: ... <quitting>

1: CREATE TABLE t_lockmods_aopart(i int, t text) USING ao_row PARTITION BY RANGE(i) (START(1) END(5) EVERY(1));
CREATE
1: BEGIN;
BEGIN
1: DELETE FROM t_lockmods_aopart WHERE i = 4;
DELETE 0
-- With GDD enabled, QD will only hold lock on root for delete
1: select * from show_locks_lockmodes;
locktype | mode | granted | relation
----------+-----------------+---------+---------------------------
relation | ExclusiveLock | t | t_lockmods_aopart_1_prt_4
relation | AccessShareLock | t | t_lockmods_aopart
relation | ExclusiveLock | t | t_lockmods_aopart
(3 rows)
1: COMMIT;
COMMIT
1: DROP TABLE t_lockmods_aopart;
DROP
1q: ... <quitting>

-- 2.8 Verify behaviors of select with locking clause (i.e. select for update)
-- when running concurrently with index creation, for Heap tables.
-- For AO/CO tables, refer to create_index_allows_readonly.source.

1: CREATE TABLE create_index_select_for_update_tbl(a int, b int);
CREATE
1: INSERT INTO create_index_select_for_update_tbl SELECT i,i FROM generate_series(1,10)i;
INSERT 10
1: set optimizer = off;
SET

-- 2.8.1 with GDD enabled, expect no blocking
1: show gp_enable_global_deadlock_detector;
gp_enable_global_deadlock_detector
------------------------------------
on
(1 row)

1: BEGIN;
BEGIN
1: SELECT * FROM create_index_select_for_update_tbl WHERE a = 2 FOR UPDATE;
a | b
---+---
2 | 2
(1 row)

2: set optimizer = off;
SET

2: BEGIN;
BEGIN
-- expect no blocking
2: CREATE INDEX create_index_select_for_update_idx ON create_index_select_for_update_tbl(a);
CREATE
2: COMMIT;
COMMIT

1: COMMIT;
COMMIT

2: DROP INDEX create_index_select_for_update_idx;
DROP

2: BEGIN;
BEGIN
2: CREATE INDEX create_index_select_for_update_idx ON create_index_select_for_update_tbl(a);
CREATE

1: BEGIN;
BEGIN
-- expect no blocking
1: SELECT * FROM create_index_select_for_update_tbl WHERE a = 2 FOR UPDATE;
a | b
---+---
2 | 2
(1 row)
1: COMMIT;
COMMIT
-- close session to avoid renew session failure after restart
1q: ... <quitting>

2: COMMIT;
COMMIT

2: DROP INDEX create_index_select_for_update_idx;
DROP

-- 2.8.2 with GDD disabled, expect blocking
>>>>>>> 0c942b968db (Refactor AO macro RelationIsAppendOptimized (#15546))
-- reset gdd
2: ALTER SYSTEM RESET gp_enable_global_deadlock_detector;
ALTER
Expand Down
3 changes: 0 additions & 3 deletions src/test/regress/expected/privileges.out
Original file line number Diff line number Diff line change
Expand Up @@ -346,10 +346,7 @@ EXPLAIN (COSTS OFF) SELECT * FROM atest12v x, atest12v y WHERE x.a = y.b;
Optimizer: Postgres query optimizer
(10 rows)

<<<<<<< HEAD
=======
discard plans;
>>>>>>> b564485081a (Reset plan cache to prevent flakes in ICW privileges)
EXPLAIN (COSTS OFF) SELECT * FROM atest12sbv x, atest12sbv y WHERE x.a = y.b;
QUERY PLAN
------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions src/test/regress/input/aocs.source
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ SELECT count(*) FROM tenk_aocs4;
-- Issue #15904
EXPLAIN (verbose, costs off) SELECT max(unique1) FROM tenk_aocs1;
CREATE TABLE tenk_aorow WITH(appendonly=true, orientation=row) AS SELECT * FROM tenk_heap_for_aocs;
ANALYZE tenk_aorow;
EXPLAIN (verbose, costs off) SELECT max(unique1) FROM tenk_aorow;

-- LIKE
Expand Down
1 change: 1 addition & 0 deletions src/test/regress/output/aocs.source
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,7 @@ EXPLAIN (verbose, costs off) SELECT max(unique1) FROM tenk_aocs1;
(9 rows)

CREATE TABLE tenk_aorow WITH(appendonly=true, orientation=row) AS SELECT * FROM tenk_heap_for_aocs;
ANALYZE tenk_aorow;
EXPLAIN (verbose, costs off) SELECT max(unique1) FROM tenk_aorow;
QUERY PLAN
-------------------------------------------------
Expand Down
3 changes: 0 additions & 3 deletions src/test/regress/sql/privileges.sql
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,8 @@ EXPLAIN (COSTS OFF) SELECT * FROM atest12 WHERE a >>> 0;
-- These plans should continue to use a nestloop, since they execute with the
-- privileges of the view owner.
EXPLAIN (COSTS OFF) SELECT * FROM atest12v x, atest12v y WHERE x.a = y.b;
<<<<<<< HEAD
=======

discard plans;
>>>>>>> b564485081a (Reset plan cache to prevent flakes in ICW privileges)
EXPLAIN (COSTS OFF) SELECT * FROM atest12sbv x, atest12sbv y WHERE x.a = y.b;

-- A non-security barrier view does not guard against information leakage.
Expand Down
2 changes: 0 additions & 2 deletions src/test/singlenode_regress/expected/privileges.out
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,6 @@ EXPLAIN (COSTS OFF) SELECT * FROM atest12 x, atest12 y

-- This should also be a nestloop, but the security barrier forces the inner
-- scan to be materialized
discard plans;
EXPLAIN (COSTS OFF) SELECT * FROM atest12sbv x, atest12sbv y WHERE x.a = y.b;
QUERY PLAN
-------------------------------------------
Expand Down Expand Up @@ -358,7 +357,6 @@ EXPLAIN (COSTS OFF) SELECT * FROM atest12v x, atest12v y
(7 rows)

-- But a security barrier view isolates the leaky operator.
discard plans;
EXPLAIN (COSTS OFF) SELECT * FROM atest12sbv x, atest12sbv y
WHERE x.a = y.b and abs(y.a) <<< 5;
QUERY PLAN
Expand Down

0 comments on commit 7618411

Please sign in to comment.