Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cherry-pick Allow role names started with 'gp_' and etc #860

Merged
merged 16 commits into from
Jan 14, 2025

Conversation

Tao-Ma
Copy link
Contributor

@Tao-Ma Tao-Ma commented Jan 12, 2025

Fixes #ISSUE_Number

What does this PR do?

Type of Change

  • Bug fix (non-breaking change)
  • New feature (non-breaking change)
  • Breaking change (fix or feature with breaking changes)
  • Documentation update

Breaking Changes

Test Plan

  • Unit tests added/updated
  • Integration tests added/updated
  • Passed make installcheck
  • Passed make -C src/test installcheck-cbdb-parallel

Impact

Performance:

User-facing changes:

Dependencies:

Checklist

Additional Context

CI Skip Instructions


@my-ship-it my-ship-it requested a review from yjhjstz January 13, 2025 02:52
@my-ship-it my-ship-it added the cherry-pick cherry-pick upstream commts label Jan 13, 2025
@yjhjstz
Copy link
Member

yjhjstz commented Jan 13, 2025

pls rebase to fix ci .

avamingli and others added 16 commits January 13, 2025 17:23
Long log:
As the title said, this commit removes dead functions in `src/backend/cdb`.

Signed-off-by: Yongtao Huang <[email protected]>
The `width` is now in `joinrel->reltarget` and has been set in `build_joinrel_tlist()`
and `add_placeholders_to_joinrel()`. After the merge of PostgreSQL 9.6, the concept of
`PlaceHolderVar` was introduced, calculating in this way may cause us to ignore the
width of `PlaceHolderVar` and thus underestimate the cost of joinrel.
PlanRowMark.canOptSelectLockingClause field is removed as it has been replaced
by RangeTblEntry.rellockmode field and never used again.
The comment seems to have been incorrectly handled while dealing with
backports and the Postgres 9.4 merge. Update it to what it is in
Postgres REL_12_STABLE as that should be the correct comment.
Long log:

Don't need to cast the unknown typed literal to text.
Drop the cast and remove FIXME.
Related commit: 1e7c4bb

Signed-off-by: Yongtao Huang <[email protected]>
As part of https://github.com/greenplum-db/gpdb/pull/15187, we added
partial wal file tests to gpdb6. Since partial wal file is already
supported by gpdb7, we just need to port the tap tests from the
aforementioned PR.

Partial wal scenario:

A few previous commits de76884 and 7cbee7c introduced the concept of
creating and archiving partial wal files when the mirror is promoted
while the primary is still alive.  In this case, the last wal file on
the old timeline in the mirror's pg_wal dir is renamed with the suffix
".partial".  This partial file also get archived. The original wal file
only gets archived once the user runs pg_rewind.

Consider the following example: Let's assume that 0000100004 is the current
wal file on the master

start with a master and standby pair
add data to master
contents of pg_wal on master:
      0000100001
      .....
      0000100003
      0000100004 - current wal file on master

master is alive but standby gets promoted
contents of pg_wal on standby:
      0000100001
      ....
      0000100003
      0000100004.partial (note that 0000100004 does not exist on the standby)
      0000200004 - current wal file on standby

Contents of the archive location:
      0000100003.tar.gz
      0000100004.partial.tar.gz

stop master with pg_ctl stop -m fast
contents of pg_wal on master:
      0000100004 on the master gets flushed and gets archived
      0000100004.done gets created on master
Contents of the archive location:
      0000100003.tar.gz
      0000100004.partial.tar.gz
      0000100004.tar.gz
run pg_rewind
      copies from standby to master
      removes 0000100004 and 0000100004.done from master's pg_wal dir

Original commit: 5a2975e20bc
Original Author: kaknikhil
A previous commit 700cad0 added tap tests for the partial wal file
feature. This test was a bit flaky on the ci pipeline.

Context:
Once we promote the standby(while the primary is running), a partial wal
file gets generated on the standby. In order to test if this file gets
generated with the correct name, we were previously querying the
pg_stat_archiver view. We would compare the name of the last archived
wal with the expected partial wal filename. It's possible that this
comparison would return wrong results on some platforms because of the
">=" predicate(which could change based on the sorting order.)

Fix:
This commit removes the use of pg_stat_archiver view and instead relies
on the pg_stat_file function to check for the existence of the partial
wal file and other files in the tap test
Commit 700cad0 add 'has_streaming => 1' when make a standby node.
This will start a walreceiver process to receive the wal log from
primary node, rather than just store its contents on the archives
of the primary. In this way, the inserted 2000 rows can all have
been present on standby node.

Revert the enable streaming change when create standby, append conn
info to the postgresql.conf after pass the first check and restart
standby node.
Commit bc08de1cc5bb introduced ONLY keyword for GRANT/REVOKE.
However there's an issue in the grammar where if the table list
starts with a table with ONLY, it could not contain more tables
with ONLY. Fixing it and adding test cases for syntax coverage.
The merge with upstream absorbed 2930078 which
disallowed creating roles with reserved names because some default system roles
started with 'pg_' were introduced since 9.6 so we don't want them to conflict:
https://www.postgresql.org/docs/9.6/default-roles.html

However, in Greenplum reserved names include not only 'pg_' but also 'gp_'. But
we do not have any system roles starting with 'gp_' so it is fine to allow users
to still create those roles.

Now modifying IsReservedName() to not check 'gp_' but adding a new function
isReservedGpName() to do that. This avoids the need to modify the signature of
IsReservedName() also helps avoid the same issue in future where 'gp_' is banned
for existing type of object names which affect existing users.

Fix #15259

# Conflicts:
#	src/backend/catalog/catalog.c
This FIXME was for planner's lack of partition pruning in certain cases.
The logic in GP6 could generate wrong results, so it was decided to
remove the over-eager optimization for GP7. Orca never did pruning in
this case. See https://github.com/greenplum-db/gpdb/issues/10287 and
https://github.com/greenplum-db/gpdb/pull/14553 for additional context.
Attnum-filenum mapping was introduced in pg_attribute_encoding in the
commit cdd03c165ad

The mapping represents the range of files used by the column for an
AOCO table. This change is to fix pg_aocsseg table to work show the
correct physical segno using this filenum field

Co-authored-by: Soumyadeep Chakraborty <[email protected]>
The new attnum-filenum changes on pg_attribute_encoding introduced in
cdd03c165ad and the column rewrite operations introduced in last commit
changes the range of aocs files on disk.
The column filename is now dependent on the filenums and not attnums.
This commit changes how we look for possible aocs column files on disk
for a table
Earlier we used to only have files in order based on natts.
Now, as the column can be rewritten we also need to check the filenum
pair (i, i+MaxHeapAttributeNumber) of every filenum.

Co-authored-by: Soumyadeep Chakraborty <[email protected]>
Co-authored-by: Ashwin Agrawal <[email protected]>
Co-authored-by: Huansong Fu <[email protected]>
@Tao-Ma Tao-Ma force-pushed the merge/gpdb_commits branch from 993fe9d to 76bea20 Compare January 13, 2025 09:23
@my-ship-it my-ship-it merged commit 467281d into apache:main Jan 14, 2025
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick cherry-pick upstream commts
Projects
None yet
Development

Successfully merging this pull request may close these issues.