aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Eisentraut <peter@eisentraut.org>2023-12-31 15:30:57 +0100
committerPeter Eisentraut <peter@eisentraut.org>2023-12-31 15:30:57 +0100
commit1141e29b61e9bf82b045540d41b27581fc3207ec (patch)
treeb0e48293ae0a303dd570129220255aa92548b180
parenta99009a9a32c2b0edd7b6632c37bc2fb6c4f594e (diff)
downloadpostgresql-1141e29b61e9bf82b045540d41b27581fc3207ec.tar.gz
postgresql-1141e29b61e9bf82b045540d41b27581fc3207ec.zip
Revert "pg_stat_statements: Add coverage for entry_dealloc()"
This reverts commit 742f6b3e6df980d7dafa4a18a165d285483d5f0e. The new test failed on big-endian platforms. Discussion: https://www.postgresql.org/message-id/flat/40d1e4f2-835f-448f-a541-8ff5db75bf3d@eisentraut.org
-rw-r--r--contrib/pg_stat_statements/Makefile2
-rw-r--r--contrib/pg_stat_statements/expected/max.out82
-rw-r--r--contrib/pg_stat_statements/meson.build1
-rw-r--r--contrib/pg_stat_statements/pg_stat_statements.conf2
-rw-r--r--contrib/pg_stat_statements/sql/max.sql61
5 files changed, 1 insertions, 147 deletions
diff --git a/contrib/pg_stat_statements/Makefile b/contrib/pg_stat_statements/Makefile
index 20834bb0ee4..414a30856e4 100644
--- a/contrib/pg_stat_statements/Makefile
+++ b/contrib/pg_stat_statements/Makefile
@@ -19,7 +19,7 @@ LDFLAGS_SL += $(filter -lm, $(LIBS))
REGRESS_OPTS = --temp-config $(top_srcdir)/contrib/pg_stat_statements/pg_stat_statements.conf
REGRESS = select dml cursors utility level_tracking planning \
- user_activity wal entry_timestamp max cleanup oldextversions
+ user_activity wal entry_timestamp cleanup oldextversions
# Disabled because these tests require "shared_preload_libraries=pg_stat_statements",
# which typical installcheck users do not have (e.g. buildfarm clients).
NO_INSTALLCHECK = 1
diff --git a/contrib/pg_stat_statements/expected/max.out b/contrib/pg_stat_statements/expected/max.out
deleted file mode 100644
index 15e25316646..00000000000
--- a/contrib/pg_stat_statements/expected/max.out
+++ /dev/null
@@ -1,82 +0,0 @@
---
--- Test deallocation of entries
---
-SHOW pg_stat_statements.max;
- pg_stat_statements.max
-------------------------
- 100
-(1 row)
-
-SET pg_stat_statements.track = 'all';
--- Create 101 tables.
-DO $$
-BEGIN
- FOR i IN 1..101 LOOP
- EXECUTE format('create table t%s (a int)', lpad(i::text, 3, '0'));
- END LOOP;
-END
-$$;
-SELECT pg_stat_statements_reset() IS NOT NULL AS t;
- t
----
- t
-(1 row)
-
--- Run 98 queries.
-DO $$
-BEGIN
- FOR i IN 1..98 LOOP
- EXECUTE format('select * from t%s', lpad(i::text, 3, '0'));
- END LOOP;
-END
-$$;
--- All 98 queries should be registered. We just check the first and
--- last to keep the output small.
-SELECT query FROM pg_stat_statements WHERE query LIKE '%t001%' OR query LIKE '%t098%' ORDER BY query;
- query
---------------------
- select * from t001
- select * from t098
-(2 rows)
-
--- Query tables 2 through 98 again, so they have a higher calls count.
--- Table 1 still has previous calls count.
-DO $$
-BEGIN
- FOR i IN 2..98 LOOP
- EXECUTE format('select * from t%s', lpad(i::text, 3, '0'));
- END LOOP;
-END
-$$;
--- Run 3 more queries. This will exceed the max and will cause the
--- least used query to be deallocated. (The queries for
--- pg_stat_statements themselves will also register, so fewer than 3
--- queries will also cause overflow, but let's keep this scenario
--- self-contained.)
-DO $$
-BEGIN
- FOR i IN 99..101 LOOP
- EXECUTE format('select * from t%s', lpad(i::text, 3, '0'));
- END LOOP;
-END
-$$;
--- Check that the limit was kept.
-SELECT count(*) <= 100 FROM pg_stat_statements;
- ?column?
-----------
- t
-(1 row)
-
--- Check that record for t001 has been deallocated.
-SELECT query FROM pg_stat_statements WHERE query LIKE '%t001%' ORDER BY query;
- query
--------
-(0 rows)
-
--- Check deallocation count.
-SELECT dealloc > 0 AS t FROM pg_stat_statements_info;
- t
----
- t
-(1 row)
-
diff --git a/contrib/pg_stat_statements/meson.build b/contrib/pg_stat_statements/meson.build
index 3e42328f6c5..c9531f44d49 100644
--- a/contrib/pg_stat_statements/meson.build
+++ b/contrib/pg_stat_statements/meson.build
@@ -50,7 +50,6 @@ tests += {
'user_activity',
'wal',
'entry_timestamp',
- 'max',
'cleanup',
'oldextversions',
],
diff --git a/contrib/pg_stat_statements/pg_stat_statements.conf b/contrib/pg_stat_statements/pg_stat_statements.conf
index 0119f681d7d..0e900d7119b 100644
--- a/contrib/pg_stat_statements/pg_stat_statements.conf
+++ b/contrib/pg_stat_statements/pg_stat_statements.conf
@@ -1,4 +1,2 @@
shared_preload_libraries = 'pg_stat_statements'
max_prepared_transactions = 5
-
-pg_stat_statements.max = 100
diff --git a/contrib/pg_stat_statements/sql/max.sql b/contrib/pg_stat_statements/sql/max.sql
deleted file mode 100644
index 155eec789a3..00000000000
--- a/contrib/pg_stat_statements/sql/max.sql
+++ /dev/null
@@ -1,61 +0,0 @@
---
--- Test deallocation of entries
---
-
-SHOW pg_stat_statements.max;
-
-SET pg_stat_statements.track = 'all';
-
--- Create 101 tables.
-DO $$
-BEGIN
- FOR i IN 1..101 LOOP
- EXECUTE format('create table t%s (a int)', lpad(i::text, 3, '0'));
- END LOOP;
-END
-$$;
-
-SELECT pg_stat_statements_reset() IS NOT NULL AS t;
-
--- Run 98 queries.
-DO $$
-BEGIN
- FOR i IN 1..98 LOOP
- EXECUTE format('select * from t%s', lpad(i::text, 3, '0'));
- END LOOP;
-END
-$$;
-
--- All 98 queries should be registered. We just check the first and
--- last to keep the output small.
-SELECT query FROM pg_stat_statements WHERE query LIKE '%t001%' OR query LIKE '%t098%' ORDER BY query;
-
--- Query tables 2 through 98 again, so they have a higher calls count.
--- Table 1 still has previous calls count.
-DO $$
-BEGIN
- FOR i IN 2..98 LOOP
- EXECUTE format('select * from t%s', lpad(i::text, 3, '0'));
- END LOOP;
-END
-$$;
-
--- Run 3 more queries. This will exceed the max and will cause the
--- least used query to be deallocated. (The queries for
--- pg_stat_statements themselves will also register, so fewer than 3
--- queries will also cause overflow, but let's keep this scenario
--- self-contained.)
-DO $$
-BEGIN
- FOR i IN 99..101 LOOP
- EXECUTE format('select * from t%s', lpad(i::text, 3, '0'));
- END LOOP;
-END
-$$;
-
--- Check that the limit was kept.
-SELECT count(*) <= 100 FROM pg_stat_statements;
--- Check that record for t001 has been deallocated.
-SELECT query FROM pg_stat_statements WHERE query LIKE '%t001%' ORDER BY query;
--- Check deallocation count.
-SELECT dealloc > 0 AS t FROM pg_stat_statements_info;