aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
...
* Refactor dtrace postprocessing make rulesAndres Freund2022-07-18
| | | | | | | | | | | | This is in preparation for building postgres with meson / ninja. Move the dtrace postprocessing sed commands into a separate file so that it can be shared by meson. Also split the rule into two for proper dependency declaration. Reviewed-by: Andres Freund <andres@anarazel.de> Author: Peter Eisentraut <peter@eisentraut.org> Discussion: https://postgr.es/m/5e216522-ba3c-f0e6-7f97-5276d0270029@enterprisedb.com
* Add output directory option to gen_node_support.plAndres Freund2022-07-18
| | | | | | | | | | | | This is in preparation for building postgres with meson / ninja. When building with meson, commands are run at the root of the build tree. Add an option to put build output into the appropriate place. This can be utilized by src/tools/msvc/ for a minor simplification, which also provides some coverage for the new option. Reviewed-by: Peter Eisentraut <peter.eisentraut@enterprisedb.com> Discussion: https://postgr.es/m/5e216522-ba3c-f0e6-7f97-5276d0270029@enterprisedb.com
* Add output directory argument to generate-unicode_norm_table.plAndres Freund2022-07-18
| | | | | | | | | | | | This is in preparation for building postgres with meson / ninja. When building with meson, commands are run at the root of the build tree. Add an option to put build output into the appropriate place. Author: Andres Freund <andres@anarazel.de> Author: Peter Eisentraut <peter@eisentraut.org> Author: Nazir Bilal Yavuz <byavuz81@gmail.com> Discussion: https://postgr.es/m/5e216522-ba3c-f0e6-7f97-5276d0270029@enterprisedb.com
* Add output file argument to generate-errcodes.plAndres Freund2022-07-18
| | | | | | | | | | | | | | | This is in preparation for building postgres with meson / ninja. meson's 'capture' (redirecting stdout to a file) is a bit slower than programs redirecting output themselves (mostly due to a python wrapper necessary for windows). That doesn't matter for most things, but errcodes.h is a dependency of nearly everything, making it a bit faster seem worthwhile. Medium term it might also be worth avoiding writing errcodes.h if its contents didn't actually change, to avoid unnecessary recompilations. Reviewed-by: Peter Eisentraut <peter.eisentraut@enterprisedb.com> Discussion: https://postgr.es/m/5e216522-ba3c-f0e6-7f97-5276d0270029@enterprisedb.com
* Add output path arg in generate-lwlocknames.plAndres Freund2022-07-18
| | | | | | | | | | | | This is in preparation for building postgres with meson / ninja. When building with meson, commands are run at the root of the build tree. Add an option to put build output into the appropriate place. This can be utilized by src/tools/msvc/ for a minor simplification, which also provides some coverage for the new option. Reviewed-by: Peter Eisentraut <peter.eisentraut@enterprisedb.com> Discussion: https://postgr.es/m/5e216522-ba3c-f0e6-7f97-5276d0270029@enterprisedb.com
* Move snowball_create.sql creation into perl fileAndres Freund2022-07-18
| | | | | | | | | | | | | | | This is in preparation for building postgres with meson / ninja. We already have duplicated code for this between the make and msvc builds. Adding a third copy seems like a bad plan, thus move the generation into a perl script. As we don't want to rely on perl being available for builds from tarballs, generate the file during distprep. Author: Peter Eisentraut <peter@eisentraut.org> Author: Andres Freund <andres@anarazel.de> Discussion: https://postgr.es/m/5e216522-ba3c-f0e6-7f97-5276d0270029@enterprisedb.com
* ecpg: Output dir, source dir, stamp file argument for preproc/*.plAndres Freund2022-07-18
| | | | | | | | | | | | | | | This is in preparation for building postgres with meson / ninja. When building with meson, commands are run at the root of the build tree. Add an option to put build output into the appropriate place. This can be utilized by src/tools/msvc/ for a minor simplification, which also provides some coverage for the new option. Add option to generate a timestamp for check_rules.pl, so that proper dependencies on it having been run can be generated. Reviewed-by: Peter Eisentraut <peter.eisentraut@enterprisedb.com> Discussion: https://postgr.es/m/5e216522-ba3c-f0e6-7f97-5276d0270029@enterprisedb.com
* psql: Output dir and dependency generation for sql_helpAndres Freund2022-07-18
| | | | | | | | | | | | | | | This is in preparation for building postgres with meson / ninja. When building with meson, commands are run at the root of the build tree. Add an option to put build output into the appropriate place. This can be utilized by src/tools/msvc/ for a minor simplification, which also provides some coverage for the new option. To deal with dependencies to the variable set of input files to this script, add an option to generate a dependency file (which meson / ninja can consume). Reviewed-by: Peter Eisentraut <peter.eisentraut@enterprisedb.com> Discussion: https://postgr.es/m/5e216522-ba3c-f0e6-7f97-5276d0270029@enterprisedb.com
* Deal with paths containing \ and spaces in basebackup_to_shell testsAndres Freund2022-07-18
| | | | | | | | | | As $gzip is embedded in postgresql.conf \ needs to be escaped, otherwise guc.c will take it as a string escape. Similarly, if "$gzip" contains spaces, the prior incantation will fail. Both of these are common on windows. Reviewed-by: Peter Eisentraut <peter.eisentraut@enterprisedb.com> Discussion: https://postgr.es/m/ce1b6eb3-5736-6f38-9775-b7020128b8d8@enterprisedb.com Backpatch: 15-, where the test was added in 027fa0fd726
* Reinstate tests accidentally removed by e3fcca0d0dTomas Vondra2022-07-18
| | | | | | | Commit e3fcca0d0d24 reverted modifications to HOT for BRIN, but it also removed a couple unrelated tests from stats.sql. Reinstate those tests. Reported-by: Peter Eisentraut
* pg_upgrade: Adjust quoting style in message to match guidelinesPeter Eisentraut2022-07-18
|
* Add another SQL/JSON error codePeter Eisentraut2022-07-18
| | | | | | | A code comment said that the standard does not define a number for ERRCODE_SQL_JSON_ITEM_CANNOT_BE_CAST_TO_TARGET_TYPE, but this was fixed in a later draft version of the standard, so use that number now.
* Convert macros to static inline functions (tupmacs.h)Peter Eisentraut2022-07-18
| | | | | Reviewed-by: Amul Sul <sulamul@gmail.com> Discussion: https://www.postgresql.org/message-id/flat/5b558da8-99fb-0a99-83dd-f72f05388517%40enterprisedb.com
* Mark all symbols exported from extension libraries PGDLLEXPORT.Andres Freund2022-07-17
| | | | | | | | | | | | This is in preparation for defaulting to -fvisibility=hidden in extensions, instead of relying on all symbols in extensions to be exported. This should have been committed before 089480c0770, but something in my commit scripts went wrong. Author: Andres Freund <andres@anarazel.de> Reviewed-By: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/20211101020311.av6hphdl6xbjbuif@alap3.anarazel.de
* Fix configure executable permissions.Andres Freund2022-07-17
| | | | | | I do not [yet] understand how, but my prior commit (089480c0770) accidentally removed the exec bit from configure. I'll try to figure that out later, for now re-add to unbreak the buildfarm.
* Default to hidden visibility for extension libraries where possibleAndres Freund2022-07-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Until now postgres built extension libraries with global visibility, i.e. exporting all symbols. On the one platform where that behavior is not natively available, namely windows, we emulate it by analyzing the input files to the shared library and exporting all the symbols therein. Not exporting all symbols is actually desirable, as it can improve loading speed, reduces the likelihood of symbol conflicts and can improve intra extension library function call performance. It also makes the non-windows builds more similar to windows builds. Additionally, with meson implementing the export-all-symbols behavior for windows, turns out to be more verbose than desirable. This patch adds support for hiding symbols by default and, to counteract that, explicit symbol visibility annotation for compilers that support __attribute__((visibility("default"))) and -fvisibility=hidden. That is expected to be most, if not all, compilers except msvc (for which we already support explicit symbol export annotations). Now that extension library symbols are explicitly exported, we don't need to export all symbols on windows anymore, hence remove that behavior from src/tools/msvc. The supporting code can't be removed, as we still need to export all symbols from the main postgres binary. Author: Andres Freund <andres@anarazel.de> Author: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/20211101020311.av6hphdl6xbjbuif@alap3.anarazel.de
* Remove now superfluous declarations of dlsym()ed symbols.Andres Freund2022-07-17
| | | | | | | | The prior commit declared them centrally. Author: Andres Freund <andres@anarazel.de> Reviewed-By: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/20211101020311.av6hphdl6xbjbuif@alap3.anarazel.de
* Add central declarations for dlsym()ed symbolsAndres Freund2022-07-17
| | | | | | | | | | | | | | This is in preparation for defaulting to -fvisibility=hidden in extensions, instead of exporting all symbols. For that symbols intended to be exported need to be tagged with PGDLLEXPORT. Most extensions only need to do so for _PG_init() and functions defined with PG_FUNCTION_INFO_V1. Adding central declarations avoids each extension having to add PGDLLEXPORT. Any existing declarations in extensions will continue to work if fmgr.h is included before them, otherwise compilation for Windows will fail. Author: Andres Freund <andres@anarazel.de> Reviewed-By: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/20211101020311.av6hphdl6xbjbuif@alap3.anarazel.de
* postgres_fdw: be more wary about shippability of reg* constants.Tom Lane2022-07-17
| | | | | | | | | | | | | | | | | | | | | | | | | | Don't consider a constant of regconfig or other reg* types to be shippable unless it refers to a built-in object, or an object in an extension that's been marked shippable. Without this restriction, we're too likely to send a constant that will fail to parse on the remote server. For the regconfig type only, consider OIDs up to 16383 to be "built in", rather than the normal cutoff of 9999. Otherwise the initdb-created text search configurations will be considered unshippable, which is unlikely to make anyone happy. It's possible that this new restriction will de-optimize queries that were working satisfactorily before. Users can restore any lost performance by making sure that objects that can be expected to exist on the remote side are in shippable extensions. However, that's not a change that people are likely to be happy about having to make after a minor-release update. Between that consideration and the lack of field complaints, let's just change this in HEAD. Noted while fixing bug #17483, although this is not precisely the problem that that report complained about. Discussion: https://postgr.es/m/1423433.1652722406@sss.pgh.pa.us
* Fix omissions in support for the "regcollation" type.Tom Lane2022-07-17
| | | | | | | | | | | | | The patch that added regcollation doesn't seem to have been too thorough about supporting it everywhere that other reg* types are supported. Fix that. (The find_expr_references omission is moderately serious, since it could result in missing expression dependencies. The others are less exciting.) Noted while fixing bug #17483. Back-patch to v13 where regcollation was added. Discussion: https://postgr.es/m/1423433.1652722406@sss.pgh.pa.us
* postgres_fdw: set search_path to 'pg_catalog' while deparsing constants.Tom Lane2022-07-17
| | | | | | | | | | | | | The motivation for this is to ensure successful transmission of the values of constants of regconfig and other reg* types. The remote will be reading them with search_path = 'pg_catalog', so schema qualification is necessary when referencing objects in other schemas. Per bug #17483 from Emmanuel Quincerot. Back-patch to all supported versions. (There's some other stuff to do here, but it's less back-patchable.) Discussion: https://postgr.es/m/1423433.1652722406@sss.pgh.pa.us
* Disable unstable test cases in src/test/ssl/t/001_ssltests.pl.Tom Lane2022-07-16
| | | | | | Missed one in 55828a6b6084724b08675615a4e911ad4d421cd1 :-( Discussion: https://postgr.es/m/E1oCNLk-000LCH-Af@gemulon.postgresql.org
* Disable unstable test cases in src/test/ssl/t/001_ssltests.pl.Tom Lane2022-07-16
| | | | | | | | | | | | | | | | Some of the test cases added by commit 3a0e38504 are failing intermittently in CI testing. It looks like, when a connection attempt fails, it's possible for psql to exit and the test script to slurp up the postmaster's log file before the connected backend has managed to write the log entry we're expecting to see. It's not clear whether that's fixable in any robust way. Pending more thought, just comment out the log_like checks. The ones in connect_ok tests should be fine, since surely the log entry should be emitted before we complete the client auth sequence. I took out all the ones in connect_fails tests though. Discussion: https://postgr.es/m/E1oCNLk-000LCH-Af@gemulon.postgresql.org
* Remove postmaster.c's reset_shared() wrapper function.Tom Lane2022-07-16
| | | | | | | | | | | reset_shared just invokes CreateSharedMemoryAndSemaphores, so let's get rid of it and invoke that directly. This removes a confusing seeming-inconsistency between the postmaster's startup sequence and the startup sequence used in standalone mode. Nathan Bossart, reviewed by Pavel Borisov Discussion: https://postgr.es/m/20220329221702.GA559657@nathanxps13
* Attempt to fix compiler warning on old compilerPeter Eisentraut2022-07-16
| | | | | A couple more like b449afb582bb9015bfbb85abc10ce122aef9ec70, per complaints from lapwing.
* Attempt to fix compiler warning on old compilerPeter Eisentraut2022-07-16
| | | | | | Build farm member lapwing (using gcc 4.7.2) didn't like one part of 9fd45870c1436b477264c0c82eb195df52bc0919, raising a compiler warning. Revert that for now.
* Replace many MemSet calls with struct initializationPeter Eisentraut2022-07-16
| | | | | | | | | | | | | | This replaces all MemSet() calls with struct initialization where that is easily and obviously possible. (For example, some cases have to worry about padding bits, so I left those.) (The same could be done with appropriate memset() calls, but this patch is part of an effort to phase out MemSet(), so it doesn't touch memset() calls.) Reviewed-by: Ranier Vilela <ranier.vf@gmail.com> Reviewed-by: Alvaro Herrera <alvherre@alvh.no-ip.org> Discussion: https://www.postgresql.org/message-id/9847b13c-b785-f4e2-75c3-12ec77a3b05c@enterprisedb.com
* Emulate sigprocmask(), not sigsetmask(), on Windows.Thomas Munro2022-07-16
| | | | | | | | | | | | | | | Since commit a65e0864, we've required Unix systems to have sigprocmask(). As noted in that commit's message, we were still emulating the historical pre-standard sigsetmask() function in our Windows support code. Emulate standard sigprocmask() instead, for consistency. The PG_SETMASK() abstraction is now redundant and all calls could in theory be replaced by plain sigprocmask() calls, but that isn't done by this commit. Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/3153247.1657834482%40sss.pgh.pa.us
* Make dsm_impl_posix_resize more future-proof.Thomas Munro2022-07-16
| | | | | | | | | | | | | | | | | | | | Commit 4518c798 blocks signals for a short region of code, but it assumed that whatever called it had the signal mask set to UnBlockSig on entry. That may be true today (or may even not be, in extensions in the wild), but it would be better not to make that assumption. We should save-and-restore the caller's signal mask. The PG_SETMASK() portability macro couldn't be used for that, which is why it wasn't done before. But... considering that commit a65e0864 established back in 9.6 that supported POSIX systems have sigprocmask(), and that this is POSIX-only code, there is no reason not to use standard sigprocmask() directly to achieve that. Back-patch to all supported releases, like 4518c798 and 80845b7c. Reviewed-by: Alvaro Herrera <alvherre@alvh.no-ip.org> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/CA%2BhUKGKx6Biq7_UuV0kn9DW%2B8QWcpJC1qwhizdtD9tN-fn0H0g%40mail.gmail.com
* Log details for client certificate failuresPeter Eisentraut2022-07-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, debugging client certificate verification failures is mostly limited to looking at the TLS alert code on the client side. For simple deployments, sometimes it's enough to see "sslv3 alert certificate revoked" and know exactly what needs to be fixed, but if you add any more complexity (multiple CA layers, misconfigured CA certificates, etc.), trying to debug what happened based on the TLS alert alone can be an exercise in frustration. Luckily, the server has more information about exactly what failed in the chain, and we already have the requisite callback implemented as a stub. We fill that in, collect the data, and pass the constructed error message back to the main code via a static variable. This lets us add our error details directly to the final "could not accept SSL connection" log message, as opposed to issuing intermediate LOGs. It ends up looking like LOG: connection received: host=localhost port=43112 LOG: could not accept SSL connection: certificate verify failed DETAIL: Client certificate verification failed at depth 1: unable to get local issuer certificate. Failed certificate data (unverified): subject "/CN=Test CA for PostgreSQL SSL regression test client certs", serial number 2315134995201656577, issuer "/CN=Test root CA for PostgreSQL SSL regression test suite". The length of the Subject and Issuer strings is limited to prevent malicious client certs from spamming the logs. In case the truncation makes things ambiguous, the certificate's serial number is also logged. Author: Jacob Champion <pchampion@vmware.com> Discussion: https://www.postgresql.org/message-id/flat/d13c4a5787c2a3f83705124f0391e0738c796751.camel@vmware.com
* Convert macros to static inline functions (xlog_internal.h)Peter Eisentraut2022-07-15
| | | | | Reviewed-by: Amul Sul <sulamul@gmail.com> Discussion: https://www.postgresql.org/message-id/flat/5b558da8-99fb-0a99-83dd-f72f05388517%40enterprisedb.com
* Support gcc -fkeep-inline-functionsPeter Eisentraut2022-07-15
| | | | | | | | | | | | | | | | For some systems, we need to avoid unsatisfied-external-reference errors in static inlines. See 27d2693187d1bcf2563ee7142ba37d4788c8d52b for example. In order to test that on other systems, the gcc option -fkeep-inline-functions can be used. But it actually is a bit stricter than what we currently have in place, so fix up a few more places along the lines of the above commit. (This undoes part of commit 2cd2569c72b8920048e35c31c9be30a6170e1410.) (Note, this does not add that gcc option anywhere to the build system, it just makes it possible to use it successfully manually.) Discussion: https://www.postgresql.org/message-id/flat/E1oBgIW-002ehP-VJ%40gemulon.postgresql.org
* Fix inconsistent parameter names between prototype and declarationDavid Rowley2022-07-15
| | | | | | | Noticed while working in this area. This code was introduced in PG15, which is still in beta, so backpatch to there for consistency. Backpatch-through: 15
* docs: make monitoring "phases" table titles consistentBruce Momjian2022-07-14
| | | | | | | | | | Reported-by: Nitin Jadhav Discussion: https://postgr.es/m/CAMm1aWbmTHwHKC2PERH0CCaFVPoxrtLeS8=wNuoge94qdSp3vA@mail.gmail.com Author: Nitin Jadhav Backpatch-through: 13
* doc: clarify how dropping of extensions affects dependent objs.Bruce Momjian2022-07-14
| | | | | | | | | | | Clarify that functions/procedures are dropped when any extension that depends on them is dropped. Reported-by: David G. Johnston Discussion: https://postgr.es/m/CAKFQuwbPSHMDGkisRUmewopweC1bFvytVqB=a=X4GFg=4ZWxPA@mail.gmail.com Backpatch-through: 13
* pg_upgrade doc: mention that replication slots must be recreatedBruce Momjian2022-07-14
| | | | | | | | Reported-by: Nikhil Shetty Discussion: https://postgr.es/m/CAFpL5Vxastip0Jei-K-=7cKXTg=5sahSe5g=om=x68NOX8+PUA@mail.gmail.com Backpatch-through: 10
* doc: add documentation about ecpg Oracle-compatibility modeBruce Momjian2022-07-14
| | | | | | | | Reported-by: Takeshi Ideriha Discussion: https://postgr.es/m/TYCPR01MB7041A157067208327D8DAAF9EAA59@TYCPR01MB7041.jpnprd01.prod.outlook.com Backpatch-through: 11
* doc: move system views section to its own chapterBruce Momjian2022-07-14
| | | | | | | | | | Previously it was inside the system catalogs chapter. Reported-by: Peter Smith Discussion: https://postgr.es/m/CAHut+PsMc18QP60D+L0hJBOXrLQT5m88yVaCDyxLq34gfPHsow@mail.gmail.com Backpatch-through: 15
* doc: clarify the behavior of identically-named savepointsBruce Momjian2022-07-14
| | | | | | | | | | Original patch by David G. Johnston. Reported-by: David G. Johnston Discussion: https://postgr.es/m/CAKFQuwYQCxSSuSL18skCWG8QHFswOJ3hjovHsOZUE346i4OpVQ@mail.gmail.com Backpatch-through: 10
* doc: clarify that "excluded" ON CONFLICT is a single rowBruce Momjian2022-07-14
| | | | | | | | | | Original patch by David G. Johnston. Reported-by: David G. Johnston Discussion: https://postgr.es/m/CAKFQuwa4J0+WuO7kW1PLbjoEvzPN+Q_j+P2bXxNnCLaszY7ZdQ@mail.gmail.com Backpatch-through: 10
* doc: mention that INSERT can block because of unique indexesBruce Momjian2022-07-14
| | | | | | | | | | Initial patch by David G. Johnston. Reported-by: David G. Johnston Discussion: https://postgr.es/m/CAKFQuwZpbdzceO41VE-xt1Xh8rWRRfgopTAK1wL9EhCo0Am-Sw@mail.gmail.com Backpatch-through: 10
* doc: mention the pg_locks lock names in parenthesesBruce Momjian2022-07-14
| | | | | | | | Reported-by: Troy Frericks Discussion: https://postgr.es/m/165653551130.665.8240515669521441325@wrigleys.postgresql.org Backpatch-through: 10
* Don't clobber postmaster sigmask in dsm_impl_resize.Thomas Munro2022-07-15
| | | | | | | | | | | | Commit 4518c798 intended to block signals in regular backends that allocate DSM segments, but dsm_impl_resize() is also reached by dsm_postmaster_startup(). It's not OK to clobber the postmaster's signal mask, so only manipulate the signal mask when under the postmaster. Back-patch to all releases, like 4518c798. Discussion: https://postgr.es/m/CA%2BhUKGKNpK%3D2OMeea_AZwpLg7Bm4%3DgYWk7eDjZ5F6YbozfOf8w%40mail.gmail.com
* Tighten up parsing logic in gen_node_support.pl.Tom Lane2022-07-14
| | | | | | | | | | | | | | | | | | | | | | | Teach this script to handle function pointer fields honestly. Previously they were just silently ignored, but that's not likely to be a behavior we can accept indefinitely. This mostly entails fixing it so that a field declaration spanning multiple lines can be parsed, because we have a bunch of such fields that're laid out that way. But that's a good improvement in its own right. With that change and a minor regex adjustment, the only struct it fails to parse in the node-defining headers is A_Const, because of the embedded union. The path of least resistance is to move that union declaration outside the struct. Having done those things, we can make it error out if it finds any within-struct syntax it doesn't understand, which seems like a pretty important property for robustness. This commit doesn't change the output files at all; it's just in the way of future-proofing. Discussion: https://postgr.es/m/2593369.1657759779@sss.pgh.pa.us
* Avoid shadowing a variable in sync.c.Thomas Munro2022-07-15
| | | | | | | | | | It was confusing to reuse the variable name 'entry' in two scopes. Use distinct variable names. Reported-by: Ranier Vilela <ranier.vf@gmail.com> Reported-by: Tom Lane <tgl@sss.pgh.pa.us> Reported-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com> Discussion: https://postgr.es/m/CAEudQArDrFyQ15Am3rgWBunGBVZFDb90onTS8SRiFAWHeiLiFA%40mail.gmail.com
* Create a distinct wait event for POSIX DSM allocation.Thomas Munro2022-07-14
| | | | | | | | | Previously we displayed "DSMFillZeroWrite" while in posix_fallocate(), because we shared the same wait event for "mmap" and "posix" DSM types. Let's introduce a new wait event "DSMAllocate", to be more accurate. Reported-by: Andres Freund <andres@anarazel.de> Discussion: https://postgr.es/m/20220711174518.yldckniicknsxgzl%40awork3.anarazel.de
* Remove redundant ftruncate() for POSIX DSM memory.Thomas Munro2022-07-14
| | | | | | | | | | | | | In early releases of the DSM infrastructure, it was possible to resize segments. That was removed in release 12 by commit 3c60d0fa. Now the ftruncate() + posix_fallocate() sequence during DSM segment creation has a redundant step: we're always extending from zero to the desired size, so we might as well just call posix_fallocate(). Let's also include the remaining ftruncate() call (non-Linux POSIX systems) in the wait event reporting, for good measure. Discussion: https://postgr.es/m/CA%2BhUKGJSm-nq8s%2B_59zb7NbFQF-OS%3DxTnTAiGLrQpuSmU2y_1A%40mail.gmail.com
* Block signals while allocating DSM memory.Thomas Munro2022-07-14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On Linux, we call posix_fallocate() on shm_open()'d memory to avoid later potential SIGBUS (see commit 899bd785). Based on field reports of systems stuck in an EINTR retry loop there, there, we made it possible to break out of that loop via slightly odd coding where the CHECK_FOR_INTERRUPTS() call was somewhat removed from the loop (see commit 422952ee). On further reflection, that was not a great choice for at least two reasons: 1. If interrupts were held, the CHECK_FOR_INTERRUPTS() would do nothing and the EINTR error would be surfaced to the user. 2. If EINTR was reported but neither QueryCancelPending nor ProcDiePending was set, then we'd dutifully retry, but with a bit more understanding of how posix_fallocate() works, it's now clear that you can get into a loop that never terminates. posix_fallocate() is not a function that can do some of the job and tell you about progress if it's interrupted, it has to undo what it's done so far and report EINTR, and if signals keep arriving faster than it can complete (cf recovery conflict signals), you're stuck. Therefore, for now, we'll simply block most signals to guarantee progress. SIGQUIT is not blocked (see InitPostmasterChild()), because its expected handler doesn't return, and unblockable signals like SIGCONT are not expected to arrive at a high rate. For good measure, we'll include the ftruncate() call in the blocked region, and add a retry loop. Back-patch to all supported releases. Reported-by: Alvaro Herrera <alvherre@alvh.no-ip.org> Reported-by: Nicola Contu <nicola.contu@gmail.com> Reviewed-by: Alvaro Herrera <alvherre@alvh.no-ip.org> Reviewed-by: Andres Freund <andres@anarazel.de> Discussion: https://postgr.es/m/20220701154105.jjfutmngoedgiad3%40alvherre.pgsql
* Correct some uses of e.g. and i.e. in message strings and documentationJohn Naylor2022-07-14
| | | | | | | | | | E.g. means "for example" and i.e. means "that is". Fix a couple uses that don't match the intended meaning. Kyotaro Horiguchi Reviewed by Junwang Zhao and Aleksander Alekseev, with one addition by me Discussion: https://www.postgresql.org/message-id/flat/20220713.180943.589079824955875739.horikyota.ntt%40gmail.com
* Remove support for Visual Studio 2013Michael Paquier2022-07-14
| | | | | | | | | | | | | | | | | | | | No members of the buildfarm are using this version of Visual Studio, resulting in all the code cleaned up here as being mostly dead, and VS2017 is the oldest version still supported. More versions could be cut, but the gain would be minimal, while removing only VS2013 has the advantage to remove from the core code all the dependencies on the value defined by _MSC_VER, where compatibility tweaks have accumulated across the years mostly around locales and strtof(), so that's a nice isolated cleanup. Note that this commit additionally allows a revert of 3154e16. The versions of Visual Studio now supported range from 2015 to 2022. Author: Michael Paquier Reviewed-by: Juan José Santamaría Flecha, Tom Lane, Thomas Munro, Justin Pryzby Discussion: https://postgr.es/m/YoH2IMtxcS3ncWn+@paquier.xyz