Fix possible failure to mark hash metapage dirty.
authorRobert Haas <rhaas@postgresql.org>
Thu, 1 Feb 2018 20:21:13 +0000 (15:21 -0500)
committerRobert Haas <rhaas@postgresql.org>
Thu, 1 Feb 2018 20:31:31 +0000 (15:31 -0500)
Report and suggested fix by Lixian Zou.  Amit Kapila put it
in the form of a patch and reviewed.

Discussion: http://postgr.es/m/151739848647.1239.12528851873396651946@wrigleys.postgresql.org

src/backend/access/hash/hashovfl.c

index c206e704d4d1d326dd4429421b26e5acb15c7013..912e38ca71e47f3d665b3cb4c4538501b49a7812 100644 (file)
@@ -341,9 +341,10 @@ found:
            metap->hashm_mapp[metap->hashm_nmaps] = BufferGetBlockNumber(newmapbuf);
            metap->hashm_nmaps++;
            metap->hashm_spares[splitnum]++;
-           MarkBufferDirty(metabuf);
        }
 
+       MarkBufferDirty(metabuf);
+
        /*
         * for new overflow page, we don't need to explicitly set the bit in
         * bitmap page, as by default that will be set to "in use".