Commit 4af1cf5
Movable DataBase Locales for Cloudberry (#1363)
* Movable DataBase Locales for Cloudberry
We inherited this issue from PostgreSQL.
PostgreSQL uses glibc to sort strings. In version glibc=2.28, collations
broke down badly (in general, there are no guarantees when updating glibc).
Changing collations breaks indexes. Similarly, a cluster with different
collations also behaves unpredictably.
What and when something has changed in glibc can be found
on https://github.com/ardentperf/glibc-unicode-sorting
Also there is special postgresql-wiki https://wiki.postgresql.org/wiki/Locale_data_changes
And you tube video https://www.youtube.com/watch?v=0E6O-V8Jato
In short, the issue can be seen through the use of bash:
( echo "1-1"; echo "11" ) | LC_COLLATE=en_US.UTF-8 sort
gives the different results in ubunru 18.04 and 22.04.
There is no way to solve the problem other than by not changing the symbol order.
We freeze symbol order and use it instead of glibc.
Here the solution https://github.com/postgredients/mdb-locales.
In this PR I have added PostgreSQL patch that replaces all glibc
locale-related calls with a calls to an external libary. It activates
using new configure parameter --with-mdblocales, which is off by
default.
Using custom locales needs libmdblocales1 package and mdb-locales
package with symbol table.
Build needs libmdblocales-dev package with headers.
Fixing the symbol order is necessary for OS upgrade. For example Ubuntu 22.04 EOL is April 2027, Rocky 8 Active Support ended May 2024, and Security support ends in 2029.
We use Movable DataBase Locales in Greenplum 6 and all our PostgreSQL installations (starting with PostgreSQL 12). This patch is adopted patch version from our internal PostgreSQL 14 fork.
* mdb_admin role
This patch introcudes new pseudo-pre-defined role "mdb_admin".
Introduces 2 new function:
extern bool mdb_admin_allow_bypass_owner_checks(Oid userId, Oid ownerId);
extern void check_mdb_admin_is_member_of_role(Oid member, Oid role);
To check mdb admin belongship and role-to-role ownership transfer
correctness.
Our mdb_admin ACL model is the following:
* Any roles user or/and roles can be granted with mdb_admin
* mdb_admin memeber can tranfser ownershup of relations,
namespaces and functions to other roles, if target role in neither:
superuser, pg_read_server_files, pg_write_server_files nor
pg_execute_server_program.
* mdb_superuser role
This patch introcudes new pseudo-pre-defined role "mdb_superuser".
Role is capable of:
GRANT/REVOKE any set of priviledges to/from any object in database.
Has power of pg_database_owner in any database, including:
DROP any object in database (except system catalog and stuff)
Role is NOT capable of:
Create database, role, extension or alter other roles with such
priviledges.
Transfer ownership to /pass has_priv of roles:
PG_READ_ALL_DATA
PG_WRITE_ALL_DATA
PG_EXECUTE_SERVER_PROGRAM
PG_READ_SERVER_FILES
PG_WRITE_SERVER_FILES
PG_DATABASE_OWNER
Allow mdb_superuser to alter objects and grant ACl to
objects, owner by pg_database_owner. Also, when acl check,
allow mdb_supersuer use pg_database_owner role power to pass check
* Extend multixact SLRU
The issue here is the same as for the PG, good detail description I found in Nikolay blog post https://v2.postgres.ai/blog/20210831-postgresql-subtransactions-considered-harmful
See also the history of original PG patches in https://commitfest.postgresql.org/patch/2627/ We could get all those fixes after rebasing to PG18, but for now, we need to adjust SLRU structure sizes.
---------
Co-authored-by: usernamedt <usernamedt@yandex-team.com>
Co-authored-by: reshke <reshkekirill@gmail.com>1 parent 2cc5674 commit 4af1cf5
56 files changed
Lines changed: 1466 additions & 114 deletions
File tree
- contrib/pax_storage/src
- cpp/storage/oper
- test/regress/expected
- devops/build/automation/cloudberry/scripts
- gpcontrib/orafce
- src
- backend
- catalog
- commands
- gporca/libgpos/server/src/unittest/gpos/string
- storage/ipc
- utils
- activity
- adt
- mb
- misc
- bin
- initdb
- pg_upgrade
- common
- include
- access
- catalog
- common
- utils
- interfaces
- ecpg/ecpglib
- libpq
- pl/plperl
- port
- test
- locale
- mdb_admin
- t
- regress
- expected
- input
- output
- sql
- singlenode_regress/expected
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
698 | 698 | | |
699 | 699 | | |
700 | 700 | | |
| 701 | + | |
701 | 702 | | |
702 | 703 | | |
703 | 704 | | |
| |||
945 | 946 | | |
946 | 947 | | |
947 | 948 | | |
| 949 | + | |
948 | 950 | | |
949 | 951 | | |
950 | 952 | | |
| |||
1693 | 1695 | | |
1694 | 1696 | | |
1695 | 1697 | | |
| 1698 | + | |
1696 | 1699 | | |
1697 | 1700 | | |
1698 | 1701 | | |
| |||
2909 | 2912 | | |
2910 | 2913 | | |
2911 | 2914 | | |
2912 | | - | |
2913 | 2915 | | |
2914 | 2916 | | |
2915 | 2917 | | |
| |||
12208 | 12210 | | |
12209 | 12211 | | |
12210 | 12212 | | |
| 12213 | + | |
| 12214 | + | |
| 12215 | + | |
| 12216 | + | |
| 12217 | + | |
| 12218 | + | |
| 12219 | + | |
| 12220 | + | |
| 12221 | + | |
| 12222 | + | |
| 12223 | + | |
| 12224 | + | |
| 12225 | + | |
| 12226 | + | |
| 12227 | + | |
| 12228 | + | |
| 12229 | + | |
| 12230 | + | |
| 12231 | + | |
| 12232 | + | |
| 12233 | + | |
| 12234 | + | |
| 12235 | + | |
| 12236 | + | |
| 12237 | + | |
| 12238 | + | |
| 12239 | + | |
| 12240 | + | |
| 12241 | + | |
| 12242 | + | |
| 12243 | + | |
| 12244 | + | |
12211 | 12245 | | |
12212 | 12246 | | |
12213 | 12247 | | |
| |||
12844 | 12878 | | |
12845 | 12879 | | |
12846 | 12880 | | |
| 12881 | + | |
| 12882 | + | |
| 12883 | + | |
| 12884 | + | |
| 12885 | + | |
| 12886 | + | |
| 12887 | + | |
| 12888 | + | |
| 12889 | + | |
| 12890 | + | |
| 12891 | + | |
| 12892 | + | |
| 12893 | + | |
| 12894 | + | |
| 12895 | + | |
| 12896 | + | |
| 12897 | + | |
| 12898 | + | |
| 12899 | + | |
| 12900 | + | |
| 12901 | + | |
| 12902 | + | |
| 12903 | + | |
| 12904 | + | |
| 12905 | + | |
| 12906 | + | |
| 12907 | + | |
| 12908 | + | |
| 12909 | + | |
| 12910 | + | |
| 12911 | + | |
| 12912 | + | |
| 12913 | + | |
| 12914 | + | |
| 12915 | + | |
| 12916 | + | |
| 12917 | + | |
| 12918 | + | |
| 12919 | + | |
| 12920 | + | |
| 12921 | + | |
| 12922 | + | |
| 12923 | + | |
| 12924 | + | |
| 12925 | + | |
| 12926 | + | |
| 12927 | + | |
| 12928 | + | |
| 12929 | + | |
| 12930 | + | |
12847 | 12931 | | |
12848 | 12932 | | |
12849 | 12933 | | |
| |||
17065 | 17149 | | |
17066 | 17150 | | |
17067 | 17151 | | |
| 17152 | + | |
| 17153 | + | |
| 17154 | + | |
| 17155 | + | |
| 17156 | + | |
| 17157 | + | |
| 17158 | + | |
| 17159 | + | |
| 17160 | + | |
| 17161 | + | |
| 17162 | + | |
17068 | 17163 | | |
17069 | 17164 | | |
17070 | 17165 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1462 | 1462 | | |
1463 | 1463 | | |
1464 | 1464 | | |
| 1465 | + | |
| 1466 | + | |
| 1467 | + | |
| 1468 | + | |
| 1469 | + | |
| 1470 | + | |
| 1471 | + | |
| 1472 | + | |
1465 | 1473 | | |
1466 | 1474 | | |
1467 | 1475 | | |
| |||
1620 | 1628 | | |
1621 | 1629 | | |
1622 | 1630 | | |
| 1631 | + | |
| 1632 | + | |
| 1633 | + | |
| 1634 | + | |
| 1635 | + | |
1623 | 1636 | | |
1624 | 1637 | | |
1625 | 1638 | | |
| |||
1999 | 2012 | | |
2000 | 2013 | | |
2001 | 2014 | | |
| 2015 | + | |
| 2016 | + | |
| 2017 | + | |
| 2018 | + | |
2002 | 2019 | | |
2003 | 2020 | | |
2004 | 2021 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
588 | 589 | | |
589 | 590 | | |
590 | 591 | | |
591 | | - | |
| 592 | + | |
592 | 593 | | |
593 | | - | |
| 594 | + | |
594 | 595 | | |
595 | 596 | | |
596 | 597 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
166 | 166 | | |
167 | 167 | | |
168 | 168 | | |
169 | | - | |
| 169 | + | |
170 | 170 | | |
171 | 171 | | |
172 | | - | |
| 172 | + | |
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
166 | 166 | | |
167 | 167 | | |
168 | 168 | | |
169 | | - | |
| 169 | + | |
170 | 170 | | |
171 | 171 | | |
172 | | - | |
| 172 | + | |
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
| |||
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
65 | 71 | | |
66 | 72 | | |
67 | 73 | | |
| |||
138 | 144 | | |
139 | 145 | | |
140 | 146 | | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
141 | 152 | | |
142 | 153 | | |
143 | 154 | | |
| |||
164 | 175 | | |
165 | 176 | | |
166 | 177 | | |
| 178 | + | |
167 | 179 | | |
168 | 180 | | |
169 | 181 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
| |||
322 | 323 | | |
323 | 324 | | |
324 | 325 | | |
325 | | - | |
| 326 | + | |
326 | 327 | | |
327 | 328 | | |
328 | 329 | | |
| |||
364 | 365 | | |
365 | 366 | | |
366 | 367 | | |
367 | | - | |
| 368 | + | |
368 | 369 | | |
369 | 370 | | |
370 | 371 | | |
| |||
409 | 410 | | |
410 | 411 | | |
411 | 412 | | |
412 | | - | |
| 413 | + | |
413 | 414 | | |
414 | 415 | | |
415 | 416 | | |
| |||
422 | 423 | | |
423 | 424 | | |
424 | 425 | | |
425 | | - | |
| 426 | + | |
426 | 427 | | |
427 | 428 | | |
428 | 429 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2971 | 2971 | | |
2972 | 2972 | | |
2973 | 2973 | | |
2974 | | - | |
2975 | 2974 | | |
2976 | 2975 | | |
2977 | 2976 | | |
| |||
2989 | 2988 | | |
2990 | 2989 | | |
2991 | 2990 | | |
2992 | | - | |
| 2991 | + | |
| 2992 | + | |
| 2993 | + | |
| 2994 | + | |
| 2995 | + | |
| 2996 | + | |
| 2997 | + | |
| 2998 | + | |
| 2999 | + | |
| 3000 | + | |
| 3001 | + | |
| 3002 | + | |
| 3003 | + | |
| 3004 | + | |
| 3005 | + | |
| 3006 | + | |
| 3007 | + | |
| 3008 | + | |
2993 | 3009 | | |
2994 | 3010 | | |
2995 | 3011 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1085 | 1085 | | |
1086 | 1086 | | |
1087 | 1087 | | |
1088 | | - | |
| 1088 | + | |
| 1089 | + | |
1089 | 1090 | | |
1090 | 1091 | | |
1091 | 1092 | | |
| |||
1105 | 1106 | | |
1106 | 1107 | | |
1107 | 1108 | | |
1108 | | - | |
1109 | | - | |
| 1109 | + | |
| 1110 | + | |
1110 | 1111 | | |
1111 | 1112 | | |
1112 | 1113 | | |
1113 | 1114 | | |
1114 | 1115 | | |
1115 | | - | |
1116 | 1116 | | |
1117 | 1117 | | |
1118 | 1118 | | |
| |||
0 commit comments