From a31e64d0652622d4627ffa2123163a43538a3f51 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sun, 4 Oct 2015 14:06:40 -0400 Subject: Fix some issues in new hashtable size calculations in nodeHash.c. Limit the size of the hashtable pointer array to not more than MaxAllocSize, per reports from Kouhei Kaigai and others of "invalid memory alloc request size" failures. There was discussion of allowing the array to get larger than that by using the "huge" palloc API, but so far no proof that that is actually a good idea, and at this point in the 9.5 cycle major changes from old behavior don't seem like the way to go. Fix a rather serious secondary bug in the new code, which was that it didn't ensure nbuckets remained a power of 2 when recomputing it for the multiple-batch case. Clean up sloppy division of labor between ExecHashIncreaseNumBuckets and its sole call site. --- src/include/executor/hashjoin.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/include/executor') diff --git a/src/include/executor/hashjoin.h b/src/include/executor/hashjoin.h index 9d0b85c77db..7a51ea6fffb 100644 --- a/src/include/executor/hashjoin.h +++ b/src/include/executor/hashjoin.h @@ -131,7 +131,7 @@ typedef struct HashJoinTableData int nbuckets_original; /* # buckets when starting the first * hash */ int nbuckets_optimal; /* optimal # buckets (per batch) */ - int log2_nbuckets_optimal; /* same as log2_nbuckets optimal */ + int log2_nbuckets_optimal; /* log2(nbuckets_optimal) */ /* buckets[i] is head of list of tuples in i'th in-memory bucket */ struct HashJoinTupleData **buckets; -- cgit v1.2.3