Skip to content

Commit 90851d1

Browse files
committed
Use INT64_FORMAT to print int64 variables in sort debug
Commit 6ee3b5f cleaned up most of the long/int64 confusion related to incremental sort, but the sort debug messages were still using %ld for int64 variables. So fix that. Author: Haiying Tang Backpatch-through: 13, where the incremental sort code was added Discussion: https://postgr.es/m/4250be9d350c4992abb722a76e288aef%40G08CNEXMBPEKD05.g08.fujitsu.local
1 parent ebb7ae8 commit 90851d1

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

src/backend/executor/nodeIncrementalSort.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ switchToPresortedPrefixMode(PlanState *pstate)
333333
*/
334334
if (node->bounded)
335335
{
336-
SO1_printf("Setting bound on presorted prefix tuplesort to: %ld\n",
336+
SO1_printf("Setting bound on presorted prefix tuplesort to: " INT64_FORMAT "\n",
337337
node->bound - node->bound_Done);
338338
tuplesort_set_bound(node->prefixsort_state,
339339
node->bound - node->bound_Done);
@@ -417,9 +417,9 @@ switchToPresortedPrefixMode(PlanState *pstate)
417417
* remaining in the large single prefix key group we think we've
418418
* encountered.
419419
*/
420-
SO1_printf("Moving %ld tuples to presorted prefix tuplesort\n", nTuples);
420+
SO1_printf("Moving " INT64_FORMAT " tuples to presorted prefix tuplesort\n", nTuples);
421421
node->n_fullsort_remaining -= nTuples;
422-
SO1_printf("Setting n_fullsort_remaining to %ld\n", node->n_fullsort_remaining);
422+
SO1_printf("Setting n_fullsort_remaining to " INT64_FORMAT "\n", node->n_fullsort_remaining);
423423

424424
if (lastTuple)
425425
{
@@ -449,7 +449,7 @@ switchToPresortedPrefixMode(PlanState *pstate)
449449
* out all of those tuples, and then come back around to find another
450450
* batch.
451451
*/
452-
SO1_printf("Sorting presorted prefix tuplesort with %ld tuples\n", nTuples);
452+
SO1_printf("Sorting presorted prefix tuplesort with " INT64_FORMAT " tuples\n", nTuples);
453453
tuplesort_performsort(node->prefixsort_state);
454454

455455
INSTRUMENT_SORT_GROUP(node, prefixsort);
@@ -462,7 +462,7 @@ switchToPresortedPrefixMode(PlanState *pstate)
462462
* - n), so store the current number of processed tuples for use
463463
* in configuring sorting bound.
464464
*/
465-
SO2_printf("Changing bound_Done from %ld to %ld\n",
465+
SO2_printf("Changing bound_Done from " INT64_FORMAT " to " INT64_FORMAT "\n",
466466
Min(node->bound, node->bound_Done + nTuples), node->bound_Done);
467467
node->bound_Done = Min(node->bound, node->bound_Done + nTuples);
468468
}
@@ -574,7 +574,7 @@ ExecIncrementalSort(PlanState *pstate)
574574
* need to re-execute the prefix mode transition function to pull
575575
* out the next prefix key group.
576576
*/
577-
SO1_printf("Re-calling switchToPresortedPrefixMode() because n_fullsort_remaining is > 0 (%ld)\n",
577+
SO1_printf("Re-calling switchToPresortedPrefixMode() because n_fullsort_remaining is > 0 (" INT64_FORMAT ")\n",
578578
node->n_fullsort_remaining);
579579
switchToPresortedPrefixMode(pstate);
580580
}
@@ -707,7 +707,7 @@ ExecIncrementalSort(PlanState *pstate)
707707
*/
708708
node->outerNodeDone = true;
709709

710-
SO1_printf("Sorting fullsort with %ld tuples\n", nTuples);
710+
SO1_printf("Sorting fullsort with " INT64_FORMAT " tuples\n", nTuples);
711711
tuplesort_performsort(fullsort_state);
712712

713713
INSTRUMENT_SORT_GROUP(node, fullsort);
@@ -776,7 +776,7 @@ ExecIncrementalSort(PlanState *pstate)
776776
* current number of processed tuples for later use
777777
* configuring the sort state's bound.
778778
*/
779-
SO2_printf("Changing bound_Done from %ld to %ld\n",
779+
SO2_printf("Changing bound_Done from " INT64_FORMAT " to " INT64_FORMAT "\n",
780780
node->bound_Done,
781781
Min(node->bound, node->bound_Done + nTuples));
782782
node->bound_Done = Min(node->bound, node->bound_Done + nTuples);
@@ -787,7 +787,7 @@ ExecIncrementalSort(PlanState *pstate)
787787
* sort and transition modes to reading out the sorted
788788
* tuples.
789789
*/
790-
SO1_printf("Sorting fullsort tuplesort with %ld tuples\n",
790+
SO1_printf("Sorting fullsort tuplesort with " INT64_FORMAT " tuples\n",
791791
nTuples);
792792
tuplesort_performsort(fullsort_state);
793793

@@ -828,7 +828,7 @@ ExecIncrementalSort(PlanState *pstate)
828828
* on FIFO retrieval semantics when transferring them to the
829829
* presorted prefix tuplesort.
830830
*/
831-
SO1_printf("Sorting fullsort tuplesort with %ld tuples\n", nTuples);
831+
SO1_printf("Sorting fullsort tuplesort with " INT64_FORMAT " tuples\n", nTuples);
832832
tuplesort_performsort(fullsort_state);
833833

834834
INSTRUMENT_SORT_GROUP(node, fullsort);
@@ -847,12 +847,12 @@ ExecIncrementalSort(PlanState *pstate)
847847
{
848848
int64 currentBound = node->bound - node->bound_Done;
849849

850-
SO2_printf("Read %ld tuples, but setting to %ld because we used bounded sort\n",
850+
SO2_printf("Read " INT64_FORMAT " tuples, but setting to " INT64_FORMAT " because we used bounded sort\n",
851851
nTuples, Min(currentBound, nTuples));
852852
nTuples = Min(currentBound, nTuples);
853853
}
854854

855-
SO1_printf("Setting n_fullsort_remaining to %ld and calling switchToPresortedPrefixMode()\n",
855+
SO1_printf("Setting n_fullsort_remaining to " INT64_FORMAT " and calling switchToPresortedPrefixMode()\n",
856856
nTuples);
857857

858858
/*
@@ -942,7 +942,7 @@ ExecIncrementalSort(PlanState *pstate)
942942
* Perform the sort and begin returning the tuples to the parent plan
943943
* node.
944944
*/
945-
SO1_printf("Sorting presorted prefix tuplesort with >= %ld tuples\n", nTuples);
945+
SO1_printf("Sorting presorted prefix tuplesort with " INT64_FORMAT " tuples\n", nTuples);
946946
tuplesort_performsort(node->prefixsort_state);
947947

948948
INSTRUMENT_SORT_GROUP(node, prefixsort);
@@ -958,7 +958,7 @@ ExecIncrementalSort(PlanState *pstate)
958958
* - n), so store the current number of processed tuples for use
959959
* in configuring sorting bound.
960960
*/
961-
SO2_printf("Changing bound_Done from %ld to %ld\n",
961+
SO2_printf("Changing bound_Done from " INT64_FORMAT " to " INT64_FORMAT "\n",
962962
node->bound_Done,
963963
Min(node->bound, node->bound_Done + nTuples));
964964
node->bound_Done = Min(node->bound, node->bound_Done + nTuples);

0 commit comments

Comments
 (0)