-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pg_tracing.max_parameter_size GUC parameter was present but never used. Use it to apply possibly truncate string stored in the parameter buffer shared across a traced transaction.
- Loading branch information
Showing
16 changed files
with
396 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,167 @@ | ||
-- Check that parameters are not exported when disabled | ||
SET pg_tracing.max_parameter_size=0; | ||
/*traceparent='00-00000000000000000000000000000001-0000000000000001-01'*/ select 1, 2, 3; | ||
?column? | ?column? | ?column? | ||
----------+----------+---------- | ||
1 | 2 | 3 | ||
(1 row) | ||
|
||
SELECT span_operation, parameters, lvl from peek_ordered_spans where trace_id='00000000000000000000000000000001'; | ||
span_operation | parameters | lvl | ||
--------------------+------------+----- | ||
select $1, $2, $3; | | 1 | ||
Planner | | 2 | ||
ExecutorRun | | 2 | ||
Result | | 3 | ||
(4 rows) | ||
|
||
-- Saturate the parameter buffer | ||
SET pg_tracing.max_parameter_size=1; | ||
/*traceparent='00-00000000000000000000000000000002-0000000000000002-01'*/ select 1, 2, 3; | ||
?column? | ?column? | ?column? | ||
----------+----------+---------- | ||
1 | 2 | 3 | ||
(1 row) | ||
|
||
SELECT span_operation, parameters, lvl from peek_ordered_spans where trace_id='00000000000000000000000000000002'; | ||
span_operation | parameters | lvl | ||
--------------------+-------------+----- | ||
select $1, $2, $3; | {1,...,...} | 1 | ||
Planner | | 2 | ||
ExecutorRun | | 2 | ||
Result | | 3 | ||
(4 rows) | ||
|
||
SET pg_tracing.max_parameter_size=2; | ||
/*traceparent='00-00000000000000000000000000000003-0000000000000003-01'*/ select 1, 2, 3; | ||
?column? | ?column? | ?column? | ||
----------+----------+---------- | ||
1 | 2 | 3 | ||
(1 row) | ||
|
||
SELECT span_operation, parameters, lvl from peek_ordered_spans where trace_id='00000000000000000000000000000003'; | ||
span_operation | parameters | lvl | ||
--------------------+-------------+----- | ||
select $1, $2, $3; | {1,...,...} | 1 | ||
Planner | | 2 | ||
ExecutorRun | | 2 | ||
Result | | 3 | ||
(4 rows) | ||
|
||
SET pg_tracing.max_parameter_size=3; | ||
/*traceparent='00-00000000000000000000000000000004-0000000000000004-01'*/ select 1, 2, 3; | ||
?column? | ?column? | ?column? | ||
----------+----------+---------- | ||
1 | 2 | 3 | ||
(1 row) | ||
|
||
SELECT span_operation, parameters, lvl from peek_ordered_spans where trace_id='00000000000000000000000000000004'; | ||
span_operation | parameters | lvl | ||
--------------------+------------+----- | ||
select $1, $2, $3; | {1,2,...} | 1 | ||
Planner | | 2 | ||
ExecutorRun | | 2 | ||
Result | | 3 | ||
(4 rows) | ||
|
||
SET pg_tracing.max_parameter_size=4; | ||
/*traceparent='00-00000000000000000000000000000005-0000000000000005-01'*/ select 1, 2, 3; | ||
?column? | ?column? | ?column? | ||
----------+----------+---------- | ||
1 | 2 | 3 | ||
(1 row) | ||
|
||
SELECT span_operation, parameters, lvl from peek_ordered_spans where trace_id='00000000000000000000000000000005'; | ||
span_operation | parameters | lvl | ||
--------------------+------------+----- | ||
select $1, $2, $3; | {1,2,...} | 1 | ||
Planner | | 2 | ||
ExecutorRun | | 2 | ||
Result | | 3 | ||
(4 rows) | ||
|
||
SET pg_tracing.max_parameter_size=5; | ||
/*traceparent='00-00000000000000000000000000000006-0000000000000006-01'*/ select 1, 2, 3; | ||
?column? | ?column? | ?column? | ||
----------+----------+---------- | ||
1 | 2 | 3 | ||
(1 row) | ||
|
||
SELECT span_operation, parameters, lvl from peek_ordered_spans where trace_id='00000000000000000000000000000006'; | ||
span_operation | parameters | lvl | ||
--------------------+------------+----- | ||
select $1, $2, $3; | {1,2,3} | 1 | ||
Planner | | 2 | ||
ExecutorRun | | 2 | ||
Result | | 3 | ||
(4 rows) | ||
|
||
CALL clean_spans(); | ||
-- Test truncated string | ||
SET pg_tracing.max_parameter_size=2; | ||
/*traceparent='00-00000000000000000000000000000001-0000000000000001-01'*/ select 'testtruncatedstring'; | ||
?column? | ||
--------------------- | ||
testtruncatedstring | ||
(1 row) | ||
|
||
SELECT span_operation, parameters, lvl from peek_ordered_spans where trace_id='00000000000000000000000000000001'; | ||
span_operation | parameters | lvl | ||
----------------+------------+----- | ||
select $1; | {'t...} | 1 | ||
Planner | | 2 | ||
ExecutorRun | | 2 | ||
Result | | 3 | ||
(4 rows) | ||
|
||
SET pg_tracing.max_parameter_size=19; | ||
/*traceparent='00-00000000000000000000000000000002-0000000000000002-01'*/ select 'testtruncatedstring'; | ||
?column? | ||
--------------------- | ||
testtruncatedstring | ||
(1 row) | ||
|
||
SELECT span_operation, parameters, lvl from peek_ordered_spans where trace_id='00000000000000000000000000000002'; | ||
span_operation | parameters | lvl | ||
----------------+--------------------------+----- | ||
select $1; | {'testtruncatedstrin...} | 1 | ||
Planner | | 2 | ||
ExecutorRun | | 2 | ||
Result | | 3 | ||
(4 rows) | ||
|
||
SET pg_tracing.max_parameter_size=20; | ||
/*traceparent='00-00000000000000000000000000000003-0000000000000003-01'*/ select 'testtruncatedstring'; | ||
?column? | ||
--------------------- | ||
testtruncatedstring | ||
(1 row) | ||
|
||
SELECT span_operation, parameters, lvl from peek_ordered_spans where trace_id='00000000000000000000000000000003'; | ||
span_operation | parameters | lvl | ||
----------------+---------------------------+----- | ||
select $1; | {'testtruncatedstring...} | 1 | ||
Planner | | 2 | ||
ExecutorRun | | 2 | ||
Result | | 3 | ||
(4 rows) | ||
|
||
SET pg_tracing.max_parameter_size=21; | ||
/*traceparent='00-00000000000000000000000000000004-0000000000000004-01'*/ select 'testtruncatedstring'; | ||
?column? | ||
--------------------- | ||
testtruncatedstring | ||
(1 row) | ||
|
||
SELECT span_operation, parameters, lvl from peek_ordered_spans where trace_id='00000000000000000000000000000004'; | ||
span_operation | parameters | lvl | ||
----------------+-------------------------+----- | ||
select $1; | {'testtruncatedstring'} | 1 | ||
Planner | | 2 | ||
ExecutorRun | | 2 | ||
Result | | 3 | ||
(4 rows) | ||
|
||
-- Cleanup | ||
CALL clean_spans(); | ||
CALL reset_settings(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
-- Saturate the parameter buffer with extended protocol | ||
SET pg_tracing.max_parameter_size=1; | ||
/*traceparent='00-00000000000000000000000000000001-0000000000000001-01'*/ select $1, $2, $3 \bind 1 2 3 \g | ||
?column? | ?column? | ?column? | ||
----------+----------+---------- | ||
1 | 2 | 3 | ||
(1 row) | ||
|
||
SELECT span_operation, parameters, lvl from peek_ordered_spans where trace_id='00000000000000000000000000000001'; | ||
span_operation | parameters | lvl | ||
-------------------+-------------+----- | ||
select $1, $2, $3 | {1,...,...} | 1 | ||
Planner | | 2 | ||
ExecutorRun | | 2 | ||
Result | | 3 | ||
(4 rows) | ||
|
||
SET pg_tracing.max_parameter_size=2; | ||
/*traceparent='00-00000000000000000000000000000002-0000000000000002-01'*/ select $1, $2, $3 \bind 1 2 3 \g | ||
?column? | ?column? | ?column? | ||
----------+----------+---------- | ||
1 | 2 | 3 | ||
(1 row) | ||
|
||
SELECT span_operation, parameters, lvl from peek_ordered_spans where trace_id='00000000000000000000000000000002'; | ||
span_operation | parameters | lvl | ||
-------------------+-------------+----- | ||
select $1, $2, $3 | {1,...,...} | 1 | ||
Planner | | 2 | ||
ExecutorRun | | 2 | ||
Result | | 3 | ||
(4 rows) | ||
|
||
SET pg_tracing.max_parameter_size=3; | ||
/*traceparent='00-00000000000000000000000000000003-0000000000000003-01'*/ select $1, $2, $3 \bind 1 2 3 \g | ||
?column? | ?column? | ?column? | ||
----------+----------+---------- | ||
1 | 2 | 3 | ||
(1 row) | ||
|
||
SELECT span_operation, parameters, lvl from peek_ordered_spans where trace_id='00000000000000000000000000000003'; | ||
span_operation | parameters | lvl | ||
-------------------+------------+----- | ||
select $1, $2, $3 | {1,2,...} | 1 | ||
Planner | | 2 | ||
ExecutorRun | | 2 | ||
Result | | 3 | ||
(4 rows) | ||
|
||
-- Cleanup | ||
CALL clean_spans(); | ||
CALL reset_settings(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
-- Check that parameters are not exported when disabled | ||
SET pg_tracing.max_parameter_size=0; | ||
/*traceparent='00-00000000000000000000000000000001-0000000000000001-01'*/ select 1, 2, 3; | ||
SELECT span_operation, parameters, lvl from peek_ordered_spans where trace_id='00000000000000000000000000000001'; | ||
|
||
-- Saturate the parameter buffer | ||
SET pg_tracing.max_parameter_size=1; | ||
/*traceparent='00-00000000000000000000000000000002-0000000000000002-01'*/ select 1, 2, 3; | ||
SELECT span_operation, parameters, lvl from peek_ordered_spans where trace_id='00000000000000000000000000000002'; | ||
|
||
SET pg_tracing.max_parameter_size=2; | ||
/*traceparent='00-00000000000000000000000000000003-0000000000000003-01'*/ select 1, 2, 3; | ||
SELECT span_operation, parameters, lvl from peek_ordered_spans where trace_id='00000000000000000000000000000003'; | ||
|
||
SET pg_tracing.max_parameter_size=3; | ||
/*traceparent='00-00000000000000000000000000000004-0000000000000004-01'*/ select 1, 2, 3; | ||
SELECT span_operation, parameters, lvl from peek_ordered_spans where trace_id='00000000000000000000000000000004'; | ||
|
||
SET pg_tracing.max_parameter_size=4; | ||
/*traceparent='00-00000000000000000000000000000005-0000000000000005-01'*/ select 1, 2, 3; | ||
SELECT span_operation, parameters, lvl from peek_ordered_spans where trace_id='00000000000000000000000000000005'; | ||
|
||
SET pg_tracing.max_parameter_size=5; | ||
/*traceparent='00-00000000000000000000000000000006-0000000000000006-01'*/ select 1, 2, 3; | ||
SELECT span_operation, parameters, lvl from peek_ordered_spans where trace_id='00000000000000000000000000000006'; | ||
CALL clean_spans(); | ||
|
||
-- Test truncated string | ||
SET pg_tracing.max_parameter_size=2; | ||
/*traceparent='00-00000000000000000000000000000001-0000000000000001-01'*/ select 'testtruncatedstring'; | ||
SELECT span_operation, parameters, lvl from peek_ordered_spans where trace_id='00000000000000000000000000000001'; | ||
|
||
SET pg_tracing.max_parameter_size=19; | ||
/*traceparent='00-00000000000000000000000000000002-0000000000000002-01'*/ select 'testtruncatedstring'; | ||
SELECT span_operation, parameters, lvl from peek_ordered_spans where trace_id='00000000000000000000000000000002'; | ||
|
||
SET pg_tracing.max_parameter_size=20; | ||
/*traceparent='00-00000000000000000000000000000003-0000000000000003-01'*/ select 'testtruncatedstring'; | ||
SELECT span_operation, parameters, lvl from peek_ordered_spans where trace_id='00000000000000000000000000000003'; | ||
|
||
SET pg_tracing.max_parameter_size=21; | ||
/*traceparent='00-00000000000000000000000000000004-0000000000000004-01'*/ select 'testtruncatedstring'; | ||
SELECT span_operation, parameters, lvl from peek_ordered_spans where trace_id='00000000000000000000000000000004'; | ||
|
||
-- Cleanup | ||
CALL clean_spans(); | ||
CALL reset_settings(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
-- Saturate the parameter buffer with extended protocol | ||
SET pg_tracing.max_parameter_size=1; | ||
/*traceparent='00-00000000000000000000000000000001-0000000000000001-01'*/ select $1, $2, $3 \bind 1 2 3 \g | ||
SELECT span_operation, parameters, lvl from peek_ordered_spans where trace_id='00000000000000000000000000000001'; | ||
|
||
SET pg_tracing.max_parameter_size=2; | ||
/*traceparent='00-00000000000000000000000000000002-0000000000000002-01'*/ select $1, $2, $3 \bind 1 2 3 \g | ||
SELECT span_operation, parameters, lvl from peek_ordered_spans where trace_id='00000000000000000000000000000002'; | ||
|
||
SET pg_tracing.max_parameter_size=3; | ||
/*traceparent='00-00000000000000000000000000000003-0000000000000003-01'*/ select $1, $2, $3 \bind 1 2 3 \g | ||
SELECT span_operation, parameters, lvl from peek_ordered_spans where trace_id='00000000000000000000000000000003'; | ||
|
||
-- Cleanup | ||
CALL clean_spans(); | ||
CALL reset_settings(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.