- 13 11月, 2020 1 次提交
-
-
由 Hao Wu 提交于
Definition FAULT_INJECTOR is hardcoded in a header(pg_config_manual.h) file. Fault injector is useful, but it may introduce some issues in production stage, like runtime cost, security problems. It's better to enable this feature in development and disable it in release. The --enable-debug-extensions configure option is used to control this feature.
-
- 17 7月, 2020 1 次提交
-
-
由 Amit Khandekar 提交于
GPOS_ASMFP() used x86_64 assembly instructions to get current frame address. This obviously doesn't compile on other architectures like ARM64. So instead use __builtin_frame_address(), which is available in gcc and presumably clang. Since gcc and clang are the two most common compilers, and since we don't want to support GPORCA on exotic architectures and compilers, don't bother to use any other way to get the frame address. Let configure fail if __builtin_frame_address() is not found, but don't do this check if gporca is disabled. GPORCA's CStackDescriptor::Backtrace() uses frame address. But there is also gp_backtrace() in the backend code that has similar functionality. This commit does not merge these two places. But it prepares the infrastructure to do the merge, including a new macro HAVE__BUILTIN_FRAME_ADDRESS defined in pg_config.h. Discussion: https://groups.google.com/a/greenplum.org/forum/#!topic/gpdb-dev/FgaR_4sGYrkReviewed-by: NHeikki Linnakangas <hlinnakangas@pivotal.io>
-
- 10 7月, 2020 2 次提交
-
-
由 Ning Yu 提交于
We used to use the option --with-libuv to enable ic-proxy, it is not staightforward to understand the purpose of that option, though. So we renamed it to --enable-ic-proxy, and the default setting is changed to "disable". Suggested by Kris Macoskey <kmacoskey@pivotal.io>
-
由 Ning Yu 提交于
The interconnect proxy mode, a.k.a. ic-proxy, is a new interconnect mode, all the backends communicate via a proxy bgworker, all the backends on the same segment share the same proxy bgworker, so every two segments only need one network connection between them, which reduces the network flows as well the ports. To enable the proxy mode we need to first configure the guc gp_interconnect_proxy_addresses, for example: gpconfig \ -c gp_interconnect_proxy_addresses \ -v "'1:-1:10.0.0.1:2000,2:0:10.0.0.2:2001,3:1:10.0.0.3:2002'" \ --skipvalidation Then restart to take effect.
-
- 22 5月, 2020 1 次提交
-
-
由 Chris Hajas 提交于
Commit 649ee57d "Build ORCA with C++14: Take Two (#10068)" left behind a major FIXME: a hard-coded CXXFLAGS in gporca.mk. At the very least this looks completely out of place aesthetically. But more importantly, this is problematic in several ways: 1. It leaves the language mode for part of the code base (src/backend/gpopt "ORCA translator") unspecified. The ORCA translator closely collaborates with ORCA and directly uses much of the interfaces from ORCA. There is a non-hypothetical risk of non-subtle incompatibilities. This is obscured by the fact that GCC and upstream Clang (which both default to gnu++14 after their respective 6.0 releases). Apple Clang from Xcode 11, however, reacts to it much like the default is still gnu++98: > In file included from CConfigParamMapping.cpp:20: > In file included from ../../../../src/include/gpopt/config/CConfigParamMapping.h:19: > In file included from ../../../../src/backend/gporca/libgpos/include/gpos/common/CBitSet.h:15: > In file included from ../../../../src/backend/gporca/libgpos/include/gpos/common/CDynamicPtrArray.h:15: > ../../../../src/backend/gporca/libgpos/include/gpos/common/CRefCount.h:68:24: error: expected ';' at end of declaration list > virtual ~CRefCount() noexcept(false) > ^ > ; 2. It potentially conflicts with other parts of the code base. Namely, when configured with gpcloud, we might have -std=c++11 and -std=gnu++14 in the same breath, which is highly undesirable or an outright error. 3. Idiomatically language standard selection should modify CXX, not CXXFLAGS, in the same vein as how AC_PROC_CC_C99 modifies CC. We already had a precedence of setting the compiler up in C++11 mode (albeit for a less-used component gpcloud). This patch leverages the same mechanism to set up CXX in C++14 mode. Authored-by: NChris Hajas <chajas@pivotal.io>
-
- 08 4月, 2020 1 次提交
-
-
由 Chris Hajas 提交于
Previously, we used a config file that was modified by cmake. Instead, use configure to modify macros. Additionally use a compile definition in cmake so we don't need a separate config file in gpos. This also enables compile-time warnings in the src/backend/gporca files. C++ files in the translator never had these warnings enabled, and so are not enabled in src/backend/gpopt. A block of unused code is removed to get pass the compile warnings.
-
- 23 3月, 2020 2 次提交
-
-
由 Hao Wu 提交于
Definition FAULT_INJECTOR is hardcoded in a header(pg_config_manual.h) file. Fault injector is useful, but it may introduce some issues in production stage, like runtime cost, security problems. It's better to enable this feature in development and disable it in release. To achieve this target, we add a configure option to make fault injector configurable. When fault injector is disabled, some tests using this feature should be avoided to run ICW. Under isolation2 and regress, there are a lot of tests. Now, all tests under isolation2 and regress that depend on fault injector are moved to a new schedule file. The pattern name of it is XXX_faultinjector_schedule. **NOTE** All tests that depend on fault injector are saved to the XXX_faultinjector_schedule. With this rule, we only run tests that don't depend on fault injector when fault injector is disabled. The schedule files used for fault injector are: src/test/regress/greenplum_faultinjector_schedule src/test/isolation2/isolation2_faultinjector_schedule src/test/isolation2/isolation2_resgroup_faultinjector_schedule Reviewed-by: NAsim R P <apraveen@pivotal.io> Reviewed-by: NAshwin Agrawal <aagrawal@pivotal.io>
- 23 1月, 2020 1 次提交
-
-
由 Mark Sliva 提交于
The interface addresses used for replication will be scanned using this new utility we added called ifaddrs that returns all of the interface addresses separated by newlines. As an internal utility, this will be installed into $GPHOME/libexec. There is no Python 2 library that provides this functionality, so we add it ourselves. Also add a configure dependency on getifaddrs and inet_ntop, which are now required to build a functioning GPDB system. As far as we can tell, the other headers and functions are already handled through other configure checks. Co-authored-by: NJacob Champion <pchampion@pivotal.io> Co-authored-by: NAdam Berlin <aberlin@pivotal.io> Co-authored-by: NBhuvnesh Chaudhary <bchaudhary@pivotal.io> Co-authored-by: NKalen Krempely <kkrempely@pivotal.io> Co-authored-by: NDavid Krieger <dkrieger@pivotal.io> Co-authored-by: NJamie McAtamney <jmcatamney@pivotal.io>
-
- 04 11月, 2019 1 次提交
-
-
由 Heikki Linnakangas 提交于
The last reference to USE_DEBUG_NTUPLESTORE was removed a loong time ago, in 2008.
-
- 31 8月, 2019 1 次提交
-
-
由 Jesse Zhang 提交于
This has been left out-of-date since commit 3b849ec0 . Oops
-
- 29 8月, 2019 1 次提交
-
-
由 gkokolatos 提交于
Commits 83147222 and 0527e4a5 added a check for libexecinfo. However the code failed to make use of this check and used a combination of flags instead which were not terribly consistent neither. Use the config check for the header file and declare a new variable for the dependant functions, backtrace and backtrace_symbols. Use this new variable to achieve concistency throughout. Reviewed-by: NAshwin Agrawal <aagrawal@pivotal.io>
-
- 19 8月, 2019 1 次提交
-
-
由 Daniel Gustafsson 提交于
The GPORCA optimizer has been known by several names since its birth and some of these are still showing up here and there even though we have replaced most with GPORCA by now. This replaces a few more that I found, mostly in code but also in the documentation. The fallback message from GPORCA still reads "Pivotal Query Optimizer", which is why there is still one mention in the documentation. Reviewed-by: NVenkatesh Raghavan <vraghavan@pivotal.io> Reviewed-by: NIvan Novick <inovick@pivotal.io>
-
- 09 8月, 2019 1 次提交
-
-
由 Chen Mulong 提交于
* Backport pg_strong_random - Backport pg_strong_random related things from fe0a0b59. (https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=fe0a0b5993d) pg_strong_random() is added for better generation of random bytes. Only parts of fe0a0b59 has been ported back includes the c file and necessary makefile changes. By default, the function is enabled. It can be disabled by --disable-strong-random when configure. HAVE_STRONG_RANDOM is defined if the function is available. - Backport a few OPENSSL related compile options from 680513ab. (https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=680513ab79c) This is to solve a few dependencies of pg_strong_random. A new macro USE_OPENSSL is introduced. It will be set to true when --with-openssl is configured. The old USE_SSL is still being used. When USE_OPENSSL defined, USE_SSL will be defined as well. This is a dependency of #8211 for endpoint token generation. Authored-by: NChen Mulong <muchen@pivotal.io>
-
- 27 6月, 2019 1 次提交
-
-
由 Michael Paquier 提交于
fe0a0b59 has removed the last use of this routine from pgcrypto, leading to a useless symbol definition and an extra configure check. Author: Michael Paquier Reviewed-by: Daniel Gustafsson, Tom Lane Discussion: https://postgr.es/m/20190626142544.GN1714@paquier.xyz
-
- 02 5月, 2019 1 次提交
-
-
由 Daniel Gustafsson 提交于
The functionality to send alerts via email (and snmp was removed in commit 65822b80 but I missed removing the autoconf check for the libcurl feature required. Since there are no more consumers, remove the check and feature macro as well. Reviewed-by: NJimmy Yih <jyih@pivotal.io>
-
- 18 4月, 2019 1 次提交
-
-
由 Ashwin Agrawal 提交于
Compilation with --enable-testutils seems to has been broken long time as `MaxDynamicLWLock` is no more defined. Given no one complained seems this is unused config option and code. Hence, instead of fixing the compilation ripping out this code.
-
- 16 2月, 2019 2 次提交
-
-
由 Tom Lane 提交于
Test for the compiler builtins __builtin_clz, __builtin_ctz, and __builtin_popcount, and make use of these in preference to handwritten C code if they're available. Create src/port infrastructure for "leftmost one", "rightmost one", and "popcount" so as to centralize these decisions. On x86_64, __builtin_popcount generally won't make use of the POPCNT opcode because that's not universally supported yet. Provide code that checks CPUID and then calls POPCNT via asm() if available. This requires indirecting through a function pointer, which is an annoying amount of overhead for a one-instruction operation, but it's probably not worth working harder than this for our current use-cases. I'm not sure we've found all the existing places that could profit from this new infrastructure; but we at least touched all the ones that used copied-and-pasted versions of the bitmapset.c code, and got rid of multiple copies of the associated constant arrays. While at it, replace c-compiler.m4's one-per-builtin-function macros with a single one that can handle all the cases we need to worry about so far. Also, because I'm paranoid, make those checks into AC_LINK checks rather than just AC_COMPILE; the former coding failed to verify that libgcc has support for the builtin, in cases where it's not inline code. David Rowley, Thomas Munro, Alvaro Herrera, Tom Lane Discussion: https://postgr.es/m/CAKJS1f9WTAGG1tPeJnD18hiQW5gAk59fQ6WK-vfdAKEHyRg2RA@mail.gmail.com
-
由 Alvaro Herrera 提交于
This reverts commits fc6c7274, 109de05c, d0b4663c and 711bab1e. Somebody will have to try harder before submitting this patch again. I've spent entirely too much time on it already, and the #ifdef maze yet to be written in order for it to build at all got on my nerves. The amount of work needed to get a platform-specific performance improvement that's barely above the noise level is not worth it.
-
- 14 2月, 2019 2 次提交
-
-
由 Alvaro Herrera 提交于
We were using uint64 function arguments as "long int" arguments to compiler builtins, which fails on machines where long ints are 32 bits: the upper half of the uint64 was being ignored. Fix by using the "ll" builtin variants instead, which on those machines take 64 bit arguments. Also, remove configure tests for __builtin_popcountl() (as well as "long" variants for ctz and clz): the theory here is that any compiler version will provide all widths or none, so one test suffices. Were this theory to be wrong, we'd have to add tests for __builtin_popcountll() and friends, which would be tedious. Per failures in buildfarm member lapwing and ensuing discussion.
-
由 Alvaro Herrera 提交于
These opcodes have been around in the AMD world since 2007, and 2008 in the case of intel. They're supported in GCC and Clang via some __builtin macros. The opcodes may be unavailable during runtime, in which case we fall back on a C-based implementation of the code. In order to get the POPCNT instruction we must pass the -mpopcnt option to the compiler. We do this only for the pg_bitutils.c file. David Rowley (with fragments taken from a patch by Thomas Munro) Discussion: https://postgr.es/m/CAKJS1f9WTAGG1tPeJnD18hiQW5gAk59fQ6WK-vfdAKEHyRg2RA@mail.gmail.com
-
- 13 2月, 2019 1 次提交
-
-
由 Andrew Gierth 提交于
Using strtod() creates a double-rounding problem; the input decimal value is first rounded to the nearest double; rounding that to the nearest float may then give an incorrect result. An example is that 7.038531e-26 when input via strtod and then rounded to float4 gives 0xAE43FEp-107 instead of the correct 0xAE43FDp-107. Values output by earlier PG versions with extra_float_digits=3 should all be read in with the same values as previously. However, values supplied by other software using shortest representations could be mis-read. On platforms that lack a strtof() entirely, we fall back to the old incorrect rounding behavior. (As strtof() is required by C99, such platforms are considered of primarily historical interest.) On VS2013, some workarounds are used to get correct error handling. The regression tests now test for the correct input values, so platforms that lack strtof() will need resultmap entries. An entry for HP-UX 10 is included (more may be needed). Reviewed-By: Tom Lane Discussion: https://postgr.es/m/871s5emitx.fsf@news-spur.riddles.org.uk Discussion: https://postgr.es/m/87d0owlqpv.fsf@news-spur.riddles.org.uk
-
- 24 1月, 2019 1 次提交
-
-
由 Jesse Zhang 提交于
We backported 128-bit integer support to speed up aggregates (commits 8122e143 and 959277a4) from upstream 9.6 into Greenplum (in commits 9b164486 and 325e6fcd). However, we forgot to also port a follow-up fix postgres/postgres@7518049980b, mostly because it's nuanced and hard to reproduce. There are two ways to tell the brokenness: 1. On a lucky day, tests would fail on my workstation, but not my laptop (or vice versa). 1. If you stare at the generated code for `int8_avg_combine` (and friends), you'll notice the compiler uses "aligned" instructions like `movaps` and `movdqa` (on AMD64). Today's my lucky day. Original commit message from postgres/postgres@7518049980b (by Tom Lane): > Our initial work with int128 neglected alignment considerations, an > oversight that came back to bite us in bug #14897 from Vincent Lachenal. > It is unsurprising that int128 might have a 16-byte alignment requirement; > what's slightly more surprising is that even notoriously lax Intel chips > sometimes enforce that. > Raising MAXALIGN seems out of the question: the costs in wasted disk and > memory space would be significant, and there would also be an on-disk > compatibility break. Nor does it seem very practical to try to allow some > data structures to have more-than-MAXALIGN alignment requirement, as we'd > have to push knowledge of that throughout various code that copies data > structures around. > The only way out of the box is to make type int128 conform to the system's > alignment assumptions. Fortunately, gcc supports that via its > __attribute__(aligned()) pragma; and since we don't currently support > int128 on non-gcc-workalike compilers, we shouldn't be losing any platform > support this way. > Although we could have just done pg_attribute_aligned(MAXIMUM_ALIGNOF) and > called it a day, I did a little bit of extra work to make the code more > portable than that: it will also support int128 on compilers without > __attribute__(aligned()), if the native alignment of their 128-bit-int > type is no more than that of int64. > Add a regression test case that exercises the one known instance of the > problem, in parallel aggregation over a bigint column. > This will need to be back-patched, along with the preparatory commit > 91aec93e. But let's see what the buildfarm makes of it first. > Discussion: https://postgr.es/m/20171110185747.31519.28038@wrigleys.postgresql.org (cherry picked from commit 75180499)
-
- 22 1月, 2019 2 次提交
-
-
由 Tom Lane 提交于
While Windows (allegedly) has _configthreadlocale() pretty far back, it seems MinGW didn't acquire support for that till more recently. Fortunately, we can use an autoconf probe on that toolchain, instead of guessing whether it's there. (Hm, I wonder whether Cygwin will need this also.) Per buildfarm. Discussion: https://postgr.es/m/20190121193512.tdmcnic2yjxlufaw@alap3.anarazel.de
-
由 Tom Lane 提交于
ecpglib attempts to force the LC_NUMERIC locale to "C" while reading server output, to avoid problems with strtod() and related functions. Historically it's just issued setlocale() calls to do that, but that has major problems if we're in a threaded application. setlocale() itself is not required by POSIX to be thread-safe (and indeed is not, on recent OpenBSD). Moreover, its effects are process-wide, so that we could cause unexpected results in other threads, or another thread could change our setting. On platforms having uselocale(), which is required by POSIX:2008, we can avoid these problems by using uselocale() instead. Windows goes its own way as usual, but we can make it safe by using _configthreadlocale(). Platforms having neither continue to use the old code, but that should be pretty much nobody among current systems. This should get back-patched, but let's see what the buildfarm thinks of it first. Michael Meskes and Tom Lane; thanks also to Takayuki Tsunakawa. Discussion: https://postgr.es/m/31420.1547783697@sss.pgh.pa.us
-
- 19 1月, 2019 1 次提交
-
-
由 Bradford Boyle 提交于
- Added with-quicklz configure flag - Added quicklz gpcontrib directory with C wrapper functions and SQL installation file - Added simple quicklz functional tests - Added #undef HAVE_LIBQUICKLZ to pg_config.h.win32. This is to parallel the recent change in pg_config.h.in that adds quicklz. pg_config.h.win32 should be autogenerated, but isn't in practice. Co-authored-by: NJimmy Yih <jyih@pivotal.io> Co-authored-by: NBen Christel <bchristel@pivotal.io> Co-authored-by: NDavid Sharp <dsharp@pivotal.io>
-
- 11 1月, 2019 1 次提交
-
-
由 Taylor Vesely 提交于
- set config flags to disable zstd in platforms that don't have the library baked in - currently only centos6 and centos7 have zstd provided in the build images - delete the suse10 config flags, because it is no longer a supported platform - add EXTRA_CONFIG_FLAGS to deb_create_package.bash Co-authored-by: NTaylor Vesely <tvesely@pivotal.io> Co-authored-by: NBen Christel <bchristel@pivotal.io> Co-authored-by: NKaren Huddleston <khuddleston@pivotal.io>
-
- 01 1月, 2019 1 次提交
-
-
由 Michael Paquier 提交于
This removes a portion of infrastructure introduced by fe0a0b59 to allow compilation of Postgres in environments where no strong random source is available, meaning that there is no linking to OpenSSL and no /dev/urandom (Windows having its own CryptoAPI). No systems shipped this century lack /dev/urandom, and the buildfarm is actually not testing this switch at all, so just remove it. This simplifies particularly some backend code which included a fallback implementation using shared memory, and removes a set of alternate regression output files from pgcrypto. Author: Michael Paquier Reviewed-by: Tom Lane Discussion: https://postgr.es/m/20181230063219.GG608@paquier.xyz
-
- 18 12月, 2018 1 次提交
-
-
由 Tom Lane 提交于
It appears that all platforms that have sys_siglist[] also have strsignal(), making that fallback case in pg_strsignal() dead code. Getting rid of it allows dropping a configure test, which seems worth more than providing textual signal descriptions on whatever platforms might still hypothetically have use for the fallback case. Discussion: https://postgr.es/m/25758.1544983503@sss.pgh.pa.us
-
- 17 12月, 2018 1 次提交
-
-
由 Tom Lane 提交于
At least as far back as the 2008 spec, POSIX has defined strsignal(3) for looking up descriptive strings for signal numbers. We hadn't gotten the word though, and were still using the crufty old sys_siglist array, which is in no standard even though most Unixen provide it. Aside from not being formally standards-compliant, this was just plain ugly because it involved #ifdef's at every place using the code. To eliminate the #ifdef's, create a portability function pg_strsignal, which wraps strsignal(3) if available and otherwise falls back to sys_siglist[] if available. The set of Unixen with neither API is probably empty these days, but on any platform with neither, you'll just get "unrecognized signal". All extant callers print the numeric signal number too, so no need to work harder than that. Along the way, upgrade pg_basebackup's child-error-exit reporting to match the rest of the system. Discussion: https://postgr.es/m/25758.1544983503@sss.pgh.pa.us
-
- 07 12月, 2018 1 次提交
-
-
由 Daniel Gustafsson 提交于
The support for sending alerts via Email or SNMP was quite a kludge, and there are much better external tools for managing alerts than what we can supply in core anyways so this retires the capability. All references to alert sending in the docs are removed, but there needs to be section written about how to migrate off this feature in the release notes or a similar location. Discussion: https://github.com/greenplum-db/gpdb/pull/6384
-
- 08 11月, 2018 2 次提交
-
-
由 Tom Lane 提交于
Per buildfarm, HAVE_COPYFILE is not the same thing as HAVE_COPYFILE_H. Add the extra configure test.
-
由 Peter Eisentraut 提交于
Add another transfer mode --clone to pg_upgrade (besides the existing --link and the default copy), using special file cloning calls. This makes the file transfer faster and more space efficient, achieving speed similar to --link mode without the associated drawbacks. On Linux, file cloning is supported on Btrfs and XFS (if formatted with reflink support). On macOS, file cloning is supported on APFS. Reviewed-by: NMichael Paquier <michael@paquier.xyz>
-
- 07 11月, 2018 1 次提交
-
-
由 Thomas Munro 提交于
Forward to POSIX pread() and pwrite(), or emulate them if unavailable. The emulation is not perfect as the file position is changed, so we'll put pg_ prefixes on the names to minimize the risk of confusion in future patches that might inadvertently try to mix pread() and read() on the same file descriptor. Author: Thomas Munro Reviewed-by: Tom Lane, Jesper Pedersen Discussion: https://postgr.es/m/CAEepm=02rapCpPR3ZGF2vW=SBHSdFYO_bz_f-wwWJonmA3APgw@mail.gmail.com
-
- 09 10月, 2018 1 次提交
-
-
由 Tom Lane 提交于
NetBSD-current generates a large number of warnings about "%m" not being appropriate to use with *printf functions. While that's true for their native printf, it's surely not true for snprintf.c, so I think they have misunderstood gcc's definition of the "gnu_printf" archetype. Nonetheless, choosing "__syslog__" instead silences the warnings; so teach configure about that. Since this is only a cosmetic warning issue (and anyway it depends on previous hacking to be self-consistent), no back-patch. Discussion: https://postgr.es/m/16785.1539046036@sss.pgh.pa.us
-
- 03 10月, 2018 1 次提交
-
-
由 Tom Lane 提交于
In combination, these changes make our version of snprintf as fast or faster than most platforms' native snprintf, except for cases involving floating-point conversion (which we still delegate to the native sprintf). The speed penalty for a float conversion is down to around 10% though, much better than before. Notable changes: * Rather than always parsing the format twice to see if it contains instances of %n$, do the extra scan only if we actually find a $. This obviously wins for non-localized formats, and even when there is use of %n$, we can avoid scanning text before the first % twice. * Use strchrnul() if available to find the next %, and emit the literal text between % escapes as strings rather than char-by-char. * Create a bespoke function (dopr_outchmulti) for the common case of emitting N copies of the same character, in place of writing loops around dopr_outch. * Simplify construction of the format string for invocations of sprintf for floats. * Const-ify some internal functions, and avoid unnecessary use of pass-by-reference arguments. Patch by me, reviewed by Andres Freund Discussion: https://postgr.es/m/11787.1534530779@sss.pgh.pa.us
-
- 01 10月, 2018 1 次提交
-
-
由 Tom Lane 提交于
The method we've traditionally used, of redeclaring strerror_r() to see if the compiler complains of inconsistent declarations, turns out not to work reliably because some compilers only report a warning, not an error. Amazingly, this has gone undetected for years, even though it certainly breaks our detection of whether strerror_r succeeded. Let's instead test whether the compiler will take the result of strerror_r() as a switch() argument. It's possible this won't work universally either, but it's the best idea I could come up with on the spur of the moment. Back-patch of commit 751f532b. Buildfarm results indicate that only icc-on-Linux actually has an issue here; perhaps the lack of field reports indicates that people don't build PG for production that way. Discussion: https://postgr.es/m/10877.1537993279@sss.pgh.pa.us
-
- 27 9月, 2018 2 次提交
-
-
由 Tom Lane 提交于
The method we've traditionally used, of redeclaring strerror_r() to see if the compiler complains of inconsistent declarations, turns out not to work reliably because some compilers only report a warning, not an error. Amazingly, this has gone undetected for years, even though it certainly breaks our detection of whether strerror_r succeeded. Let's instead test whether the compiler will take the result of strerror_r() as a switch() argument. It's possible this won't work universally either, but it's the best idea I could come up with on the spur of the moment. We should probably back-patch this once the dust settles, but first let's see what the buildfarm thinks of it. Discussion: https://postgr.es/m/10877.1537993279@sss.pgh.pa.us
-
由 Tom Lane 提交于
We've spent an awful lot of effort over the years in coping with platform-specific vagaries of the *printf family of functions. Let's just forget all that mess and standardize on always using src/port/snprintf.c. This gets rid of a lot of configure logic, and it will allow a saner approach to dealing with %m (though actually changing that is left for a follow-on patch). Preliminary performance testing suggests that as it stands, snprintf.c is faster than the native printf functions for some tasks on some platforms, and slower for other cases. A pending patch will improve that, though cases with floating-point conversions will doubtless remain slower unless we want to put a *lot* of effort into that. Still, we've not observed that *printf is really a performance bottleneck for most workloads, so I doubt this matters much. Patch by me, reviewed by Michael Paquier Discussion: https://postgr.es/m/2975.1526862605@sss.pgh.pa.us
-
- 26 9月, 2018 1 次提交
-
-
由 Tom Lane 提交于
elog.c has long had a private strerror wrapper that handles assorted possible failures or deficiencies of the platform's strerror. On Windows, it also knows how to translate Winsock error codes, which the native strerror does not. Move all this code into src/port/strerror.c and define strerror() as a macro that invokes it, so that both our frontend and backend code will have all of this behavior. I believe this constitutes an actual bug fix on Windows, since AFAICS our frontend code did not report Winsock error codes properly before this. However, the main point is to lay the groundwork for implementing %m in src/port/snprintf.c: the behavior we want %m to have is this one, not the native strerror's. Note that this throws away the prior use of src/port/strerror.c, which was to implement strerror() on platforms lacking it. That's been dead code for nigh twenty years now, since strerror() was already required by C89. We should likewise cause strerror_r to use this behavior, but I'll tackle that separately. Patch by me, reviewed by Michael Paquier Discussion: https://postgr.es/m/2975.1526862605@sss.pgh.pa.us
-