diff options
author | Andres Freund <andres@anarazel.de> | 2014-06-29 17:08:04 +0200 |
---|---|---|
committer | Andres Freund <andres@anarazel.de> | 2014-06-30 10:49:39 +0200 |
commit | 1cbc9480106241aaa8db112331e93d0a265b6db0 (patch) | |
tree | 9d0e1f4b4d9ca54835bfac2c3050d2e119b51d4d /src/backend/replication/logical/logical.c | |
parent | 1c6821be31f91ab92547a8ed4246762c8cefb1b3 (diff) | |
download | postgresql-1cbc9480106241aaa8db112331e93d0a265b6db0.tar.gz postgresql-1cbc9480106241aaa8db112331e93d0a265b6db0.zip |
Check interrupts during logical decoding more frequently.
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.
Diffstat (limited to 'src/backend/replication/logical/logical.c')
-rw-r--r-- | src/backend/replication/logical/logical.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/backend/replication/logical/logical.c b/src/backend/replication/logical/logical.c index 9eb5cd5ee4d..49f9c7d3a57 100644 --- a/src/backend/replication/logical/logical.c +++ b/src/backend/replication/logical/logical.c @@ -451,11 +451,6 @@ DecodingContextFindStartpoint(LogicalDecodingContext *ctx) XLogRecord *record; char *err = NULL; - /* - * If the caller requires that interrupts be checked, the read_page - * callback should do so, as those will often wait. - */ - /* the read_page callback waits for new WAL */ record = XLogReadRecord(ctx->reader, startptr, &err); if (err) @@ -470,6 +465,8 @@ DecodingContextFindStartpoint(LogicalDecodingContext *ctx) /* only continue till we found a consistent spot */ if (DecodingContextReady(ctx)) break; + + CHECK_FOR_INTERRUPTS(); } ctx->slot->data.confirmed_flush = ctx->reader->EndRecPtr; |