1. 13 Apr, 2021 6 commits
    • Tom Lane's avatar
      Avoid improbable PANIC during heap_update. · 34f581c3
      Tom Lane authored
      heap_update needs to clear any existing "all visible" flag on
      the old tuple's page (and on the new page too, if different).
      Per coding rules, to do this it must acquire pin on the appropriate
      visibility-map page while not holding exclusive buffer lock;
      which creates a race condition since someone else could set the
      flag whenever we're not holding the buffer lock.  The code is
      supposed to handle that by re-checking the flag after acquiring
      buffer lock and retrying if it became set.  However, one code
      path through heap_update itself, as well as one in its subroutine
      RelationGetBufferForTuple, failed to do this.  The end result,
      in the unlikely event that a concurrent VACUUM did set the flag
      while we're transiently not holding lock, is a non-recurring
      "PANIC: wrong buffer passed to visibilitymap_clear" failure.
      
      This has been seen a few times in the buildfarm since recent VACUUM
      changes that added code paths that could set the all-visible flag
      while holding only exclusive buffer lock.  Previously, the flag
      was (usually?) set only after doing LockBufferForCleanup, which
      would insist on buffer pin count zero, thus preventing the flag
      from becoming set partway through heap_update.  However, it's
      clear that it's heap_update not VACUUM that's at fault here.
      
      What's less clear is whether there is any hazard from these bugs
      in released branches.  heap_update is certainly violating API
      expectations, but if there is no code path that can set all-visible
      without a cleanup lock then it's only a latent bug.  That's not
      100% certain though, besides which we should worry about extensions
      or future back-patch fixes that could introduce such code paths.
      
      I chose to back-patch to v12.  Fixing RelationGetBufferForTuple
      before that would require also back-patching portions of older
      fixes (notably 0d1fe9f7), which is more code churn than seems
      prudent to fix a hypothetical issue.
      
      Discussion: https://postgr.es/m/2247102.1618008027@sss.pgh.pa.us
      34f581c3
    • Fujii Masao's avatar
      5fe83ada
    • Noah Misch's avatar
      Use "-I." in directories holding Bison parsers, for Oracle compilers. · 455dbc01
      Noah Misch authored
      With the Oracle Developer Studio 12.6 compiler, #line directives alter
      the current source file location for purposes of #include "..."
      directives.  Hence, a VPATH build failed with 'cannot find include file:
      "specscanner.c"'.  With two exceptions, parser-containing directories
      already add "-I. -I$(srcdir)"; eliminate the exceptions.  Back-patch to
      9.6 (all supported versions).
      455dbc01
    • Noah Misch's avatar
      Port regress-python3-mangle.mk to Solaris "sed". · c3556f6f
      Noah Misch authored
      It doesn't support "\(foo\)*" like a POSIX "sed" implementation does;
      see the Autoconf manual.  Back-patch to 9.6 (all supported versions).
      c3556f6f
    • Thomas Munro's avatar
      Fix potential SSI hazard in heap_update(). · b1df6b69
      Thomas Munro authored
      Commit 6f38d4da failed to heed a warning about the stability of the
      value pointed to by "otid".  The caller is allowed to pass in a pointer to
      newtup->t_self, which will be updated during the execution of the
      function.  Instead, the SSI check should use the value we copy into
      oldtup.t_self near the top of the function.
      
      Not a live bug, because newtup->t_self doesn't really get updated until
      a bit later, but it was confusing and broke the rule established by the
      comment.
      
      Back-patch to 13.
      Reported-by: default avatarTom Lane <tgl@sss.pgh.pa.us>
      Discussion: https://postgr.es/m/2689164.1618160085%40sss.pgh.pa.us
      b1df6b69
    • Michael Paquier's avatar
      Remove duplicated --no-sync switches in new tests of test_pg_dump · 885a8764
      Michael Paquier authored
      These got introduced in 6568cef2.
      
      Reported-by: Noah Misch
      Discussion: https://postgr.es/m/20210404220802.GA728316@rfd.leadboat.com
      885a8764
  2. 12 Apr, 2021 9 commits
  3. 11 Apr, 2021 5 commits
    • Tom Lane's avatar
      Silence some Coverity warnings and improve code consistency. · 6277435a
      Tom Lane authored
      Coverity complained about possible overflow in expressions like
      	intresult = tm->tm_sec * 1000000 + fsec;
      on the grounds that the multiplication would happen in 32-bit
      arithmetic before widening to the int64 result.  I think these
      are all false positives because of the limited possible range of
      tm_sec; but nonetheless it seems silly to spell it like that when
      nearby lines have the identical computation written with a 64-bit
      constant.
      
      ... or more accurately, with an LL constant, which is not project
      style.  Make all of these use INT64CONST(), as we do elsewhere.
      
      This is all new code from a2da77cd, so no need for back-patch.
      6277435a
    • Tom Lane's avatar
      Add macro PGWARNING, and make PGERROR available on all platforms. · d7cff12c
      Tom Lane authored
      We'd previously noted the need for coping with Windows headers
      that provide some other definition of macro "ERROR" than elog.h
      does.  It turns out that R also wants to define ERROR, and
      WARNING too.  PL/R has been working around this in a hacky way
      that broke when we recently changed the numeric value of ERROR.
      To let them have a more future-proof solution, provide an
      alternate macro PGWARNING for WARNING, and make PGERROR visible
      always, not only when #ifdef WIN32.
      
      Discussion: https://postgr.es/m/CADK3HHK6iMChd1yoOqssxBn5Z14Zar8Ztr3G-N_fuG7F8YTP3w@mail.gmail.com
      d7cff12c
    • Tom Lane's avatar
      Fix uninitialized variable from commit a4d75c86. · 9cb92334
      Tom Lane authored
      The path for *exprs != NIL would misbehave, and likely crash,
      since pull_varattnos expects its last argument to be valid
      at call.
      
      Found by Coverity --- we have no coverage of this path in
      the regression tests.
      9cb92334
    • Fujii Masao's avatar
      Avoid unnecessary table open/close in TRUNCATE command. · 81a23dd8
      Fujii Masao authored
      ExecuteTruncate() filters out the duplicate tables specified
      in the TRUNCATE command, for example in the case where "TRUNCATE foo, foo"
      is executed. Such duplicate tables obviously don't need to be opened
      and closed because they are skipped. But previously it always opened
      the tables before checking whether they were duplicated ones or not,
      and then closed them if they were. That is, the duplicated tables were
      opened and closed unnecessarily.
      
      This commit changes ExecuteTruncate() so that it opens the table
      after it confirms that table is not duplicated one, which leads to
      avoid unnecessary table open/close.
      
      Do not back-patch because such unnecessary table open/close is not
      a bug though it exists in older versions.
      
      Author: Bharath Rupireddy
      Reviewed-by: Amul Sul, Fujii Masao
      Discussion: https://postgr.es/m/CALj2ACUdBO_sXJTa08OZ0YT0qk7F_gAmRa9hT4dxRcgPS4nsZA@mail.gmail.com
      81a23dd8
    • Fujii Masao's avatar
      Remove COMMIT_TS_SETTS record. · 08aa89b3
      Fujii Masao authored
      Commit 438fc4a3 prevented the WAL replay from writing
      COMMIT_TS_SETTS record. By this change there is no code that
      generates COMMIT_TS_SETTS record in PostgreSQL core.
      Also we can think that there are no extensions using the record
      because we've not received so far any complaints about the issue
      that commit 438fc4a3 fixed. Therefore this commit removes
      COMMIT_TS_SETTS record and its related code. Even without
      this record, the timestamp required for commit timestamp feature
      can be acquired from the COMMIT record.
      
      Bump WAL page magic.
      Reported-by: default avatarlx zou <zoulx1982@163.com>
      Author: Fujii Masao
      Reviewed-by: Alvaro Herrera
      Discussion: https://postgr.es/m/16931-620d0f2fdc6108f1@postgresql.org
      08aa89b3
  4. 10 Apr, 2021 5 commits
  5. 09 Apr, 2021 9 commits
  6. 08 Apr, 2021 6 commits