agora inbox for [email protected]
help / color / mirror / Atom feed[PATCH 5/6] Add copy progress reporting regression tests.
24+ 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; 24+ 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] 24+ 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; 24+ 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] 24+ 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; 24+ 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] 24+ 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; 24+ 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] 24+ 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; 24+ 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] 24+ 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; 24+ 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] 24+ 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; 24+ 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] 24+ 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; 24+ 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] 24+ 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; 24+ 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] 24+ 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; 24+ 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] 24+ 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; 24+ 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] 24+ 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; 24+ 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] 24+ 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; 24+ 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] 24+ 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; 24+ 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] 24+ 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; 24+ 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] 24+ 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; 24+ 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] 24+ 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; 24+ 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] 24+ 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; 24+ 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] 24+ 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; 24+ 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] 24+ 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; 24+ 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] 24+ 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; 24+ 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] 24+ 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; 24+ 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] 24+ messages in thread
* Re: evtcache: EventTriggerCache vs Event Trigger Cache
@ 2023-05-04 12:18 Daniel Gustafsson <[email protected]>
2023-05-08 08:39 ` Re: evtcache: EventTriggerCache vs Event Trigger Cache Daniel Gustafsson <[email protected]>
0 siblings, 1 reply; 24+ messages in thread
From: Daniel Gustafsson @ 2023-05-04 12:18 UTC (permalink / raw)
To: Tom Lane <[email protected]>; +Cc: PostgreSQL Hackers <[email protected]>
> On 4 May 2023, at 14:09, Tom Lane <[email protected]> wrote:
>
> Daniel Gustafsson <[email protected]> writes:
>> When reading a memory contexts log I realized that we have this:
>> LOG: level: 2; EventTriggerCache: 8192 total in 1 blocks; 7928 free (4 chunks); 264 used
>> LOG: level: 3; Event Trigger Cache: 8192 total in 1 blocks; 2616 free (0 chunks); 5576 used
>
>> The reason is that BuildEventTriggerCache sets up a context "EventTriggerCache"
>> which house a hash named "Event Trigger Cache" which in turn creates a context
>> with the table name. I think it makes sense that these share the same name,
>> but I think it would be less confusing if they also shared the same spelling
>> whitespace-wise. Any reason to not rename the hash EventTriggerCache to make
>> the logging a tiny bit easier to read and grep?
>
> Hmm, I'm kinda -1 on them having the same name visible in the
> contexts dump --- that seems very confusing. How about naming
> the hash "EventTriggerCacheHash" or so?
I think the level is the indicator here, but I have no strong opinions,
EventTriggerCacheHash is fine by me.
--
Daniel Gustafsson
^ permalink raw reply [nested|flat] 24+ messages in thread
* Re: evtcache: EventTriggerCache vs Event Trigger Cache
2023-05-04 12:18 Re: evtcache: EventTriggerCache vs Event Trigger Cache Daniel Gustafsson <[email protected]>
@ 2023-05-08 08:39 ` Daniel Gustafsson <[email protected]>
0 siblings, 0 replies; 24+ messages in thread
From: Daniel Gustafsson @ 2023-05-08 08:39 UTC (permalink / raw)
To: Tom Lane <[email protected]>; +Cc: PostgreSQL Hackers <[email protected]>
> On 4 May 2023, at 14:18, Daniel Gustafsson <[email protected]> wrote:
>
>> On 4 May 2023, at 14:09, Tom Lane <[email protected]> wrote:
>>
>> Daniel Gustafsson <[email protected]> writes:
>>> When reading a memory contexts log I realized that we have this:
>>> LOG: level: 2; EventTriggerCache: 8192 total in 1 blocks; 7928 free (4 chunks); 264 used
>>> LOG: level: 3; Event Trigger Cache: 8192 total in 1 blocks; 2616 free (0 chunks); 5576 used
>>
>>> The reason is that BuildEventTriggerCache sets up a context "EventTriggerCache"
>>> which house a hash named "Event Trigger Cache" which in turn creates a context
>>> with the table name. I think it makes sense that these share the same name,
>>> but I think it would be less confusing if they also shared the same spelling
>>> whitespace-wise. Any reason to not rename the hash EventTriggerCache to make
>>> the logging a tiny bit easier to read and grep?
>>
>> Hmm, I'm kinda -1 on them having the same name visible in the
>> contexts dump --- that seems very confusing. How about naming
>> the hash "EventTriggerCacheHash" or so?
>
> I think the level is the indicator here, but I have no strong opinions,
> EventTriggerCacheHash is fine by me.
The attached trivial diff does that, parking this in the next CF.
--
Daniel Gustafsson
Attachments:
[application/octet-stream] evtcachehash.diff (550B, ../../[email protected]/2-evtcachehash.diff)
download | inline diff:
diff --git a/src/backend/utils/cache/evtcache.c b/src/backend/utils/cache/evtcache.c
index 1f5e7eb4c6..b080f7a35f 100644
--- a/src/backend/utils/cache/evtcache.c
+++ b/src/backend/utils/cache/evtcache.c
@@ -121,7 +121,7 @@ BuildEventTriggerCache(void)
ctl.keysize = sizeof(EventTriggerEvent);
ctl.entrysize = sizeof(EventTriggerCacheEntry);
ctl.hcxt = EventTriggerCacheContext;
- cache = hash_create("Event Trigger Cache", 32, &ctl,
+ cache = hash_create("EventTriggerCacheHash", 32, &ctl,
HASH_ELEM | HASH_BLOBS | HASH_CONTEXT);
/*
^ permalink raw reply [nested|flat] 24+ messages in thread
end of thread, other threads:[~2023-05-08 08:39 UTC | newest]
Thread overview: 24+ 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]>
2023-05-04 12:18 Re: evtcache: EventTriggerCache vs Event Trigger Cache Daniel Gustafsson <[email protected]>
2023-05-08 08:39 ` Re: evtcache: EventTriggerCache vs Event Trigger Cache Daniel Gustafsson <[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