Skip to content
Snippets Groups Projects
Select Git revision
  • benchmark-tools
  • postgres-lambda
  • master default
  • REL9_4_25
  • REL9_5_20
  • REL9_6_16
  • REL_10_11
  • REL_11_6
  • REL_12_1
  • REL_12_0
  • REL_12_RC1
  • REL_12_BETA4
  • REL9_4_24
  • REL9_5_19
  • REL9_6_15
  • REL_10_10
  • REL_11_5
  • REL_12_BETA3
  • REL9_4_23
  • REL9_5_18
  • REL9_6_14
  • REL_10_9
  • REL_11_4
23 results

xlog_internal.h

Blame
    • Andres Freund's avatar
      4f1b890b
      Merge the various forms of transaction commit & abort records. · 4f1b890b
      Andres Freund authored
      Since 465883b0 two versions of commit records have existed. A compact
      version that was used when no cache invalidations, smgr unlinks and
      similar were needed, and a full version that could deal with all
      that. Additionally the full version was embedded into twophase commit
      records.
      
      That resulted in a measurable reduction in the size of the logged WAL in
      some workloads. But more recently additions like logical decoding, which
      e.g. needs information about the database something was executed on,
      made it applicable in fewer situations. The static split generally made
      it hard to expand the commit record, because concerns over the size made
      it hard to add anything to the compact version.
      
      Additionally it's not particularly pretty to have twophase.c insert
      RM_XACT records.
      
      Rejigger things so that the commit and abort records only have one form
      each, including the twophase equivalents. The presence of the various
      optional (in the sense of not being in every record) pieces is indicated
      by a bits in the 'xinfo' flag.  That flag previously was not included in
      compact commit records. To prevent an increase in size due to its
      presence, it's only included if necessary; signalled by a bit in the
      xl_info bits available for xact.c, similar to heapam.c's
      XLOG_HEAP_OPMASK/XLOG_HEAP_INIT_PAGE.
      
      Twophase commit/aborts are now the same as their normal
      counterparts. The original transaction's xid is included in an optional
      data field.
      
      This means that commit records generally are smaller, except in the case
      of a transaction with subtransactions, but no other special cases; the
      increase there is four bytes, which seems acceptable given that the more
      common case of not having subtransactions shrank.  The savings are
      especially measurable for twophase commits, which previously always used
      the full version; but will in practice only infrequently have required
      that.
      
      The motivation for this work are not the space savings and and
      deduplication though; it's that it makes it easier to extend commit
      records with additional information. That's just a few lines of code
      now; without impacting the common case where that information is not
      needed.
      
      Discussion: 20150220152150.GD4149@awork2.anarazel.de,
          235610.92468.qm%40web29004.mail.ird.yahoo.com
      
      Reviewed-By: Heikki Linnakangas, Simon Riggs
      4f1b890b
      History
      Merge the various forms of transaction commit & abort records.
      Andres Freund authored
      Since 465883b0 two versions of commit records have existed. A compact
      version that was used when no cache invalidations, smgr unlinks and
      similar were needed, and a full version that could deal with all
      that. Additionally the full version was embedded into twophase commit
      records.
      
      That resulted in a measurable reduction in the size of the logged WAL in
      some workloads. But more recently additions like logical decoding, which
      e.g. needs information about the database something was executed on,
      made it applicable in fewer situations. The static split generally made
      it hard to expand the commit record, because concerns over the size made
      it hard to add anything to the compact version.
      
      Additionally it's not particularly pretty to have twophase.c insert
      RM_XACT records.
      
      Rejigger things so that the commit and abort records only have one form
      each, including the twophase equivalents. The presence of the various
      optional (in the sense of not being in every record) pieces is indicated
      by a bits in the 'xinfo' flag.  That flag previously was not included in
      compact commit records. To prevent an increase in size due to its
      presence, it's only included if necessary; signalled by a bit in the
      xl_info bits available for xact.c, similar to heapam.c's
      XLOG_HEAP_OPMASK/XLOG_HEAP_INIT_PAGE.
      
      Twophase commit/aborts are now the same as their normal
      counterparts. The original transaction's xid is included in an optional
      data field.
      
      This means that commit records generally are smaller, except in the case
      of a transaction with subtransactions, but no other special cases; the
      increase there is four bytes, which seems acceptable given that the more
      common case of not having subtransactions shrank.  The savings are
      especially measurable for twophase commits, which previously always used
      the full version; but will in practice only infrequently have required
      that.
      
      The motivation for this work are not the space savings and and
      deduplication though; it's that it makes it easier to extend commit
      records with additional information. That's just a few lines of code
      now; without impacting the common case where that information is not
      needed.
      
      Discussion: 20150220152150.GD4149@awork2.anarazel.de,
          235610.92468.qm%40web29004.mail.ird.yahoo.com
      
      Reviewed-By: Heikki Linnakangas, Simon Riggs