Skip to content
Snippets Groups Projects
  1. Jul 01, 2017
    • Tom Lane's avatar
      Reduce delay for last logicalrep feedback message when master goes idle. · f32678c0
      Tom Lane authored
      The regression tests contain numerous cases where we do some activity on a
      master server and then wait till the slave has ack'd flushing its copy of
      that transaction.  Because WAL flush on the slave is asynchronous to the
      logicalrep worker process, the worker cannot send such a feedback message
      during the LogicalRepApplyLoop iteration where it processes the last data
      from the master.  In the previous coding, the feedback message would come
      out only when the loop's WaitLatchOrSocket call returned WL_TIMEOUT.  That
      requires one full second of delay (NAPTIME_PER_CYCLE); and to add insult
      to injury, it could take more than that if the WaitLatchOrSocket was
      interrupted a few times by latch-setting events.
      
      In reality we can expect the slave's walwriter process to have flushed the
      WAL data after, more or less, WalWriterDelay (typically 200ms).  Hence,
      if there are unacked transactions pending, make the wait delay only that
      long rather than the full NAPTIME_PER_CYCLE.  Also, move one of the
      send_feedback() calls into the loop main line, so that we'll check for the
      need to send feedback even if we were woken by a latch event and not either
      socket data or timeout.
      
      It's not clear how much this matters for production purposes, but
      it's definitely helpful for testing.
      
      Discussion: https://postgr.es/m/30864.1498861103@sss.pgh.pa.us
      f32678c0
  2. Jun 21, 2017
    • Tom Lane's avatar
      Phase 3 of pgindent updates. · 382ceffd
      Tom Lane authored
      Don't move parenthesized lines to the left, even if that means they
      flow past the right margin.
      
      By default, BSD indent lines up statement continuation lines that are
      within parentheses so that they start just to the right of the preceding
      left parenthesis.  However, traditionally, if that resulted in the
      continuation line extending to the right of the desired right margin,
      then indent would push it left just far enough to not overrun the margin,
      if it could do so without making the continuation line start to the left of
      the current statement indent.  That makes for a weird mix of indentations
      unless one has been completely rigid about never violating the 80-column
      limit.
      
      This behavior has been pretty universally panned by Postgres developers.
      Hence, disable it with indent's new -lpl switch, so that parenthesized
      lines are always lined up with the preceding left paren.
      
      This patch is much less interesting than the first round of indent
      changes, but also bulkier, so I thought it best to separate the effects.
      
      Discussion: https://postgr.es/m/E1dAmxK-0006EE-1r@gemulon.postgresql.org
      Discussion: https://postgr.es/m/30527.1495162840@sss.pgh.pa.us
      382ceffd
    • Tom Lane's avatar
      Phase 2 of pgindent updates. · c7b8998e
      Tom Lane authored
      Change pg_bsd_indent to follow upstream rules for placement of comments
      to the right of code, and remove pgindent hack that caused comments
      following #endif to not obey the general rule.
      
      Commit e3860ffa wasn't actually using
      the published version of pg_bsd_indent, but a hacked-up version that
      tried to minimize the amount of movement of comments to the right of
      code.  The situation of interest is where such a comment has to be
      moved to the right of its default placement at column 33 because there's
      code there.  BSD indent has always moved right in units of tab stops
      in such cases --- but in the previous incarnation, indent was working
      in 8-space tab stops, while now it knows we use 4-space tabs.  So the
      net result is that in about half the cases, such comments are placed
      one tab stop left of before.  This is better all around: it leaves
      more room on the line for comment text, and it means that in such
      cases the comment uniformly starts at the next 4-space tab stop after
      the code, rather than sometimes one and sometimes two tabs after.
      
      Also, ensure that comments following #endif are indented the same
      as comments following other preprocessor commands such as #else.
      That inconsistency turns out to have been self-inflicted damage
      from a poorly-thought-through post-indent "fixup" in pgindent.
      
      This patch is much less interesting than the first round of indent
      changes, but also bulkier, so I thought it best to separate the effects.
      
      Discussion: https://postgr.es/m/E1dAmxK-0006EE-1r@gemulon.postgresql.org
      Discussion: https://postgr.es/m/30527.1495162840@sss.pgh.pa.us
      c7b8998e
  3. Jun 17, 2017
  4. Jun 13, 2017
  5. Jun 07, 2017
    • Peter Eisentraut's avatar
      Consistently use subscription name as application name · d4bfc06e
      Peter Eisentraut authored
      The logical replication apply worker uses the subscription name as
      application name, except for table sync.  This was incorrectly set to
      use the replication slot name, which might be different, in one case.
      Also add a comment why the other case is different.
      d4bfc06e
    • Andres Freund's avatar
      Clean up latch related code. · 9206ced1
      Andres Freund authored
      The larger part of this patch replaces usages of MyProc->procLatch
      with MyLatch.  The latter works even early during backend startup,
      where MyProc->procLatch doesn't yet.  While the affected code
      shouldn't run in cases where it's not initialized, it might get copied
      into places where it might.  Using MyLatch is simpler and a bit faster
      to boot, so there's little point to stick with the previous coding.
      
      While doing so I noticed some weaknesses around newly introduced uses
      of latches that could lead to missed events, and an omitted
      CHECK_FOR_INTERRUPTS() call in worker_spi.
      
      As all the actual bugs are in v10 code, there doesn't seem to be
      sufficient reason to backpatch this.
      
      Author: Andres Freund
      Discussion:
          https://postgr.es/m/20170606195321.sjmenrfgl2nu6j63@alap3.anarazel.de
          https://postgr.es/m/20170606210405.sim3yl6vpudhmufo@alap3.anarazel.de
      Backpatch: -
      9206ced1
  6. Jun 06, 2017
  7. Jun 03, 2017
  8. Jun 02, 2017
    • Peter Eisentraut's avatar
      Fix signal handling in logical replication workers · 9fcf670c
      Peter Eisentraut authored
      
      The logical replication worker processes now use the normal die()
      handler for SIGTERM and CHECK_FOR_INTERRUPTS() instead of custom code.
      One problem before was that the apply worker would not exit promptly
      when a subscription was dropped, which could lead to deadlocks.
      
      Author: Petr Jelinek <petr.jelinek@2ndquadrant.com>
      Reported-by: default avatarMasahiko Sawada <sawada.mshk@gmail.com>
      9fcf670c
    • Peter Eisentraut's avatar
      Reorganize logical replication worker disconnect code · 6812330f
      Peter Eisentraut authored
      Move the walrcv_disconnect() calls into the before_shmem_exit handler.
      This makes sure the call is always made even during exit by signal, it
      saves some duplicate code, and it makes the logic more similar to
      walreceiver.c.
      
      Author: Petr Jelinek <petr.jelinek@2ndquadrant.com>
      6812330f
  9. May 25, 2017
  10. May 18, 2017
  11. May 17, 2017
  12. May 09, 2017
  13. May 08, 2017
  14. Apr 27, 2017
  15. Apr 18, 2017
  16. Apr 14, 2017
  17. Apr 10, 2017
  18. Apr 04, 2017
    • Peter Eisentraut's avatar
      Fix typo · d1f103c7
      Peter Eisentraut authored
      Author: Masahiko Sawada <sawada.mshk@gmail.com>
      d1f103c7
    • Peter Eisentraut's avatar
      Fix remote position tracking in logical replication · fe7bbc4d
      Peter Eisentraut authored
      We need to set the origin remote position to end_lsn, not commit_lsn, as
      commit_lsn is the start of commit record, and we use the origin remote
      position as start position when restarting replication stream.  If we'd
      use commit_lsn, we could request data that we already received from the
      remote server after a crash of a downstream server.
      
      Author: Petr Jelinek <petr.jelinek@2ndquadrant.com>
      fe7bbc4d
  19. Apr 03, 2017
  20. Mar 23, 2017
    • Peter Eisentraut's avatar
      Logical replication support for initial data copy · 7c4f5240
      Peter Eisentraut authored
      
      Add functionality for a new subscription to copy the initial data in the
      tables and then sync with the ongoing apply process.
      
      For the copying, add a new internal COPY option to have the COPY source
      data provided by a callback function.  The initial data copy works on
      the subscriber by receiving COPY data from the publisher and then
      providing it locally into a COPY that writes to the destination table.
      
      A WAL receiver can now execute full SQL commands.  This is used here to
      obtain information about tables and publications.
      
      Several new options were added to CREATE and ALTER SUBSCRIPTION to
      control whether and when initial table syncing happens.
      
      Change pg_dump option --no-create-subscription-slots to
      --no-subscription-connect and use the new CREATE SUBSCRIPTION
      ... NOCONNECT option for that.
      
      Author: Petr Jelinek <petr.jelinek@2ndquadrant.com>
      Tested-by: default avatarErik Rijkers <er@xs4all.nl>
      7c4f5240
  21. Mar 14, 2017
  22. Mar 03, 2017
  23. Feb 23, 2017
    • Tom Lane's avatar
      Consistently declare timestamp variables as TimestampTz. · c29aff95
      Tom Lane authored
      Twiddle the replication-related code so that its timestamp variables
      are declared TimestampTz, rather than the uninformative "int64" that
      was previously used for meant-to-be-always-integer timestamps.
      This resolves the int64-vs-TimestampTz declaration inconsistencies
      introduced by commit 7c030783, though in the opposite direction to
      what was originally suggested.
      
      This required including datatype/timestamp.h in a couple more places
      than before.  I decided it would be a good idea to slim down that
      header by not having it pull in <float.h> etc, as those headers are
      no longer at all relevant to its purpose.  Unsurprisingly, a small number
      of .c files turn out to have been depending on those inclusions, so add
      them back in the .c files as needed.
      
      Discussion: https://postgr.es/m/26788.1487455319@sss.pgh.pa.us
      Discussion: https://postgr.es/m/27694.1487456324@sss.pgh.pa.us
      c29aff95
  24. Feb 21, 2017
  25. Feb 06, 2017
  26. Jan 25, 2017
  27. Jan 23, 2017
  28. Jan 20, 2017
Loading