* Attempt to read a tuple from given worker. */
| 712 | * Attempt to read a tuple from given worker. |
| 713 | */ |
| 714 | static MinimalTuple |
| 715 | gm_readnext_tuple(GatherMergeState *gm_state, int nreader, bool nowait, |
| 716 | bool *done) |
| 717 | { |
| 718 | TupleQueueReader *reader; |
| 719 | MinimalTuple tup; |
| 720 | |
| 721 | /* Check for async events, particularly messages from workers. */ |
| 722 | CHECK_FOR_INTERRUPTS(); |
| 723 | |
| 724 | /* |
| 725 | * Attempt to read a tuple. |
| 726 | * |
| 727 | * Note that TupleQueueReaderNext will just return NULL for a worker which |
| 728 | * fails to initialize. We'll treat that worker as having produced no |
| 729 | * tuples; WaitForParallelWorkersToFinish will error out when we get |
| 730 | * there. |
| 731 | */ |
| 732 | reader = gm_state->reader[nreader - 1]; |
| 733 | tup = TupleQueueReaderNext(reader, nowait, done); |
| 734 | |
| 735 | /* |
| 736 | * Since we'll be buffering these across multiple calls, we need to make a |
| 737 | * copy. |
| 738 | */ |
| 739 | return tup ? heap_copy_minimal_tuple(tup) : NULL; |
| 740 | } |
| 741 | |
| 742 | /* |
| 743 | * We have one slot for each item in the heap array. We use SlotNumber |
no test coverage detected