v6-0004-Assert-that-the-incremental-fasthash-variants-giv.patch

text/x-patch

Filename: v6-0004-Assert-that-the-incremental-fasthash-variants-giv.patch
Type: text/x-patch
Part: 2
Message: Re: Change GUC hashtable to use simplehash?

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 v6-0004
Subject: Assert that the incremental fasthash variants give the same answer as the original
File+
src/common/hashfn.c 4 0
From 31c9e4161b5d0b96a939048991a838a74cb559f3 Mon Sep 17 00:00:00 2001
From: John Naylor <john.naylor@postgresql.org>
Date: Sat, 9 Dec 2023 16:22:35 +0700
Subject: [PATCH v6 04/13] Assert that the incremental fasthash variants give
 the same answer as the original

---
 src/common/hashfn.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/common/hashfn.c b/src/common/hashfn.c
index 2490607eea..37c8d307c7 100644
--- a/src/common/hashfn.c
+++ b/src/common/hashfn.c
@@ -26,6 +26,7 @@
 #include "common/hashfn.h"
 #include "port/pg_bitutils.h"
 
+#include "common/hashfn_unstable.h"
 
 /*
  * This hash function was written by Bob Jenkins
@@ -150,6 +151,9 @@ hash_bytes(const unsigned char *k, int keylen)
 				c,
 				len;
 
+	// XXX not for commit
+	Assert(fasthash64_orig((void *) k, keylen, 0) == fasthash64(k, keylen, 0));
+
 	/* Set up the internal state */
 	len = keylen;
 	a = b = c = 0x9e3779b9 + len + 3923095;
-- 
2.43.0