From 311437bf9826b5077fb44d500981b5c793a34a79 Mon Sep 17 00:00:00 2001
From: ChangAo Chen <cca5507@qq.com>
Date: Sat, 6 Dec 2025 22:53:43 +0800
Subject: [PATCH v2] Fix incorrect comments in tuplesort.c.

---
 src/backend/utils/sort/tuplesort.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/src/backend/utils/sort/tuplesort.c b/src/backend/utils/sort/tuplesort.c
index 5d4411dc33f..3c49a9ad207 100644
--- a/src/backend/utils/sort/tuplesort.c
+++ b/src/backend/utils/sort/tuplesort.c
@@ -111,11 +111,11 @@
 #include "utils/tuplesort.h"
 
 /*
- * Initial size of memtuples array.  We're trying to select this size so that
- * array doesn't exceed ALLOCSET_SEPARATE_THRESHOLD and so that the overhead of
- * allocation might possibly be lowered.  However, we don't consider array sizes
- * less than 1024.
+ * Initial size of memtuples array.
  *
+ * It must be more than ALLOCSET_SEPARATE_THRESHOLD; see comments
+ * in grow_memtuples().  However, we don't consider array sizes
+ * less than 1024.
  */
 #define INITIAL_MEMTUPSIZE Max(1024, \
 	ALLOCSET_SEPARATE_THRESHOLD / sizeof(SortTuple) + 1)
@@ -692,10 +692,6 @@ tuplesort_begin_common(int workMem, SortCoordinate coordinate, int sortopt)
 	state->base.sortcontext = sortcontext;
 	state->base.maincontext = maincontext;
 
-	/*
-	 * Initial size of array must be more than ALLOCSET_SEPARATE_THRESHOLD;
-	 * see comments in grow_memtuples().
-	 */
 	state->memtupsize = INITIAL_MEMTUPSIZE;
 	state->memtuples = NULL;
 
@@ -784,10 +780,6 @@ tuplesort_begin_batch(Tuplesortstate *state)
 
 	state->memtupcount = 0;
 
-	/*
-	 * Initial size of array must be more than ALLOCSET_SEPARATE_THRESHOLD;
-	 * see comments in grow_memtuples().
-	 */
 	state->growmemtuples = true;
 	state->slabAllocatorUsed = false;
 	if (state->memtuples != NULL && state->memtupsize != INITIAL_MEMTUPSIZE)
-- 
2.52.0

