diff options
author | Tomas Vondra <tomas.vondra@postgresql.org> | 2018-08-16 16:49:10 +0200 |
---|---|---|
committer | Tomas Vondra <tomas.vondra@postgresql.org> | 2018-08-16 16:55:34 +0200 |
commit | 43ba5ac6aa4879eea2d16f7f531b256c8203a3c3 (patch) | |
tree | 32d8ef143b7150ce296bffd9298c486da7116e83 | |
parent | 36147ec9f1e2dcbe35fc813825242d72d1c57b70 (diff) | |
download | postgresql-43ba5ac6aa4879eea2d16f7f531b256c8203a3c3.tar.gz postgresql-43ba5ac6aa4879eea2d16f7f531b256c8203a3c3.zip |
Close the file descriptor in ApplyLogicalMappingFile
The function was forgetting to close the file descriptor, resulting
in failures like this:
ERROR: 53000: exceeded maxAllocatedDescs (492) while trying to open
file "pg_logical/mappings/map-4000-4eb-1_60DE1E08-5376b5-537c6b"
LOCATION: OpenTransientFile, fd.c:2161
Simply close the file at the end, and backpatch to 9.4 (where logical
decoding was introduced). While at it, fix a nearby typo.
Discussion: https://www.postgresql.org/message-id/flat/738a590a-2ce5-9394-2bef-7b1caad89b37%402ndquadrant.com
-rw-r--r-- | src/backend/replication/logical/reorderbuffer.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/backend/replication/logical/reorderbuffer.c b/src/backend/replication/logical/reorderbuffer.c index 1d43a165ad0..5f4ae1291c6 100644 --- a/src/backend/replication/logical/reorderbuffer.c +++ b/src/backend/replication/logical/reorderbuffer.c @@ -3278,11 +3278,13 @@ ApplyLogicalMappingFile(HTAB *tuplecid_data, Oid relid, const char *fname) new_ent->combocid = ent->combocid; } } + + CloseTransientFile(fd); } /* - * Check whether the TransactionOId 'xid' is in the pre-sorted array 'xip'. + * Check whether the TransactionOid 'xid' is in the pre-sorted array 'xip'. */ static bool TransactionIdInArray(TransactionId xid, TransactionId *xip, Size num) |