=== Applying patches on top of PostgreSQL commit ID 5c8eda1f72a2b0a8c48ada9b872eb5ef581f7c81 === /etc/rc.d/jail: WARNING: Per-jail configuration via jail_* variables is obsolete. Please consider migrating to /etc/jail.conf. Mon Aug 4 03:39:20 UTC 2025 On branch cf/5620 nothing to commit, working tree clean === using 'git am' to apply patch ./v10-0001-Improve-accounting-for-memory-used-by-shared-hash-ta.patch === Applying: Improve accounting for memory used by shared hash tables Using index info to reconstruct a base tree... M src/backend/storage/ipc/shmem.c M src/backend/utils/hash/dynahash.c Falling back to patching base and 3-way merge... Auto-merging src/backend/utils/hash/dynahash.c CONFLICT (content): Merge conflict in src/backend/utils/hash/dynahash.c Auto-merging src/backend/storage/ipc/shmem.c error: Failed to merge in the changes. hint: Use 'git am --show-current-patch=diff' to see the failed patch Patch failed at 0001 Improve accounting for memory used by shared hash tables When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort". Unstaged changes after reset: M src/backend/storage/ipc/shmem.c M src/backend/utils/hash/dynahash.c M src/include/utils/hsearch.h === using patch(1) to apply patch ./v10-0001-Improve-accounting-for-memory-used-by-shared-hash-ta.patch === patching file src/backend/storage/ipc/shmem.c Hunk #1 succeeded at 74 (offset 1 line). Hunk #2 succeeded at 352 (offset 5 lines). patching file src/backend/utils/hash/dynahash.c Hunk #1 succeeded at 272 (offset 12 lines). Hunk #2 succeeded at 319 (offset 12 lines). Hunk #3 succeeded at 611 (offset 13 lines). Hunk #4 succeeded at 625 (offset 13 lines). Hunk #5 succeeded at 650 (offset 13 lines). Hunk #6 succeeded at 778 (offset 17 lines). Hunk #7 succeeded at 811 (offset 17 lines). Hunk #8 succeeded at 919 (offset 17 lines). Hunk #9 succeeded at 1402 (offset 17 lines). Hunk #10 succeeded at 1439 (offset 17 lines). Hunk #11 FAILED at 1801. Hunk #12 succeeded at 1890 (offset 45 lines). Hunk #13 succeeded at 2101 (offset 45 lines). 1 out of 13 hunks FAILED -- saving rejects to file src/backend/utils/hash/dynahash.c.rej patching file src/include/utils/hsearch.h Unstaged changes after reset: M src/backend/storage/ipc/shmem.c M src/backend/utils/hash/dynahash.c M src/include/utils/hsearch.h Removing src/backend/utils/hash/dynahash.c.rej === using 'git apply' to apply patch ./v10-0001-Improve-accounting-for-memory-used-by-shared-hash-ta.patch === Applied patch to 'src/backend/storage/ipc/shmem.c' cleanly. Applied patch to 'src/backend/utils/hash/dynahash.c' with conflicts. Applied patch to 'src/include/utils/hsearch.h' cleanly. U src/backend/utils/hash/dynahash.c diff --cc src/backend/utils/hash/dynahash.c index 81da03629f0,53b84db0683..00000000000 --- a/src/backend/utils/hash/dynahash.c +++ b/src/backend/utils/hash/dynahash.c @@@ -1724,50 -1808,36 +1825,83 @@@ element_alloc(HTAB *hashp, int nelem { HASHHDR *hctl = hashp->hctl; Size elementSize; ++<<<<<<< ours + Size requestSize; + char *allocedBlock; + HASHELEMENT *firstElement; + HASHELEMENT *tmpElement; + HASHELEMENT *prevElement; + int i; + + if (hctl->isfixed) + return false; + + /* Each element has a HASHELEMENT header plus user data. */ + elementSize = MAXALIGN(sizeof(HASHELEMENT)) + MAXALIGN(hctl->entrysize); + + requestSize = nelem * elementSize; + + /* Add space for slist_node list link if we need one. */ +#ifdef USE_VALGRIND + if (!hashp->isshared) + requestSize += MAXALIGN(sizeof(slist_node)); +#endif + + /* Allocate the memory. */ ++======= + HASHELEMENT *firstElement = NULL; + + if (hashp->isfixed) + return NULL; + + /* Each element has a HASHELEMENT header plus user data. */ + elementSize = HASH_ELEMENT_SIZE(hctl); ++>>>>>>> theirs CurrentDynaHashCxt = hashp->hcxt; - firstElement = (HASHELEMENT *) hashp->alloc(nelem * elementSize); + allocedBlock = hashp->alloc(requestSize); ++<<<<<<< ours + if (!allocedBlock) + return false; ++======= + if (!firstElement) + return NULL; + + return firstElement; + } + + /* + * link the elements allocated by element_alloc into the indicated free list + */ + static void + element_add(HTAB *hashp, HASHELEMENT *firstElement, int nelem, int freelist_idx) + { + HASHHDR *hctl = hashp->hctl; + Size elementSize; + HASHELEMENT *tmpElement; + HASHELEMENT *prevElement; + int i; + + /* Each element has a HASHELEMENT header plus user data. */ + elementSize = HASH_ELEMENT_SIZE(hctl); ++>>>>>>> theirs + + /* + * If USE_VALGRIND, each allocated block of elements of a non-shared + * hashtable is chained into a list, so that Valgrind won't think it's + * been leaked. + */ +#ifdef USE_VALGRIND + if (hashp->isshared) + firstElement = (HASHELEMENT *) allocedBlock; + else + { + slist_push_head(&hashp->element_blocks, (slist_node *) allocedBlock); + firstElement = (HASHELEMENT *) (allocedBlock + MAXALIGN(sizeof(slist_node))); + } +#else + firstElement = (HASHELEMENT *) allocedBlock; +#endif /* prepare to link all the new entries into the freelist */ prevElement = NULL;