diff options
author | Amit Kapila <akapila@postgresql.org> | 2020-10-15 08:17:51 +0530 |
---|---|---|
committer | Amit Kapila <akapila@postgresql.org> | 2020-10-15 08:17:51 +0530 |
commit | d7eb52d7181d83cf2363570f7a205b8eb1008dbc (patch) | |
tree | a4f64fb81dcf84ccb3c5fdfb6263e24923442bea /src/include | |
parent | 564a410c81b4a9d289c948690a3135d0cd25411b (diff) | |
download | postgresql-d7eb52d7181d83cf2363570f7a205b8eb1008dbc.tar.gz postgresql-d7eb52d7181d83cf2363570f7a205b8eb1008dbc.zip |
Execute invalidation messages for each XLOG_XACT_INVALIDATIONS message
during logical decoding.
Prior to commit c55040ccd0 we have no way of knowing the invalidations
before commit. So, while decoding we use to execute all the invalidations
at each command end as we had no way of knowing which invalidations
happened before that command. Due to this, transactions involving large
amounts of DDLs use to take more time and also lead to high CPU usage. But
now we know specific invalidations at each command end so we execute only
required invalidations.
It has been observed that decoding of a transaction containing truncation
of a table with 1000 partitions would be finished in 1s whereas before
this patch it used to take 4-5 minutes.
Author: Dilip Kumar
Reviewed-by: Amit Kapila and Keisuke Kuroda
Discussion: https://postgr.es/m/CANDwggKYveEtXjXjqHA6RL3AKSHMsQyfRY6bK+NqhAWJyw8psQ@mail.gmail.com
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/replication/reorderbuffer.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/include/replication/reorderbuffer.h b/src/include/replication/reorderbuffer.h index 0cc3aebb111..1c77819aad2 100644 --- a/src/include/replication/reorderbuffer.h +++ b/src/include/replication/reorderbuffer.h @@ -57,6 +57,7 @@ enum ReorderBufferChangeType REORDER_BUFFER_CHANGE_UPDATE, REORDER_BUFFER_CHANGE_DELETE, REORDER_BUFFER_CHANGE_MESSAGE, + REORDER_BUFFER_CHANGE_INVALIDATION, REORDER_BUFFER_CHANGE_INTERNAL_SNAPSHOT, REORDER_BUFFER_CHANGE_INTERNAL_COMMAND_ID, REORDER_BUFFER_CHANGE_INTERNAL_TUPLECID, @@ -149,6 +150,13 @@ typedef struct ReorderBufferChange CommandId cmax; CommandId combocid; } tuplecid; + + /* Invalidation. */ + struct + { + uint32 ninvalidations; /* Number of messages */ + SharedInvalidationMessage *invalidations; /* invalidation message */ + } inval; } data; /* @@ -313,8 +321,8 @@ typedef struct ReorderBufferTXN uint64 nentries_mem; /* - * List of ReorderBufferChange structs, including new Snapshots and new - * CommandIds + * List of ReorderBufferChange structs, including new Snapshots, new + * CommandIds and command invalidation messages. */ dlist_head changes; |