GIN index build's allocatedMemory counter needs to be long, not uint32.
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 16 Nov 2007 21:50:13 +0000 (21:50 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 16 Nov 2007 21:50:13 +0000 (21:50 +0000)
Else, in a 64-bit machine with maintenance_work_mem set to above 4Gb,
the counter overflows and we never recognize having reached the
maintenance_work_mem limit.  I believe this explains out-of-memory
failure recently reported by Sean Davis.

This is a bug, so backpatch to 8.2.

src/include/access/gin.h

index 58c5ea582e31315469a6bc9d262801b67f3583b8..403a1310e81d29a3869172ad9b3733dc79ff0e81 100644 (file)
@@ -453,7 +453,7 @@ typedef struct
        uint32          maxdepth;
        EntryAccumulator **stack;
        uint32          stackpos;
-       uint32          allocatedMemory;
+       long            allocatedMemory;
 
        uint32          length;
        EntryAccumulator *entryallocator;