summaryrefslogtreecommitdiff
path: root/src/backend/access/gin/ginfast.c
diff options
context:
space:
mode:
authorTeodor Sigaev <teodor@sigaev.ru>2015-09-02 20:08:58 +0300
committerTeodor Sigaev <teodor@sigaev.ru>2015-09-02 20:08:58 +0300
commit30bb26b5e04cff911db960801e32e5f57045eb61 (patch)
treeb05b945313ce910e999818a1194b2e88183b32f7 /src/backend/access/gin/ginfast.c
parent075ab425bdbb4bb2de41624305f20885cae7ba7e (diff)
Allow usage of huge maintenance_work_mem for GIN build.
Currently, in-memory posting list during GIN build process is limited 1GB because of using repalloc. The patch replaces call of repalloc to repalloc_huge. It increases limit of posting list from 180 millions (1GB / sizeof(ItemPointerData)) to 4 billions limited by maxcount/count fields in GinEntryAccumulator and subsequent calls. Check added. Also, fix accounting of allocatedMemory during build to prevent integer overflow with maintenance_work_mem > 4GB. Robert Abraham <robert.abraham86@googlemail.com> with additions by me
Diffstat (limited to 'src/backend/access/gin/ginfast.c')
-rw-r--r--src/backend/access/gin/ginfast.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/backend/access/gin/ginfast.c b/src/backend/access/gin/ginfast.c
index c5732c3dc03..54e593d8a97 100644
--- a/src/backend/access/gin/ginfast.c
+++ b/src/backend/access/gin/ginfast.c
@@ -814,7 +814,7 @@ ginInsertCleanup(GinState *ginstate,
*/
if (GinPageGetOpaque(page)->rightlink == InvalidBlockNumber ||
(GinPageHasFullRow(page) &&
- (accum.allocatedMemory >= maintenance_work_mem * 1024L)))
+ (accum.allocatedMemory >= (Size)maintenance_work_mem * 1024L)))
{
ItemPointerData *list;
uint32 nlist;