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

snapmgr.h

Blame
    • Robert Haas's avatar
      b89e1510
      Introduce logical decoding. · b89e1510
      Robert Haas authored
      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
      History
      Introduce logical decoding.
      Robert Haas authored
      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.
    snapmgr.h 2.22 KiB
    /*-------------------------------------------------------------------------
     *
     * snapmgr.h
     *	  POSTGRES snapshot manager
     *
     * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group
     * Portions Copyright (c) 1994, Regents of the University of California
     *
     * src/include/utils/snapmgr.h
     *
     *-------------------------------------------------------------------------
     */
    #ifndef SNAPMGR_H
    #define SNAPMGR_H
    
    #include "fmgr.h"
    #include "utils/resowner.h"
    #include "utils/snapshot.h"
    
    
    extern bool FirstSnapshotSet;
    
    extern TransactionId TransactionXmin;
    extern TransactionId RecentXmin;
    extern TransactionId RecentGlobalXmin;
    extern TransactionId RecentGlobalDataXmin;
    
    extern Snapshot GetTransactionSnapshot(void);
    extern Snapshot GetLatestSnapshot(void);
    extern void SnapshotSetCommandId(CommandId curcid);
    
    extern Snapshot GetCatalogSnapshot(Oid relid);
    extern Snapshot GetNonHistoricCatalogSnapshot(Oid relid);
    extern void InvalidateCatalogSnapshot(void);
    
    extern void PushActiveSnapshot(Snapshot snapshot);
    extern void PushCopiedSnapshot(Snapshot snapshot);
    extern void UpdateActiveSnapshotCommandId(void);
    extern void PopActiveSnapshot(void);
    extern Snapshot GetActiveSnapshot(void);
    extern bool ActiveSnapshotSet(void);
    
    extern Snapshot RegisterSnapshot(Snapshot snapshot);
    extern void UnregisterSnapshot(Snapshot snapshot);
    extern Snapshot RegisterSnapshotOnOwner(Snapshot snapshot, ResourceOwner owner);
    extern void UnregisterSnapshotFromOwner(Snapshot snapshot, ResourceOwner owner);
    
    extern void AtSubCommit_Snapshot(int level);
    extern void AtSubAbort_Snapshot(int level);
    extern void AtEOXact_Snapshot(bool isCommit);
    
    extern Datum pg_export_snapshot(PG_FUNCTION_ARGS);
    extern void ImportSnapshot(const char *idstr);
    extern bool XactHasExportedSnapshots(void);
    extern void DeleteAllExportedSnapshotFiles(void);
    extern bool ThereAreNoPriorRegisteredSnapshots(void);
    
    extern char *ExportSnapshot(Snapshot snapshot);
    
    /* Support for catalog timetravel for logical decoding */
    struct HTAB;
    extern struct HTAB *HistoricSnapshotGetTupleCids(void);
    extern void SetupHistoricSnapshot(Snapshot snapshot_now, struct HTAB *tuplecids);
    extern void TeardownHistoricSnapshot(bool is_error);
    extern bool HistoricSnapshotActive(void);
    
    #endif   /* SNAPMGR_H */