On Fri, Apr 4, 2025 at 9:15 PM Rahila Syed <rahilasye...@gmail.com> wrote: > > Please find attached the patch which removes the changes for non-shared hash > tables > and keeps them for shared hash tables. >
/* Allocate initial segments */ + i = 0; for (segp = hashp->dir; hctl->nsegs < nsegs; hctl->nsegs++, segp++) { - *segp = seg_alloc(hashp); - if (*segp == NULL) - return false; + /* Assign initial segments, which are also pre-allocated */ + if (hashp->isshared) + { + *segp = (HASHSEGMENT) HASH_SEGMENT_PTR(hashp, i++); + MemSet(*segp, 0, HASH_SEGMENT_SIZE(hashp)); + } + else + { + *segp = seg_alloc(hashp); + i++; + } In the non-shared hash table case, previously, we used to return false from here when seg_alloc() fails, but now it seems to be proceeding without returning false. Is there a reason for the same? > I tested this by running make-check, make-check world and the reproducer > script shared > by David. I also ran pgbench to test creation and expansion of some of the > shared hash tables. > This covers the basic tests for this patch. I think we should do some low-level testing of both shared and non-shared hash tables by having a contrib module or such (we don't need to commit such a contrib module, but it will give us confidence that the low-level data structure allocation change is thoroughly tested). We also need to focus on negative tests where there is insufficient memory in the system. -- With Regards, Amit Kapila.