v71-0003-DEV-Fix-failure-to-sort-debug-array-for-iteratio.patch
application/x-patch
Filename: v71-0003-DEV-Fix-failure-to-sort-debug-array-for-iteratio.patch
Type: application/x-patch
Part: 1
Patch
Format: format-patch
Series: patch v71-0003
Subject: DEV: Fix failure to sort debug array for iteration
| File | + | − |
|---|---|---|
| src/backend/access/common/tidstore.c | 7 | 0 |
From 4ed9f578c2f8d20f4477c80703a085b3dd3bef01 Mon Sep 17 00:00:00 2001
From: John Naylor <john.naylor@postgresql.org>
Date: Wed, 13 Mar 2024 14:56:56 +0700
Subject: [PATCH v71 3/6] DEV: Fix failure to sort debug array for iteration
---
src/backend/access/common/tidstore.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/backend/access/common/tidstore.c b/src/backend/access/common/tidstore.c
index 33753d8ed2..4f5882818b 100644
--- a/src/backend/access/common/tidstore.c
+++ b/src/backend/access/common/tidstore.c
@@ -433,6 +433,13 @@ TidStoreBeginIterate(TidStore *ts)
#ifdef TIDSTORE_DEBUG
if (!TidStoreIsShared(ts))
iter->tids_idx = 0;
+
+ /* Make sure the TID array is sorted */
+ if (ts->tids_unordered)
+ {
+ qsort(ts->tids, ts->num_tids, sizeof(ItemPointerData), itemptr_cmp);
+ ts->tids_unordered = false;
+ }
#endif
return iter;
--
2.44.0