Close the file descriptor in ApplyLogicalMappingFile
authorTomas Vondra <tomas.vondra@postgresql.org>
Thu, 16 Aug 2018 14:49:10 +0000 (16:49 +0200)
committerTomas Vondra <tomas.vondra@postgresql.org>
Thu, 16 Aug 2018 14:52:44 +0000 (16:52 +0200)
commit5257b9bfbafdbb17fa7b3a1d387dfaa7d40626cb
treeccfb5599a58b12d579596f35adc0f0c22a392f2c
parentc2a2e331da17e86ba874ff9449b1d2c9e7e829fd
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
src/backend/replication/logical/reorderbuffer.c