Re: tuple radix sort

From: cca5507 <cca5507(at)qq(dot)com>
To: John Naylor <johncnaylorls(at)gmail(dot)com>
Cc: zengman <zengman(at)halodbtech(dot)com>, pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: tuple radix sort
Date: 2026-04-01 09:27:13
Message-ID: tencent_49E3F11E74D8A584A2144ED532A490CBC40A@qq.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi John,

How about adding an assertion here:

```
diff --git a/src/backend/utils/sort/tuplesort.c b/src/backend/utils/sort/tuplesort.c
index 72c2c2995d8..bcc534136d7 100644
--- a/src/backend/utils/sort/tuplesort.c
+++ b/src/backend/utils/sort/tuplesort.c
@@ -2783,6 +2783,8 @@ radix_sort_recursive(SortTuple *begin, size_t n_elems, int level, Tuplesortstate
else
next_level = level + 1;

+ Assert(next_level > level);
+
for (uint8 *rp = remaining_partitions;
rp < remaining_partitions + num_partitions;
rp++)
```

It can help us catch some unexpected behaviors.

--
Regards,
ChangAo Chen

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Zsolt Parragi 2026-04-01 09:35:18 Re: [oauth] Split and extend PGOAUTHDEBUG
Previous Message Adam Lee 2026-04-01 08:53:09 [PATCH] Fix minRecoveryPoint not advanced past checkpoint in CreateRestartPoint