summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
7 daysLooks like we can't test NLS on machines that lack any es_ES locale.Tom Lane
While commit 5b275a6e1 fixed a few unhappy buildfarm animals, it looks like the remainder simply don't have any es_ES locale at all. There's little point in running the test in that case, so minimize the number of variant expected-files by bailing out. Also emit a log entry so that it's possible to tell from buildfarm postmaster logs which case occurred. Possibly, the scope of this testing could be improved by providing additional translations. But I think it's likely that the failing animals have no non-C locales installed at all. In passing, update typedefs.list so that koel doesn't think regress.c is misformatted. Discussion: https://postgr.es/m/[email protected]
7 daysbufmgr: Add one-entry cache for private refcountAndres Freund
The private refcount entry for a buffer is often looked up repeatedly for the same buffer, e.g. to pin and then unpin a buffer. Benchmarking shows that it's worthwhile to have a one-entry cache for that case. With that cache in place, it's worth splitting GetPrivateRefCountEntry() into a small inline portion (for the cache hit case) and an out-of-line helper for the rest. This is helpful for some workloads today, but becomes more important in an upcoming patch that will utilize the private refcount infrastructure to also store whether the buffer is currently locked, as that increases the rate of lookups substantially. Reviewed-by: Melanie Plageman <[email protected]> Discussion: https://postgr.es/m/6rgb2nvhyvnszz4ul3wfzlf5rheb2kkwrglthnna7qhe24onwr@vw27225tkyar
7 daysbufmgr: Separate keys for private refcount infrastructureAndres Freund
This makes lookups faster, due to allowing auto-vectorized lookups. It is also beneficial for an upcoming patch, independent of auto-vectorization, as the upcoming patch wants to track more information for each pinned buffer, making the existing loop, iterating over an array of PrivateRefCountEntry, more expensive due to increasing its size. Reviewed-by: Melanie Plageman <[email protected]> Discussion: https://postgr.es/m/fvfmkr5kk4nyex56ejgxj3uzi63isfxovp2biecb4bspbjrze7@az2pljabhnff
7 daysTry a few different locale name spellings in nls.sql.Tom Lane
While CI testing in advance of commit 8c498479d suggested that all Unix-ish platforms would accept 'es_ES.UTF-8', the buildfarm has a different opinion. Let's dynamically select something that works, if possible. Discussion: https://postgr.es/m/[email protected]
7 daysFix double assignment.Tom Lane
Coverity complained about this, not without reason: OldMultiXactReader *state = state = pg_malloc(sizeof(*state)); (I'm surprised this is even legal C ... why is "state" in-scope in its initialization expression?) While at it, convert to use our newly-preferred "pg_malloc_object" macro instead of an explicit sizeof().
7 daysAdd a regression test to verify that NLS translation works.Tom Lane
We've never actually had a formal test for this facility. It seems worth adding one now, mainly because we are starting to depend on gettext() being able to handle the PRI* macros from <inttypes.h>, and it's not all that certain that that works everywhere. So the test goes to a bit of effort to check all the PRI* macros we are likely to use. (This effort has indeed found one problem already, now fixed in commit f8715ec86.) Discussion: https://postgr.es/m/[email protected] Discussion: https://postgr.es/m/[email protected]
8 daysRefactor WaitLSNType enum to use a macro for type countAlexander Korotkov
Change WAIT_LSN_TYPE_COUNT from an enum sentinel to a macro definition, in a similar way to IOObject, IOContext, and BackendType enums. Remove explicit enum value assignments well. Author: Xuneng Zhou <[email protected]>
8 daysFix usage of palloc() in MERGE/SPLIT PARTITION(s) codeAlexander Korotkov
f2e4cc427951 and 4b3d173629f4 implement ALTER TABLE ... MERGE/SPLIT PARTITION(s) commands. In several places, these commits use palloc(), where we should use palloc_object() and palloc_array(). This commit provides appropriate usage of palloc_object() and palloc_array(). Reported-by: Man Zeng <[email protected]> Discussion: https://postgr.es/m/tencent_3661BB522D5466B33EA33666%40qq.com
8 daysImplement ALTER TABLE ... SPLIT PARTITION ... commandAlexander Korotkov
This new DDL command splits a single partition into several partitions. Just like the ALTER TABLE ... MERGE PARTITIONS ... command, new partitions are created using the createPartitionTable() function with the parent partition as the template. This commit comprises a quite naive implementation which works in a single process and holds the ACCESS EXCLUSIVE LOCK on the parent table during all the operations, including the tuple routing. This is why the new DDL command can't be recommended for large, partitioned tables under high load. However, this implementation comes in handy in certain cases, even as it is. Also, it could serve as a foundation for future implementations with less locking and possibly parallelism. Discussion: https://postgr.es/m/c73a1746-0cd0-6bdd-6b23-3ae0b7c0c582%40postgrespro.ru Author: Dmitry Koval <[email protected]> Co-authored-by: Alexander Korotkov <[email protected]> Co-authored-by: Tender Wang <[email protected]> Co-authored-by: Richard Guo <[email protected]> Co-authored-by: Dagfinn Ilmari Mannsaker <[email protected]> Co-authored-by: Fujii Masao <[email protected]> Co-authored-by: Jian He <[email protected]> Reviewed-by: Matthias van de Meent <[email protected]> Reviewed-by: Laurenz Albe <[email protected]> Reviewed-by: Zhihong Yu <[email protected]> Reviewed-by: Justin Pryzby <[email protected]> Reviewed-by: Alvaro Herrera <[email protected]> Reviewed-by: Robert Haas <[email protected]> Reviewed-by: Stephane Tachoires <[email protected]> Reviewed-by: Jian He <[email protected]> Reviewed-by: Alexander Korotkov <[email protected]> Reviewed-by: Pavel Borisov <[email protected]> Reviewed-by: Masahiko Sawada <[email protected]> Reviewed-by: Alexander Lakhin <[email protected]> Reviewed-by: Kyotaro Horiguchi <[email protected]> Reviewed-by: Daniel Gustafsson <[email protected]> Reviewed-by: Tom Lane <[email protected]> Reviewed-by: Noah Misch <[email protected]>
8 daysImplement ALTER TABLE ... MERGE PARTITIONS ... commandAlexander Korotkov
This new DDL command merges several partitions into a single partition of the target table. The target partition is created using the new createPartitionTable() function with the parent partition as the template. This commit comprises a quite naive implementation which works in a single process and holds the ACCESS EXCLUSIVE LOCK on the parent table during all the operations, including the tuple routing. This is why this new DDL command can't be recommended for large partitioned tables under a high load. However, this implementation comes in handy in certain cases, even as it is. Also, it could serve as a foundation for future implementations with less locking and possibly parallelism. Discussion: https://postgr.es/m/c73a1746-0cd0-6bdd-6b23-3ae0b7c0c582%40postgrespro.ru Author: Dmitry Koval <[email protected]> Co-authored-by: Alexander Korotkov <[email protected]> Co-authored-by: Tender Wang <[email protected]> Co-authored-by: Richard Guo <[email protected]> Co-authored-by: Dagfinn Ilmari Mannsaker <[email protected]> Co-authored-by: Fujii Masao <[email protected]> Co-authored-by: Jian He <[email protected]> Reviewed-by: Matthias van de Meent <[email protected]> Reviewed-by: Laurenz Albe <[email protected]> Reviewed-by: Zhihong Yu <[email protected]> Reviewed-by: Justin Pryzby <[email protected]> Reviewed-by: Alvaro Herrera <[email protected]> Reviewed-by: Robert Haas <[email protected]> Reviewed-by: Stephane Tachoires <[email protected]> Reviewed-by: Jian He <[email protected]> Reviewed-by: Alexander Korotkov <[email protected]> Reviewed-by: Pavel Borisov <[email protected]> Reviewed-by: Masahiko Sawada <[email protected]> Reviewed-by: Alexander Lakhin <[email protected]> Reviewed-by: Kyotaro Horiguchi <[email protected]> Reviewed-by: Daniel Gustafsson <[email protected]> Reviewed-by: Tom Lane <[email protected]> Reviewed-by: Noah Misch <[email protected]>
8 daysFix jsonb_object_agg crash after eliminating null-valued pairs.Tom Lane
In commit b61aa76e4 I added an assumption in jsonb_object_agg_finalfn that it'd be okay to apply uniqueifyJsonbObject repeatedly to a JsonbValue. I should have studied that code more closely first, because in skip_nulls mode it removed leading nulls by changing the "pairs" array start pointer. This broke the data structure's invariants in two ways: pairs no longer references a repalloc-able chunk, and the distance from pairs to the end of its array is less than parseState->size. So any subsequent addition of more pairs is at high risk of clobbering memory and/or causing repalloc to crash. Unfortunately, adding more pairs is exactly what will happen when the aggregate is being used as a window function. Fix by rewriting uniqueifyJsonbObject to not do that. The prior coding had little to recommend it anyway. Reported-by: Alexander Lakhin <[email protected]> Author: Tom Lane <[email protected]> Discussion: https://postgr.es/m/[email protected]
8 daysUse correct preprocessor conditional in relptr.hPeter Eisentraut
When relptr.h was added (commit fbc1c12a94a), there was no check for HAVE_TYPEOF, so it used HAVE__BUILTIN_TYPES_COMPATIBLE_P, which already existed (commit ea473fb2dee) and which was thought to cover approximately the same compilers. But the guarded code can also work without HAVE__BUILTIN_TYPES_COMPATIBLE_P, and we now have a check for HAVE_TYPEOF (commit 4cb824699e1), so let's fix this up to use the correct logic. Co-authored-by: Thomas Munro <[email protected]> Discussion: https://www.postgresql.org/message-id/CA%2BhUKGL7trhWiJ4qxpksBztMMTWDyPnP1QN%2BLq341V7QL775DA%40mail.gmail.com
9 daysFix out-of-date comment on makeRangeConstructorsPeter Eisentraut
We did define 4 functions in 4429f6a9e3, but in df73584431e7 we got rid of the 0- and 1-arg versions. Author: Paul A. Jungwirth <[email protected]> Reviewed-by: Chao Li <[email protected]> Discussion: https://www.postgresql.org/message-id/CA%2BrenyVQti3iC7LE4UxtQb4ROLYMs6%2Bu-d4LrN5U4idH1Ghx6Q%40mail.gmail.com
9 daysClarify comment about temporal foreign keysPeter Eisentraut
In RI_ConstraintInfo, period_contained_by_oper and period_intersect_oper can take either anyrange or anymultirange. Author: Paul A. Jungwirth <[email protected]> Discussion: https://www.postgresql.org/message-id/CA%2BrenyWzDth%2BjqLZA2L2Cezs3wE%2BWX-5P8W2EOVx_zfFD%3Daicg%40mail.gmail.com
10 daysReject opclass options in ON CONFLICT clauseÁlvaro Herrera
It's as pointless as ASC/DESC and NULLS FIRST/LAST are, so reject all of them in the same way. While at it, normalize the others' error messages to have less translatable strings. Add tests for these errors. Noticed while reviewing recent INSERT ON CONFLICT patches. Author: Álvaro Herrera <[email protected]> Reviewed-by: Peter Geoghegan <[email protected]> Discussion: https://postgr.es/m/[email protected]
10 daysReplace most StaticAssertStmt() with StaticAssertDecl()Peter Eisentraut
Similar to commit 75f49221c22, it is preferable to use StaticAssertDecl() instead of StaticAssertStmt() when possible. Discussion: https://www.postgresql.org/message-id/flat/CA%2BhUKGKvr0x_oGmQTUkx%3DODgSksT2EtgCA6LmGx_jQFG%3DsDUpg%40mail.gmail.com
10 daysNever store 0 as the nextMXactHeikki Linnakangas
Before this commit, when multixid wraparound happens, MultiXactState->nextMXact goes to 0, which is invalid. All the readers need to deal with that possibility and skip over the 0. That's error-prone and we've missed it a few times in the past. This commit changes the responsibility so that all the writers of MultiXactState->nextMXact skip over the zero already, and readers can trust that it's never 0. We were already doing that for MultiXactState->oldestMultiXactId; none of its writers would set it to 0. ReadMultiXactIdRange() was nevertheless checking for that possibility. For clarity, remove that check. Reviewed-by: Ashutosh Bapat <[email protected]> Reviewed-by: Maxim Orlov <[email protected]> Discussion: https://www.postgresql.org/message-id/[email protected]
10 daysFix some comments.Nathan Bossart
Like commit 123661427b, these were discovered while reviewing Aleksander Alekseev's proposed changes to pgindent.
10 daysFix infer_arbiter_index for partitioned tablesÁlvaro Herrera
The fix for concurrent index operations in bc32a12e0db2 started considering indexes that are not yet marked indisvalid as arbiters for INSERT ON CONFLICT. For partitioned tables, this leads to including indexes that may not exist in partitions, causing a trivially reproducible "invalid arbiter index list" error to be thrown because of failure to match the index. To fix, it suffices to ignore !indisvalid indexes on partitioned tables. There should be no risk that the set of indexes will change for concurrent transactions, because in order for such an index to be marked valid, an ALTER INDEX ATTACH PARTITION must run which requires AccessExclusiveLock. Author: Mihail Nikalayeu <[email protected]> Reported-by: Alexander Lakhin <[email protected]> Reviewed-by: Álvaro Herrera <[email protected]> Discussion: https://postgr.es/m/17622f79-117a-4a44-aa8e-0374e53faaf0%40gmail.com
11 daysFix comment on how temp files and subtransactions are handledHeikki Linnakangas
The comment was accurate a long time ago, but not any more. I failed to update the comment in commit ab3148b712.
11 daysAdd runtime checks for bogus multixact offsetsHeikki Linnakangas
It's not far-fetched that we'd try to read a multixid with an invalid offset in case of bugs or corruption. Or if you call pg_get_multixact_members() after a crash that left behind invalid but unused multixids. Better to get a somewhat descriptive error message if that happens. Discussion: https://www.postgresql.org/message-id/[email protected]
11 daysMake <assert.h> consistently available in frontend and backendPeter Eisentraut
Previously, c.h made <assert.h> only available in frontends (#ifdef FRONTEND), which was probably reasonable, because the only thing it would give you is assert(), which you generally shouldn't use in the backend. But with C11, <assert.h> also makes available static_assert(), which would be useful everywhere. So this patch moves <assert.h> to the commonly available header files in c.h and fixes a small complication in regcustom.h that resulted from that. Co-authored-by: Thomas Munro <[email protected]> Discussion: https://www.postgresql.org/message-id/flat/CA%2BhUKGKvr0x_oGmQTUkx%3DODgSksT2EtgCA6LmGx_jQFG%3DsDUpg%40mail.gmail.com
11 daysUse palloc_object() and palloc_array(), the last changeMichael Paquier
This is the last batch of changes that have been suggested by the author, this part covering the non-trivial changes. Some of the changes suggested have been discarded as they seem to lead to more instructions generated, leaving the parts that can be qualified as in-place replacements. Similar work has been done in 1b105f9472bd, 0c3c5c3b06a3 and 31d3847a37be. Author: David Geier <[email protected]> Discussion: https://postgr.es/m/[email protected]
11 daysEnhance slot synchronization API to respect promotion signal.Amit Kapila
Previously, during a promotion, only the slot synchronization worker was signaled to shut down. The backend executing slot synchronization via the pg_sync_replication_slots() SQL function was not signaled, allowing it to complete its synchronization cycle before exiting. An upcoming patch improves pg_sync_replication_slots() to wait until replication slots are fully persisted before finishing. This behaviour requires the backend to exit promptly if a promotion occurs. This patch ensures that, during promotion, a signal is also sent to the backend running pg_sync_replication_slots(), allowing it to be interrupted and exit immediately. Author: Ajin Cherian <[email protected]> Reviewed-by: Shveta Malik <[email protected]> Reviewed-by: Chao Li <[email protected]> Reviewed-by: Amit Kapila <[email protected]> Discussion: https://postgr.es/m/CAFPTHDZAA%2BgWDntpa5ucqKKba41%3DtXmoXqN3q4rpjO9cdxgQrw%40mail.gmail.com
11 daysClarify why _bt_killitems sorts its items array.Peter Geoghegan
Make it clear why _bt_killitems sorts the scan's so->killedItems[] array. Also add an assertion to the _bt_killitems loop (that iterates through this array) to verify it accesses tuples in leaf page order. Follow-up to commit bfb335df58. Author: Peter Geoghegan <[email protected]> Suggested-by: Victor Yegorov <[email protected]> Discussion: https://postgr.es/m/CAGnEboirgArezZDNeFrR8FOGvKF-Xok333s2iVwWi65gZf8MEA@mail.gmail.com
11 daysFix allocation formula in llvmjit_expr.cMichael Paquier
An array of LLVMBasicBlockRef is allocated with the size used for an element being "LLVMBasicBlockRef *" rather than "LLVMBasicBlockRef". LLVMBasicBlockRef is a type that refers to a pointer, so this did not directly cause a problem because both should have the same size, still it is incorrect. This issue has been spotted while reviewing a different patch, and exists since 2a0faed9d702, so backpatch all the way down. Discussion: https://postgr.es/m/CA+hUKGLngd9cKHtTUuUdEo2eWEgUcZ_EQRbP55MigV2t_zTReg@mail.gmail.com Backpatch-through: 14
11 daysFix MULTIXACT_DEBUG builds.Peter Geoghegan
Oversight in commit bd8d9c9b. Discussion: https://postgr.es/m/CAH2-WzmvwVKZ+0Z=RL_+g_aOku8QxWddDCXmtyLj02y+nYaD0g@mail.gmail.com
11 daysAllow PG_PRINTF_ATTRIBUTE to be different in C and C++ code.Tom Lane
Although clang claims to be compatible with gcc's printf format archetypes, this appears to be a falsehood: it likes __syslog__ (which gcc does not, on most platforms) and doesn't accept gnu_printf. This means that if you try to use gcc with clang++ or clang with g++, you get compiler warnings when compiling printf-like calls in our C++ code. This has been true for quite awhile, but it's gotten more annoying with the recent appearance of several buildfarm members that are configured like this. To fix, run separate probes for the format archetype to use with the C and C++ compilers, and conditionally define PG_PRINTF_ATTRIBUTE depending on __cplusplus. (We could alternatively insist that you not mix-and-match C and C++ compilers; but if the case works otherwise, this is a poor reason to insist on that.) No back-patch for now, but we may want to do that if this patch survives buildfarm testing. Discussion: https://postgr.es/m/[email protected]
11 daysReturn TIDs in desc order during backwards scans.Peter Geoghegan
Always return TIDs in descending order when returning groups of TIDs from an nbtree posting list tuple during nbtree backwards scans. This makes backwards scans tend to require fewer buffer hits, since the scan is less likely to repeatedly pin and unpin the same heap page/buffer (we'll get exactly as many buffer hits as we get with a similar forwards scan case). Commit 0d861bbb, which added nbtree deduplication, originally did things this way to avoid interfering with _bt_killitems's approach to setting LP_DEAD bits on posting list tuples. _bt_killitems makes a soft assumption that it can always iterate through posting lists in ascending TID order, finding corresponding killItems[]/so->currPos.items[] entries in that same order. This worked out because of the prior _bt_readpage backwards scan behavior. If we just changed the backwards scan posting list logic in _bt_readpage, without altering _bt_killitems itself, it would break its soft assumption. Avoid that problem by sorting the so->killedItems[] array at the start of _bt_killitems. That way the order that dead items are saved in from btgettuple can't matter; so->killedItems[] will always be in the same order as so->currPos.items[] in the end. Since so->currPos.items[] is now always in leaf page order, regardless of the scan direction used within _bt_readpage, and since so->killedItems[] is always in that same order, the _bt_killitems loop can continue to make a uniform assumption about everything being in page order. In fact, sorting like this makes the previous soft assumption about item order into a hard invariant. Also deduplicate the so->killedItems[] array after it is sorted. That way there's no risk of the _bt_killitems loop becoming confused by a duplicate dead item/TID. This was possible in cases that involved a scrollable cursor that encountered the same dead TID more than once (within the same leaf page/so->currPos context). This doesn't come up very much in practice, but it seems best to be as consistent as possible about how and when _bt_killitems will LP_DEAD-mark index tuples. Author: Peter Geoghegan <[email protected]> Reviewed-By: Mircea Cadariu <[email protected]> Reviewed-By: Victor Yegorov <[email protected]> Discussion: https://postgr.es/m/CAH2-Wz=Wut2pKvbW-u3hJ_LXwsYeiXHiW8oN1GfbKPavcGo8Ow@mail.gmail.com
11 daysAdd pg_iswcased().Jeff Davis
True if character has multiple case forms. Will be a useful multibyte-aware replacement for char_is_cased(). Reviewed-by: Chao Li <[email protected]> Reviewed-by: Peter Eisentraut <[email protected]> Discussion: https://postgr.es/m/[email protected]
11 daysRemove char_tolower() API.Jeff Davis
It's only useful for an ILIKE optimization for the libc provider using a single-byte encoding and a non-C locale, but it creates significant internal complexity. Reviewed-by: Chao Li <[email protected]> Reviewed-by: Peter Eisentraut <[email protected]> Discussion: https://postgr.es/m/[email protected]
11 daysFix bogus extra arguments to query_safe in testHeikki Linnakangas
The test seemed to incorrectly think that query_safe() takes an argument that describes what the query does, similar to e.g. command_ok(). Until commit bd8d9c9bdf the extra arguments were harmless and were just ignored, but when commit bd8d9c9bdf introduced a new optional argument to query_safe(), the extra arguments started clashing with that, causing the test to fail. Backpatch to v17, that's the oldest branch where the test exists. The extra arguments didn't cause any trouble on the older branches, but they were clearly bogus anyway.
11 daysImprove DDL deparsing testHeikki Linnakangas
1. The test initially focuses on the "parent" table, then switches to the "part" table, and goes back to the "parent" table. That seems a little weird, so move the tests around so that all the commands on the "parent" table are done first, followed by the "part" table. 2. ALTER TABLE ALTER COLUMN SET EXPRESSION was not tested, so add that. Author: jian he <[email protected]> Reviewed-by: Chao Li <[email protected]> Discussion: https://www.postgresql.org/message-id/CACJufxFDi7fnwB-8xXd_ExML7-7pKbTaK4j46AJ=4-14DXvtVg@mail.gmail.com
12 daysAdd comment about keeping PD_ALL_VISIBLE and VM in syncMelanie Plageman
The comment above heap_xlog_visible() about the critical integrity requirement for PD_ALL_VISIBLE and the visibility map should also be in heap_xlog_prune_freeze() where we set PD_ALL_VISIBLE. Oversight in add323da40a6bf9e Author: Melanie Plageman <[email protected]> Discussion: https://postgr.es/m/flat/CAAKRu_ZMw6Npd_qm2KM%2BFwQ3cMOMx1Dh3VMhp8-V7SOLxdK9-g%40mail.gmail.com
12 daysSimplify vacuum visibility assertionMelanie Plageman
Phase I vacuum gives the page a once-over after pruning and freezing to check that the values of all_visible and all_frozen agree with the result of heap_page_is_all_visible(). This is meant to keep the logic in phase I for determining visibility in sync with the logic in phase III. Rewrite the assertion to avoid an Assert(false). Suggested by Andres Freund. Author: Melanie Plageman <[email protected]> Discussion: https://postgr.es/m/mhf4vkmh3j57zx7vuxp4jagtdzwhu3573pgfpmnjwqa6i6yj5y%40sy4ymcdtdklo
12 daysFix comment in GetPublicationRelationsHeikki Linnakangas
This function gets the list of relations associated with the publication but the comment said the opposite. Author: Shlok Kyal <[email protected]> Discussion: https://www.postgresql.org/message-id/CANhcyEV3C_CGBeDtjvKjALDJDMH-Uuc9BWfSd=eck8SCXnE=fQ@mail.gmail.com
12 daysFix some near-bugs related to ResourceOwner function argumentsHeikki Linnakangas
These functions took a ResourceOwner argument, but only checked if it was NULL, and then used CurrentResourceOwner for the actual work. Surely the intention was to use the passed-in resource owner. All current callers passed CurrentResourceOwner or NULL, so this has no consequences at the moment, but it's an accident waiting to happen for future caller and extensions. Author: Matthias van de Meent <[email protected]> Discussion: https://www.postgresql.org/message-id/CAEze2Whnfv8VuRZaohE-Af+GxBA1SNfD_rXfm84Jv-958UCcJA@mail.gmail.com Backpatch-through: 17
12 dayslibpq: Authorize pthread_exit() in libpq_checkMichael Paquier
pthread_exit() is added to the list of symbols allowed when building libpq. This has been reported as possible when libpq is statically linked to libcrypto, where pthread_exit() could be called. Reported-by: Torsten Rupp <[email protected]> Author: Nazir Bilal Yavuz <[email protected]> Reviewed-by: Daniel Gustafsson <[email protected]> Reviewed-by: Michael Paquier <[email protected]> Discussion: https://postgr.es/m/[email protected]
12 daysFix failures with cross-version pg_upgrade testsMichael Paquier
Buildfarm members skimmer and crake have reported that pg_upgrade running from v18 fails due to the changes of d52c24b0f808, with the expectations that the objects removed in the test module injection_points should still be present post upgrades, but the test module does not have them anymore. The origin of the issue is that the following test modules depend on injection_points, but they do not drop the extension once the tests finish, leaving its traces in the dumps used for the upgrades: - gin, down to v17 - typcache, down to v18 - nbtree, HEAD-only Test modules have no upgrade requirements, as they are used only for.. Tests, so there is no point in keeping them around. An alternative solution would be to drop the databases created by these modules in AdjustUpgrade.pm, but the solution of this commit to drop the extension is simpler. Note that there would be a catch if using a solution based on AdjustUpgrade.pm as the database name used for the test runs differs between configure and meson: - configure relies on USE_MODULE_DB for the database name unicity, that would build a database name based on the *first* entry of REGRESS, that lists all the SQL tests. - meson relies on a "name" field. For example, for the test module "gin", the regression database is named "regression_gin" under meson, while it is more complex for configure, as of "contrib_regression_gin_incomplete_splits". So a AdjustUpgrade.pm would need a set of DROP DATABASE IF EXISTS to solve this issue, to cope with each build system. The failure has been caused by d52c24b0f808, and the problem can happen with upgrade dumps from v17 and v18 to HEAD. This problem is not currently reachable in the back-branches, but it could be possible that a future change in injection_points in stable branches invalidates this theory, so this commit is applied down to v17 in the test modules that matter. Per discussion with Tom Lane and Heikki Linnakangas. Discussion: https://postgr.es/m/[email protected] Backpatch-through: 17
12 daysFix two issues with recently-introduced nbtree testMichael Paquier
REGRESS has forgotten about the test nbtree_half_dead_pages, and a .gitignore was missing from the module. Oversights in c085aab27819 for REGRESS and 1e4e5783e7d7 for the missing .gitignore. Discussion: https://postgr.es/m/[email protected]
12 daysFix meson warning due to missing declaration of NMMichael Paquier
The warning was showing up in the early stages of the meson build, when the contents of Makefile.global is generated based on the configuration of meson for PGXS. NM is added to pgxs_empty. This declaration is only used internally for the libpq sanity check, so there is no point in exposing it in PGXS. Oversight in 4a8e6f43a6b5. Reported-by: Peter Eisentraut <[email protected]> Reviewed-by: Nazir Bilal Yavuz <[email protected]> Discussion: https://postgr.es/m/[email protected]
12 daysFix typo in commentHeikki Linnakangas
Author: Xuneng Zhou <[email protected]> Reviewed-by: Chao Li <[email protected]> Discussion: https://www.postgresql.org/message-id/CABPTF7V8CbOXGePqrad6EH3Om7DRhNiO3C0rQ-62UuT7RdU-GQ@mail.gmail.com
12 daysFix misleading comment in tuplesort.cDavid Rowley
A comment in tuplesort.c was claiming that the code was defining INITIAL_MEMTUPSIZE so that it *does not* exceed ALLOCSET_SEPARATE_THRESHOLD, but the code actually ensures that we purposefully *do* exceed ALLOCSET_SEPARATE_THRESHOLD for the initial allocation of the tuples array, as per reasons detailed in the commentary of grow_memtuples(). Also, there's not much need to repeat the mention about ALLOCSET_SEPARATE_THRESHOLD in each location where INITIAL_MEMTUPSIZE is used, so remove those comments. Author: ChangAo Chen <[email protected]> Reviewed-by: Chao Li <[email protected]> Reviewed-by: David G. Johnston <[email protected]> Discussion: https://postgr.es/m/tencent_6FA14F85D6B5B5291532D6789E07F4765C08%40qq.com
12 daysUse palloc_object() and palloc_array() in backend codeMichael Paquier
The idea is to encourage more the use of these new routines across the tree, as these offer stronger type safety guarantees than palloc(). This batch of changes includes most of the trivial changes suggested by the author for src/backend/. A total of 334 files are updated here. Among these files, 48 of them have their build change slightly; these are caused by line number changes as the new allocation formulas are simpler, shaving around 100 lines of code in total. Similar work has been done in 0c3c5c3b06a3 and 31d3847a37be. Author: David Geier <[email protected]> Discussion: https://postgr.es/m/[email protected]
12 daysFix O_CLOEXEC flag handling in Windows port.Thomas Munro
PostgreSQL's src/port/open.c has always set bInheritHandle = TRUE when opening files on Windows, making all file descriptors inheritable by child processes. This meant the O_CLOEXEC flag, added to many call sites by commit 1da569ca1f (v16), was silently ignored. The original commit included a comment suggesting that our open() replacement doesn't create inheritable handles, but it was a mis- understanding of the code path. In practice, the code was creating inheritable handles in all cases. This hasn't caused widespread problems because most child processes (archive_command, COPY PROGRAM, etc.) operate on file paths passed as arguments rather than inherited file descriptors. Even if a child wanted to use an inherited handle, it would need to learn the numeric handle value, which isn't passed through our IPC mechanisms. Nonetheless, the current behavior is wrong. It violates documented O_CLOEXEC semantics, contradicts our own code comments, and makes PostgreSQL behave differently on Windows than on Unix. It also creates potential issues with future code or security auditing tools. To fix, define O_CLOEXEC to _O_NOINHERIT in master, previously used by O_DSYNC. We use different values in the back branches to preserve existing values. In pgwin32_open_handle() we set bInheritHandle according to whether O_CLOEXEC is specified, for the same atomic semantics as POSIX in multi-threaded programs that create processes. Backpatch-through: 16 Author: Bryan Green <[email protected]> Co-authored-by: Thomas Munro <[email protected]> (minor adjustments) Discussion: https://postgr.es/m/e2b16375-7430-4053-bda3-5d2194ff1880%40gmail.com
12 daysvacuumdb: Add --dry-run.Nathan Bossart
This new option instructs vacuumdb to print, but not execute, the VACUUM and ANALYZE commands that would've been sent to the server. Author: Corey Huinker <[email protected]> Reviewed-by: Chao Li <[email protected]> Reviewed-by: Kirill Reshke <[email protected]> Reviewed-by: Álvaro Herrera <[email protected]> Discussion: https://postgr.es/m/CADkLM%3DckHkX7Of5SrK7g0LokPUwJ%3Dkk8JU1GXGF5pZ1eBVr0%3DQ%40mail.gmail.com
12 daysAdd ParallelSlotSetIdle().Nathan Bossart
This commit refactors the code for marking a ParallelSlot as idle to a new static inline function. This can be used to mark a slot that was obtained via ParallelSlotGetIdle() but that we don't intend to actually use for a query as idle again. This is preparatory work for a follow-up commit that will add a --dry-run option to vacuumdb. Reviewed-by: Corey Huinker <[email protected]> Reviewed-by: Kirill Reshke <[email protected]> Reviewed-by: Chao Li <[email protected] Discussion: https://postgr.es/m/CADkLM%3DckHkX7Of5SrK7g0LokPUwJ%3Dkk8JU1GXGF5pZ1eBVr0%3DQ%40mail.gmail.com
12 daysvacuumdb: Move some variables to the vacuumingOptions struct.Nathan Bossart
Presently, the "echo" and "quiet" variables are carted around to various functions, which is a bit tedious. To simplify things, this commit moves them into the vacuumingOptions struct and removes the related function parameters. While at it, remove some redundant initialization code in vacuumdb's main() function. This is preparatory work for a follow-up commit that will add a --dry-run option to vacuumdb. Reviewed-by: Corey Huinker <[email protected]> Reviewed-by: Kirill Reshke <[email protected]> Reviewed-by: Chao Li <[email protected]> Discussion: https://postgr.es/m/CADkLM%3DckHkX7Of5SrK7g0LokPUwJ%3Dkk8JU1GXGF5pZ1eBVr0%3DQ%40mail.gmail.com
12 daysAdd started_by column to pg_stat_progress_analyze view.Masahiko Sawada
The new column, started_by, indicates the initiator of the analyze ('manual' or 'autovacuum'), helping users and monitoring tools to better understand ANALYZE behavior. Bump catalog version. Author: Shinya Kato <[email protected]> Reviewed-by: Masahiko Sawada <[email protected]> Reviewed-by: Sami Imseih <[email protected]> Reviewed-by: Yu Wang <[email protected]> Discussion: https://postgr.es/m/CAA5RZ0suoicwxFeK_eDkUrzF7s0BVTaE7M%2BehCpYcCk5wiECpw%40mail.gmail.com
12 daysAdd mode and started_by columns to pg_stat_progress_vacuum view.Masahiko Sawada
The new columns, mode and started_by, indicate the vacuum mode ('normal', 'aggressive', or 'failsafe') and the initiator of the vacuum ('manual', 'autovacuum', or 'autovacuum_wraparound'), respectively. This allows users and monitoring tools to better understand VACUUM behavior. Bump catalog version. Author: Shinya Kato <[email protected]> Reviewed-by: Kirill Reshke <[email protected]> Reviewed-by: Nathan Bossart <[email protected]> Reviewed-by: Robert Treat <[email protected]> Reviewed-by: Masahiko Sawada <[email protected]> Reviewed-by: Sami Imseih <[email protected]> Reviewed-by: Michael Paquier <[email protected]> Reviewed-by: Yu Wang <[email protected]> Discussion: https://postgr.es/m/CAOzEurQcOY-OBL_ouEVfEaFqe_md3vB5pXjR_m6L71Dcp1JKCQ@mail.gmail.com