citus/src/backend/distributed/executor
Nils Dijk 3fcb456381
Refactor/partitioned result destreceiver (#5432)
This change creates a slightly higher abstraction of the `PartitionedResultDestReceiver` where it decouples the partitioning from writing it to a file. This allows for easier reuse for other `DestReceiver`'s that would like to route different tuples to different `DestReceiver`'s.

Originally there was a lot of state kept in `PartitionedResultDestReceiver` to be able to lazily create `FileDestReceivers` when the first tuple arrived for that target. This convoluted the implementation of the processing of tuples with where they should go.

This refactor changes that where it makes the `PartitionedResultDestReceiver` completely agnostic of what kind of Receivers it is writing to. When constructed you pass it a list of `DestReceiver` compatible pointers with the length of `partitionCount`. Internally the `PartitionedResultDestReceiver` keeps track of which `DestReceiver`'s have been started or not, and start them when they first receive a tuple.

Alternatively, if the instantiating code of the `PartitionedResultDestReceiver` wants, the startup can be turned from lazily to eagerly. When the startup is eager (not lazy) all `rStartup` functions on the list of `DestReceiver`'s are called during the startup of the `PartitionedResultDestReceiver` and marked as such.

A downside of this approach is the following. On highly partitioned destinations we now need to allocate a `FileDestReceiver` for every target, _always_. When the data passed into the `PartitionedResultDestReceiver` is highly skewed to a small set of `FileDestReceiver`'s this will waste some memory. Given the small size of a `FileDestReceiver`, and the fact that actual file handles are only created during the processing of the startup of the `FileDestReceiver` I think this memory waste is not a problem. If this would become a problem we could refactor the source list into some kind of generator object which can generate the `DestReceiver`'s on the fly.
2021-11-05 13:31:18 +01:00
..
adaptive_executor.c Fix typos. Spurred spotting "connectios" in logs 2021-10-25 13:54:09 +00:00
citus_custom_scan.c Deparse/parse the local cached queries 2021-06-21 12:24:29 +03:00
directed_acyclic_graph_execution.c Remove task tracker executor (#3850) 2020-07-18 13:11:36 +03:00
distributed_execution_locks.c Introduce cache entry/table utilities (#4132) 2020-09-02 22:26:05 +03:00
distributed_intermediate_results.c Fixes function names in comments 2021-10-06 09:24:43 +03:00
insert_select_executor.c Drop support for Inactive Shard placements 2021-10-22 18:03:35 +02:00
intermediate_results.c Move CheckCitusVersion to the top of each function 2021-06-01 17:43:46 +02:00
local_executor.c Fix typos. Spurred spotting "connectios" in logs 2021-10-25 13:54:09 +00:00
multi_client_executor.c Remove unused functions that cppcheck found 2020-10-19 13:50:52 +03:00
multi_executor.c Fix typos. Spurred spotting "connectios" in logs 2021-10-25 13:54:09 +00:00
multi_server_executor.c Local execution considers intermediate result size limit 2020-10-15 17:18:55 +02:00
partitioned_intermediate_results.c Refactor/partitioned result destreceiver (#5432) 2021-11-05 13:31:18 +01:00
placement_access.c Not include to-be-deleted shards while finding shard placements 2021-06-28 13:05:31 +03:00
query_stats.c Remove task tracker executor (#3850) 2020-07-18 13:11:36 +03:00
repartition_join_execution.c Introduce GetCurrentLocalExecutionStatus wrapper 2020-10-15 15:38:19 +03:00
subplan_execution.c Fix explain subplan duration 2020-07-03 20:39:55 +03:00
tuple_destination.c Fixes function names in comments 2021-10-06 09:24:43 +03:00