1. 28 2月, 2019 2 次提交
    • S
      Teach xlogreader to follow timeline switches · 26930d11
      Simon Riggs 提交于
      Uses page-based mechanism to ensure we’re using the correct timeline.
      
      Tests are included to exercise the functionality using a cold disk-level copy
      of the master that's started up as a replica with slots intact, but the
      intended use of the functionality is with later features.
      
      Craig Ringer, reviewed by Simon Riggs and Andres Freund
      26930d11
    • S
      Refactor to create generic WAL page read callback · 03baa031
      Simon Riggs 提交于
      Previously we didn’t have a generic WAL page read callback function,
      surprisingly. Logical decoding has logical_read_local_xlog_page(), which was
      actually generic, so move that to xlogfunc.c and rename to
      read_local_xlog_page().
      Maintain logical_read_local_xlog_page() so existing callers still work.
      
      As requested by Michael Paquier, Alvaro Herrera and Andres Freund
      03baa031
  2. 10 1月, 2016 1 次提交
    • T
      Clean up some lack-of-STRICT issues in the core code, too. · 78b7aaaa
      Tom Lane 提交于
      A scan for missed proisstrict markings in the core code turned up
      these functions:
      
      brin_summarize_new_values
      pg_stat_reset_single_table_counters
      pg_stat_reset_single_function_counters
      pg_create_logical_replication_slot
      pg_create_physical_replication_slot
      pg_drop_replication_slot
      
      The first three of these take OID, so a null argument will normally look
      like a zero to them, resulting in "ERROR: could not open relation with OID
      0" for brin_summarize_new_values, and no action for the pg_stat_reset_XXX
      functions.  The other three will dump core on a null argument, though this
      is mitigated by the fact that they won't do so until after checking that
      the caller is superuser or has rolreplication privilege.
      
      In addition, the pg_logical_slot_get/peek[_binary]_changes family was
      intentionally marked nonstrict, but failed to make nullness checks on all
      the arguments; so again a null-pointer-dereference crash is possible but
      only for superusers and rolreplication users.
      
      Add the missing ARGISNULL checks to the latter functions, and mark the
      former functions as strict in pg_proc.  Make that change in the back
      branches too, even though we can't force initdb there, just so that
      installations initdb'd in future won't have the issue.  Since none of these
      bugs rise to the level of security issues (and indeed the pg_stat_reset_XXX
      functions hardly misbehave at all), it seems sufficient to do this.
      
      In addition, fix some order-of-operations oddities in the slot_get_changes
      family, mostly cosmetic, but not the part that moves the function's last
      few operations into the PG_TRY block.  As it stood, there was significant
      risk for an error to exit without clearing historical information from
      the system caches.
      
      The slot_get_changes bugs go back to 9.4 where that code was introduced.
      Back-patch appropriate subsets of the pg_proc changes into all active
      branches, as well.
      78b7aaaa
  3. 01 10月, 2014 1 次提交
  4. 30 6月, 2014 1 次提交
    • A
      Check interrupts during logical decoding more frequently. · 6ad903d7
      Andres Freund 提交于
      When reading large amounts of preexisting WAL during logical decoding
      using the SQL interface we possibly could fail to check interrupts in
      due time. Similarly the same could happen on systems with a very high
      WAL volume while creating a new logical replication slot, independent
      of the used interface.
      
      Previously these checks where only performed in xlogreader's read_page
      callbacks, while waiting for new WAL to be produced. That's not
      sufficient though, if there's never a need to wait.  Walsender's send
      loop already contains a interrupt check.
      
      Backpatch to 9.4 where the logical decoding feature was introduced.
      6ad903d7
  5. 07 5月, 2014 1 次提交
    • B
      pgindent run for 9.4 · 0a783200
      Bruce Momjian 提交于
      This includes removing tabs after periods in C comments, which was
      applied to back branches, so this change should not effect backpatching.
      0a783200
  6. 05 3月, 2014 1 次提交
  7. 04 3月, 2014 1 次提交
    • R
      Introduce logical decoding. · b89e1510
      Robert Haas 提交于
      This feature, building on previous commits, allows the write-ahead log
      stream to be decoded into a series of logical changes; that is,
      inserts, updates, and deletes and the transactions which contain them.
      It is capable of handling decoding even across changes to the schema
      of the effected tables.  The output format is controlled by a
      so-called "output plugin"; an example is included.  To make use of
      this in a real replication system, the output plugin will need to be
      modified to produce output in the format appropriate to that system,
      and to perform filtering.
      
      Currently, information can be extracted from the logical decoding
      system only via SQL; future commits will add the ability to stream
      changes via walsender.
      
      Andres Freund, with review and other contributions from many other
      people, including Álvaro Herrera, Abhijit Menon-Sen, Peter Gheogegan,
      Kevin Grittner, Robert Haas, Heikki Linnakangas, Fujii Masao, Abhijit
      Menon-Sen, Michael Paquier, Simon Riggs, Craig Ringer, and Steve
      Singer.
      b89e1510