v1-0001-Use-new-hash-APIs-for-search-path-cache.patch
text/x-patch
Filename: v1-0001-Use-new-hash-APIs-for-search-path-cache.patch
Type: text/x-patch
Part: 0
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: format-patch
Series: patch v1-0001
Subject: Use new hash APIs for search path cache
| File | + | − |
|---|---|---|
| src/backend/catalog/namespace.c | 12 | 4 |
From a30e5f0ea580fb5038eb90e862f697b557627f32 Mon Sep 17 00:00:00 2001
From: Jeff Davis <jeff@j-davis.com>
Date: Fri, 8 Dec 2023 12:14:27 -0800
Subject: [PATCH v1] Use new hash APIs for search path cache
---
src/backend/catalog/namespace.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/src/backend/catalog/namespace.c b/src/backend/catalog/namespace.c
index 5027efc91d..af815a889d 100644
--- a/src/backend/catalog/namespace.c
+++ b/src/backend/catalog/namespace.c
@@ -42,6 +42,7 @@
#include "catalog/pg_type.h"
#include "commands/dbcommands.h"
#include "common/hashfn.h"
+#include "common/hashfn_unstable.h"
#include "funcapi.h"
#include "mb/pg_wchar.h"
#include "miscadmin.h"
@@ -247,11 +248,18 @@ static bool MatchNamedCall(HeapTuple proctup, int nargs, List *argnames,
static inline uint32
spcachekey_hash(SearchPathCacheKey key)
{
- const unsigned char *bytes = (const unsigned char *) key.searchPath;
- int blen = strlen(key.searchPath);
+ const char *buf = key.searchPath;
+ fasthash64_state hs;
- return hash_combine(hash_bytes(bytes, blen),
- hash_uint32(key.roleid));
+ fasthash64_init(&hs, key.roleid);
+
+ while (*buf)
+ {
+ fasthash64_accum_byte(&hs, *buf);
+ buf++;
+ }
+
+ return fasthash64_final32(&hs);
}
static inline bool
--
2.34.1