Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions expected/parallel.out
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,15 @@ set parallel_setup_cost=0;
set parallel_tuple_cost=0;
set min_parallel_table_scan_size=0;
set max_parallel_workers_per_gather=2;
-- Test a sampled parallel hash join. Parallel Hash nodes may have
-- instrumentation even when their child was executed by another worker.
set enable_nestloop=false;
set enable_mergejoin=false;
/*dddbs='postgres.db',traceparent='00-00000000000000000000000000000001-0000000000000005-01'*/ select count(*) from pg_tracing_test r join pg_tracing_test s using (a) \gset
\echo :count
10000
CALL clean_spans();
-- Test leaderless parallel query
set parallel_leader_participation=false;
/*dddbs='postgres.db',traceparent='00-00000000000000000000000000000001-0000000000000001-01'*/ select 1 from pg_class limit 1;
?column?
Expand Down
9 changes: 9 additions & 0 deletions regress/16/expected/parallel.out
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,15 @@ set parallel_setup_cost=0;
set parallel_tuple_cost=0;
set min_parallel_table_scan_size=0;
set max_parallel_workers_per_gather=2;
-- Test a sampled parallel hash join. Parallel Hash nodes may have
-- instrumentation even when their child was executed by another worker.
set enable_nestloop=false;
set enable_mergejoin=false;
/*dddbs='postgres.db',traceparent='00-00000000000000000000000000000001-0000000000000005-01'*/ select count(*) from pg_tracing_test r join pg_tracing_test s using (a) \gset
\echo :count
10000
CALL clean_spans();
-- Test leaderless parallel query
set parallel_leader_participation=false;
/*dddbs='postgres.db',traceparent='00-00000000000000000000000000000001-0000000000000001-01'*/ select 1 from pg_class limit 1;
?column?
Expand Down
9 changes: 9 additions & 0 deletions regress/17/expected/parallel.out
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,15 @@ set parallel_setup_cost=0;
set parallel_tuple_cost=0;
set min_parallel_table_scan_size=0;
set max_parallel_workers_per_gather=2;
-- Test a sampled parallel hash join. Parallel Hash nodes may have
-- instrumentation even when their child was executed by another worker.
set enable_nestloop=false;
set enable_mergejoin=false;
/*dddbs='postgres.db',traceparent='00-00000000000000000000000000000001-0000000000000005-01'*/ select count(*) from pg_tracing_test r join pg_tracing_test s using (a) \gset
\echo :count
10000
CALL clean_spans();
-- Test leaderless parallel query
set parallel_leader_participation=false;
/*dddbs='postgres.db',traceparent='00-00000000000000000000000000000001-0000000000000001-01'*/ select 1 from pg_class limit 1;
?column?
Expand Down
9 changes: 9 additions & 0 deletions regress/18/expected/parallel.out
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,15 @@ set parallel_setup_cost=0;
set parallel_tuple_cost=0;
set min_parallel_table_scan_size=0;
set max_parallel_workers_per_gather=2;
-- Test a sampled parallel hash join. Parallel Hash nodes may have
-- instrumentation even when their child was executed by another worker.
set enable_nestloop=false;
set enable_mergejoin=false;
/*dddbs='postgres.db',traceparent='00-00000000000000000000000000000001-0000000000000005-01'*/ select count(*) from pg_tracing_test r join pg_tracing_test s using (a) \gset
\echo :count
10000
CALL clean_spans();
-- Test leaderless parallel query
set parallel_leader_participation=false;
/*dddbs='postgres.db',traceparent='00-00000000000000000000000000000001-0000000000000001-01'*/ select 1 from pg_class limit 1;
?column?
Expand Down
10 changes: 10 additions & 0 deletions sql/parallel.sql
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,16 @@ set parallel_setup_cost=0;
set parallel_tuple_cost=0;
set min_parallel_table_scan_size=0;
set max_parallel_workers_per_gather=2;

-- Test a sampled parallel hash join. Parallel Hash nodes may have
-- instrumentation even when their child was executed by another worker.
set enable_nestloop=false;
set enable_mergejoin=false;
/*dddbs='postgres.db',traceparent='00-00000000000000000000000000000001-0000000000000005-01'*/ select count(*) from pg_tracing_test r join pg_tracing_test s using (a) \gset
\echo :count
CALL clean_spans();

-- Test leaderless parallel query
set parallel_leader_participation=false;
/*dddbs='postgres.db',traceparent='00-00000000000000000000000000000001-0000000000000001-01'*/ select 1 from pg_class limit 1;

Expand Down
8 changes: 5 additions & 3 deletions src/pg_tracing_planstate.c
Original file line number Diff line number Diff line change
Expand Up @@ -395,10 +395,12 @@ create_spans_from_planstate(PlanState *planstate, planstateTraceContext * planst
span_id = generate_rnd_uint64();
break;
case T_Hash:
/* For hash node, use the child's start */
/* The child may be executed by another parallel worker */
traced_planstate = get_traced_planstate(outerPlanState(planstate));
Assert(traced_planstate != NULL);
span_start = traced_planstate->node_start;
if (traced_planstate != NULL)
span_start = traced_planstate->node_start;
else
span_start = parent_start;

/*
* We still need to generate a dedicated span_id since
Expand Down