summaryrefslogtreecommitdiff
path: root/src/test/perl/PostgreSQL
AgeCommit message (Collapse)Author
2024-04-07Change debug printing to log filenameDaniel Gustafsson
When restarting the cluster fails the code introduced in 33774978c78 printed the full log contents to aid debugging. For cases when the logfile is large this adds unnecessary overhead. Reduce to printing the logfile path instead. Reported-by: Andres Freund <[email protected]> Discussion: https://postgr.es/m/[email protected]
2024-04-06Backport IPC::Run optimization to src/test/perl.Noah Misch
This one-liner makes the TAP portion of "make check-world" 7% faster on a non-Windows machine. Discussion: https://postgr.es/m/[email protected]
2024-04-05Allow synced slots to have their inactive_since.Amit Kapila
This commit does two things: 1) Maintains inactive_since for sync slots whenever the slot is released just like any other regular slot. 2) Ensures the value is set to the current timestamp during the promotion of standby to help correctly interpret the time after promotion. We don't want the slots to appear inactive for a long time after promotion if they haven't been synchronized recently. This would also avoid the invalidation of such slots immediately after promotion if tomorrow we have a feature that invalidates slots based on their inactivity time. Whoever acquires the slot i.e. makes the slot active will reset it to NULL. Author: Bharath Rupireddy Reviewed-by: Bertrand Drouvot, Amit Kapila, Shveta Malik, Masahiko Sawada Discussion: https://postgr.es/m/CAA4eK1KrPGwfZV9LYGidjxHeW+rxJ=E2ThjXvwRGLO=iLNuo=Q@mail.gmail.com Discussion: https://postgr.es/m/CALj2ACW4aUe-_uFQOjdWCEN-xXoLGhmvRFnL8SNw_TZ5nJe+aw@mail.gmail.com Discussion: https://postgr.es/m/CA+Tgmob_Ta-t2ty8QrKHBGnNLrf4ZYcwhGHGFsuUoFrAEDw4sA@mail.gmail.com
2024-03-19Activate perlcritic InputOutput::RequireCheckedSyscalls and fix resulting ↵Peter Eisentraut
warnings This checks that certain I/O-related Perl functions properly check their return value. Some parts of the PostgreSQL code had been a bit sloppy about that. The new perlcritic warnings are fixed here. I didn't design any beautiful error messages, mostly just used "or die $!", which mostly matches existing code, and also this is developer-level code, so having the system error plus source code reference should be ok. Initially, we only activate this check for a subset of what the perlcritic check would warn about. The effective list is chmod flock open read rename seek symlink system The initial set of functions is picked because most existing code already checked the return value of those, so any omissions are probably unintended, or because it seems important for test correctness. The actual perlcritic configuration is written as an exclude list. That seems better so that we are clear on what we are currently not checking. Maybe future patches want to investigate checking some of the other functions. (In principle, we might eventually want to check all of them, but since this is test and build support code, not production code, there are probably some reasonable compromises to be made.) Reviewed-by: Daniel Gustafsson <[email protected]> Discussion: https://www.postgresql.org/message-id/flat/88b7d4f2-46d9-4cc7-b1f7-613c90f9a76a%40eisentraut.org
2024-03-18Remove references to backup_fs_hot() in Cluster.pmMichael Paquier
This routine has been removed in 39969e2a1e4d with the exclusive backup mode but there were still references to it. Issue noticed while working on 071e3ad59d6f.
2024-03-13Reintroduce MAINTAIN privilege and pg_maintain predefined role.Nathan Bossart
Roles with MAINTAIN on a relation may run VACUUM, ANALYZE, REINDEX, REFRESH MATERIALIZE VIEW, CLUSTER, and LOCK TABLE on the relation. Roles with privileges of pg_maintain may run those same commands on all relations. This was previously committed for v16, but it was reverted in commit 151c22deee due to concerns about search_path tricks that could be used to escalate privileges to the table owner. Commits 2af07e2f74, 59825d1639, and c7ea3f4229 resolved these concerns by restricting search_path when running maintenance commands. Bumps catversion. Reviewed-by: Jeff Davis Discussion: https://postgr.es/m/20240305161235.GA3478007%40nathanxps13
2024-03-09Simplify and merge unwanted-module drop logic in AdjustUpgrade.pm.Tom Lane
In be7800674 and followups, we failed to notice that there was already a better way to do it: instead of using DROP DATABASE IF EXISTS, we can check the list of existing DBs. Also, there seems no reason not to merge this into the pre-existing code for getting rid of unwanted module databases. Discussion: https://postgr.es/m/[email protected]
2024-03-04Further further fix pg_upgrade crossversion test for adminpack.Tom Lane
Apparently, buildfarm animal crake has the adminpack regression DB named as "regression_adminpack" in some branches. Not clear why I didn't see that when testing here. In any case, drop that too. Discussion: https://postgr.es/m/[email protected]
2024-03-04Further fix pg_upgrade crossversion test for adminpack.Tom Lane
The DROP DATABASE step needs an "if exists" option, as the oldest branches we test don't have the contrib_regression_adminpack DB. Also remove unnecessary command to drop the extension from the regression database; no version has installed it there during buildfarm testing. Discussion: https://postgr.es/m/[email protected]
2024-03-04Fix crossversion test for unsupported versionsDaniel Gustafsson
The fix in be78006741 only accounted for supported versions of postgres but the crossversion test use 11 as the source version, which is an EOL version. Fix by removing the lower bound in the adminpack cleanup. Discussion: https://postgr.es/m/[email protected]
2024-03-04Adjust pg_upgrade crossversion test for adminpackDaniel Gustafsson
Commit cc09e6549f which removed the adminpack extension failed to instrument the crossversion pg_upgrade test to drop the extension before attempting an upgrade to v17. Discussion: https://postgr.es/m/[email protected]
2024-03-04Add PostgreSQL::Test::Cluster::wait_for_event()Michael Paquier
Per a demand from the author and the reviewer of this commit, this adds to Cluster.pm a helper routine that can be used to monitor when a process reaches a wanted wait event. This can be used in combination with the module injection_points for the "wait" callback, though it is not limited to it as this monitors pg_stat_activity for a wait_event and a backend_type. Author: Bertrand Drouvot Reviewed-by: Andrey Borodin Discussion: https://postgr.es/m/[email protected]
2024-02-28Fix cross-version upgrade tests after f0827b443.Tom Lane
Removing the get_columns_length() function from regress.so means we have to drop it when testing upgrades from versions that had it. Per buildfarm. Discussion: https://postgr.es/m/[email protected]
2024-02-21Add option force_initdb to PostgreSQL::Test::Cluster:init()Michael Paquier
This option is useful to bypass the default behavior of init() which would create the data folder of a new cluster by copying it from a template previously initdb'd, if any. Copying the data folder is much cheaper than running initdb, but some tests may want to force that. For example, one scenario of pg_combinebackup updated in this commit needs a different system ID for two nodes. Previously, this could only be achieved by unsetting $ENV{'INITDB_TEMPLATE'}, which could become a problem in complex node setups by making tests less efficient. Author: Amul Sul Reviewed-by: Robert Haas, Michael Paquier Discussion: https://postgr.es/m/[email protected]
2024-02-19Fix test race between primary XLOG_RUNNING_XACTS and standby logical slot.Noah Misch
Before the previous commit, the test could hang until LOG_SNAPSHOT_INTERVAL_MS (15s), until checkpoint_timeout (300s), or indefinitely. An indefinite hang was awfully improbable. It entailed the test reaching checkpoint_timeout before the DecodingContextFindStartpoint() of a CREATE SUBSCRIPTION, yet after the preceding WAL record. Back-patch to v16, which introduced the test. Bertrand Drouvot, reported by Noah Misch. Discussion: https://postgr.es/m/[email protected]
2024-02-15Allow passing extra options to initdb for testsPeter Eisentraut
Setting the environment variable PG_TEST_INITDB_EXTRA_OPTS passes extra options to initdb run by pg_regress or PostgreSQL::Test::Cluster's init. This can be useful for a wide variety of uses, like running all tests with checksums enabled, or with JIT enabled, or with different GUC settings, or with different locale settings. (Not all tests are going to pass with arbitrary options, but it is useful to run this against specific test suites.) Reviewed-by: Ian Lawrence Barwick <[email protected]> Discussion: https://www.postgresql.org/message-id/flat/d4d2ad9f-1c1d-47a1-bb4d-c10a747d4f15%40eisentraut.org
2024-01-18Fix an issue in PostgreSQL::Test::Cluster:psql()Peter Eisentraut
Due to the commit c5385929 which made all Perl warnings to fatal, use of PostgreSQL::Test::Cluster:psql() and safe_psql() with timeout started to fail with the following error: Use of uninitialized value $ret in bitwise and (&) at ..src/test/perl/PostgreSQL/Test/Cluster.pm line 2015. Fix that by placing $ret conversion code in psql() in an if (defined $ret) block. With this change, the behavior of psql() becomes same as before, that is, the whole function returns undef on timeout, which is usefully different from returning 0. Author: Bharath Rupireddy <[email protected]> Discussion: https://www.postgresql.org/message-id/flat/06f899fd-1826-05ab-42d6-adeb1fd5e200%40eisentraut.org
2024-01-04Update copyright for 2024Bruce Momjian
Reported-by: Michael Paquier Discussion: https://postgr.es/m/[email protected] Backpatch-through: 12
2023-12-29Make all Perl warnings fatalPeter Eisentraut
There are a lot of Perl scripts in the tree, mostly code generation and TAP tests. Occasionally, these scripts produce warnings. These are probably always mistakes on the developer side (true positives). Typical examples are warnings from genbki.pl or related when you make a mess in the catalog files during development, or warnings from tests when they massage a config file that looks different on different hosts, or mistakes during merges (e.g., duplicate subroutine definitions), or just mistakes that weren't noticed because there is a lot of output in a verbose build. This changes all warnings into fatal errors, by replacing use warnings; by use warnings FATAL => 'all'; in all Perl files. Discussion: https://www.postgresql.org/message-id/flat/06f899fd-1826-05ab-42d6-adeb1fd5e200%40eisentraut.org
2023-12-23Set readline-relevant ENV vars in interactive_psql(), not caller.Tom Lane
Commit 664d75753 pulled 010_tab_completion.pl's infrastructure for invoking an interactive psql session out into a generally-useful test function, but it didn't move enough stuff. We need to set up various environment variables that readline will look at, both to ensure stability of test results and to prevent test actions from cluttering the calling user's ~/.psql_history. Expecting calling scripts to remember to do that is too failure-prone: the other existing caller 001_password.pl did not do it. Hence, remove those initialization steps from 010_tab_completion.pl and put them into interactive_psql(). Since interactive_psql was already making a local ENV hash, this has no effect on calling scripts. Discussion: https://postgr.es/m/[email protected]
2023-12-21Add PostgreSQL::Test::Cluster::advance_walMichael Paquier
This is a function that makes a node jump by N WAL segments, which is something a couple of tests have been relying on for some cases related to streaming, replication slot limits and logical decoding on standbys. Hence, this centralizes the logic, while making it cheaper by relying on pg_logical_emit_message() to emit WAL records before switching to a new segment. Author: Bharath Rupireddy Reviewed-by: Kyotaro Horiguchi, Euler Taveira Discussion: https://postgr.es/m/CALj2ACU3R8QFCvDewHCMKjgb2w_-CMCyd6DAK=Jb-af14da5eg@mail.gmail.com
2023-12-20Add support for incremental backup.Robert Haas
To take an incremental backup, you use the new replication command UPLOAD_MANIFEST to upload the manifest for the prior backup. This prior backup could either be a full backup or another incremental backup. You then use BASE_BACKUP with the INCREMENTAL option to take the backup. pg_basebackup now has an --incremental=PATH_TO_MANIFEST option to trigger this behavior. An incremental backup is like a regular full backup except that some relation files are replaced with files with names like INCREMENTAL.${ORIGINAL_NAME}, and the backup_label file contains additional lines identifying it as an incremental backup. The new pg_combinebackup tool can be used to reconstruct a data directory from a full backup and a series of incremental backups. Patch by me. Reviewed by Matthias van de Meent, Dilip Kumar, Jakub Wartak, Peter Eisentraut, and Álvaro Herrera. Thanks especially to Jakub for incredibly helpful and extensive testing. Discussion: http://postgr.es/m/CA+TgmoYOYZfMCyOXFyC-P+-mdrZqm5pP2N7S-r0z3_402h9rsA@mail.gmail.com
2023-11-30Add option to specify timeout seconds to BackgroundPsql.pm.Masahiko Sawada
Previously, a background psql session uses the default timeout and it cannot be overridden. This change adds a new option to set the timeout during start. There are no users of this new option. It is needed for an upcoming patch adding tests for XID wraparound. Reviewed-by: Daniel Gustafsson, Noah Misch Discussion: https://postgr.es/m/C9CF2F76-0D81-4C9D-9832-202BE8517056%40yesql.se
2023-11-30Fix wrong description of BackgroundPsql's timeout.Masahiko Sawada
Backpatch through 16 where this was introduced by 664d757531e1. Reviewed-by: Daniel Gustafsson Backpatch-through: 16 Discussion: http://postgr.es/m/CAD21AoBXMEqDBLoDuAWVWoTLYB4aNsxx4oYNmyJJbhfq_vGQBQ@mail.gmail.com
2023-11-30Fix BackgroundPsql's set_query_timer_restart() issue without argument.Masahiko Sawada
The set_query_timer_restart() required an argument to define a value to query_timer_restart, but none of the existing callers passes an argument to this function. This changes the function to set a value without an argument. Backpatch through 16 where the background psql TAP functions were refactored by 664d757531e1. Reviewed-by: Bharath Rupireddy, Tom Lane Discussion: https://postgr.es/m/CAD21AoA0B6VKe_5A9nZi8i5umwSN-zJJuPVNht9DaOZ9SJumMA@mail.gmail.com Backpatch-through: 16
2023-10-06Add test for checking the line length of --help outputPeter Eisentraut
There was some discussion what the line length should be. Most output currently clearly targets around 80 columns, but the maximum in use currently is 95, so we set that as the current maximum. This just ensures that there is some guidance and there are no wild deviations. based on patch by Atsushi Torikoshi <[email protected]> Discussion: https://www.postgresql.org/message-id/flat/[email protected]
2023-09-22Don't trust unvalidated xl_tot_len.Thomas Munro
xl_tot_len comes first in a WAL record. Usually we don't trust it to be the true length until we've validated the record header. If the record header was split across two pages, previously we wouldn't do the validation until after we'd already tried to allocate enough memory to hold the record, which was bad because it might actually be garbage bytes from a recycled WAL file, so we could try to allocate a lot of memory. Release 15 made it worse. Since 70b4f82a4b5, we'd at least generate an end-of-WAL condition if the garbage 4 byte value happened to be > 1GB, but we'd still try to allocate up to 1GB of memory bogusly otherwise. That was an improvement, but unfortunately release 15 tries to allocate another object before that, so you could get a FATAL error and recovery could fail. We can fix both variants of the problem more fundamentally using pre-existing page-level validation, if we just re-order some logic. The new order of operations in the split-header case defers all memory allocation based on xl_tot_len until we've read the following page. At that point we know that its first few bytes are not recycled data, by checking its xlp_pageaddr, and that its xlp_rem_len agrees with xl_tot_len on the preceding page. That is strong evidence that xl_tot_len was truly the start of a record that was logged. This problem was most likely to occur on a standby, because walreceiver.c recycles WAL files without zeroing out trailing regions of each page. We could fix that too, but it wouldn't protect us from rare crash scenarios where the trailing zeroes don't make it to disk. With reliable xl_tot_len validation in place, the ancient policy of considering malloc failure to indicate corruption at end-of-WAL seems quite surprising, but changing that is left for later work. Also included is a new TAP test to exercise various cases of end-of-WAL detection by writing contrived data into the WAL from Perl. Back-patch to 12. We decided not to put this change into the final release of 11. Author: Thomas Munro <[email protected]> Author: Michael Paquier <[email protected]> Reported-by: Alexander Lakhin <[email protected]> Reviewed-by: Noah Misch <[email protected]> (the idea, not the code) Reviewed-by: Michael Paquier <[email protected]> Reviewed-by: Sergei Kornilov <[email protected]> Reviewed-by: Alexander Lakhin <[email protected]> Discussion: https://postgr.es/m/17928-aa92416a70ff44a2%40postgresql.org
2023-09-22Avoid using internal test methods in SSL testsDaniel Gustafsson
The SSL tests for pg_ctl restart with an incorrect key passphrase used the internal _update_pid method to set the pidfile after running pg_ctl manually instead of using the supplied ->restart method. This refactors the ->restart method to accept a fail_ok parameter like how ->start and ->stop does, and changes the SSL tests to use this instead. This removes the need to call internal test module functions. Reviewed-by: Melih Mutlu <[email protected]> Reviewed-by: Heikki Linnakangas <[email protected]> Discussion: https://postgr.es/m/[email protected]
2023-08-29Perl: Remove useless linesAlvaro Herrera
2023-08-25Avoid non-POSIX cp flagsAndres Freund
Commit 252dcb32 used cp -a, but apparently Solaris doesn't like that. Use cp -RPp instead. Author: Thomas Munro <[email protected]> Reviewed-by: Daniel Gustafsson <[email protected]> Discussion: https://postgr.es/m/CA+hUKGL10AoQVMMqgOJ8CTjoz9MLidD8ik2e8PibzLNMz0+aRg@mail.gmail.com
2023-08-24Use "template" data directory in testsAndres Freund
When running all (or just many) of our tests, a significant portion of both CPU time and IO is spent running initdb. Most of those initdb runs don't specify any options influencing properties of the created data directory. Avoid most of that overhead by creating a "template" data directory, alongside the temporary installation. Instead of running initdb, pg_regress and tap tests can copy that data directory. When a tap test specifies options to initdb, the template data directory is not used. That could be relaxed for some options, but it's not clear it's worth the effort. There unfortunately is some duplication between pg_regress.c and Cluster.pm, but there are no easy ways of sharing that code without introducing additional complexity. Reviewed-by: Daniel Gustafsson <[email protected]> Discussion: https://postgr.es/m/[email protected]
2023-08-23Avoid use of Perl getprotobynamePeter Eisentraut
getprotobyname returns undefined on some CI machines. It's not clear why. The code overall still works, but it raises a warning. In PostgreSQL C code, we always call socket() with 0 for the protocol argument, so we should be able to do the same in Perl (since the Perl documentation says that the arguments of the socket function are the same as in C). So do that, to avoid the issue. Reviewed-by: Andrew Dunstan <[email protected]> Discussion: https://www.postgresql.org/message-id/flat/06f899fd-1826-05ab-42d6-adeb1fd5e200%40eisentraut.org
2023-07-24Compare only major versions in AdjustUpgrade.pmAlvaro Herrera
Because PostgreSQL::Version is very nuanced about development version numbers, the comparison to 16beta2 makes it think that that release is older than 16, therefore applying a database tweak that doesn't work there (the comparison is only supposed to match when run on version 15). As suggested by Andrew Dunstan, fix by having AdjustUpgrade.pm public methods create a separate PostgreSQL::Version object to use for these comparisons, that only carries the major version number. While at it, have the same methods ensure that the objects given are of the expected type. Backpatch to 16. This module goes all the way back to 9.2, but there's probably no need for this fix except where betas still live. Co-authored-by: Andrew Dunstan <[email protected]> Discussion: https://postgr.es/m/[email protected]
2023-07-08Fix Perl warningPeter Eisentraut
Use of uninitialized value $content in concatenation (.) or string
2023-07-07Revert MAINTAIN privilege and pg_maintain predefined role.Nathan Bossart
This reverts the following commits: 4dbdb82513, c2122aae63, 5b1a879943, 9e1e9d6560, ff9618e82a, 60684dd834, 4441fc704d, and b5d6382496. A role with the MAINTAIN privilege may be able to use search_path tricks to escalate privileges to the table owner. Unfortunately, it is too late in the v16 development cycle to apply the proposed fix, i.e., restricting search_path when running maintenance commands. Bumps catversion. Reviewed-by: Jeff Davis Discussion: https://postgr.es/m/E1q7j7Y-000z1H-Hr%40gemulon.postgresql.org Backpatch-through: 16
2023-07-03Make PG_TEST_NOCLEAN work for temporary directories in TAP testsMichael Paquier
When set, this environment variable was only effective for data directories but not for all the other temporary files created by PostgreSQL::Test::Utils. Keeping the temporary files after a successful run can be useful for debugging purposes. The documentation is updated to reflect the new behavior, with contents available in doc/ since v16 and in src/test/perl/README since v15. Author: Jacob Champion Reviewed-by: Daniel Gustafsson Discussion: https://postgr.es/m/CAAWbhmgHtDH1SGZ+Fw05CsXtE0mzTmjbuUxLB9mY9iPKgM6cUw@mail.gmail.com Discussion: https://postgr.es/m/[email protected] Backpatch-through: 11
2023-06-09Refactor routine to find single log content pattern in TAP testsMichael Paquier
The same routine to check if a specific pattern can be found in the server logs was copied over four different test scripts. This refactors the whole to use a single routine located in PostgreSQL::Test::Cluster, named log_contains, to grab the contents of the server logs and check for a specific pattern. On HEAD, the code previously used assumed that slurp_file() could not handle an undefined offset, setting it to zero, but slurp_file() does do an extra fseek() before retrieving the log contents only if an offset is defined. In two places, the test was retrieving the full log contents with slurp_file() after calling substr() to apply an offset, ignoring that slurp_file() would be able to handle that. Backpatch all the way down to ease the introduction of new tests that could rely on the new routine. Author: Vignesh C Reviewed-by: Andrew Dunstan, Dagfinn Ilmari Mannsåker, Michael Paquier Discussion: https://postgr.es/m/CALDaNm0YSiLpjCmajwLfidQrFOrLNKPQir7s__PeVvh9U3uoTQ@mail.gmail.com Backpatch-through: 11
2023-06-09Refactor log check logic for connect_ok/fails in PostgreSQL::Test::ClusterMichael Paquier
This commit refactors a bit the code in charge of checking for log patterns when connections fail or succeed, by moving the log pattern checks into their own routine, for clarity. This has come up as something to improve while discussing the refactoring of find_in_log(). Backpatch down to 14 where these routines are used, to ease the introduction of new tests that could rely on them. Author: Vignesh C, Michael Paquier Discussion: https://postgr.es/m/CALDaNm0YSiLpjCmajwLfidQrFOrLNKPQir7s__PeVvh9U3uoTQ@mail.gmail.com Backpatch-through: 14
2023-05-22Spell the values of libpq's gssdelegation parameter as "0" and "1".Tom Lane
That's how other boolean options are handled, so do likewise. The previous coding with "enable" and "disable" was seemingly modeled on gssencmode, but that's a three-way flag. While at it, add PGGSSDELEGATION to the set of environment variables cleared by pg_regress and Utils.pm. Abhijit Menon-Sen, per gripe from Alvaro Herrera Discussion: https://postgr.es/m/[email protected]
2023-05-19Pre-beta mechanical code beautification.Tom Lane
Run pgindent, pgperltidy, and reformat-dat-files. This set of diffs is a bit larger than typical. We've updated to pg_bsd_indent 2.1.2, which properly indents variable declarations that have multi-line initialization expressions (the continuation lines are now indented one tab stop). We've also updated to perltidy version 20230309 and changed some of its settings, which reduces its desire to add whitespace to lines to make assignments etc. line up. Going forward, that should make for fewer random-seeming changes to existing code. Discussion: https://postgr.es/m/[email protected]
2023-04-27Add a test to verify that subscription to the standby works.Amit Kapila
Author: Bertrand Drouvot Reviewed-by: Vignesh C, Alvaro Herrera, Amit Kapila Discussion: https://postgr.es/m/[email protected]
2023-04-18Fix Utils.pm's locale-munging so that Perl itself is also affected.Tom Lane
Utils.pm has a BEGIN block that editorializes on the locale-related environment variables, primarily in order to stabilize the behavior of child programs. It turns out that if the calling test script has already done "use locale", this fails to affect the behavior of Perl itself, causing locale behavior to be different between Perl and child programs. That breaks commit cd82e5c79's attempt to deal with locale-specific behavior in psql. To fix, we just need to call setlocale() to redo the calculation of locale. Per report from Aleksander Alekseev. No back-patch for now, since there are no locale-dependent TAP tests in prior branches, and I'm not yet convinced that this won't have side-effects of its own. Discussion: https://postgr.es/m/CAJ7c6TO9KpYYxoVVseWEQB5KtjWDkt8NfyAeKPcHoe2Jq+ykpw@mail.gmail.com
2023-04-18Fix various typosDavid Rowley
This fixes many spelling mistakes in comments, but a few references to invalid parameter names, function names and option names too in comments and also some in string constants Also, fix an #undef that was undefining the incorrect definition Author: Alexander Lakhin Reviewed-by: Justin Pryzby Discussion: https://postgr.es/m/[email protected]
2023-04-13De-Revert "Add support for Kerberos credential delegation"Stephen Frost
This reverts commit 3d03b24c3 (Revert Add support for Kerberos credential delegation) which was committed on the grounds of concern about portability, but on further review and discussion, it's clear that we are better off explicitly requiring MIT Kerberos as that appears to be the only GSSAPI library currently that's under proper maintenance and ongoing development. The API used for storing credentials was added to MIT Kerberos over a decade ago while for the other libraries which appear to be mainly based on Heimdal, which exists explicitly to be a re-implementation of MIT Kerberos, the API never made it to a released version (even though it was added to the Heimdal git repo over 5 years ago..). This post-feature-freeze change was approved by the RMT. Discussion: https://postgr.es/m/ZDDO6jaESKaBgej0%40tamriel.snowman.net
2023-04-08Revert "Add support for Kerberos credential delegation"Stephen Frost
This reverts commit 3d4fa227bce4294ce1cc214b4a9d3b7caa3f0454. Per discussion and buildfarm, this depends on APIs that seem to not be available on at least one platform (NetBSD). Should be certainly possible to rework to be optional on that platform if necessary but bit late for that at this point. Discussion: https://postgr.es/m/[email protected]
2023-04-08TAP test for logical decoding on standbyAndres Freund
Author: "Drouvot, Bertrand" <[email protected]> Author: Amit Khandekar <[email protected]> Author: Craig Ringer <[email protected]> (in an older version) Author: Andres Freund <[email protected]> Reviewed-by: "Drouvot, Bertrand" <[email protected]> Reviewed-by: Andres Freund <[email protected]> Reviewed-by: Robert Haas <[email protected]> Reviewed-by: Amit Kapila <[email protected]> Reviewed-by: Fabrízio de Royes Mello <[email protected]>
2023-04-08Add support for Kerberos credential delegationStephen Frost
Support GSSAPI/Kerberos credentials being delegated to the server by a client. With this, a user authenticating to PostgreSQL using Kerberos (GSSAPI) credentials can choose to delegate their credentials to the PostgreSQL server (which can choose to accept them, or not), allowing the server to then use those delegated credentials to connect to another service, such as with postgres_fdw or dblink or theoretically any other service which is able to be authenticated using Kerberos. Both postgres_fdw and dblink are changed to allow non-superuser password-less connections but only when GSSAPI credentials have been delegated to the server by the client and GSSAPI is used to authenticate to the remote system. Authors: Stephen Frost, Peifeng Qiu Reviewed-By: David Christensen Discussion: https://postgr.es/m/CO1PR05MB8023CC2CB575E0FAAD7DF4F8A8E29@CO1PR05MB8023.namprd05.prod.outlook.com
2023-04-07Refactor background psql TAP functionsDaniel Gustafsson
This breaks out the background and interactive psql functionality into a new class, PostgreSQL::Test::BackgroundPsql. Sessions are still initiated via PostgreSQL::Test::Cluster, but once started they can be manipulated by the new helper functions which intend to make querying easier. A sample session for a command which can be expected to finish at a later time can be seen below. my $session = $node->background_psql('postgres'); $bsession->query_until(qr/start/, q( \echo start CREATE INDEX CONCURRENTLY idx ON t(a); )); $bsession->quit; Patch by Andres Freund with some additional hacking by me. Author: Andres Freund <[email protected]> Reviewed-by: Andrew Dunstan <[email protected]> Discussion: https://postgr.es/m/[email protected]
2023-03-29Support connection load balancing in libpqDaniel Gustafsson
This adds support for load balancing connections with libpq using a connection parameter: load_balance_hosts=<string>. When setting the param to random, hosts and addresses will be connected to in random order. This then results in load balancing across these addresses and hosts when multiple clients or frequent connection setups are used. The randomization employed performs two levels of shuffling: 1. The given hosts are randomly shuffled, before resolving them one-by-one. 2. Once a host its addresses get resolved, the returned addresses are shuffled, before trying to connect to them one-by-one. Author: Jelte Fennema <[email protected]> Reviewed-by: Aleksander Alekseev <[email protected]> Reviewed-by: Michael Banck <[email protected]> Reviewed-by: Andrey Borodin <[email protected]> Discussion: https://postgr.es/m/PR3PR83MB04768E2FF04818EEB2179949F7A69@PR3PR83MB0476.EURPRD83.prod.outlook.
2023-02-13Add wait_for_replay_catchup wrapper to Cluster.pmAlvaro Herrera
This simplifies a few lines of Perl test code a bit. Author: Bertrand Drouvot Discussion: https://postgr.es/m/[email protected]