Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 236f1ea

Browse files
committed
Fix and clarify function comment on LogicalTapeSetCreate.
Commit c4649cc removed the "shared" and "ntapes" arguments, but the comment still talked about "shared". It also talked about "a shared file handle", which was technically correct because even before commit c4649cc, the "shared file handle" referred to the "fileset" argument, not "shared". But it was very confusing. Improve the comment. Also add a comment on what the "preallocate" argument does. Backpatch to v15, just to make backpatching other patches easier in the future. Discussion: https://www.postgresql.org/message-id/af989685-91d5-aad4-8f60-1d066b5ec309@enterprisedb.com Reviewed-by: Peter Eisentraut
1 parent 67c5b88 commit 236f1ea

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/backend/utils/sort/logtape.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -537,14 +537,20 @@ ltsInitReadBuffer(LogicalTape *lt)
537537
* The tape set is initially empty. Use LogicalTapeCreate() to create
538538
* tapes in it.
539539
*
540-
* Serial callers pass NULL argument for shared, and -1 for worker. Parallel
541-
* worker callers pass a shared file handle and their own worker number.
540+
* In a single-process sort, pass NULL argument for fileset, and -1 for
541+
* worker.
542542
*
543-
* Leader callers pass a shared file handle and -1 for worker. After creating
544-
* the tape set, use LogicalTapeImport() to import the worker tapes into it.
543+
* In a parallel sort, parallel workers pass the shared fileset handle and
544+
* their own worker number. After the workers have finished, create the
545+
* tape set in the leader, passing the shared fileset handle and -1 for
546+
* worker, and use LogicalTapeImport() to import the worker tapes into it.
545547
*
546548
* Currently, the leader will only import worker tapes into the set, it does
547549
* not create tapes of its own, although in principle that should work.
550+
*
551+
* If preallocate is true, blocks for each individual tape are allocated in
552+
* batches. This avoids fragmentation when writing multiple tapes at the
553+
* same time.
548554
*/
549555
LogicalTapeSet *
550556
LogicalTapeSetCreate(bool preallocate, SharedFileSet *fileset, int worker)

0 commit comments

Comments
 (0)