Fix getting heap tuple size

Also change corresponding tests to what they were originally in fd546cf
pull/7387/head
Karina Litskevich 2023-12-22 11:06:36 +03:00
parent 968ac74cde
commit 3841a47093
4 changed files with 12 additions and 22 deletions

View File

@ -109,7 +109,7 @@ TupleStoreTupleDestPutTuple(TupleDestination *self, Task *task,
uint64 tupleSize = tupleLibpqSize; uint64 tupleSize = tupleLibpqSize;
if (tupleSize == 0) if (tupleSize == 0)
{ {
tupleSize = HeapTupleHeaderGetDatumLength(heapTuple); tupleSize = heapTuple->t_len;
} }
/* /*

View File

@ -203,6 +203,7 @@ DEPS = {
"foreign_key_to_reference_shard_rebalance": TestDeps( "foreign_key_to_reference_shard_rebalance": TestDeps(
"minimal_schedule", ["remove_coordinator_from_metadata"] "minimal_schedule", ["remove_coordinator_from_metadata"]
), ),
"limit_intermediate_size": TestDeps("base_schedule"),
} }

View File

@ -16,7 +16,8 @@ SELECT cte.user_id, cte.value_2 FROM cte,cte2 ORDER BY 1,2 LIMIT 10;
ERROR: the intermediate result size exceeds citus.max_intermediate_result_size (currently 2 kB) ERROR: the intermediate result size exceeds citus.max_intermediate_result_size (currently 2 kB)
DETAIL: Citus restricts the size of intermediate results of complex subqueries and CTEs to avoid accidentally pulling large result sets into once place. DETAIL: Citus restricts the size of intermediate results of complex subqueries and CTEs to avoid accidentally pulling large result sets into once place.
HINT: To run the current query, set citus.max_intermediate_result_size to a higher value or -1 to disable. HINT: To run the current query, set citus.max_intermediate_result_size to a higher value or -1 to disable.
SET citus.max_intermediate_result_size TO 17; SET citus.max_intermediate_result_size TO 9;
-- regular adaptive executor CTE should fail
WITH cte AS MATERIALIZED WITH cte AS MATERIALIZED
( (
SELECT SELECT
@ -38,20 +39,9 @@ FROM
ORDER BY ORDER BY
1,2 1,2
LIMIT 10; LIMIT 10;
user_id | value_2 ERROR: the intermediate result size exceeds citus.max_intermediate_result_size (currently 9 kB)
--------------------------------------------------------------------- DETAIL: Citus restricts the size of intermediate results of complex subqueries and CTEs to avoid accidentally pulling large result sets into once place.
1 | 0 HINT: To run the current query, set citus.max_intermediate_result_size to a higher value or -1 to disable.
1 | 0
1 | 0
1 | 0
1 | 0
1 | 0
1 | 0
1 | 0
1 | 0
1 | 0
(10 rows)
-- router queries should be able to get limitted too -- router queries should be able to get limitted too
SET citus.max_intermediate_result_size TO 2; SET citus.max_intermediate_result_size TO 2;
-- this should pass, since we fetch small portions in each subplan -- this should pass, since we fetch small portions in each subplan
@ -117,11 +107,9 @@ WITH cte AS MATERIALIZED (
AND EXISTS (select * from cte2, cte3) AND EXISTS (select * from cte2, cte3)
) )
SELECT count(*) FROM cte WHERE EXISTS (select * from cte); SELECT count(*) FROM cte WHERE EXISTS (select * from cte);
count ERROR: the intermediate result size exceeds citus.max_intermediate_result_size (currently 4 kB)
--------------------------------------------------------------------- DETAIL: Citus restricts the size of intermediate results of complex subqueries and CTEs to avoid accidentally pulling large result sets into once place.
105 HINT: To run the current query, set citus.max_intermediate_result_size to a higher value or -1 to disable.
(1 row)
SET citus.max_intermediate_result_size TO 3; SET citus.max_intermediate_result_size TO 3;
-- this should fail since the cte-subplan exceeds the limit even if the -- this should fail since the cte-subplan exceeds the limit even if the
-- cte2 and cte3 does not -- cte2 and cte3 does not

View File

@ -17,7 +17,8 @@ cte2 AS MATERIALIZED (
SELECT cte.user_id, cte.value_2 FROM cte,cte2 ORDER BY 1,2 LIMIT 10; SELECT cte.user_id, cte.value_2 FROM cte,cte2 ORDER BY 1,2 LIMIT 10;
SET citus.max_intermediate_result_size TO 17; SET citus.max_intermediate_result_size TO 9;
-- regular adaptive executor CTE should fail
WITH cte AS MATERIALIZED WITH cte AS MATERIALIZED
( (
SELECT SELECT