]> granicus.if.org Git - postgresql/commitdiff
Adjust trace_sort log messages.
authorPeter Geoghegan <pg@bowt.ie>
Thu, 1 Nov 2018 16:18:55 +0000 (09:18 -0700)
committerPeter Geoghegan <pg@bowt.ie>
Thu, 1 Nov 2018 16:18:55 +0000 (09:18 -0700)
The project message style guide dictates: "When citing the name of an
object, state what kind of object it is".  The parallel CREATE INDEX
patch added a worker number to most of the trace_sort messages within
tuplesort.c without specifying the object type.  Bring these messages
into compliance with the style guide.

We're still treating a leader or serial Tuplesortstate as having worker
number -1.  trace_sort is a developer option, and these two cases are
highly comparable, so this seems appropriate.

Per complaint from Tom Lane.

Discussion: https://postgr.es/m/8330.1540831863@sss.pgh.pa.us
Backpatch: 11-, where parallel CREATE INDEX was introduced.

src/backend/utils/sort/tuplesort.c

index 9fb33b9035e198782cc8e02efdc36485e4001641..549baf4b4f683df2dcb6845f95a67098715bb6f4 100644 (file)
@@ -1259,11 +1259,11 @@ tuplesort_end(Tuplesortstate *state)
        if (trace_sort)
        {
                if (state->tapeset)
-                       elog(LOG, "%s of %d ended, %ld disk blocks used: %s",
+                       elog(LOG, "%s of worker %d ended, %ld disk blocks used: %s",
                                 SERIAL(state) ? "external sort" : "parallel external sort",
                                 state->worker, spaceUsed, pg_rusage_show(&state->ru_start));
                else
-                       elog(LOG, "%s of %d ended, %ld KB used: %s",
+                       elog(LOG, "%s of worker %d ended, %ld KB used: %s",
                                 SERIAL(state) ? "internal sort" : "unperformed parallel sort",
                                 state->worker, spaceUsed, pg_rusage_show(&state->ru_start));
        }
@@ -1793,7 +1793,7 @@ tuplesort_performsort(Tuplesortstate *state)
 
 #ifdef TRACE_SORT
        if (trace_sort)
-               elog(LOG, "performsort of %d starting: %s",
+               elog(LOG, "performsort of worker %d starting: %s",
                         state->worker, pg_rusage_show(&state->ru_start));
 #endif
 
@@ -1878,11 +1878,11 @@ tuplesort_performsort(Tuplesortstate *state)
        if (trace_sort)
        {
                if (state->status == TSS_FINALMERGE)
-                       elog(LOG, "performsort of %d done (except %d-way final merge): %s",
+                       elog(LOG, "performsort of worker %d done (except %d-way final merge): %s",
                                 state->worker, state->activeTapes,
                                 pg_rusage_show(&state->ru_start));
                else
-                       elog(LOG, "performsort of %d done: %s",
+                       elog(LOG, "performsort of worker %d done: %s",
                                 state->worker, pg_rusage_show(&state->ru_start));
        }
 #endif
@@ -2410,7 +2410,7 @@ inittapes(Tuplesortstate *state, bool mergeruns)
 
 #ifdef TRACE_SORT
        if (trace_sort)
-               elog(LOG, "%d switching to external sort with %d tapes: %s",
+               elog(LOG, "worker %d switching to external sort with %d tapes: %s",
                         state->worker, maxTapes, pg_rusage_show(&state->ru_start));
 #endif
 
@@ -2660,7 +2660,7 @@ mergeruns(Tuplesortstate *state)
         */
 #ifdef TRACE_SORT
        if (trace_sort)
-               elog(LOG, "%d using " INT64_FORMAT " KB of memory for read buffers among %d input tapes",
+               elog(LOG, "worker %d using " INT64_FORMAT " KB of memory for read buffers among %d input tapes",
                         state->worker, state->availMem / 1024, numInputTapes);
 #endif
 
@@ -2836,7 +2836,7 @@ mergeonerun(Tuplesortstate *state)
 
 #ifdef TRACE_SORT
        if (trace_sort)
-               elog(LOG, "%d finished %d-way merge step: %s", state->worker,
+               elog(LOG, "worker %d finished %d-way merge step: %s", state->worker,
                         state->activeTapes, pg_rusage_show(&state->ru_start));
 #endif
 }
@@ -2971,7 +2971,7 @@ dumptuples(Tuplesortstate *state, bool alltuples)
 
 #ifdef TRACE_SORT
        if (trace_sort)
-               elog(LOG, "%d starting quicksort of run %d: %s",
+               elog(LOG, "worker %d starting quicksort of run %d: %s",
                         state->worker, state->currentRun,
                         pg_rusage_show(&state->ru_start));
 #endif
@@ -2984,7 +2984,7 @@ dumptuples(Tuplesortstate *state, bool alltuples)
 
 #ifdef TRACE_SORT
        if (trace_sort)
-               elog(LOG, "%d finished quicksort of run %d: %s",
+               elog(LOG, "worker %d finished quicksort of run %d: %s",
                         state->worker, state->currentRun,
                         pg_rusage_show(&state->ru_start));
 #endif
@@ -3012,7 +3012,7 @@ dumptuples(Tuplesortstate *state, bool alltuples)
 
 #ifdef TRACE_SORT
        if (trace_sort)
-               elog(LOG, "%d finished writing run %d to tape %d: %s",
+               elog(LOG, "worker %d finished writing run %d to tape %d: %s",
                         state->worker, state->currentRun, state->destTape,
                         pg_rusage_show(&state->ru_start));
 #endif