agora inbox for [email protected]help / color / mirror / Atom feed
[PATCH 5/6] Add copy progress reporting regression tests. 23+ messages / 2 participants [nested] [flat]
* [PATCH 5/6] Add copy progress reporting regression tests. @ 2021-02-09 12:06 Josef Šimánek <[email protected]> 0 siblings, 0 replies; 23+ messages in thread From: Josef Šimánek @ 2021-02-09 12:06 UTC (permalink / raw) This tests some basic features of copy progress reporting. Sadly, we can only request one snapshot of progress_reporting each transaction / statement, so we can't (easily) get intermediate results without each result requiring a seperate statement being run. Author: Josef Šimánek, Matthias van de Meent --- src/test/regress/input/copy.source | 57 +++++++++++++++++++++++++++++ src/test/regress/output/copy.source | 44 ++++++++++++++++++++++ 2 files changed, 101 insertions(+) diff --git a/src/test/regress/input/copy.source b/src/test/regress/input/copy.source index a1d529ad36..ddde33e7cc 100644 --- a/src/test/regress/input/copy.source +++ b/src/test/regress/input/copy.source @@ -201,3 +201,60 @@ select * from parted_copytest where b = 1; select * from parted_copytest where b = 2; drop table parted_copytest; + +-- +-- progress reporting +-- + +-- setup +-- reuse employer datatype, that has a small sized data set + +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); + +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); + +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting + +copy progress_reporting from stdin; +sharon 25 (15,12) 1000 sam +sam 30 (10,5) 2000 bill +bill 20 (11,10) 1000 sharon +\. + +-- reporting of FILE imports, and correct reporting of tuples-excluded + +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); + +-- cleanup progress_reporting + +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; diff --git a/src/test/regress/output/copy.source b/src/test/regress/output/copy.source index 938d3551da..60f4206aa1 100644 --- a/src/test/regress/output/copy.source +++ b/src/test/regress/output/copy.source @@ -165,3 +165,47 @@ select * from parted_copytest where b = 2; (1 row) drop table parted_copytest; +-- +-- progress reporting +-- +-- setup +-- reuse employer datatype, that has a small sized data set +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting +copy progress_reporting from stdin; +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "STDIO", "bytes_total": 0, "bytes_processed": 79, "tuples_excluded": 0, "tuples_processed": 3} +-- reporting of FILE imports, and correct reporting of tuples-excluded +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "FILE", "bytes_total": 79, "bytes_processed": 79, "tuples_excluded": 1, "tuples_processed": 2} +-- cleanup progress_reporting +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; -- 2.26.2 --------------DA8D60BF026F7ACE69A9AEE5 Content-Type: text/x-patch; charset=UTF-8; name="v7-0006-0003-review.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="v7-0006-0003-review.patch" ^ permalink raw reply [nested|flat] 23+ messages in thread
* [PATCH 5/6] Add copy progress reporting regression tests. @ 2021-02-09 12:06 Josef Šimánek <[email protected]> 0 siblings, 0 replies; 23+ messages in thread From: Josef Šimánek @ 2021-02-09 12:06 UTC (permalink / raw) This tests some basic features of copy progress reporting. Sadly, we can only request one snapshot of progress_reporting each transaction / statement, so we can't (easily) get intermediate results without each result requiring a seperate statement being run. Author: Josef Šimánek, Matthias van de Meent --- src/test/regress/input/copy.source | 57 +++++++++++++++++++++++++++++ src/test/regress/output/copy.source | 44 ++++++++++++++++++++++ 2 files changed, 101 insertions(+) diff --git a/src/test/regress/input/copy.source b/src/test/regress/input/copy.source index a1d529ad36..ddde33e7cc 100644 --- a/src/test/regress/input/copy.source +++ b/src/test/regress/input/copy.source @@ -201,3 +201,60 @@ select * from parted_copytest where b = 1; select * from parted_copytest where b = 2; drop table parted_copytest; + +-- +-- progress reporting +-- + +-- setup +-- reuse employer datatype, that has a small sized data set + +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); + +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); + +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting + +copy progress_reporting from stdin; +sharon 25 (15,12) 1000 sam +sam 30 (10,5) 2000 bill +bill 20 (11,10) 1000 sharon +\. + +-- reporting of FILE imports, and correct reporting of tuples-excluded + +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); + +-- cleanup progress_reporting + +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; diff --git a/src/test/regress/output/copy.source b/src/test/regress/output/copy.source index 938d3551da..60f4206aa1 100644 --- a/src/test/regress/output/copy.source +++ b/src/test/regress/output/copy.source @@ -165,3 +165,47 @@ select * from parted_copytest where b = 2; (1 row) drop table parted_copytest; +-- +-- progress reporting +-- +-- setup +-- reuse employer datatype, that has a small sized data set +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting +copy progress_reporting from stdin; +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "STDIO", "bytes_total": 0, "bytes_processed": 79, "tuples_excluded": 0, "tuples_processed": 3} +-- reporting of FILE imports, and correct reporting of tuples-excluded +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "FILE", "bytes_total": 79, "bytes_processed": 79, "tuples_excluded": 1, "tuples_processed": 2} +-- cleanup progress_reporting +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; -- 2.26.2 --------------DA8D60BF026F7ACE69A9AEE5 Content-Type: text/x-patch; charset=UTF-8; name="v7-0006-0003-review.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="v7-0006-0003-review.patch" ^ permalink raw reply [nested|flat] 23+ messages in thread
* [PATCH 5/6] Add copy progress reporting regression tests. @ 2021-02-09 12:06 Josef Šimánek <[email protected]> 0 siblings, 0 replies; 23+ messages in thread From: Josef Šimánek @ 2021-02-09 12:06 UTC (permalink / raw) This tests some basic features of copy progress reporting. Sadly, we can only request one snapshot of progress_reporting each transaction / statement, so we can't (easily) get intermediate results without each result requiring a seperate statement being run. Author: Josef Šimánek, Matthias van de Meent --- src/test/regress/input/copy.source | 57 +++++++++++++++++++++++++++++ src/test/regress/output/copy.source | 44 ++++++++++++++++++++++ 2 files changed, 101 insertions(+) diff --git a/src/test/regress/input/copy.source b/src/test/regress/input/copy.source index a1d529ad36..ddde33e7cc 100644 --- a/src/test/regress/input/copy.source +++ b/src/test/regress/input/copy.source @@ -201,3 +201,60 @@ select * from parted_copytest where b = 1; select * from parted_copytest where b = 2; drop table parted_copytest; + +-- +-- progress reporting +-- + +-- setup +-- reuse employer datatype, that has a small sized data set + +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); + +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); + +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting + +copy progress_reporting from stdin; +sharon 25 (15,12) 1000 sam +sam 30 (10,5) 2000 bill +bill 20 (11,10) 1000 sharon +\. + +-- reporting of FILE imports, and correct reporting of tuples-excluded + +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); + +-- cleanup progress_reporting + +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; diff --git a/src/test/regress/output/copy.source b/src/test/regress/output/copy.source index 938d3551da..60f4206aa1 100644 --- a/src/test/regress/output/copy.source +++ b/src/test/regress/output/copy.source @@ -165,3 +165,47 @@ select * from parted_copytest where b = 2; (1 row) drop table parted_copytest; +-- +-- progress reporting +-- +-- setup +-- reuse employer datatype, that has a small sized data set +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting +copy progress_reporting from stdin; +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "STDIO", "bytes_total": 0, "bytes_processed": 79, "tuples_excluded": 0, "tuples_processed": 3} +-- reporting of FILE imports, and correct reporting of tuples-excluded +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "FILE", "bytes_total": 79, "bytes_processed": 79, "tuples_excluded": 1, "tuples_processed": 2} +-- cleanup progress_reporting +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; -- 2.26.2 --------------DA8D60BF026F7ACE69A9AEE5 Content-Type: text/x-patch; charset=UTF-8; name="v7-0006-0003-review.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="v7-0006-0003-review.patch" ^ permalink raw reply [nested|flat] 23+ messages in thread
* [PATCH 5/6] Add copy progress reporting regression tests. @ 2021-02-09 12:06 Josef Šimánek <[email protected]> 0 siblings, 0 replies; 23+ messages in thread From: Josef Šimánek @ 2021-02-09 12:06 UTC (permalink / raw) This tests some basic features of copy progress reporting. Sadly, we can only request one snapshot of progress_reporting each transaction / statement, so we can't (easily) get intermediate results without each result requiring a seperate statement being run. Author: Josef Šimánek, Matthias van de Meent --- src/test/regress/input/copy.source | 57 +++++++++++++++++++++++++++++ src/test/regress/output/copy.source | 44 ++++++++++++++++++++++ 2 files changed, 101 insertions(+) diff --git a/src/test/regress/input/copy.source b/src/test/regress/input/copy.source index a1d529ad36..ddde33e7cc 100644 --- a/src/test/regress/input/copy.source +++ b/src/test/regress/input/copy.source @@ -201,3 +201,60 @@ select * from parted_copytest where b = 1; select * from parted_copytest where b = 2; drop table parted_copytest; + +-- +-- progress reporting +-- + +-- setup +-- reuse employer datatype, that has a small sized data set + +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); + +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); + +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting + +copy progress_reporting from stdin; +sharon 25 (15,12) 1000 sam +sam 30 (10,5) 2000 bill +bill 20 (11,10) 1000 sharon +\. + +-- reporting of FILE imports, and correct reporting of tuples-excluded + +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); + +-- cleanup progress_reporting + +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; diff --git a/src/test/regress/output/copy.source b/src/test/regress/output/copy.source index 938d3551da..60f4206aa1 100644 --- a/src/test/regress/output/copy.source +++ b/src/test/regress/output/copy.source @@ -165,3 +165,47 @@ select * from parted_copytest where b = 2; (1 row) drop table parted_copytest; +-- +-- progress reporting +-- +-- setup +-- reuse employer datatype, that has a small sized data set +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting +copy progress_reporting from stdin; +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "STDIO", "bytes_total": 0, "bytes_processed": 79, "tuples_excluded": 0, "tuples_processed": 3} +-- reporting of FILE imports, and correct reporting of tuples-excluded +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "FILE", "bytes_total": 79, "bytes_processed": 79, "tuples_excluded": 1, "tuples_processed": 2} +-- cleanup progress_reporting +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; -- 2.26.2 --------------DA8D60BF026F7ACE69A9AEE5 Content-Type: text/x-patch; charset=UTF-8; name="v7-0006-0003-review.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="v7-0006-0003-review.patch" ^ permalink raw reply [nested|flat] 23+ messages in thread
* [PATCH 5/6] Add copy progress reporting regression tests. @ 2021-02-09 12:06 Josef Šimánek <[email protected]> 0 siblings, 0 replies; 23+ messages in thread From: Josef Šimánek @ 2021-02-09 12:06 UTC (permalink / raw) This tests some basic features of copy progress reporting. Sadly, we can only request one snapshot of progress_reporting each transaction / statement, so we can't (easily) get intermediate results without each result requiring a seperate statement being run. Author: Josef Šimánek, Matthias van de Meent --- src/test/regress/input/copy.source | 57 +++++++++++++++++++++++++++++ src/test/regress/output/copy.source | 44 ++++++++++++++++++++++ 2 files changed, 101 insertions(+) diff --git a/src/test/regress/input/copy.source b/src/test/regress/input/copy.source index a1d529ad36..ddde33e7cc 100644 --- a/src/test/regress/input/copy.source +++ b/src/test/regress/input/copy.source @@ -201,3 +201,60 @@ select * from parted_copytest where b = 1; select * from parted_copytest where b = 2; drop table parted_copytest; + +-- +-- progress reporting +-- + +-- setup +-- reuse employer datatype, that has a small sized data set + +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); + +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); + +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting + +copy progress_reporting from stdin; +sharon 25 (15,12) 1000 sam +sam 30 (10,5) 2000 bill +bill 20 (11,10) 1000 sharon +\. + +-- reporting of FILE imports, and correct reporting of tuples-excluded + +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); + +-- cleanup progress_reporting + +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; diff --git a/src/test/regress/output/copy.source b/src/test/regress/output/copy.source index 938d3551da..60f4206aa1 100644 --- a/src/test/regress/output/copy.source +++ b/src/test/regress/output/copy.source @@ -165,3 +165,47 @@ select * from parted_copytest where b = 2; (1 row) drop table parted_copytest; +-- +-- progress reporting +-- +-- setup +-- reuse employer datatype, that has a small sized data set +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting +copy progress_reporting from stdin; +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "STDIO", "bytes_total": 0, "bytes_processed": 79, "tuples_excluded": 0, "tuples_processed": 3} +-- reporting of FILE imports, and correct reporting of tuples-excluded +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "FILE", "bytes_total": 79, "bytes_processed": 79, "tuples_excluded": 1, "tuples_processed": 2} +-- cleanup progress_reporting +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; -- 2.26.2 --------------DA8D60BF026F7ACE69A9AEE5 Content-Type: text/x-patch; charset=UTF-8; name="v7-0006-0003-review.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="v7-0006-0003-review.patch" ^ permalink raw reply [nested|flat] 23+ messages in thread
* [PATCH 5/6] Add copy progress reporting regression tests. @ 2021-02-09 12:06 Josef Šimánek <[email protected]> 0 siblings, 0 replies; 23+ messages in thread From: Josef Šimánek @ 2021-02-09 12:06 UTC (permalink / raw) This tests some basic features of copy progress reporting. Sadly, we can only request one snapshot of progress_reporting each transaction / statement, so we can't (easily) get intermediate results without each result requiring a seperate statement being run. Author: Josef Šimánek, Matthias van de Meent --- src/test/regress/input/copy.source | 57 +++++++++++++++++++++++++++++ src/test/regress/output/copy.source | 44 ++++++++++++++++++++++ 2 files changed, 101 insertions(+) diff --git a/src/test/regress/input/copy.source b/src/test/regress/input/copy.source index a1d529ad36..ddde33e7cc 100644 --- a/src/test/regress/input/copy.source +++ b/src/test/regress/input/copy.source @@ -201,3 +201,60 @@ select * from parted_copytest where b = 1; select * from parted_copytest where b = 2; drop table parted_copytest; + +-- +-- progress reporting +-- + +-- setup +-- reuse employer datatype, that has a small sized data set + +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); + +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); + +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting + +copy progress_reporting from stdin; +sharon 25 (15,12) 1000 sam +sam 30 (10,5) 2000 bill +bill 20 (11,10) 1000 sharon +\. + +-- reporting of FILE imports, and correct reporting of tuples-excluded + +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); + +-- cleanup progress_reporting + +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; diff --git a/src/test/regress/output/copy.source b/src/test/regress/output/copy.source index 938d3551da..60f4206aa1 100644 --- a/src/test/regress/output/copy.source +++ b/src/test/regress/output/copy.source @@ -165,3 +165,47 @@ select * from parted_copytest where b = 2; (1 row) drop table parted_copytest; +-- +-- progress reporting +-- +-- setup +-- reuse employer datatype, that has a small sized data set +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting +copy progress_reporting from stdin; +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "STDIO", "bytes_total": 0, "bytes_processed": 79, "tuples_excluded": 0, "tuples_processed": 3} +-- reporting of FILE imports, and correct reporting of tuples-excluded +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "FILE", "bytes_total": 79, "bytes_processed": 79, "tuples_excluded": 1, "tuples_processed": 2} +-- cleanup progress_reporting +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; -- 2.26.2 --------------DA8D60BF026F7ACE69A9AEE5 Content-Type: text/x-patch; charset=UTF-8; name="v7-0006-0003-review.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="v7-0006-0003-review.patch" ^ permalink raw reply [nested|flat] 23+ messages in thread
* [PATCH 5/6] Add copy progress reporting regression tests. @ 2021-02-09 12:06 Josef Šimánek <[email protected]> 0 siblings, 0 replies; 23+ messages in thread From: Josef Šimánek @ 2021-02-09 12:06 UTC (permalink / raw) This tests some basic features of copy progress reporting. Sadly, we can only request one snapshot of progress_reporting each transaction / statement, so we can't (easily) get intermediate results without each result requiring a seperate statement being run. Author: Josef Šimánek, Matthias van de Meent --- src/test/regress/input/copy.source | 57 +++++++++++++++++++++++++++++ src/test/regress/output/copy.source | 44 ++++++++++++++++++++++ 2 files changed, 101 insertions(+) diff --git a/src/test/regress/input/copy.source b/src/test/regress/input/copy.source index a1d529ad36..ddde33e7cc 100644 --- a/src/test/regress/input/copy.source +++ b/src/test/regress/input/copy.source @@ -201,3 +201,60 @@ select * from parted_copytest where b = 1; select * from parted_copytest where b = 2; drop table parted_copytest; + +-- +-- progress reporting +-- + +-- setup +-- reuse employer datatype, that has a small sized data set + +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); + +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); + +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting + +copy progress_reporting from stdin; +sharon 25 (15,12) 1000 sam +sam 30 (10,5) 2000 bill +bill 20 (11,10) 1000 sharon +\. + +-- reporting of FILE imports, and correct reporting of tuples-excluded + +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); + +-- cleanup progress_reporting + +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; diff --git a/src/test/regress/output/copy.source b/src/test/regress/output/copy.source index 938d3551da..60f4206aa1 100644 --- a/src/test/regress/output/copy.source +++ b/src/test/regress/output/copy.source @@ -165,3 +165,47 @@ select * from parted_copytest where b = 2; (1 row) drop table parted_copytest; +-- +-- progress reporting +-- +-- setup +-- reuse employer datatype, that has a small sized data set +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting +copy progress_reporting from stdin; +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "STDIO", "bytes_total": 0, "bytes_processed": 79, "tuples_excluded": 0, "tuples_processed": 3} +-- reporting of FILE imports, and correct reporting of tuples-excluded +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "FILE", "bytes_total": 79, "bytes_processed": 79, "tuples_excluded": 1, "tuples_processed": 2} +-- cleanup progress_reporting +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; -- 2.26.2 --------------DA8D60BF026F7ACE69A9AEE5 Content-Type: text/x-patch; charset=UTF-8; name="v7-0006-0003-review.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="v7-0006-0003-review.patch" ^ permalink raw reply [nested|flat] 23+ messages in thread
* [PATCH 5/6] Add copy progress reporting regression tests. @ 2021-02-09 12:06 Josef Šimánek <[email protected]> 0 siblings, 0 replies; 23+ messages in thread From: Josef Šimánek @ 2021-02-09 12:06 UTC (permalink / raw) This tests some basic features of copy progress reporting. Sadly, we can only request one snapshot of progress_reporting each transaction / statement, so we can't (easily) get intermediate results without each result requiring a seperate statement being run. Author: Josef Šimánek, Matthias van de Meent --- src/test/regress/input/copy.source | 57 +++++++++++++++++++++++++++++ src/test/regress/output/copy.source | 44 ++++++++++++++++++++++ 2 files changed, 101 insertions(+) diff --git a/src/test/regress/input/copy.source b/src/test/regress/input/copy.source index a1d529ad36..ddde33e7cc 100644 --- a/src/test/regress/input/copy.source +++ b/src/test/regress/input/copy.source @@ -201,3 +201,60 @@ select * from parted_copytest where b = 1; select * from parted_copytest where b = 2; drop table parted_copytest; + +-- +-- progress reporting +-- + +-- setup +-- reuse employer datatype, that has a small sized data set + +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); + +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); + +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting + +copy progress_reporting from stdin; +sharon 25 (15,12) 1000 sam +sam 30 (10,5) 2000 bill +bill 20 (11,10) 1000 sharon +\. + +-- reporting of FILE imports, and correct reporting of tuples-excluded + +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); + +-- cleanup progress_reporting + +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; diff --git a/src/test/regress/output/copy.source b/src/test/regress/output/copy.source index 938d3551da..60f4206aa1 100644 --- a/src/test/regress/output/copy.source +++ b/src/test/regress/output/copy.source @@ -165,3 +165,47 @@ select * from parted_copytest where b = 2; (1 row) drop table parted_copytest; +-- +-- progress reporting +-- +-- setup +-- reuse employer datatype, that has a small sized data set +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting +copy progress_reporting from stdin; +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "STDIO", "bytes_total": 0, "bytes_processed": 79, "tuples_excluded": 0, "tuples_processed": 3} +-- reporting of FILE imports, and correct reporting of tuples-excluded +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "FILE", "bytes_total": 79, "bytes_processed": 79, "tuples_excluded": 1, "tuples_processed": 2} +-- cleanup progress_reporting +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; -- 2.26.2 --------------DA8D60BF026F7ACE69A9AEE5 Content-Type: text/x-patch; charset=UTF-8; name="v7-0006-0003-review.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="v7-0006-0003-review.patch" ^ permalink raw reply [nested|flat] 23+ messages in thread
* [PATCH 5/6] Add copy progress reporting regression tests. @ 2021-02-09 12:06 Josef Šimánek <[email protected]> 0 siblings, 0 replies; 23+ messages in thread From: Josef Šimánek @ 2021-02-09 12:06 UTC (permalink / raw) This tests some basic features of copy progress reporting. Sadly, we can only request one snapshot of progress_reporting each transaction / statement, so we can't (easily) get intermediate results without each result requiring a seperate statement being run. Author: Josef Šimánek, Matthias van de Meent --- src/test/regress/input/copy.source | 57 +++++++++++++++++++++++++++++ src/test/regress/output/copy.source | 44 ++++++++++++++++++++++ 2 files changed, 101 insertions(+) diff --git a/src/test/regress/input/copy.source b/src/test/regress/input/copy.source index a1d529ad36..ddde33e7cc 100644 --- a/src/test/regress/input/copy.source +++ b/src/test/regress/input/copy.source @@ -201,3 +201,60 @@ select * from parted_copytest where b = 1; select * from parted_copytest where b = 2; drop table parted_copytest; + +-- +-- progress reporting +-- + +-- setup +-- reuse employer datatype, that has a small sized data set + +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); + +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); + +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting + +copy progress_reporting from stdin; +sharon 25 (15,12) 1000 sam +sam 30 (10,5) 2000 bill +bill 20 (11,10) 1000 sharon +\. + +-- reporting of FILE imports, and correct reporting of tuples-excluded + +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); + +-- cleanup progress_reporting + +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; diff --git a/src/test/regress/output/copy.source b/src/test/regress/output/copy.source index 938d3551da..60f4206aa1 100644 --- a/src/test/regress/output/copy.source +++ b/src/test/regress/output/copy.source @@ -165,3 +165,47 @@ select * from parted_copytest where b = 2; (1 row) drop table parted_copytest; +-- +-- progress reporting +-- +-- setup +-- reuse employer datatype, that has a small sized data set +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting +copy progress_reporting from stdin; +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "STDIO", "bytes_total": 0, "bytes_processed": 79, "tuples_excluded": 0, "tuples_processed": 3} +-- reporting of FILE imports, and correct reporting of tuples-excluded +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "FILE", "bytes_total": 79, "bytes_processed": 79, "tuples_excluded": 1, "tuples_processed": 2} +-- cleanup progress_reporting +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; -- 2.26.2 --------------DA8D60BF026F7ACE69A9AEE5 Content-Type: text/x-patch; charset=UTF-8; name="v7-0006-0003-review.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="v7-0006-0003-review.patch" ^ permalink raw reply [nested|flat] 23+ messages in thread
* [PATCH 5/6] Add copy progress reporting regression tests. @ 2021-02-09 12:06 Josef Šimánek <[email protected]> 0 siblings, 0 replies; 23+ messages in thread From: Josef Šimánek @ 2021-02-09 12:06 UTC (permalink / raw) This tests some basic features of copy progress reporting. Sadly, we can only request one snapshot of progress_reporting each transaction / statement, so we can't (easily) get intermediate results without each result requiring a seperate statement being run. Author: Josef Šimánek, Matthias van de Meent --- src/test/regress/input/copy.source | 57 +++++++++++++++++++++++++++++ src/test/regress/output/copy.source | 44 ++++++++++++++++++++++ 2 files changed, 101 insertions(+) diff --git a/src/test/regress/input/copy.source b/src/test/regress/input/copy.source index a1d529ad36..ddde33e7cc 100644 --- a/src/test/regress/input/copy.source +++ b/src/test/regress/input/copy.source @@ -201,3 +201,60 @@ select * from parted_copytest where b = 1; select * from parted_copytest where b = 2; drop table parted_copytest; + +-- +-- progress reporting +-- + +-- setup +-- reuse employer datatype, that has a small sized data set + +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); + +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); + +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting + +copy progress_reporting from stdin; +sharon 25 (15,12) 1000 sam +sam 30 (10,5) 2000 bill +bill 20 (11,10) 1000 sharon +\. + +-- reporting of FILE imports, and correct reporting of tuples-excluded + +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); + +-- cleanup progress_reporting + +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; diff --git a/src/test/regress/output/copy.source b/src/test/regress/output/copy.source index 938d3551da..60f4206aa1 100644 --- a/src/test/regress/output/copy.source +++ b/src/test/regress/output/copy.source @@ -165,3 +165,47 @@ select * from parted_copytest where b = 2; (1 row) drop table parted_copytest; +-- +-- progress reporting +-- +-- setup +-- reuse employer datatype, that has a small sized data set +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting +copy progress_reporting from stdin; +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "STDIO", "bytes_total": 0, "bytes_processed": 79, "tuples_excluded": 0, "tuples_processed": 3} +-- reporting of FILE imports, and correct reporting of tuples-excluded +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "FILE", "bytes_total": 79, "bytes_processed": 79, "tuples_excluded": 1, "tuples_processed": 2} +-- cleanup progress_reporting +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; -- 2.26.2 --------------DA8D60BF026F7ACE69A9AEE5 Content-Type: text/x-patch; charset=UTF-8; name="v7-0006-0003-review.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="v7-0006-0003-review.patch" ^ permalink raw reply [nested|flat] 23+ messages in thread
* [PATCH 5/6] Add copy progress reporting regression tests. @ 2021-02-09 12:06 Josef Šimánek <[email protected]> 0 siblings, 0 replies; 23+ messages in thread From: Josef Šimánek @ 2021-02-09 12:06 UTC (permalink / raw) This tests some basic features of copy progress reporting. Sadly, we can only request one snapshot of progress_reporting each transaction / statement, so we can't (easily) get intermediate results without each result requiring a seperate statement being run. Author: Josef Šimánek, Matthias van de Meent --- src/test/regress/input/copy.source | 57 +++++++++++++++++++++++++++++ src/test/regress/output/copy.source | 44 ++++++++++++++++++++++ 2 files changed, 101 insertions(+) diff --git a/src/test/regress/input/copy.source b/src/test/regress/input/copy.source index a1d529ad36..ddde33e7cc 100644 --- a/src/test/regress/input/copy.source +++ b/src/test/regress/input/copy.source @@ -201,3 +201,60 @@ select * from parted_copytest where b = 1; select * from parted_copytest where b = 2; drop table parted_copytest; + +-- +-- progress reporting +-- + +-- setup +-- reuse employer datatype, that has a small sized data set + +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); + +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); + +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting + +copy progress_reporting from stdin; +sharon 25 (15,12) 1000 sam +sam 30 (10,5) 2000 bill +bill 20 (11,10) 1000 sharon +\. + +-- reporting of FILE imports, and correct reporting of tuples-excluded + +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); + +-- cleanup progress_reporting + +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; diff --git a/src/test/regress/output/copy.source b/src/test/regress/output/copy.source index 938d3551da..60f4206aa1 100644 --- a/src/test/regress/output/copy.source +++ b/src/test/regress/output/copy.source @@ -165,3 +165,47 @@ select * from parted_copytest where b = 2; (1 row) drop table parted_copytest; +-- +-- progress reporting +-- +-- setup +-- reuse employer datatype, that has a small sized data set +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting +copy progress_reporting from stdin; +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "STDIO", "bytes_total": 0, "bytes_processed": 79, "tuples_excluded": 0, "tuples_processed": 3} +-- reporting of FILE imports, and correct reporting of tuples-excluded +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "FILE", "bytes_total": 79, "bytes_processed": 79, "tuples_excluded": 1, "tuples_processed": 2} +-- cleanup progress_reporting +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; -- 2.26.2 --------------DA8D60BF026F7ACE69A9AEE5 Content-Type: text/x-patch; charset=UTF-8; name="v7-0006-0003-review.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="v7-0006-0003-review.patch" ^ permalink raw reply [nested|flat] 23+ messages in thread
* [PATCH 5/6] Add copy progress reporting regression tests. @ 2021-02-09 12:06 Josef Šimánek <[email protected]> 0 siblings, 0 replies; 23+ messages in thread From: Josef Šimánek @ 2021-02-09 12:06 UTC (permalink / raw) This tests some basic features of copy progress reporting. Sadly, we can only request one snapshot of progress_reporting each transaction / statement, so we can't (easily) get intermediate results without each result requiring a seperate statement being run. Author: Josef Šimánek, Matthias van de Meent --- src/test/regress/input/copy.source | 57 +++++++++++++++++++++++++++++ src/test/regress/output/copy.source | 44 ++++++++++++++++++++++ 2 files changed, 101 insertions(+) diff --git a/src/test/regress/input/copy.source b/src/test/regress/input/copy.source index a1d529ad36..ddde33e7cc 100644 --- a/src/test/regress/input/copy.source +++ b/src/test/regress/input/copy.source @@ -201,3 +201,60 @@ select * from parted_copytest where b = 1; select * from parted_copytest where b = 2; drop table parted_copytest; + +-- +-- progress reporting +-- + +-- setup +-- reuse employer datatype, that has a small sized data set + +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); + +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); + +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting + +copy progress_reporting from stdin; +sharon 25 (15,12) 1000 sam +sam 30 (10,5) 2000 bill +bill 20 (11,10) 1000 sharon +\. + +-- reporting of FILE imports, and correct reporting of tuples-excluded + +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); + +-- cleanup progress_reporting + +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; diff --git a/src/test/regress/output/copy.source b/src/test/regress/output/copy.source index 938d3551da..60f4206aa1 100644 --- a/src/test/regress/output/copy.source +++ b/src/test/regress/output/copy.source @@ -165,3 +165,47 @@ select * from parted_copytest where b = 2; (1 row) drop table parted_copytest; +-- +-- progress reporting +-- +-- setup +-- reuse employer datatype, that has a small sized data set +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting +copy progress_reporting from stdin; +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "STDIO", "bytes_total": 0, "bytes_processed": 79, "tuples_excluded": 0, "tuples_processed": 3} +-- reporting of FILE imports, and correct reporting of tuples-excluded +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "FILE", "bytes_total": 79, "bytes_processed": 79, "tuples_excluded": 1, "tuples_processed": 2} +-- cleanup progress_reporting +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; -- 2.26.2 --------------DA8D60BF026F7ACE69A9AEE5 Content-Type: text/x-patch; charset=UTF-8; name="v7-0006-0003-review.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="v7-0006-0003-review.patch" ^ permalink raw reply [nested|flat] 23+ messages in thread
* [PATCH 5/6] Add copy progress reporting regression tests. @ 2021-02-09 12:06 Josef Šimánek <[email protected]> 0 siblings, 0 replies; 23+ messages in thread From: Josef Šimánek @ 2021-02-09 12:06 UTC (permalink / raw) This tests some basic features of copy progress reporting. Sadly, we can only request one snapshot of progress_reporting each transaction / statement, so we can't (easily) get intermediate results without each result requiring a seperate statement being run. Author: Josef Šimánek, Matthias van de Meent --- src/test/regress/input/copy.source | 57 +++++++++++++++++++++++++++++ src/test/regress/output/copy.source | 44 ++++++++++++++++++++++ 2 files changed, 101 insertions(+) diff --git a/src/test/regress/input/copy.source b/src/test/regress/input/copy.source index a1d529ad36..ddde33e7cc 100644 --- a/src/test/regress/input/copy.source +++ b/src/test/regress/input/copy.source @@ -201,3 +201,60 @@ select * from parted_copytest where b = 1; select * from parted_copytest where b = 2; drop table parted_copytest; + +-- +-- progress reporting +-- + +-- setup +-- reuse employer datatype, that has a small sized data set + +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); + +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); + +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting + +copy progress_reporting from stdin; +sharon 25 (15,12) 1000 sam +sam 30 (10,5) 2000 bill +bill 20 (11,10) 1000 sharon +\. + +-- reporting of FILE imports, and correct reporting of tuples-excluded + +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); + +-- cleanup progress_reporting + +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; diff --git a/src/test/regress/output/copy.source b/src/test/regress/output/copy.source index 938d3551da..60f4206aa1 100644 --- a/src/test/regress/output/copy.source +++ b/src/test/regress/output/copy.source @@ -165,3 +165,47 @@ select * from parted_copytest where b = 2; (1 row) drop table parted_copytest; +-- +-- progress reporting +-- +-- setup +-- reuse employer datatype, that has a small sized data set +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting +copy progress_reporting from stdin; +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "STDIO", "bytes_total": 0, "bytes_processed": 79, "tuples_excluded": 0, "tuples_processed": 3} +-- reporting of FILE imports, and correct reporting of tuples-excluded +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "FILE", "bytes_total": 79, "bytes_processed": 79, "tuples_excluded": 1, "tuples_processed": 2} +-- cleanup progress_reporting +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; -- 2.26.2 --------------DA8D60BF026F7ACE69A9AEE5 Content-Type: text/x-patch; charset=UTF-8; name="v7-0006-0003-review.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="v7-0006-0003-review.patch" ^ permalink raw reply [nested|flat] 23+ messages in thread
* [PATCH 5/6] Add copy progress reporting regression tests. @ 2021-02-09 12:06 Josef Šimánek <[email protected]> 0 siblings, 0 replies; 23+ messages in thread From: Josef Šimánek @ 2021-02-09 12:06 UTC (permalink / raw) This tests some basic features of copy progress reporting. Sadly, we can only request one snapshot of progress_reporting each transaction / statement, so we can't (easily) get intermediate results without each result requiring a seperate statement being run. Author: Josef Šimánek, Matthias van de Meent --- src/test/regress/input/copy.source | 57 +++++++++++++++++++++++++++++ src/test/regress/output/copy.source | 44 ++++++++++++++++++++++ 2 files changed, 101 insertions(+) diff --git a/src/test/regress/input/copy.source b/src/test/regress/input/copy.source index a1d529ad36..ddde33e7cc 100644 --- a/src/test/regress/input/copy.source +++ b/src/test/regress/input/copy.source @@ -201,3 +201,60 @@ select * from parted_copytest where b = 1; select * from parted_copytest where b = 2; drop table parted_copytest; + +-- +-- progress reporting +-- + +-- setup +-- reuse employer datatype, that has a small sized data set + +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); + +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); + +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting + +copy progress_reporting from stdin; +sharon 25 (15,12) 1000 sam +sam 30 (10,5) 2000 bill +bill 20 (11,10) 1000 sharon +\. + +-- reporting of FILE imports, and correct reporting of tuples-excluded + +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); + +-- cleanup progress_reporting + +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; diff --git a/src/test/regress/output/copy.source b/src/test/regress/output/copy.source index 938d3551da..60f4206aa1 100644 --- a/src/test/regress/output/copy.source +++ b/src/test/regress/output/copy.source @@ -165,3 +165,47 @@ select * from parted_copytest where b = 2; (1 row) drop table parted_copytest; +-- +-- progress reporting +-- +-- setup +-- reuse employer datatype, that has a small sized data set +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting +copy progress_reporting from stdin; +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "STDIO", "bytes_total": 0, "bytes_processed": 79, "tuples_excluded": 0, "tuples_processed": 3} +-- reporting of FILE imports, and correct reporting of tuples-excluded +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "FILE", "bytes_total": 79, "bytes_processed": 79, "tuples_excluded": 1, "tuples_processed": 2} +-- cleanup progress_reporting +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; -- 2.26.2 --------------DA8D60BF026F7ACE69A9AEE5 Content-Type: text/x-patch; charset=UTF-8; name="v7-0006-0003-review.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="v7-0006-0003-review.patch" ^ permalink raw reply [nested|flat] 23+ messages in thread
* [PATCH 5/6] Add copy progress reporting regression tests. @ 2021-02-09 12:06 Josef Šimánek <[email protected]> 0 siblings, 0 replies; 23+ messages in thread From: Josef Šimánek @ 2021-02-09 12:06 UTC (permalink / raw) This tests some basic features of copy progress reporting. Sadly, we can only request one snapshot of progress_reporting each transaction / statement, so we can't (easily) get intermediate results without each result requiring a seperate statement being run. Author: Josef Šimánek, Matthias van de Meent --- src/test/regress/input/copy.source | 57 +++++++++++++++++++++++++++++ src/test/regress/output/copy.source | 44 ++++++++++++++++++++++ 2 files changed, 101 insertions(+) diff --git a/src/test/regress/input/copy.source b/src/test/regress/input/copy.source index a1d529ad36..ddde33e7cc 100644 --- a/src/test/regress/input/copy.source +++ b/src/test/regress/input/copy.source @@ -201,3 +201,60 @@ select * from parted_copytest where b = 1; select * from parted_copytest where b = 2; drop table parted_copytest; + +-- +-- progress reporting +-- + +-- setup +-- reuse employer datatype, that has a small sized data set + +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); + +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); + +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting + +copy progress_reporting from stdin; +sharon 25 (15,12) 1000 sam +sam 30 (10,5) 2000 bill +bill 20 (11,10) 1000 sharon +\. + +-- reporting of FILE imports, and correct reporting of tuples-excluded + +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); + +-- cleanup progress_reporting + +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; diff --git a/src/test/regress/output/copy.source b/src/test/regress/output/copy.source index 938d3551da..60f4206aa1 100644 --- a/src/test/regress/output/copy.source +++ b/src/test/regress/output/copy.source @@ -165,3 +165,47 @@ select * from parted_copytest where b = 2; (1 row) drop table parted_copytest; +-- +-- progress reporting +-- +-- setup +-- reuse employer datatype, that has a small sized data set +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting +copy progress_reporting from stdin; +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "STDIO", "bytes_total": 0, "bytes_processed": 79, "tuples_excluded": 0, "tuples_processed": 3} +-- reporting of FILE imports, and correct reporting of tuples-excluded +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "FILE", "bytes_total": 79, "bytes_processed": 79, "tuples_excluded": 1, "tuples_processed": 2} +-- cleanup progress_reporting +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; -- 2.26.2 --------------DA8D60BF026F7ACE69A9AEE5 Content-Type: text/x-patch; charset=UTF-8; name="v7-0006-0003-review.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="v7-0006-0003-review.patch" ^ permalink raw reply [nested|flat] 23+ messages in thread
* [PATCH 5/6] Add copy progress reporting regression tests. @ 2021-02-09 12:06 Josef Šimánek <[email protected]> 0 siblings, 0 replies; 23+ messages in thread From: Josef Šimánek @ 2021-02-09 12:06 UTC (permalink / raw) This tests some basic features of copy progress reporting. Sadly, we can only request one snapshot of progress_reporting each transaction / statement, so we can't (easily) get intermediate results without each result requiring a seperate statement being run. Author: Josef Šimánek, Matthias van de Meent --- src/test/regress/input/copy.source | 57 +++++++++++++++++++++++++++++ src/test/regress/output/copy.source | 44 ++++++++++++++++++++++ 2 files changed, 101 insertions(+) diff --git a/src/test/regress/input/copy.source b/src/test/regress/input/copy.source index a1d529ad36..ddde33e7cc 100644 --- a/src/test/regress/input/copy.source +++ b/src/test/regress/input/copy.source @@ -201,3 +201,60 @@ select * from parted_copytest where b = 1; select * from parted_copytest where b = 2; drop table parted_copytest; + +-- +-- progress reporting +-- + +-- setup +-- reuse employer datatype, that has a small sized data set + +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); + +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); + +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting + +copy progress_reporting from stdin; +sharon 25 (15,12) 1000 sam +sam 30 (10,5) 2000 bill +bill 20 (11,10) 1000 sharon +\. + +-- reporting of FILE imports, and correct reporting of tuples-excluded + +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); + +-- cleanup progress_reporting + +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; diff --git a/src/test/regress/output/copy.source b/src/test/regress/output/copy.source index 938d3551da..60f4206aa1 100644 --- a/src/test/regress/output/copy.source +++ b/src/test/regress/output/copy.source @@ -165,3 +165,47 @@ select * from parted_copytest where b = 2; (1 row) drop table parted_copytest; +-- +-- progress reporting +-- +-- setup +-- reuse employer datatype, that has a small sized data set +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting +copy progress_reporting from stdin; +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "STDIO", "bytes_total": 0, "bytes_processed": 79, "tuples_excluded": 0, "tuples_processed": 3} +-- reporting of FILE imports, and correct reporting of tuples-excluded +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "FILE", "bytes_total": 79, "bytes_processed": 79, "tuples_excluded": 1, "tuples_processed": 2} +-- cleanup progress_reporting +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; -- 2.26.2 --------------DA8D60BF026F7ACE69A9AEE5 Content-Type: text/x-patch; charset=UTF-8; name="v7-0006-0003-review.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="v7-0006-0003-review.patch" ^ permalink raw reply [nested|flat] 23+ messages in thread
* [PATCH 5/6] Add copy progress reporting regression tests. @ 2021-02-09 12:06 Josef Šimánek <[email protected]> 0 siblings, 0 replies; 23+ messages in thread From: Josef Šimánek @ 2021-02-09 12:06 UTC (permalink / raw) This tests some basic features of copy progress reporting. Sadly, we can only request one snapshot of progress_reporting each transaction / statement, so we can't (easily) get intermediate results without each result requiring a seperate statement being run. Author: Josef Šimánek, Matthias van de Meent --- src/test/regress/input/copy.source | 57 +++++++++++++++++++++++++++++ src/test/regress/output/copy.source | 44 ++++++++++++++++++++++ 2 files changed, 101 insertions(+) diff --git a/src/test/regress/input/copy.source b/src/test/regress/input/copy.source index a1d529ad36..ddde33e7cc 100644 --- a/src/test/regress/input/copy.source +++ b/src/test/regress/input/copy.source @@ -201,3 +201,60 @@ select * from parted_copytest where b = 1; select * from parted_copytest where b = 2; drop table parted_copytest; + +-- +-- progress reporting +-- + +-- setup +-- reuse employer datatype, that has a small sized data set + +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); + +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); + +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting + +copy progress_reporting from stdin; +sharon 25 (15,12) 1000 sam +sam 30 (10,5) 2000 bill +bill 20 (11,10) 1000 sharon +\. + +-- reporting of FILE imports, and correct reporting of tuples-excluded + +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); + +-- cleanup progress_reporting + +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; diff --git a/src/test/regress/output/copy.source b/src/test/regress/output/copy.source index 938d3551da..60f4206aa1 100644 --- a/src/test/regress/output/copy.source +++ b/src/test/regress/output/copy.source @@ -165,3 +165,47 @@ select * from parted_copytest where b = 2; (1 row) drop table parted_copytest; +-- +-- progress reporting +-- +-- setup +-- reuse employer datatype, that has a small sized data set +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting +copy progress_reporting from stdin; +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "STDIO", "bytes_total": 0, "bytes_processed": 79, "tuples_excluded": 0, "tuples_processed": 3} +-- reporting of FILE imports, and correct reporting of tuples-excluded +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "FILE", "bytes_total": 79, "bytes_processed": 79, "tuples_excluded": 1, "tuples_processed": 2} +-- cleanup progress_reporting +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; -- 2.26.2 --------------DA8D60BF026F7ACE69A9AEE5 Content-Type: text/x-patch; charset=UTF-8; name="v7-0006-0003-review.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="v7-0006-0003-review.patch" ^ permalink raw reply [nested|flat] 23+ messages in thread
* [PATCH 5/6] Add copy progress reporting regression tests. @ 2021-02-09 12:06 Josef Šimánek <[email protected]> 0 siblings, 0 replies; 23+ messages in thread From: Josef Šimánek @ 2021-02-09 12:06 UTC (permalink / raw) This tests some basic features of copy progress reporting. Sadly, we can only request one snapshot of progress_reporting each transaction / statement, so we can't (easily) get intermediate results without each result requiring a seperate statement being run. Author: Josef Šimánek, Matthias van de Meent --- src/test/regress/input/copy.source | 57 +++++++++++++++++++++++++++++ src/test/regress/output/copy.source | 44 ++++++++++++++++++++++ 2 files changed, 101 insertions(+) diff --git a/src/test/regress/input/copy.source b/src/test/regress/input/copy.source index a1d529ad36..ddde33e7cc 100644 --- a/src/test/regress/input/copy.source +++ b/src/test/regress/input/copy.source @@ -201,3 +201,60 @@ select * from parted_copytest where b = 1; select * from parted_copytest where b = 2; drop table parted_copytest; + +-- +-- progress reporting +-- + +-- setup +-- reuse employer datatype, that has a small sized data set + +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); + +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); + +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting + +copy progress_reporting from stdin; +sharon 25 (15,12) 1000 sam +sam 30 (10,5) 2000 bill +bill 20 (11,10) 1000 sharon +\. + +-- reporting of FILE imports, and correct reporting of tuples-excluded + +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); + +-- cleanup progress_reporting + +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; diff --git a/src/test/regress/output/copy.source b/src/test/regress/output/copy.source index 938d3551da..60f4206aa1 100644 --- a/src/test/regress/output/copy.source +++ b/src/test/regress/output/copy.source @@ -165,3 +165,47 @@ select * from parted_copytest where b = 2; (1 row) drop table parted_copytest; +-- +-- progress reporting +-- +-- setup +-- reuse employer datatype, that has a small sized data set +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting +copy progress_reporting from stdin; +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "STDIO", "bytes_total": 0, "bytes_processed": 79, "tuples_excluded": 0, "tuples_processed": 3} +-- reporting of FILE imports, and correct reporting of tuples-excluded +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "FILE", "bytes_total": 79, "bytes_processed": 79, "tuples_excluded": 1, "tuples_processed": 2} +-- cleanup progress_reporting +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; -- 2.26.2 --------------DA8D60BF026F7ACE69A9AEE5 Content-Type: text/x-patch; charset=UTF-8; name="v7-0006-0003-review.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="v7-0006-0003-review.patch" ^ permalink raw reply [nested|flat] 23+ messages in thread
* [PATCH 5/6] Add copy progress reporting regression tests. @ 2021-02-09 12:06 Josef Šimánek <[email protected]> 0 siblings, 0 replies; 23+ messages in thread From: Josef Šimánek @ 2021-02-09 12:06 UTC (permalink / raw) This tests some basic features of copy progress reporting. Sadly, we can only request one snapshot of progress_reporting each transaction / statement, so we can't (easily) get intermediate results without each result requiring a seperate statement being run. Author: Josef Šimánek, Matthias van de Meent --- src/test/regress/input/copy.source | 57 +++++++++++++++++++++++++++++ src/test/regress/output/copy.source | 44 ++++++++++++++++++++++ 2 files changed, 101 insertions(+) diff --git a/src/test/regress/input/copy.source b/src/test/regress/input/copy.source index a1d529ad36..ddde33e7cc 100644 --- a/src/test/regress/input/copy.source +++ b/src/test/regress/input/copy.source @@ -201,3 +201,60 @@ select * from parted_copytest where b = 1; select * from parted_copytest where b = 2; drop table parted_copytest; + +-- +-- progress reporting +-- + +-- setup +-- reuse employer datatype, that has a small sized data set + +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); + +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); + +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting + +copy progress_reporting from stdin; +sharon 25 (15,12) 1000 sam +sam 30 (10,5) 2000 bill +bill 20 (11,10) 1000 sharon +\. + +-- reporting of FILE imports, and correct reporting of tuples-excluded + +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); + +-- cleanup progress_reporting + +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; diff --git a/src/test/regress/output/copy.source b/src/test/regress/output/copy.source index 938d3551da..60f4206aa1 100644 --- a/src/test/regress/output/copy.source +++ b/src/test/regress/output/copy.source @@ -165,3 +165,47 @@ select * from parted_copytest where b = 2; (1 row) drop table parted_copytest; +-- +-- progress reporting +-- +-- setup +-- reuse employer datatype, that has a small sized data set +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting +copy progress_reporting from stdin; +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "STDIO", "bytes_total": 0, "bytes_processed": 79, "tuples_excluded": 0, "tuples_processed": 3} +-- reporting of FILE imports, and correct reporting of tuples-excluded +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "FILE", "bytes_total": 79, "bytes_processed": 79, "tuples_excluded": 1, "tuples_processed": 2} +-- cleanup progress_reporting +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; -- 2.26.2 --------------DA8D60BF026F7ACE69A9AEE5 Content-Type: text/x-patch; charset=UTF-8; name="v7-0006-0003-review.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="v7-0006-0003-review.patch" ^ permalink raw reply [nested|flat] 23+ messages in thread
* [PATCH 5/6] Add copy progress reporting regression tests. @ 2021-02-09 12:06 Josef Šimánek <[email protected]> 0 siblings, 0 replies; 23+ messages in thread From: Josef Šimánek @ 2021-02-09 12:06 UTC (permalink / raw) This tests some basic features of copy progress reporting. Sadly, we can only request one snapshot of progress_reporting each transaction / statement, so we can't (easily) get intermediate results without each result requiring a seperate statement being run. Author: Josef Šimánek, Matthias van de Meent --- src/test/regress/input/copy.source | 57 +++++++++++++++++++++++++++++ src/test/regress/output/copy.source | 44 ++++++++++++++++++++++ 2 files changed, 101 insertions(+) diff --git a/src/test/regress/input/copy.source b/src/test/regress/input/copy.source index a1d529ad36..ddde33e7cc 100644 --- a/src/test/regress/input/copy.source +++ b/src/test/regress/input/copy.source @@ -201,3 +201,60 @@ select * from parted_copytest where b = 1; select * from parted_copytest where b = 2; drop table parted_copytest; + +-- +-- progress reporting +-- + +-- setup +-- reuse employer datatype, that has a small sized data set + +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); + +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); + +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting + +copy progress_reporting from stdin; +sharon 25 (15,12) 1000 sam +sam 30 (10,5) 2000 bill +bill 20 (11,10) 1000 sharon +\. + +-- reporting of FILE imports, and correct reporting of tuples-excluded + +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); + +-- cleanup progress_reporting + +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; diff --git a/src/test/regress/output/copy.source b/src/test/regress/output/copy.source index 938d3551da..60f4206aa1 100644 --- a/src/test/regress/output/copy.source +++ b/src/test/regress/output/copy.source @@ -165,3 +165,47 @@ select * from parted_copytest where b = 2; (1 row) drop table parted_copytest; +-- +-- progress reporting +-- +-- setup +-- reuse employer datatype, that has a small sized data set +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting +copy progress_reporting from stdin; +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "STDIO", "bytes_total": 0, "bytes_processed": 79, "tuples_excluded": 0, "tuples_processed": 3} +-- reporting of FILE imports, and correct reporting of tuples-excluded +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "FILE", "bytes_total": 79, "bytes_processed": 79, "tuples_excluded": 1, "tuples_processed": 2} +-- cleanup progress_reporting +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; -- 2.26.2 --------------DA8D60BF026F7ACE69A9AEE5 Content-Type: text/x-patch; charset=UTF-8; name="v7-0006-0003-review.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="v7-0006-0003-review.patch" ^ permalink raw reply [nested|flat] 23+ messages in thread
* [PATCH 5/6] Add copy progress reporting regression tests. @ 2021-02-09 12:06 Josef Šimánek <[email protected]> 0 siblings, 0 replies; 23+ messages in thread From: Josef Šimánek @ 2021-02-09 12:06 UTC (permalink / raw) This tests some basic features of copy progress reporting. Sadly, we can only request one snapshot of progress_reporting each transaction / statement, so we can't (easily) get intermediate results without each result requiring a seperate statement being run. Author: Josef Šimánek, Matthias van de Meent --- src/test/regress/input/copy.source | 57 +++++++++++++++++++++++++++++ src/test/regress/output/copy.source | 44 ++++++++++++++++++++++ 2 files changed, 101 insertions(+) diff --git a/src/test/regress/input/copy.source b/src/test/regress/input/copy.source index a1d529ad36..ddde33e7cc 100644 --- a/src/test/regress/input/copy.source +++ b/src/test/regress/input/copy.source @@ -201,3 +201,60 @@ select * from parted_copytest where b = 1; select * from parted_copytest where b = 2; drop table parted_copytest; + +-- +-- progress reporting +-- + +-- setup +-- reuse employer datatype, that has a small sized data set + +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); + +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); + +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting + +copy progress_reporting from stdin; +sharon 25 (15,12) 1000 sam +sam 30 (10,5) 2000 bill +bill 20 (11,10) 1000 sharon +\. + +-- reporting of FILE imports, and correct reporting of tuples-excluded + +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); + +-- cleanup progress_reporting + +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; diff --git a/src/test/regress/output/copy.source b/src/test/regress/output/copy.source index 938d3551da..60f4206aa1 100644 --- a/src/test/regress/output/copy.source +++ b/src/test/regress/output/copy.source @@ -165,3 +165,47 @@ select * from parted_copytest where b = 2; (1 row) drop table parted_copytest; +-- +-- progress reporting +-- +-- setup +-- reuse employer datatype, that has a small sized data set +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting +copy progress_reporting from stdin; +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "STDIO", "bytes_total": 0, "bytes_processed": 79, "tuples_excluded": 0, "tuples_processed": 3} +-- reporting of FILE imports, and correct reporting of tuples-excluded +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "FILE", "bytes_total": 79, "bytes_processed": 79, "tuples_excluded": 1, "tuples_processed": 2} +-- cleanup progress_reporting +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; -- 2.26.2 --------------DA8D60BF026F7ACE69A9AEE5 Content-Type: text/x-patch; charset=UTF-8; name="v7-0006-0003-review.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="v7-0006-0003-review.patch" ^ permalink raw reply [nested|flat] 23+ messages in thread
* [PATCH 5/6] Add copy progress reporting regression tests. @ 2021-02-09 12:06 Josef Šimánek <[email protected]> 0 siblings, 0 replies; 23+ messages in thread From: Josef Šimánek @ 2021-02-09 12:06 UTC (permalink / raw) This tests some basic features of copy progress reporting. Sadly, we can only request one snapshot of progress_reporting each transaction / statement, so we can't (easily) get intermediate results without each result requiring a seperate statement being run. Author: Josef Šimánek, Matthias van de Meent --- src/test/regress/input/copy.source | 57 +++++++++++++++++++++++++++++ src/test/regress/output/copy.source | 44 ++++++++++++++++++++++ 2 files changed, 101 insertions(+) diff --git a/src/test/regress/input/copy.source b/src/test/regress/input/copy.source index a1d529ad36..ddde33e7cc 100644 --- a/src/test/regress/input/copy.source +++ b/src/test/regress/input/copy.source @@ -201,3 +201,60 @@ select * from parted_copytest where b = 1; select * from parted_copytest where b = 2; drop table parted_copytest; + +-- +-- progress reporting +-- + +-- setup +-- reuse employer datatype, that has a small sized data set + +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); + +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); + +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting + +copy progress_reporting from stdin; +sharon 25 (15,12) 1000 sam +sam 30 (10,5) 2000 bill +bill 20 (11,10) 1000 sharon +\. + +-- reporting of FILE imports, and correct reporting of tuples-excluded + +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); + +-- cleanup progress_reporting + +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; diff --git a/src/test/regress/output/copy.source b/src/test/regress/output/copy.source index 938d3551da..60f4206aa1 100644 --- a/src/test/regress/output/copy.source +++ b/src/test/regress/output/copy.source @@ -165,3 +165,47 @@ select * from parted_copytest where b = 2; (1 row) drop table parted_copytest; +-- +-- progress reporting +-- +-- setup +-- reuse employer datatype, that has a small sized data set +create table progress_reporting ( + name text, + age int4, + location point, + salary int4, + manager name +); +create function notice_after_progress_reporting() returns trigger AS +$$ +declare report record; +begin + -- We cannot expect 'pid' nor 'relid' to be consistent over runs due to + -- variance in system process ids, and concurrency in runs of tests. + -- Additionally, due to the usage of this test in pg_regress, the 'datid' + -- also is not consistent between runs. + select into report (to_jsonb(r) - '{pid,relid,datid}'::text[]) as value + from pg_stat_progress_copy r + where pid = pg_backend_pid(); + + raise info 'progress: %', report.value::text; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; +create trigger check_after_progress_reporting + after insert on progress_reporting + for each statement + execute function notice_after_progress_reporting(); +-- reporting of STDIO imports, and correct bytes-processed/tuples-processed reporting +copy progress_reporting from stdin; +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "STDIO", "bytes_total": 0, "bytes_processed": 79, "tuples_excluded": 0, "tuples_processed": 3} +-- reporting of FILE imports, and correct reporting of tuples-excluded +copy progress_reporting from '@abs_srcdir@/data/emp.data' + where (salary < 2000); +INFO: progress: {"command": "COPY FROM", "datname": "regression", "io_target": "FILE", "bytes_total": 79, "bytes_processed": 79, "tuples_excluded": 1, "tuples_processed": 2} +-- cleanup progress_reporting +drop trigger check_after_progress_reporting on progress_reporting; +drop function notice_after_progress_reporting(); +drop table progress_reporting; -- 2.26.2 --------------DA8D60BF026F7ACE69A9AEE5 Content-Type: text/x-patch; charset=UTF-8; name="v7-0006-0003-review.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="v7-0006-0003-review.patch" ^ permalink raw reply [nested|flat] 23+ messages in thread
* [PATCH v2.6 32/34] Temporary: Increase BAS_BULKREAD size @ 2024-09-01 04:42 Andres Freund <[email protected]> 0 siblings, 0 replies; 23+ messages in thread From: Andres Freund @ 2024-09-01 04:42 UTC (permalink / raw) Without this we only can execute very little AIO for sequential scans, as there's just not enough buffers in the ring. This isn't the right fix, as just increasing the ring size can have negative performance implications in workloads where the kernel has all the data cached. Author: Reviewed-By: Discussion: https://postgr.es/m/ Backpatch: --- src/backend/storage/buffer/freelist.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/backend/storage/buffer/freelist.c b/src/backend/storage/buffer/freelist.c index 336715b6c63..b72a5957a20 100644 --- a/src/backend/storage/buffer/freelist.c +++ b/src/backend/storage/buffer/freelist.c @@ -555,7 +555,12 @@ GetAccessStrategy(BufferAccessStrategyType btype) return NULL; case BAS_BULKREAD: - ring_size_kb = 256; + + /* + * FIXME: Temporary increase to allow large enough streaming reads + * to actually benefit from AIO. This needs a better solution. + */ + ring_size_kb = 2 * 1024; break; case BAS_BULKWRITE: ring_size_kb = 16 * 1024; -- 2.48.1.76.g4e746b1a31.dirty --6g5xner6ro2tsnwz Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v2.6-0033-WIP-Use-MAP_POPULATE.patch" ^ permalink raw reply [nested|flat] 23+ messages in thread
end of thread, other threads:[~2024-09-01 04:42 UTC | newest] Thread overview: 23+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2021-02-09 12:06 [PATCH 5/6] Add copy progress reporting regression tests. Josef Šimánek <[email protected]> 2021-02-09 12:06 [PATCH 5/6] Add copy progress reporting regression tests. Josef Šimánek <[email protected]> 2021-02-09 12:06 [PATCH 5/6] Add copy progress reporting regression tests. Josef Šimánek <[email protected]> 2021-02-09 12:06 [PATCH 5/6] Add copy progress reporting regression tests. Josef Šimánek <[email protected]> 2021-02-09 12:06 [PATCH 5/6] Add copy progress reporting regression tests. Josef Šimánek <[email protected]> 2021-02-09 12:06 [PATCH 5/6] Add copy progress reporting regression tests. Josef Šimánek <[email protected]> 2021-02-09 12:06 [PATCH 5/6] Add copy progress reporting regression tests. Josef Šimánek <[email protected]> 2021-02-09 12:06 [PATCH 5/6] Add copy progress reporting regression tests. Josef Šimánek <[email protected]> 2021-02-09 12:06 [PATCH 5/6] Add copy progress reporting regression tests. Josef Šimánek <[email protected]> 2021-02-09 12:06 [PATCH 5/6] Add copy progress reporting regression tests. Josef Šimánek <[email protected]> 2021-02-09 12:06 [PATCH 5/6] Add copy progress reporting regression tests. Josef Šimánek <[email protected]> 2021-02-09 12:06 [PATCH 5/6] Add copy progress reporting regression tests. Josef Šimánek <[email protected]> 2021-02-09 12:06 [PATCH 5/6] Add copy progress reporting regression tests. Josef Šimánek <[email protected]> 2021-02-09 12:06 [PATCH 5/6] Add copy progress reporting regression tests. Josef Šimánek <[email protected]> 2021-02-09 12:06 [PATCH 5/6] Add copy progress reporting regression tests. Josef Šimánek <[email protected]> 2021-02-09 12:06 [PATCH 5/6] Add copy progress reporting regression tests. Josef Šimánek <[email protected]> 2021-02-09 12:06 [PATCH 5/6] Add copy progress reporting regression tests. Josef Šimánek <[email protected]> 2021-02-09 12:06 [PATCH 5/6] Add copy progress reporting regression tests. Josef Šimánek <[email protected]> 2021-02-09 12:06 [PATCH 5/6] Add copy progress reporting regression tests. Josef Šimánek <[email protected]> 2021-02-09 12:06 [PATCH 5/6] Add copy progress reporting regression tests. Josef Šimánek <[email protected]> 2021-02-09 12:06 [PATCH 5/6] Add copy progress reporting regression tests. Josef Šimánek <[email protected]> 2021-02-09 12:06 [PATCH 5/6] Add copy progress reporting regression tests. Josef Šimánek <[email protected]> 2024-09-01 04:42 [PATCH v2.6 32/34] Temporary: Increase BAS_BULKREAD size Andres Freund <[email protected]>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox