v1-0001-Add-function-to-return-DSA-area-for-a-dshash-tabl.patch
application/octet-stream
Filename: v1-0001-Add-function-to-return-DSA-area-for-a-dshash-tabl.patch
Type: application/octet-stream
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: Add function to return DSA area for a dshash table
| File | + | − |
|---|---|---|
| src/backend/lib/dshash.c | 11 | 0 |
| src/include/lib/dshash.h | 1 | 0 |
From b2f69377435fe170b1321e55d0c3141ebe8a2efc Mon Sep 17 00:00:00 2001
From: Sami Imseih <samimseih@gmail.com>
Date: Mon, 6 Apr 2026 21:50:24 +0000
Subject: [PATCH v1 1/1] Add function to return DSA area for a dshash table
A caller using GetNamedDSHash() to retrieve a dshash table may also
want to limit its size. Add dshash_get_dsa_area(), which returns the
dsa_area for a given dshash_table, allowing callers to pass it to
dsa_set_size_limit().
---
src/backend/lib/dshash.c | 11 +++++++++++
src/include/lib/dshash.h | 1 +
2 files changed, 12 insertions(+)
diff --git a/src/backend/lib/dshash.c b/src/backend/lib/dshash.c
index 1999989c14f..62ac68d4add 100644
--- a/src/backend/lib/dshash.c
+++ b/src/backend/lib/dshash.c
@@ -363,6 +363,17 @@ dshash_destroy(dshash_table *hash_table)
pfree(hash_table);
}
+/*
+ * Get the DSA area used by this hash table.
+ */
+dsa_area *
+dshash_get_dsa_area(dshash_table *hash_table)
+{
+ Assert(hash_table->control->magic == DSHASH_MAGIC);
+
+ return hash_table->area;
+}
+
/*
* Get a handle that can be used by other processes to attach to this hash
* table.
diff --git a/src/include/lib/dshash.h b/src/include/lib/dshash.h
index 64b758b381b..b868084df04 100644
--- a/src/include/lib/dshash.h
+++ b/src/include/lib/dshash.h
@@ -89,6 +89,7 @@ extern dshash_table *dshash_attach(dsa_area *area,
dshash_table_handle handle,
void *arg);
extern void dshash_detach(dshash_table *hash_table);
+extern dsa_area *dshash_get_dsa_area(dshash_table *hash_table);
extern dshash_table_handle dshash_get_hash_table_handle(dshash_table *hash_table);
extern void dshash_destroy(dshash_table *hash_table);
--
2.50.1