citus/src/backend/distributed/executor
Karina 20dc58cf5d
Fix getting heap tuple size (#7387)
This fixes #7230. 

First of all, using HeapTupleHeaderGetDatumLength(heapTuple) is
definetly wrong, it gives a number that's 4 times less than the correct
tuple size (heapTuple.t_len). See

https://github.com/postgres/postgres/blob/REL_16_0/src/include/access/htup_details.h#L455-L456

https://github.com/postgres/postgres/blob/REL_16_0/src/include/varatt.h#L279

https://github.com/postgres/postgres/blob/REL_16_0/src/include/varatt.h#L225-L226

When I fixed it, the limit_intermediate_size test failed, so I tried to
understand what's going on there. In original commit fd546cf these
queries were supposed to fail. Then in b3af63c three of the queries that
were supposed to fail suddenly worked and tests were changed to pass
without understanding why the output had changed or how to keep test
testing what it had to test. Even comments saying that these queries
should fail were left untouched. Commit message gives no clue about why
exactly test has changed:

> It seems that when we use adaptive executor instead of task tracker,
we
> exceed the intermediate result size less in the test. Therefore
updated
> the tests accordingly.

Then 3fda2c3 also blindly raised the limit for one of the queries to
keep it working:


3fda2c3254 (diff-a9b7b617f9dfd345318cb8987d5897143ca1b723c87b81049bbadd94dcc86570R19)

When in fe3caf3 that HeapTupleHeaderGetDatumLength(heapTuple) call was
finally added, one of those test queries became failing again.

The other two of them now also failing after the fix. I don't understand
how exactly the calculation of "intermediate result size" that is
limited by citus.max_intermediate_result_size had changed through
b3af63c and fe3caf3, but these numbers are now closer to what
they originally were when this limitation was added in
fd546cf. So these queries should fail, like in the original
version of the limit_intermediate_size test.

Co-authored-by: Karina Litskevich <litskevichkarina@gmail.com>
2024-01-08 17:09:30 +01:00
..
adaptive_executor.c Sort includes (#7326) 2023-11-23 18:19:54 +01:00
citus_custom_scan.c Sort includes (#7326) 2023-11-23 18:19:54 +01:00
directed_acyclic_graph_execution.c Sort includes (#7326) 2023-11-23 18:19:54 +01:00
distributed_execution_locks.c Sort includes (#7326) 2023-11-23 18:19:54 +01:00
distributed_intermediate_results.c Sort includes (#7326) 2023-11-23 18:19:54 +01:00
executor_util_params.c Sort includes (#7326) 2023-11-23 18:19:54 +01:00
executor_util_tasks.c Sort includes (#7326) 2023-11-23 18:19:54 +01:00
executor_util_tuples.c Sort includes (#7326) 2023-11-23 18:19:54 +01:00
insert_select_executor.c Sort includes (#7326) 2023-11-23 18:19:54 +01:00
intermediate_results.c Sort includes (#7326) 2023-11-23 18:19:54 +01:00
local_executor.c Sort includes (#7326) 2023-11-23 18:19:54 +01:00
merge_executor.c Sort includes (#7326) 2023-11-23 18:19:54 +01:00
multi_executor.c Sort includes (#7326) 2023-11-23 18:19:54 +01:00
multi_server_executor.c Sort includes (#7326) 2023-11-23 18:19:54 +01:00
partitioned_intermediate_results.c Sort includes (#7326) 2023-11-23 18:19:54 +01:00
placement_access.c Sort includes (#7326) 2023-11-23 18:19:54 +01:00
query_stats.c Sort includes (#7326) 2023-11-23 18:19:54 +01:00
repartition_executor.c Sort includes (#7326) 2023-11-23 18:19:54 +01:00
repartition_join_execution.c Sort includes (#7326) 2023-11-23 18:19:54 +01:00
subplan_execution.c Sort includes (#7326) 2023-11-23 18:19:54 +01:00
transmit.c Sort includes (#7326) 2023-11-23 18:19:54 +01:00
tuple_destination.c Fix getting heap tuple size (#7387) 2024-01-08 17:09:30 +01:00