public inbox for [email protected]
help / color / mirror / Atom feed[PATCH 3/5] Remove entries that haven't been used for a certain time
93+ messages / 11 participants
[nested] [flat]
* [PATCH 3/5] Remove entries that haven't been used for a certain time
@ 2018-10-16 04:04 Kyotaro Horiguchi <[email protected]>
0 siblings, 0 replies; 93+ messages in thread
From: Kyotaro Horiguchi @ 2018-10-16 04:04 UTC (permalink / raw)
Catcache entries can be left alone for several reasons. It is not
desirable that they eat up memory. With this patch, This adds
consideration of removal of entries that haven't been used for a
certain time before enlarging the hash array.
This also can put a hard limit on the number of catcache entries.
---
doc/src/sgml/config.sgml | 40 ++++
src/backend/tcop/postgres.c | 13 ++
src/backend/utils/cache/catcache.c | 283 +++++++++++++++++++++++++-
src/backend/utils/init/globals.c | 1 +
src/backend/utils/init/postinit.c | 11 +
src/backend/utils/misc/guc.c | 43 ++++
src/backend/utils/misc/postgresql.conf.sample | 2 +
src/include/miscadmin.h | 1 +
src/include/utils/catcache.h | 50 ++++-
src/include/utils/timeout.h | 1 +
10 files changed, 436 insertions(+), 9 deletions(-)
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 07b847a8e9..4749ad61a9 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -1661,6 +1661,46 @@ include_dir 'conf.d'
</listitem>
</varlistentry>
+ <varlistentry id="guc-catalog-cache-prune-min-age" xreflabel="catalog_cache_prune_min_age">
+ <term><varname>catalog_cache_prune_min_age</varname> (<type>integer</type>)
+ <indexterm>
+ <primary><varname>catalog_cache_prune_min_age</varname> configuration
+ parameter</primary>
+ </indexterm>
+ </term>
+ <listitem>
+ <para>
+ Specifies the minimum amount of unused time in seconds at which a
+ system catalog cache entry is removed. -1 indicates that this feature
+ is disabled at all. The value defaults to 300 seconds (<literal>5
+ minutes</literal>). The catalog cache entries that are not used for
+ the duration can be removed to prevent it from being filled up with
+ useless entries. This behaviour is muted until the size of a catalog
+ cache exceeds <xref linkend="guc-catalog-cache-memory-target"/>.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry id="guc-catalog-cache-memory-target" xreflabel="catalog_cache_memory_target">
+ <term><varname>catalog_cache_memory_target</varname> (<type>integer</type>)
+ <indexterm>
+ <primary><varname>catalog_cache_memory_target</varname> configuration
+ parameter</primary>
+ </indexterm>
+ </term>
+ <listitem>
+ <para>
+ Specifies the maximum amount of memory to which a system catalog cache
+ can expand without pruning in kilobytes. The value defaults to 0,
+ indicating that age-based pruning is always considered. After
+ exceeding this size, catalog cache starts pruning according to
+ <xref linkend="guc-catalog-cache-prune-min-age"/>. If you need to keep
+ certain amount of catalog cache entries with intermittent usage, try
+ increase this setting.
+ </para>
+ </listitem>
+ </varlistentry>
+
<varlistentry id="guc-max-stack-depth" xreflabel="max_stack_depth">
<term><varname>max_stack_depth</varname> (<type>integer</type>)
<indexterm>
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 36cfd507b2..f192ee2ca6 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -71,6 +71,7 @@
#include "tcop/pquery.h"
#include "tcop/tcopprot.h"
#include "tcop/utility.h"
+#include "utils/catcache.h"
#include "utils/lsyscache.h"
#include "utils/memutils.h"
#include "utils/ps_status.h"
@@ -2584,6 +2585,7 @@ start_xact_command(void)
* not desired, the timeout has to be disabled explicitly.
*/
enable_statement_timeout();
+ SetCatCacheClock(GetCurrentStatementStartTimestamp());
}
static void
@@ -3159,6 +3161,14 @@ ProcessInterrupts(void)
if (ParallelMessagePending)
HandleParallelMessages();
+
+ if (CatcacheClockTimeoutPending)
+ {
+ CatcacheClockTimeoutPending = 0;
+
+ /* Update timetamp then set up the next timeout */
+ UpdateCatCacheClock();
+ }
}
@@ -4021,6 +4031,9 @@ PostgresMain(int argc, char *argv[],
QueryCancelPending = false; /* second to avoid race condition */
stmt_timeout_active = false;
+ /* get sync with the timer state */
+ catcache_clock_timeout_active = false;
+
/* Not reading from the client anymore. */
DoingCommandRead = false;
diff --git a/src/backend/utils/cache/catcache.c b/src/backend/utils/cache/catcache.c
index 258a1d64cc..04a60a490a 100644
--- a/src/backend/utils/cache/catcache.c
+++ b/src/backend/utils/cache/catcache.c
@@ -39,6 +39,7 @@
#include "utils/rel.h"
#include "utils/resowner_private.h"
#include "utils/syscache.h"
+#include "utils/timeout.h"
/* #define CACHEDEBUG */ /* turns DEBUG elogs on */
@@ -71,9 +72,43 @@
#define CACHE6_elog(a,b,c,d,e,f,g)
#endif
+/* GUC variable to define the minimum age of entries that will be considered to
+ * be evicted in seconds. This variable is shared among various cache
+ * mechanisms.
+ */
+int catalog_cache_prune_min_age = 300;
+
+/*
+ * GUC variable to define the minimum size of hash to cosider entry eviction.
+ * This variable is shared among various cache mechanisms.
+ */
+int catalog_cache_memory_target = 0;
+
+/*
+ * GUC for limit by the number of entries. Entries are removed when the number
+ * of them goes above catalog_cache_entry_limit and leaving newer entries by
+ * the ratio specified by catalog_cache_prune_ratio.
+ */
+int catalog_cache_entry_limit = 0;
+double catalog_cache_prune_ratio = 0.8;
+
+/*
+ * Flag to keep track of whether catcache clock timer is active.
+ */
+bool catcache_clock_timeout_active = false;
+
+/*
+ * Minimum interval between two success move of a cache entry in LRU list,
+ * in microseconds.
+ */
+#define MIN_LRU_UPDATE_INTERVAL 100000 /* 100ms */
+
/* Cache management header --- pointer is NULL until created */
static CatCacheHeader *CacheHdr = NULL;
+/* Clock used to record the last accessed time of a catcache record. */
+TimestampTz catcacheclock = 0;
+
static inline HeapTuple SearchCatCacheInternal(CatCache *cache,
int nkeys,
Datum v1, Datum v2,
@@ -481,6 +516,7 @@ CatCacheRemoveCTup(CatCache *cache, CatCTup *ct)
/* delink from linked list */
dlist_delete(&ct->cache_elem);
+ dlist_delete(&ct->lru_node);
/*
* Free keys when we're dealing with a negative entry, normal entries just
@@ -490,6 +526,7 @@ CatCacheRemoveCTup(CatCache *cache, CatCTup *ct)
CatCacheFreeKeys(cache->cc_tupdesc, cache->cc_nkeys,
cache->cc_keyno, ct->keys);
+ cache->cc_memusage -= ct->size;
pfree(ct);
--cache->cc_ntup;
@@ -779,6 +816,7 @@ InitCatCache(int id,
MemoryContext oldcxt;
size_t sz;
int i;
+ uint64 base_size;
/*
* nbuckets is the initial number of hash buckets to use in this catcache.
@@ -821,8 +859,12 @@ InitCatCache(int id,
*
* Note: we rely on zeroing to initialize all the dlist headers correctly
*/
+ base_size = MemoryContextGetConsumption(CacheMemoryContext);
sz = sizeof(CatCache) + PG_CACHE_LINE_SIZE;
cp = (CatCache *) CACHELINEALIGN(palloc0(sz));
+ cp->cc_head_alloc_size =
+ MemoryContextGetConsumption(CacheMemoryContext) - base_size;
+
cp->cc_bucket = palloc0(nbuckets * sizeof(dlist_head));
/*
@@ -842,6 +884,11 @@ InitCatCache(int id,
for (i = 0; i < nkeys; ++i)
cp->cc_keyno[i] = key[i];
+ /* cc_head_alloc_size + consumed size for cc_bucket */
+ cp->cc_memusage =
+ MemoryContextGetConsumption(CacheMemoryContext) - base_size;
+
+ dlist_init(&cp->cc_lru_list);
/*
* new cache is initialized as far as we can go for now. print some
* debugging information, if appropriate.
@@ -858,9 +905,185 @@ InitCatCache(int id,
*/
MemoryContextSwitchTo(oldcxt);
+ /* initialize catcache reference clock if haven't done yet */
+ if (catcacheclock == 0)
+ catcacheclock = GetCurrentTimestamp();
+
return cp;
}
+/*
+ * helper routine for SetCatCacheClock and UpdateCatCacheClockTimer.
+ *
+ * We need to maintain the catcache clock during a long query.
+ */
+void
+SetupCatCacheClockTimer(void)
+{
+ long delay;
+
+ /* stop timer if not needed */
+ if (catalog_cache_prune_min_age == 0)
+ {
+ catcache_clock_timeout_active = false;
+ return;
+ }
+
+ /* One 10th of the variable, in milliseconds */
+ delay = catalog_cache_prune_min_age * 1000/10;
+
+ /* Lower limit is 1 second */
+ if (delay < 1000)
+ delay = 1000;
+
+ enable_timeout_after(CATCACHE_CLOCK_TIMEOUT, delay);
+
+ catcache_clock_timeout_active = true;
+}
+
+/*
+ * Update catcacheclock: this is intended to be called from
+ * CATCACHE_CLOCK_TIMEOUT. The interval is expected more than 1 second (see
+ * above), so GetCurrentTime() doesn't harm.
+ */
+void
+UpdateCatCacheClock(void)
+{
+ catcacheclock = GetCurrentTimestamp();
+ SetupCatCacheClockTimer();
+}
+
+/*
+ * It may take an unexpectedly long time before the next clock update when
+ * catalog_cache_prune_min_age gets shorter. Disabling the current timer let
+ * the next update happen at the expected interval. We don't necessariry
+ * require this for increase the age but we don't need to avoid to disable
+ * either.
+ */
+void
+assign_catalog_cache_prune_min_age(int newval, void *extra)
+{
+ if (catcache_clock_timeout_active)
+ disable_timeout(CATCACHE_CLOCK_TIMEOUT, false);
+
+ catcache_clock_timeout_active = false;
+}
+
+/*
+ * CatCacheCleanupOldEntries - Remove infrequently-used entries
+ *
+ * Catcache entries can be left alone for several reasons. We remove them if
+ * they are not accessed for a certain time to prevent catcache from
+ * bloating. The eviction is performed with the similar algorithm with buffer
+ * eviction using access counter. Entries that are accessed several times can
+ * live longer than those that have had less access in the same duration.
+ */
+static bool
+CatCacheCleanupOldEntries(CatCache *cp)
+{
+ int nremoved = 0;
+ int nelems_before = cp->cc_ntup;
+ int ndelelems = 0;
+ bool prune_by_age = false;
+ bool prune_by_number = false;
+ dlist_mutable_iter iter;
+
+ /* prune only if the size of the hash is above the target */
+ if (catalog_cache_prune_min_age >= 0 &&
+ cp->cc_memusage > (Size) catalog_cache_memory_target * 1024L)
+ prune_by_age = true;
+
+ if (catalog_cache_entry_limit > 0 &&
+ nelems_before >= catalog_cache_entry_limit)
+ {
+ ndelelems = nelems_before -
+ (int) (catalog_cache_entry_limit * catalog_cache_prune_ratio);
+
+ /* an arbitrary lower limit.. */
+ if (ndelelems < 256)
+ ndelelems = 256;
+ if (ndelelems > nelems_before)
+ ndelelems = nelems_before;
+
+ prune_by_number = true;
+ }
+
+ /* Return immediately if no pruning is wanted */
+ if (!prune_by_age && !prune_by_number)
+ return false;
+
+ /* Scan over LRU to find entries to remove */
+ dlist_foreach_modify(iter, &cp->cc_lru_list)
+ {
+ CatCTup *ct = dlist_container(CatCTup, lru_node, iter.cur);
+ bool remove_this = false;
+
+ /* We don't remove referenced entry */
+ if (ct->refcount != 0 ||
+ (ct->c_list && ct->c_list->refcount != 0))
+ continue;
+
+ /* check against age */
+ if (prune_by_age)
+ {
+ long entry_age;
+ int us;
+
+ /*
+ * Calculate the duration from the time of the last access to the
+ * "current" time. Since catcacheclock is not advanced within a
+ * transaction, the entries that are accessed within the current
+ * transaction won't be pruned.
+ */
+ TimestampDifference(ct->lastaccess, catcacheclock, &entry_age, &us);
+
+ if (entry_age < catalog_cache_prune_min_age)
+ {
+ /* no longer have a business with further entries, exit */
+ prune_by_age = false;
+ break;
+ }
+ /*
+ * Entries that are not accessed after last pruning are removed in
+ * that seconds, and that has been accessed several times are
+ * removed after leaving alone for up to three times of the
+ * duration. We don't try shrink buckets since pruning effectively
+ * caps catcache expansion in the long term.
+ */
+ if (ct->naccess > 0)
+ ct->naccess--;
+ else
+ remove_this = true;
+ }
+
+ /* check against entry number */
+ if (prune_by_number)
+ {
+ if (nremoved < ndelelems)
+ remove_this = true;
+ else
+ prune_by_number = false; /* we're satisfied */
+ }
+
+ /* exit immediately if all finished */
+ if (!prune_by_age && !prune_by_number)
+ break;
+
+ /* do the work */
+ if (remove_this)
+ {
+ CatCacheRemoveCTup(cp, ct);
+ nremoved++;
+ }
+ }
+
+ if (nremoved > 0)
+ elog(DEBUG1, "pruning catalog cache id=%d for %s: removed %d / %d",
+ cp->id, cp->cc_relname, nremoved, nelems_before);
+
+ return nremoved > 0;
+}
+
/*
* Enlarge a catcache, doubling the number of buckets.
*/
@@ -870,6 +1093,7 @@ RehashCatCache(CatCache *cp)
dlist_head *newbucket;
int newnbuckets;
int i;
+ uint64 base_size = MemoryContextGetConsumption(CacheMemoryContext);
elog(DEBUG1, "rehashing catalog cache id %d for %s; %d tups, %d buckets",
cp->id, cp->cc_relname, cp->cc_ntup, cp->cc_nbuckets);
@@ -878,6 +1102,10 @@ RehashCatCache(CatCache *cp)
newnbuckets = cp->cc_nbuckets * 2;
newbucket = (dlist_head *) MemoryContextAllocZero(CacheMemoryContext, newnbuckets * sizeof(dlist_head));
+ /* recalculate memory usage from the first */
+ cp->cc_memusage = cp->cc_head_alloc_size +
+ MemoryContextGetConsumption(CacheMemoryContext) - base_size;
+
/* Move all entries from old hash table to new. */
for (i = 0; i < cp->cc_nbuckets; i++)
{
@@ -890,6 +1118,7 @@ RehashCatCache(CatCache *cp)
dlist_delete(iter.cur);
dlist_push_head(&newbucket[hashIndex], &ct->cache_elem);
+ cp->cc_memusage += ct->size;
}
}
@@ -1274,6 +1503,21 @@ SearchCatCacheInternal(CatCache *cache,
*/
dlist_move_head(bucket, &ct->cache_elem);
+ /* Update access information for pruning */
+ if (ct->naccess < 2)
+ ct->naccess++;
+
+ /*
+ * We don't want too frequent update of
+ * LRU. catalog_cache_prune_min_age can be changed on-session so we
+ * need to maintain the LRU regardless of catalog_cache_prune_min_age.
+ */
+ if (catcacheclock - ct->lastaccess > MIN_LRU_UPDATE_INTERVAL)
+ {
+ ct->lastaccess = catcacheclock;
+ dlist_move_tail(&cache->cc_lru_list, &ct->lru_node);
+ }
+
/*
* If it's a positive entry, bump its refcount and return it. If it's
* negative, we can report failure to the caller.
@@ -1709,6 +1953,11 @@ SearchCatCacheList(CatCache *cache,
/* Now we can build the CatCList entry. */
oldcxt = MemoryContextSwitchTo(CacheMemoryContext);
nmembers = list_length(ctlist);
+
+ /*
+ * Don't waste a time by counting the list in catcache memory usage,
+ * since it doesn't live a long life.
+ */
cl = (CatCList *)
palloc(offsetof(CatCList, members) + nmembers * sizeof(CatCTup *));
@@ -1819,11 +2068,13 @@ CatalogCacheCreateEntry(CatCache *cache, HeapTuple ntp, Datum *arguments,
CatCTup *ct;
HeapTuple dtp;
MemoryContext oldcxt;
+ uint64 base_size = MemoryContextGetConsumption(CacheMemoryContext);
/* negative entries have no tuple associated */
if (ntp)
{
int i;
+ int tupsize;
Assert(!negative);
@@ -1842,8 +2093,8 @@ CatalogCacheCreateEntry(CatCache *cache, HeapTuple ntp, Datum *arguments,
/* Allocate memory for CatCTup and the cached tuple in one go */
oldcxt = MemoryContextSwitchTo(CacheMemoryContext);
- ct = (CatCTup *) palloc(sizeof(CatCTup) +
- MAXIMUM_ALIGNOF + dtp->t_len);
+ tupsize = sizeof(CatCTup) + MAXIMUM_ALIGNOF + dtp->t_len;
+ ct = (CatCTup *) palloc(tupsize);
ct->tuple.t_len = dtp->t_len;
ct->tuple.t_self = dtp->t_self;
ct->tuple.t_tableOid = dtp->t_tableOid;
@@ -1877,7 +2128,6 @@ CatalogCacheCreateEntry(CatCache *cache, HeapTuple ntp, Datum *arguments,
Assert(negative);
oldcxt = MemoryContextSwitchTo(CacheMemoryContext);
ct = (CatCTup *) palloc(sizeof(CatCTup));
-
/*
* Store keys - they'll point into separately allocated memory if not
* by-value.
@@ -1898,18 +2148,36 @@ CatalogCacheCreateEntry(CatCache *cache, HeapTuple ntp, Datum *arguments,
ct->dead = false;
ct->negative = negative;
ct->hash_value = hashValue;
+ ct->naccess = 0;
+ ct->lastaccess = catcacheclock;
+ dlist_push_tail(&cache->cc_lru_list, &ct->lru_node);
dlist_push_head(&cache->cc_bucket[hashIndex], &ct->cache_elem);
cache->cc_ntup++;
CacheHdr->ch_ntup++;
+ ct->size = MemoryContextGetConsumption(CacheMemoryContext) - base_size;
+ cache->cc_memusage += ct->size;
+
+ /* increase refcount so that this survives pruning */
+ ct->refcount++;
+
/*
- * If the hash table has become too full, enlarge the buckets array. Quite
- * arbitrarily, we enlarge when fill factor > 2.
+ * If the hash table has become too full, try cleanup by removing
+ * infrequently used entries to make a room for the new entry. If it
+ * failed, enlarge the bucket array instead. Quite arbitrarily, we try
+ * this when fill factor > 2.
*/
- if (cache->cc_ntup > cache->cc_nbuckets * 2)
+ if (cache->cc_ntup > cache->cc_nbuckets * 2 &&
+ !CatCacheCleanupOldEntries(cache))
RehashCatCache(cache);
+ /* we may still want to prune by entry number, check it */
+ else if (catalog_cache_entry_limit > 0 &&
+ cache->cc_ntup > catalog_cache_entry_limit)
+ CatCacheCleanupOldEntries(cache);
+
+ ct->refcount--;
return ct;
}
@@ -1940,7 +2208,7 @@ CatCacheFreeKeys(TupleDesc tupdesc, int nkeys, int *attnos, Datum *keys)
/*
* Helper routine that copies the keys in the srckeys array into the dstkeys
* one, guaranteeing that the datums are fully allocated in the current memory
- * context.
+ * context. Returns allocated memory size.
*/
static void
CatCacheCopyKeys(TupleDesc tupdesc, int nkeys, int *attnos,
@@ -1976,7 +2244,6 @@ CatCacheCopyKeys(TupleDesc tupdesc, int nkeys, int *attnos,
att->attbyval,
att->attlen);
}
-
}
/*
diff --git a/src/backend/utils/init/globals.c b/src/backend/utils/init/globals.c
index fd51934aaf..0e8b972a29 100644
--- a/src/backend/utils/init/globals.c
+++ b/src/backend/utils/init/globals.c
@@ -32,6 +32,7 @@ volatile sig_atomic_t QueryCancelPending = false;
volatile sig_atomic_t ProcDiePending = false;
volatile sig_atomic_t ClientConnectionLost = false;
volatile sig_atomic_t IdleInTransactionSessionTimeoutPending = false;
+volatile sig_atomic_t CatcacheClockTimeoutPending = false;
volatile sig_atomic_t ConfigReloadPending = false;
volatile uint32 InterruptHoldoffCount = 0;
volatile uint32 QueryCancelHoldoffCount = 0;
diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c
index a5ee209f91..9eb50e9676 100644
--- a/src/backend/utils/init/postinit.c
+++ b/src/backend/utils/init/postinit.c
@@ -72,6 +72,7 @@ static void ShutdownPostgres(int code, Datum arg);
static void StatementTimeoutHandler(void);
static void LockTimeoutHandler(void);
static void IdleInTransactionSessionTimeoutHandler(void);
+static void CatcacheClockTimeoutHandler(void);
static bool ThereIsAtLeastOneRole(void);
static void process_startup_options(Port *port, bool am_superuser);
static void process_settings(Oid databaseid, Oid roleid);
@@ -628,6 +629,8 @@ InitPostgres(const char *in_dbname, Oid dboid, const char *username,
RegisterTimeout(LOCK_TIMEOUT, LockTimeoutHandler);
RegisterTimeout(IDLE_IN_TRANSACTION_SESSION_TIMEOUT,
IdleInTransactionSessionTimeoutHandler);
+ RegisterTimeout(CATCACHE_CLOCK_TIMEOUT,
+ CatcacheClockTimeoutHandler);
}
/*
@@ -1238,6 +1241,14 @@ IdleInTransactionSessionTimeoutHandler(void)
SetLatch(MyLatch);
}
+static void
+CatcacheClockTimeoutHandler(void)
+{
+ CatcacheClockTimeoutPending = true;
+ InterruptPending = true;
+ SetLatch(MyLatch);
+}
+
/*
* Returns true if at least one role is defined in this database cluster.
*/
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 41d477165c..c62d5ad8b8 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -81,6 +81,7 @@
#include "tsearch/ts_cache.h"
#include "utils/builtins.h"
#include "utils/bytea.h"
+#include "utils/catcache.h"
#include "utils/guc_tables.h"
#include "utils/float.h"
#include "utils/memutils.h"
@@ -2205,6 +2206,38 @@ static struct config_int ConfigureNamesInt[] =
NULL, NULL, NULL
},
+ {
+ {"catalog_cache_prune_min_age", PGC_USERSET, RESOURCES_MEM,
+ gettext_noop("Sets the minimum unused duration of cache entries before removal."),
+ gettext_noop("Catalog cache entries that live unused for longer than this seconds are considered to be removed."),
+ GUC_UNIT_S
+ },
+ &catalog_cache_prune_min_age,
+ 300, -1, INT_MAX,
+ NULL, assign_catalog_cache_prune_min_age, NULL
+ },
+
+ {
+ {"catalog_cache_memory_target", PGC_USERSET, RESOURCES_MEM,
+ gettext_noop("Sets the minimum syscache size to keep."),
+ gettext_noop("Time-based cache pruning starts working after exceeding this size."),
+ GUC_UNIT_KB
+ },
+ &catalog_cache_memory_target,
+ 0, 0, MAX_KILOBYTES,
+ NULL, NULL, NULL
+ },
+
+ {
+ {"catalog_cache_entry_limit", PGC_USERSET, RESOURCES_MEM,
+ gettext_noop("Sets the maximum entries of catcache."),
+ NULL
+ },
+ &catalog_cache_entry_limit,
+ 0, 0, INT_MAX,
+ NULL, NULL, NULL
+ },
+
/*
* We use the hopefully-safely-small value of 100kB as the compiled-in
* default for max_stack_depth. InitializeGUCOptions will increase it if
@@ -3368,6 +3401,16 @@ static struct config_real ConfigureNamesReal[] =
NULL, NULL, NULL
},
+ {
+ {"catalog_cache_prune_ratio", PGC_USERSET, RESOURCES_MEM,
+ gettext_noop("Reduce ratio of pruning caused by catalog_cache_entry_limit."),
+ NULL
+ },
+ &catalog_cache_prune_ratio,
+ 0.8, 0.0, 1.0,
+ NULL, NULL, NULL
+ },
+
/* End-of-list marker */
{
{NULL, 0, 0, NULL, NULL}, NULL, 0.0, 0.0, 0.0, NULL, NULL, NULL
diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample
index ad6c436f93..aeb5968e75 100644
--- a/src/backend/utils/misc/postgresql.conf.sample
+++ b/src/backend/utils/misc/postgresql.conf.sample
@@ -128,6 +128,8 @@
#work_mem = 4MB # min 64kB
#maintenance_work_mem = 64MB # min 1MB
#autovacuum_work_mem = -1 # min 1MB, or -1 to use maintenance_work_mem
+#catalog_cache_memory_target = 0kB # in kB
+#catalog_cache_prune_min_age = 300s # -1 disables pruning
#max_stack_depth = 2MB # min 100kB
#shared_memory_type = mmap # the default is the first option
# supported by the operating system:
diff --git a/src/include/miscadmin.h b/src/include/miscadmin.h
index c9e35003a5..33b800e80f 100644
--- a/src/include/miscadmin.h
+++ b/src/include/miscadmin.h
@@ -82,6 +82,7 @@ extern PGDLLIMPORT volatile sig_atomic_t InterruptPending;
extern PGDLLIMPORT volatile sig_atomic_t QueryCancelPending;
extern PGDLLIMPORT volatile sig_atomic_t ProcDiePending;
extern PGDLLIMPORT volatile sig_atomic_t IdleInTransactionSessionTimeoutPending;
+extern PGDLLIMPORT volatile sig_atomic_t CatcacheClockTimeoutPending;
extern PGDLLIMPORT volatile sig_atomic_t ConfigReloadPending;
extern PGDLLIMPORT volatile sig_atomic_t ClientConnectionLost;
diff --git a/src/include/utils/catcache.h b/src/include/utils/catcache.h
index 65d816a583..0a714bf514 100644
--- a/src/include/utils/catcache.h
+++ b/src/include/utils/catcache.h
@@ -22,6 +22,7 @@
#include "access/htup.h"
#include "access/skey.h"
+#include "datatype/timestamp.h"
#include "lib/ilist.h"
#include "utils/relcache.h"
@@ -61,6 +62,11 @@ typedef struct catcache
slist_node cc_next; /* list link */
ScanKeyData cc_skey[CATCACHE_MAXKEYS]; /* precomputed key info for heap
* scans */
+ dlist_head cc_lru_list;
+ int cc_head_alloc_size;/* consumed memory to allocate this struct */
+ int cc_memusage; /* memory usage of this catcache (excluding
+ * header part) */
+ int cc_nfreeent; /* # of entries currently not referenced */
/*
* Keep these at the end, so that compiling catcache.c with CATCACHE_STATS
@@ -119,7 +125,10 @@ typedef struct catctup
bool dead; /* dead but not yet removed? */
bool negative; /* negative cache entry? */
HeapTupleData tuple; /* tuple management header */
-
+ int naccess; /* # of access to this entry, up to 2 */
+ TimestampTz lastaccess; /* approx. timestamp of the last usage */
+ dlist_node lru_node; /* LRU node */
+ int size; /* palloc'ed size off this tuple */
/*
* The tuple may also be a member of at most one CatCList. (If a single
* catcache is list-searched with varying numbers of keys, we may have to
@@ -189,6 +198,45 @@ typedef struct catcacheheader
/* this extern duplicates utils/memutils.h... */
extern PGDLLIMPORT MemoryContext CacheMemoryContext;
+/* for guc.c, not PGDLLPMPORT'ed */
+extern int catalog_cache_prune_min_age;
+extern int catalog_cache_memory_target;
+extern int catalog_cache_entry_limit;
+extern double catalog_cache_prune_ratio;
+
+/* to use as access timestamp of catcache entries */
+extern TimestampTz catcacheclock;
+
+/*
+ * Flag to keep track of whether catcache timestamp timer is active.
+ */
+extern bool catcache_clock_timeout_active;
+
+/* catcache prune time helper functions */
+extern void SetupCatCacheClockTimer(void);
+extern void UpdateCatCacheClock(void);
+
+/*
+ * SetCatCacheClock - set timestamp for catcache access record and start
+ * maintenance timer if needed. We keep to update the clock even while pruning
+ * is disable so that we are not confused by bogus clock value.
+ */
+static inline void
+SetCatCacheClock(TimestampTz ts)
+{
+ catcacheclock = ts;
+
+ if (!catcache_clock_timeout_active && catalog_cache_prune_min_age > 0)
+ SetupCatCacheClockTimer();
+}
+
+static inline TimestampTz
+GetCatCacheClock(void)
+{
+ return catcacheclock;
+}
+
+extern void assign_catalog_cache_prune_min_age(int newval, void *extra);
extern void CreateCacheMemoryContext(void);
extern CatCache *InitCatCache(int id, Oid reloid, Oid indexoid,
diff --git a/src/include/utils/timeout.h b/src/include/utils/timeout.h
index 9244a2a7b7..b2d97b4f7b 100644
--- a/src/include/utils/timeout.h
+++ b/src/include/utils/timeout.h
@@ -31,6 +31,7 @@ typedef enum TimeoutId
STANDBY_TIMEOUT,
STANDBY_LOCK_TIMEOUT,
IDLE_IN_TRANSACTION_SESSION_TIMEOUT,
+ CATCACHE_CLOCK_TIMEOUT,
/* First user-definable timeout reason */
USER_TIMEOUT,
/* Maximum number of timeout reasons */
--
2.16.3
----Next_Part(Wed_Feb_13_15_31_14_2019_467)--
Content-Type: Text/X-Patch; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="v15-0004-Syscache-usage-tracking-feature.patch"
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: [PATCH] Add native windows on arm64 support
@ 2022-04-07 17:42 Tom Lane <[email protected]>
2022-04-07 17:53 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
0 siblings, 1 reply; 93+ messages in thread
From: Tom Lane @ 2022-04-07 17:42 UTC (permalink / raw)
To: Andres Freund <[email protected]>; +Cc: Michael Paquier <[email protected]>; Thomas Munro <[email protected]>; Julien Rouhaud <[email protected]>; Niyas Sait <[email protected]>; PostgreSQL Hackers <[email protected]>
Andres Freund <[email protected]> writes:
> On 2022-04-07 09:40:43 -0400, Tom Lane wrote:
>> If it causes problems down the road, how will we debug it?
> If what causes problems down the road? Afaics the patch doesn't change
> anything outside of windows-on-arm, so it shouldn't cause any breakage we care
> about until we get a buildfarm animal.
Do we have a volunteer to run a buildfarm animal? I don't see much
point in thinking about this till there is one ready to go.
regards, tom lane
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: [PATCH] Add native windows on arm64 support
2022-04-07 17:42 Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
@ 2022-04-07 17:53 ` Andres Freund <[email protected]>
2022-04-19 14:22 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
0 siblings, 1 reply; 93+ messages in thread
From: Andres Freund @ 2022-04-07 17:53 UTC (permalink / raw)
To: Tom Lane <[email protected]>; Niyas Sait <[email protected]>; +Cc: Michael Paquier <[email protected]>; Thomas Munro <[email protected]>; Julien Rouhaud <[email protected]>; PostgreSQL Hackers <[email protected]>
Hi,
On 2022-04-07 13:42:49 -0400, Tom Lane wrote:
> Andres Freund <[email protected]> writes:
> > On 2022-04-07 09:40:43 -0400, Tom Lane wrote:
> >> If it causes problems down the road, how will we debug it?
>
> > If what causes problems down the road? Afaics the patch doesn't change
> > anything outside of windows-on-arm, so it shouldn't cause any breakage we care
> > about until we get a buildfarm animal.
>
> Do we have a volunteer to run a buildfarm animal? I don't see much
> point in thinking about this till there is one ready to go.
OP said that they might be able to:
https://www.postgresql.org/message-id/CAFPTBD_NZb%3Dq_6uE-QV%2BS%2Bpm%3DRc9sBKrg8CQ_Y3dc27Awrm7cQ%40...
Niyas, any updates on that?
Greetings,
Andres Freund
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: [PATCH] Add native windows on arm64 support
2022-04-07 17:42 Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-04-07 17:53 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
@ 2022-04-19 14:22 ` Niyas Sait <[email protected]>
2022-04-20 00:28 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
0 siblings, 1 reply; 93+ messages in thread
From: Niyas Sait @ 2022-04-19 14:22 UTC (permalink / raw)
To: Andres Freund <[email protected]>; +Cc: Tom Lane <[email protected]>; Michael Paquier <[email protected]>; Thomas Munro <[email protected]>; Julien Rouhaud <[email protected]>; PostgreSQL Hackers <[email protected]>
> Niyas, any updates on that?
Sorry for the delay! Configuring the scripts took some time. I have
successfully run the builfarm animal script using my git repository [1]
which contains the proposed patch on a Windows Arm64 machine.
I made a request to add a new machine to build farm through [2].
I believe we should be able to enable the build farm machine once the
change has been merged.
Thanks,
Niyas
[1] https://github.com/nsait-linaro/postgres.git
[2] https://buildfarm.postgresql.org/cgi-bin/register-form.pl
On Thu, 7 Apr 2022 at 18:54, Andres Freund <[email protected]> wrote:
> Hi,
>
> On 2022-04-07 13:42:49 -0400, Tom Lane wrote:
> > Andres Freund <[email protected]> writes:
> > > On 2022-04-07 09:40:43 -0400, Tom Lane wrote:
> > >> If it causes problems down the road, how will we debug it?
> >
> > > If what causes problems down the road? Afaics the patch doesn't change
> > > anything outside of windows-on-arm, so it shouldn't cause any breakage
> we care
> > > about until we get a buildfarm animal.
> >
> > Do we have a volunteer to run a buildfarm animal? I don't see much
> > point in thinking about this till there is one ready to go.
>
> OP said that they might be able to:
>
> https://www.postgresql.org/message-id/CAFPTBD_NZb%3Dq_6uE-QV%2BS%2Bpm%3DRc9sBKrg8CQ_Y3dc27Awrm7cQ%40...
>
> Niyas, any updates on that?
>
> Greetings,
>
> Andres Freund
>
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: [PATCH] Add native windows on arm64 support
2022-04-07 17:42 Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-04-07 17:53 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-04-19 14:22 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
@ 2022-04-20 00:28 ` Michael Paquier <[email protected]>
2022-04-20 09:43 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
0 siblings, 1 reply; 93+ messages in thread
From: Michael Paquier @ 2022-04-20 00:28 UTC (permalink / raw)
To: Niyas Sait <[email protected]>; +Cc: Andres Freund <[email protected]>; Tom Lane <[email protected]>; Thomas Munro <[email protected]>; Julien Rouhaud <[email protected]>; PostgreSQL Hackers <[email protected]>
On Tue, Apr 19, 2022 at 03:22:30PM +0100, Niyas Sait wrote:
> Sorry for the delay! Configuring the scripts took some time. I have
> successfully run the builfarm animal script using my git repository [1]
> which contains the proposed patch on a Windows Arm64 machine.
>
> I made a request to add a new machine to build farm through [2].
Have you tested with the amount of coverage provided by vcregress.pl?
Another thing I was wondering about is if it would be possible to have
this option in Travis, but that does not seem to be the case:
https://docs.travis-ci.com/user/reference/windows/#windows-version
> I believe we should be able to enable the build farm machine once the
> change has been merged.
Better to wait for the beginning of the development cycle at this
stage, based on all the replies received. That would bring us to the
beginning of July.
+ if ($solution->{platform} eq 'ARM64') {
+ push(@pgportfiles, 'pg_crc32c_armv8_choose.c');
+ push(@pgportfiles, 'pg_crc32c_armv8.c');
+ } else {
+ push(@pgportfiles, 'pg_crc32c_sse42_choose.c');
+ push(@pgportfiles, 'pg_crc32c_sse42.c');
+ }
+++ b/src/port/pg_crc32c_armv8.c
+#ifndef _MSC_VER
#include <arm_acle.h>
+#endif
[ ... ]
+#ifdef _M_ARM64
+ /*
+ * arm64 way of hinting processor for spin loops optimisations
+ * ref: https://community.arm.com/support-forums/f/infrastructure-solutions-forum/48654/ssetoneon-faq
+ */
+ __isb(_ARM64_BARRIER_SY);
+#else
I think that such extra optimizations had better be in a separate
patch, and we should focus on getting the build done first.
+ # arm64 linker only supports dynamic base address
+ my $cfgrandbaseaddress = $self->{platform} eq 'ARM64' ? 'true' : 'false';
This issue is still lying around, and you may have been lucky. Would
there be any issues to remove this change to get a basic support in?
As mentioned upthread, there is a long history of Postgres with ASLR.
This would mean that a basic patch could be done with just the changes
for gendef.pl, and the first part of the changes inMSBuildProject.pm.
Would that not be enough?
--
Michael
Attachments:
[application/pgp-signature] signature.asc (833B, ../../Yl9TmT%[email protected]/2-signature.asc)
download
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: [PATCH] Add native windows on arm64 support
2022-04-07 17:42 Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-04-07 17:53 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-04-19 14:22 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-20 00:28 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
@ 2022-04-20 09:43 ` Niyas Sait <[email protected]>
2022-04-21 04:07 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
0 siblings, 1 reply; 93+ messages in thread
From: Niyas Sait @ 2022-04-20 09:43 UTC (permalink / raw)
To: Michael Paquier <[email protected]>; +Cc: Andres Freund <[email protected]>; Tom Lane <[email protected]>; Thomas Munro <[email protected]>; Julien Rouhaud <[email protected]>; PostgreSQL Hackers <[email protected]>
> Have you tested with the amount of coverage provided by vcregress.pl?
I built and ran the relevant tests with the help of run_build.pl.
I think following tests are executed - check, contribcheck, ecpgcheck,
installcheck, isolationcheck, modulescheck, and upgradecheck.
> Another thing I was wondering about is if it would be possible to have
> this option in Travis, but that does not seem to be the case:
> https://docs.travis-ci.com/user/reference/windows/#windows-version
Yes, I think Travis doesn't yet support Windows/Arm64 platform.
> + if ($solution->{platform} eq 'ARM64') {
> + push(@pgportfiles, 'pg_crc32c_armv8_choose.c');
> + push(@pgportfiles, 'pg_crc32c_armv8.c');
> + } else {
> + push(@pgportfiles, 'pg_crc32c_sse42_choose.c');
> + push(@pgportfiles, 'pg_crc32c_sse42.c');
> + }
>
> +++ b/src/port/pg_crc32c_armv8.c
> +#ifndef _MSC_VER
> #include <arm_acle.h>
> +#endif
> [ ... ]
> +#ifdef _M_ARM64
> + /*
> + * arm64 way of hinting processor for spin loops optimisations
> + * ref:
https://community.arm.com/support-forums/f/infrastructure-solutions-forum/48654/ssetoneon-faq
> + */
> + __isb(_ARM64_BARRIER_SY);
> +#else
> I think that such extra optimizations had better be in a separate
> patch, and we should focus on getting the build done first.
> This would mean that a basic patch could be done with just the changes
> for gendef.pl, and the first part of the changes inMSBuildProject.pm.
> Would that not be enough?
I cannot build without any of the above changes. Nothing specific for
optimization
is added to this patch.
> + # arm64 linker only supports dynamic base address
> + my $cfgrandbaseaddress = $self->{platform} eq 'ARM64' ? 'true' :
'false';
> This issue is still lying around, and you may have been lucky. Would
> there be any issues to remove this change to get a basic support in?
> As mentioned upthread, there is a long history of Postgres with ASLR.
MSVC linker doesn't allow non-random base addresses for Arm64 platforms.
It is needed for basic support.
Niyas
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: [PATCH] Add native windows on arm64 support
2022-04-07 17:42 Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-04-07 17:53 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-04-19 14:22 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-20 00:28 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-04-20 09:43 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
@ 2022-04-21 04:07 ` Michael Paquier <[email protected]>
2022-04-21 09:21 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
0 siblings, 1 reply; 93+ messages in thread
From: Michael Paquier @ 2022-04-21 04:07 UTC (permalink / raw)
To: Niyas Sait <[email protected]>; +Cc: Andres Freund <[email protected]>; Tom Lane <[email protected]>; Thomas Munro <[email protected]>; Julien Rouhaud <[email protected]>; PostgreSQL Hackers <[email protected]>
On Wed, Apr 20, 2022 at 10:43:06AM +0100, Niyas Sait wrote:
>> This issue is still lying around, and you may have been lucky. Would
>> there be any issues to remove this change to get a basic support in?
>> As mentioned upthread, there is a long history of Postgres with ASLR.
>
> MSVC linker doesn't allow non-random base addresses for Arm64 platforms.
> It is needed for basic support.
Why does it not allow that? Is that just a limitation of the
compiler? If yes, what is the error happening? This question is not
exactly answered yet as of this thread. I may be missing a reference
about that in the upstream docs, but I see nowhere an explanation
about the reason and the why. That's also one of the first questions
from Thomas upthread.
--
Michael
Attachments:
[application/pgp-signature] signature.asc (833B, ../../[email protected]/2-signature.asc)
download
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: [PATCH] Add native windows on arm64 support
2022-04-07 17:42 Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-04-07 17:53 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-04-19 14:22 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-20 00:28 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-04-20 09:43 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-21 04:07 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
@ 2022-04-21 09:21 ` Niyas Sait <[email protected]>
2022-04-25 01:17 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
0 siblings, 1 reply; 93+ messages in thread
From: Niyas Sait @ 2022-04-21 09:21 UTC (permalink / raw)
To: Michael Paquier <[email protected]>; +Cc: Andres Freund <[email protected]>; Tom Lane <[email protected]>; Thomas Munro <[email protected]>; Julien Rouhaud <[email protected]>; PostgreSQL Hackers <[email protected]>
> Why does it not allow that? Is that just a limitation of the
> compiler? If yes, what is the error happening? This question is not
> exactly answered yet as of this thread. I may be missing a reference
> about that in the upstream docs, but I see nowhere an explanation
> about the reason and the why. That's also one of the first questions
> from Thomas upthread.
The following error occurs:
LINK : fatal error LNK1246: '/DYNAMICBASE:NO' not compatible with 'ARM64'
target machine; link without '/DYNAMICBASE:NO
This seems to be a deliberate restriction for Arm64 targets. However, no
references were provided. To clarify, I have posted a question [1] on the
community channel of Visual Studio.
Niyas
[1]
https://developercommunity.visualstudio.com/t/LINK-:-fatal-error-LNK1246:-DYNAMICBAS/10020163
On Thu, 21 Apr 2022 at 05:07, Michael Paquier <[email protected]> wrote:
> On Wed, Apr 20, 2022 at 10:43:06AM +0100, Niyas Sait wrote:
> >> This issue is still lying around, and you may have been lucky. Would
> >> there be any issues to remove this change to get a basic support in?
> >> As mentioned upthread, there is a long history of Postgres with ASLR.
> >
> > MSVC linker doesn't allow non-random base addresses for Arm64 platforms.
> > It is needed for basic support.
>
> Why does it not allow that? Is that just a limitation of the
> compiler? If yes, what is the error happening? This question is not
> exactly answered yet as of this thread. I may be missing a reference
> about that in the upstream docs, but I see nowhere an explanation
> about the reason and the why. That's also one of the first questions
> from Thomas upthread.
> --
> Michael
>
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: [PATCH] Add native windows on arm64 support
2022-04-07 17:42 Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-04-07 17:53 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-04-19 14:22 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-20 00:28 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-04-20 09:43 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-21 04:07 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-04-21 09:21 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
@ 2022-04-25 01:17 ` Michael Paquier <[email protected]>
2022-05-09 11:44 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
0 siblings, 1 reply; 93+ messages in thread
From: Michael Paquier @ 2022-04-25 01:17 UTC (permalink / raw)
To: Niyas Sait <[email protected]>; +Cc: Andres Freund <[email protected]>; Tom Lane <[email protected]>; Thomas Munro <[email protected]>; Julien Rouhaud <[email protected]>; PostgreSQL Hackers <[email protected]>
On Thu, Apr 21, 2022 at 10:21:04AM +0100, Niyas Sait wrote:
> The following error occurs:
>
> LINK : fatal error LNK1246: '/DYNAMICBASE:NO' not compatible with 'ARM64'
> target machine; link without '/DYNAMICBASE:NO
Okay, that's interesting. In light of things like 7f3e17b, that may
be annoying. Perhaps newer Windows versions are able to handle that
better. I am wondering if it would be worth re-evaluating this
change, and attempt to re-enable that in environments other than
arm64. This could become interesting if we consider that there have
been talks to cut the support for a bunch of Windows versions to focus
on the newer ones only.
> This seems to be a deliberate restriction for Arm64 targets. However, no
> references were provided. To clarify, I have posted a question [1] on the
> community channel of Visual Studio.
Thanks for doing that! Your post is just a couple of days old, let's
see if we get a reply on that.
--
Michael
Attachments:
[application/pgp-signature] signature.asc (833B, ../../[email protected]/2-signature.asc)
download
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: [PATCH] Add native windows on arm64 support
2022-04-07 17:42 Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-04-07 17:53 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-04-19 14:22 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-20 00:28 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-04-20 09:43 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-21 04:07 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-04-21 09:21 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-25 01:17 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
@ 2022-05-09 11:44 ` Niyas Sait <[email protected]>
2022-05-10 01:01 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
0 siblings, 1 reply; 93+ messages in thread
From: Niyas Sait @ 2022-05-09 11:44 UTC (permalink / raw)
To: Michael Paquier <[email protected]>; +Cc: Andres Freund <[email protected]>; Tom Lane <[email protected]>; Thomas Munro <[email protected]>; Julien Rouhaud <[email protected]>; PostgreSQL Hackers <[email protected]>
> Thanks for doing that! Your post is just a couple of days old, let's
> see if we get a reply on that.
Microsoft updated documentation [1] and clarified that ASLR cannot be
disabled for Arm64 targets.
Because ASLR can't be disabled on ARM, ARM64, or ARM64EC architectures,
> /DYNAMICBASE:NO isn't supported for these targets.
Thanks
Niyas
[1]
https://docs.microsoft.com/en-us/cpp/build/reference/dynamicbase?view=msvc-170
On Mon, 25 Apr 2022 at 02:17, Michael Paquier <[email protected]> wrote:
> On Thu, Apr 21, 2022 at 10:21:04AM +0100, Niyas Sait wrote:
> > The following error occurs:
> >
> > LINK : fatal error LNK1246: '/DYNAMICBASE:NO' not compatible with 'ARM64'
> > target machine; link without '/DYNAMICBASE:NO
>
> Okay, that's interesting. In light of things like 7f3e17b, that may
> be annoying. Perhaps newer Windows versions are able to handle that
> better. I am wondering if it would be worth re-evaluating this
> change, and attempt to re-enable that in environments other than
> arm64. This could become interesting if we consider that there have
> been talks to cut the support for a bunch of Windows versions to focus
> on the newer ones only.
>
> > This seems to be a deliberate restriction for Arm64 targets. However, no
> > references were provided. To clarify, I have posted a question [1] on the
> > community channel of Visual Studio.
>
> Thanks for doing that! Your post is just a couple of days old, let's
> see if we get a reply on that.
> --
> Michael
>
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: [PATCH] Add native windows on arm64 support
2022-04-07 17:42 Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-04-07 17:53 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-04-19 14:22 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-20 00:28 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-04-20 09:43 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-21 04:07 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-04-21 09:21 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-25 01:17 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-05-09 11:44 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
@ 2022-05-10 01:01 ` Michael Paquier <[email protected]>
2022-07-14 08:36 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-08-26 01:29 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
0 siblings, 2 replies; 93+ messages in thread
From: Michael Paquier @ 2022-05-10 01:01 UTC (permalink / raw)
To: Niyas Sait <[email protected]>; +Cc: Andres Freund <[email protected]>; Tom Lane <[email protected]>; Thomas Munro <[email protected]>; Julien Rouhaud <[email protected]>; PostgreSQL Hackers <[email protected]>
On Mon, May 09, 2022 at 12:44:22PM +0100, Niyas Sait wrote:
> Microsoft updated documentation [1] and clarified that ASLR cannot be
> disabled for Arm64 targets.
>
> Because ASLR can't be disabled on ARM, ARM64, or ARM64EC architectures,
> > /DYNAMICBASE:NO isn't supported for these targets.
Better than nothing, I guess, though this does not stand as a reason
explaining why this choice has been made. And it looks like we will
never know. We are going to need more advanced testing to check that
DYNAMICBASE is stable enough if we begin to enable it. Perhaps we
should really look at that for all the build targets we currently
support rather than just ARM, for the most modern Win32 environments
if we are going to cut support for most of the oldest releases..
--
Michael
Attachments:
[application/pgp-signature] signature.asc (833B, ../../Ynm5g2152%2FyKc%[email protected]/2-signature.asc)
download
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: [PATCH] Add native windows on arm64 support
2022-04-07 17:42 Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-04-07 17:53 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-04-19 14:22 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-20 00:28 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-04-20 09:43 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-21 04:07 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-04-21 09:21 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-25 01:17 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-05-09 11:44 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-05-10 01:01 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
@ 2022-07-14 08:36 ` Niyas Sait <[email protected]>
1 sibling, 0 replies; 93+ messages in thread
From: Niyas Sait @ 2022-07-14 08:36 UTC (permalink / raw)
To: Michael Paquier <[email protected]>; +Cc: Andres Freund <[email protected]>; Tom Lane <[email protected]>; Thomas Munro <[email protected]>; Julien Rouhaud <[email protected]>; PostgreSQL Hackers <[email protected]>
Hello,
Please find a new patch (no further changes) rebased on top of the master.
On Tue, 10 May 2022 at 02:02, Michael Paquier <[email protected]> wrote:
> On Mon, May 09, 2022 at 12:44:22PM +0100, Niyas Sait wrote:
> > Microsoft updated documentation [1] and clarified that ASLR cannot be
> > disabled for Arm64 targets.
> >
> > Because ASLR can't be disabled on ARM, ARM64, or ARM64EC architectures,
> > > /DYNAMICBASE:NO isn't supported for these targets.
>
> Better than nothing, I guess, though this does not stand as a reason
> explaining why this choice has been made. And it looks like we will
> never know. We are going to need more advanced testing to check that
> DYNAMICBASE is stable enough if we begin to enable it. Perhaps we
> should really look at that for all the build targets we currently
> support rather than just ARM, for the most modern Win32 environments
> if we are going to cut support for most of the oldest releases..
> --
> Michael
>
--
Niyas Sait
Linaro Limited
Attachments:
[application/octet-stream] v2-0001-Enable-postgres-native-build-for-windows-arm64-pl.patch (5.7K, ../../CAFPTBD_zcrXZihjbyUENiMLkx8JH+FrSEGFr0E0ZX4VKnmoj4w@mail.gmail.com/3-v2-0001-Enable-postgres-native-build-for-windows-arm64-pl.patch)
download | inline diff:
From 36b5ef714ca4213a25a5f2b02e936826c8dcae43 Mon Sep 17 00:00:00 2001
From: Niyas Sait <[email protected]>
Date: Tue, 22 Feb 2022 13:07:24 +0000
Subject: [PATCH v2] Enable postgres native build for windows-arm64 platform
Following changes are included
- Extend MSVC scripts to handle ARM64 platform
- Add arm64 definition of spin_delay function
- Exclude arm_acle.h import for MSVC
---
src/include/storage/s_lock.h | 10 +++++++++-
src/port/pg_crc32c_armv8.c | 2 ++
src/tools/msvc/MSBuildProject.pm | 15 +++++++++++----
src/tools/msvc/Mkvcbuild.pm | 9 +++++++--
src/tools/msvc/Solution.pm | 9 +++++++--
src/tools/msvc/gendef.pl | 8 ++++----
6 files changed, 40 insertions(+), 13 deletions(-)
diff --git a/src/include/storage/s_lock.h b/src/include/storage/s_lock.h
index 1c9f6f0895..5ee3bddabc 100644
--- a/src/include/storage/s_lock.h
+++ b/src/include/storage/s_lock.h
@@ -703,13 +703,21 @@ typedef LONG slock_t;
#define SPIN_DELAY() spin_delay()
/* If using Visual C++ on Win64, inline assembly is unavailable.
- * Use a _mm_pause intrinsic instead of rep nop.
+ * Use _mm_pause (x64) or __isb(arm64) intrinsic instead of rep nop.
*/
#if defined(_WIN64)
static __forceinline void
spin_delay(void)
{
+#ifdef _M_ARM64
+ /*
+ * arm64 way of hinting processor for spin loops optimisations
+ * ref: https://community.arm.com/support-forums/f/infrastructure-solutions-forum/48654/ssetoneon-faq
+ */
+ __isb(_ARM64_BARRIER_SY);
+#else
_mm_pause();
+#endif
}
#else
static __forceinline void
diff --git a/src/port/pg_crc32c_armv8.c b/src/port/pg_crc32c_armv8.c
index 9e301f96f6..981718752f 100644
--- a/src/port/pg_crc32c_armv8.c
+++ b/src/port/pg_crc32c_armv8.c
@@ -14,7 +14,9 @@
*/
#include "c.h"
+#ifndef _MSC_VER
#include <arm_acle.h>
+#endif
#include "port/pg_crc32c.h"
diff --git a/src/tools/msvc/MSBuildProject.pm b/src/tools/msvc/MSBuildProject.pm
index 62acdda3a1..5128dc9bd6 100644
--- a/src/tools/msvc/MSBuildProject.pm
+++ b/src/tools/msvc/MSBuildProject.pm
@@ -310,11 +310,18 @@ sub WriteItemDefinitionGroup
: ($self->{type} eq "dll" ? 'DynamicLibrary' : 'StaticLibrary');
my $libs = $self->GetAdditionalLinkerDependencies($cfgname, ';');
- my $targetmachine =
- $self->{platform} eq 'Win32' ? 'MachineX86' : 'MachineX64';
+ my $targetmachine;
+ if ($self->{platform} eq 'Win32') {
+ $targetmachine = 'MachineX86';
+ } elsif ($self->{platform} eq 'ARM64'){
+ $targetmachine = 'MachineARM64';
+ } else {
+ $targetmachine = 'MachineX64';
+ }
my $includes = join ';', @{ $self->{includes} }, "";
-
+ # arm64 linker only supports dynamic base address
+ my $cfgrandbaseaddress = $self->{platform} eq 'ARM64' ? 'true' : 'false';
print $f <<EOF;
<ItemDefinitionGroup Condition="'\$(Configuration)|\$(Platform)'=='$cfgname|$self->{platform}'">
<ClCompile>
@@ -347,7 +354,7 @@ sub WriteItemDefinitionGroup
<ProgramDatabaseFile>.\\$cfgname\\$self->{name}\\$self->{name}.pdb</ProgramDatabaseFile>
<GenerateMapFile>false</GenerateMapFile>
<MapFileName>.\\$cfgname\\$self->{name}\\$self->{name}.map</MapFileName>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ <RandomizedBaseAddress>$cfgrandbaseaddress</RandomizedBaseAddress>
<!-- Permit links to MinGW-built, 32-bit DLLs (default before VS2012). -->
<ImageHasSafeExceptionHandlers/>
<SubSystem>Console</SubSystem>
diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm
index e4feda10fd..fab85a957e 100644
--- a/src/tools/msvc/Mkvcbuild.pm
+++ b/src/tools/msvc/Mkvcbuild.pm
@@ -114,8 +114,13 @@ sub mkvcbuild
if ($vsVersion >= '9.00')
{
- push(@pgportfiles, 'pg_crc32c_sse42_choose.c');
- push(@pgportfiles, 'pg_crc32c_sse42.c');
+ if ($solution->{platform} eq 'ARM64') {
+ push(@pgportfiles, 'pg_crc32c_armv8_choose.c');
+ push(@pgportfiles, 'pg_crc32c_armv8.c');
+ } else {
+ push(@pgportfiles, 'pg_crc32c_sse42_choose.c');
+ push(@pgportfiles, 'pg_crc32c_sse42.c');
+ }
push(@pgportfiles, 'pg_crc32c_sb8.c');
}
else
diff --git a/src/tools/msvc/Solution.pm b/src/tools/msvc/Solution.pm
index fa32dc371d..6d4ba86167 100644
--- a/src/tools/msvc/Solution.pm
+++ b/src/tools/msvc/Solution.pm
@@ -67,8 +67,13 @@ sub DeterminePlatform
# Examine CL help output to determine if we are in 32 or 64-bit mode.
my $output = `cl /help 2>&1`;
$? >> 8 == 0 or die "cl command not found";
- $self->{platform} =
- ($output =~ /^\/favor:<.+AMD64/m) ? 'x64' : 'Win32';
+ if ($output =~ /^\/favor:<.+AMD64/m) {
+ $self->{platform} = 'x64';
+ } elsif($output =~ /for ARM64$/m) {
+ $self->{platform} = 'ARM64';
+ } else {
+ $self->{platform} = 'Win32';
+ }
}
else
{
diff --git a/src/tools/msvc/gendef.pl b/src/tools/msvc/gendef.pl
index b8c514a831..2068484b14 100644
--- a/src/tools/msvc/gendef.pl
+++ b/src/tools/msvc/gendef.pl
@@ -120,9 +120,9 @@ sub writedef
{
my $isdata = $def->{$f} eq 'data';
- # Strip the leading underscore for win32, but not x64
+ # Strip the leading underscore for win32, but not x64 and arm64
$f =~ s/^_//
- unless ($platform eq "x64");
+ unless ($platform ne "Win32");
# Emit just the name if it's a function symbol, or emit the name
# decorated with the DATA option for variables.
@@ -144,13 +144,13 @@ sub usage
{
die( "Usage: gendef.pl <modulepath> <platform>\n"
. " modulepath: path to dir with obj files, no trailing slash"
- . " platform: Win32 | x64");
+ . " platform: Win32 | x64 | ARM64");
}
usage()
unless scalar(@ARGV) == 2
&& ( ($ARGV[0] =~ /\\([^\\]+$)/)
- && ($ARGV[1] eq 'Win32' || $ARGV[1] eq 'x64'));
+ && ($ARGV[1] eq 'Win32' || $ARGV[1] eq 'x64' || $ARGV[1] eq 'ARM64'));
my $defname = uc $1;
my $deffile = "$ARGV[0]/$defname.def";
my $platform = $ARGV[1];
--
2.35.0.windows.1
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: [PATCH] Add native windows on arm64 support
2022-04-07 17:42 Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-04-07 17:53 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-04-19 14:22 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-20 00:28 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-04-20 09:43 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-21 04:07 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-04-21 09:21 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-25 01:17 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-05-09 11:44 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-05-10 01:01 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
@ 2022-08-26 01:29 ` Andres Freund <[email protected]>
2022-08-26 02:09 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
1 sibling, 1 reply; 93+ messages in thread
From: Andres Freund @ 2022-08-26 01:29 UTC (permalink / raw)
To: Michael Paquier <[email protected]>; +Cc: Niyas Sait <[email protected]>; Tom Lane <[email protected]>; Thomas Munro <[email protected]>; Julien Rouhaud <[email protected]>; PostgreSQL Hackers <[email protected]>
Hi,
On 2022-05-10 10:01:55 +0900, Michael Paquier wrote:
> On Mon, May 09, 2022 at 12:44:22PM +0100, Niyas Sait wrote:
> > Microsoft updated documentation [1] and clarified that ASLR cannot be
> > disabled for Arm64 targets.
> >
> > Because ASLR can't be disabled on ARM, ARM64, or ARM64EC architectures,
> > > /DYNAMICBASE:NO isn't supported for these targets.
>
> Better than nothing, I guess, though this does not stand as a reason
> explaining why this choice has been made. And it looks like we will
> never know. We are going to need more advanced testing to check that
> DYNAMICBASE is stable enough if we begin to enable it. Perhaps we
> should really look at that for all the build targets we currently
> support rather than just ARM, for the most modern Win32 environments
> if we are going to cut support for most of the oldest releases..
I accidentally did a lot of testing with DYNAMICBASE - I accidentally
mistranslated MSBuildProject.pm's <RandomizedBaseAddress>false</> to adding
/DYNAMICBASE in the meson port. Survived several hundred CI cycles and dozens
of local runs without observing any problems related to that.
Which doesn't surprise me, given the way we reserve space in the new process.
Greetings,
Andres Freund
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: [PATCH] Add native windows on arm64 support
2022-04-07 17:42 Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-04-07 17:53 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-04-19 14:22 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-20 00:28 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-04-20 09:43 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-21 04:07 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-04-21 09:21 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-25 01:17 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-05-09 11:44 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-05-10 01:01 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-26 01:29 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
@ 2022-08-26 02:09 ` Michael Paquier <[email protected]>
2022-08-26 03:29 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
0 siblings, 1 reply; 93+ messages in thread
From: Michael Paquier @ 2022-08-26 02:09 UTC (permalink / raw)
To: Andres Freund <[email protected]>; +Cc: Niyas Sait <[email protected]>; Tom Lane <[email protected]>; Thomas Munro <[email protected]>; Julien Rouhaud <[email protected]>; PostgreSQL Hackers <[email protected]>
On Thu, Aug 25, 2022 at 06:29:07PM -0700, Andres Freund wrote:
> I accidentally did a lot of testing with DYNAMICBASE - I accidentally
> mistranslated MSBuildProject.pm's <RandomizedBaseAddress>false</> to adding
> /DYNAMICBASE in the meson port. Survived several hundred CI cycles and dozens
> of local runs without observing any problems related to that.
>
> Which doesn't surprise me, given the way we reserve space in the new process.
Still, we had problems with that in the past and I don't recall huge
changes in the way we allocate shmem on WIN32. Could there be some
stuff in Windows itself that would explain more stability? I would
not mind switching back to DYNAMICBASE on HEAD seeing your results.
That would simplify this thread's patch a bit as well.
--
Michael
Attachments:
[application/pgp-signature] signature.asc (833B, ../../[email protected]/2-signature.asc)
download
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: [PATCH] Add native windows on arm64 support
2022-04-07 17:42 Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-04-07 17:53 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-04-19 14:22 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-20 00:28 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-04-20 09:43 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-21 04:07 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-04-21 09:21 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-25 01:17 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-05-09 11:44 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-05-10 01:01 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-26 01:29 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-26 02:09 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
@ 2022-08-26 03:29 ` Andres Freund <[email protected]>
2022-08-27 02:33 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
0 siblings, 1 reply; 93+ messages in thread
From: Andres Freund @ 2022-08-26 03:29 UTC (permalink / raw)
To: Michael Paquier <[email protected]>; +Cc: Niyas Sait <[email protected]>; Tom Lane <[email protected]>; Thomas Munro <[email protected]>; Julien Rouhaud <[email protected]>; PostgreSQL Hackers <[email protected]>
Hi,
On 2022-08-26 11:09:41 +0900, Michael Paquier wrote:
> On Thu, Aug 25, 2022 at 06:29:07PM -0700, Andres Freund wrote:
> > I accidentally did a lot of testing with DYNAMICBASE - I accidentally
> > mistranslated MSBuildProject.pm's <RandomizedBaseAddress>false</> to adding
> > /DYNAMICBASE in the meson port. Survived several hundred CI cycles and dozens
> > of local runs without observing any problems related to that.
> >
> > Which doesn't surprise me, given the way we reserve space in the new process.
>
> Still, we had problems with that in the past and I don't recall huge
> changes in the way we allocate shmem on WIN32.
It's really not great that 7f3e17b4827 disabled randomization without even a
comment as to why...
There actually seems to have been a lot of work in that area. See 617dc6d299c
/ bcbf2346d69 and as well as the retrying in 45e004fb4e39. Those weren't
prevented by us disabling ASLR.
Greetings,
Andres Freund
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: [PATCH] Add native windows on arm64 support
2022-04-07 17:42 Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-04-07 17:53 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-04-19 14:22 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-20 00:28 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-04-20 09:43 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-21 04:07 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-04-21 09:21 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-25 01:17 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-05-09 11:44 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-05-10 01:01 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-26 01:29 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-26 02:09 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-26 03:29 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
@ 2022-08-27 02:33 ` Michael Paquier <[email protected]>
2022-08-27 03:02 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-08-27 19:27 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
0 siblings, 2 replies; 93+ messages in thread
From: Michael Paquier @ 2022-08-27 02:33 UTC (permalink / raw)
To: Andres Freund <[email protected]>; +Cc: Niyas Sait <[email protected]>; Tom Lane <[email protected]>; Thomas Munro <[email protected]>; Julien Rouhaud <[email protected]>; PostgreSQL Hackers <[email protected]>
On Thu, Aug 25, 2022 at 08:29:43PM -0700, Andres Freund wrote:
> It's really not great that 7f3e17b4827 disabled randomization without even a
> comment as to why...
This story is on this thread, with some processes not able to start:
https://www.postgresql.org/message-id/BD0D89EC2438455C9DE0DC94D36912F4@maumau
> There actually seems to have been a lot of work in that area. See 617dc6d299c
> / bcbf2346d69 and as well as the retrying in 45e004fb4e39. Those weren't
> prevented by us disabling ASLR.
Indeed. 45e004f looks like the most interesting bit here. FWIW, I
would not mind re-enabling that on HEAD, as of something like the
attached. I have done a dozen of runs without seeing a test failure,
and knowing that we don't support anything older than Win10 makes me
feel safer about this change. Any objections?
--
Michael
Attachments:
[text/x-diff] 0001-Re-enable-ASLR-on-Windows.patch (973B, ../../YwmCj%[email protected]/2-0001-Re-enable-ASLR-on-Windows.patch)
download | inline diff:
From 0fde47c2d4e65bd9f1f5a7b4607f8b8b95162242 Mon Sep 17 00:00:00 2001
From: Michael Paquier <[email protected]>
Date: Sat, 27 Aug 2022 10:20:53 +0900
Subject: [PATCH] Re-enable ASLR on Windows
---
src/tools/msvc/MSBuildProject.pm | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/tools/msvc/MSBuildProject.pm b/src/tools/msvc/MSBuildProject.pm
index 62acdda3a1..594729ceb7 100644
--- a/src/tools/msvc/MSBuildProject.pm
+++ b/src/tools/msvc/MSBuildProject.pm
@@ -347,7 +347,6 @@ sub WriteItemDefinitionGroup
<ProgramDatabaseFile>.\\$cfgname\\$self->{name}\\$self->{name}.pdb</ProgramDatabaseFile>
<GenerateMapFile>false</GenerateMapFile>
<MapFileName>.\\$cfgname\\$self->{name}\\$self->{name}.map</MapFileName>
- <RandomizedBaseAddress>false</RandomizedBaseAddress>
<!-- Permit links to MinGW-built, 32-bit DLLs (default before VS2012). -->
<ImageHasSafeExceptionHandlers/>
<SubSystem>Console</SubSystem>
--
2.37.2
[application/pgp-signature] signature.asc (833B, ../../YwmCj%[email protected]/3-signature.asc)
download
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: [PATCH] Add native windows on arm64 support
2022-04-07 17:42 Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-04-07 17:53 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-04-19 14:22 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-20 00:28 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-04-20 09:43 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-21 04:07 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-04-21 09:21 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-25 01:17 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-05-09 11:44 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-05-10 01:01 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-26 01:29 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-26 02:09 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-26 03:29 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-27 02:33 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
@ 2022-08-27 03:02 ` Tom Lane <[email protected]>
1 sibling, 0 replies; 93+ messages in thread
From: Tom Lane @ 2022-08-27 03:02 UTC (permalink / raw)
To: Michael Paquier <[email protected]>; +Cc: Andres Freund <[email protected]>; Niyas Sait <[email protected]>; Thomas Munro <[email protected]>; Julien Rouhaud <[email protected]>; PostgreSQL Hackers <[email protected]>
Michael Paquier <[email protected]> writes:
> Indeed. 45e004f looks like the most interesting bit here. FWIW, I
> would not mind re-enabling that on HEAD, as of something like the
> attached. I have done a dozen of runs without seeing a test failure,
> and knowing that we don't support anything older than Win10 makes me
> feel safer about this change. Any objections?
We're early enough in the v16 cycle to have plenty of time to detect
any problems, so I see little reason not to try it.
regards, tom lane
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: [PATCH] Add native windows on arm64 support
2022-04-07 17:42 Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-04-07 17:53 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-04-19 14:22 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-20 00:28 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-04-20 09:43 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-21 04:07 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-04-21 09:21 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-25 01:17 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-05-09 11:44 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-05-10 01:01 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-26 01:29 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-26 02:09 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-26 03:29 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-27 02:33 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
@ 2022-08-27 19:27 ` Andres Freund <[email protected]>
2022-08-28 07:23 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
1 sibling, 1 reply; 93+ messages in thread
From: Andres Freund @ 2022-08-27 19:27 UTC (permalink / raw)
To: Michael Paquier <[email protected]>; +Cc: Niyas Sait <[email protected]>; Tom Lane <[email protected]>; Thomas Munro <[email protected]>; Julien Rouhaud <[email protected]>; PostgreSQL Hackers <[email protected]>
Hi,
On 2022-08-27 11:33:51 +0900, Michael Paquier wrote:
> FWIW, I would not mind re-enabling that on HEAD, as of something like the
> attached. I have done a dozen of runs without seeing a test failure, and
> knowing that we don't support anything older than Win10 makes me feel safer
> about this change. Any objections?
+1. We don't have a choice about it on other architectures and it seems like a
bad idea to disable on its own.
I checked, and it looks like we didn't add --disable-dynamicbase, so ASLR
wasn't disabled for mingw builds.
Greetings,
Andres Freund
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: [PATCH] Add native windows on arm64 support
2022-04-07 17:42 Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-04-07 17:53 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-04-19 14:22 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-20 00:28 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-04-20 09:43 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-21 04:07 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-04-21 09:21 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-25 01:17 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-05-09 11:44 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-05-10 01:01 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-26 01:29 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-26 02:09 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-26 03:29 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-27 02:33 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-27 19:27 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
@ 2022-08-28 07:23 ` Michael Paquier <[email protected]>
2022-08-28 14:09 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
0 siblings, 1 reply; 93+ messages in thread
From: Michael Paquier @ 2022-08-28 07:23 UTC (permalink / raw)
To: Andres Freund <[email protected]>; +Cc: Niyas Sait <[email protected]>; Tom Lane <[email protected]>; Thomas Munro <[email protected]>; Julien Rouhaud <[email protected]>; PostgreSQL Hackers <[email protected]>
On Sat, Aug 27, 2022 at 12:27:57PM -0700, Andres Freund wrote:
> I checked, and it looks like we didn't add --disable-dynamicbase, so ASLR
> wasn't disabled for mingw builds.
True enough. I have applied the patch to re-enable that on HEAD.
Let's now see what happens in the next couple of days. Popcorn is
ready here.
--
Michael
Attachments:
[application/pgp-signature] signature.asc (833B, ../../YwsX3Jf89ucT%[email protected]/2-signature.asc)
download
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: [PATCH] Add native windows on arm64 support
2022-04-07 17:42 Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-04-07 17:53 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-04-19 14:22 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-20 00:28 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-04-20 09:43 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-21 04:07 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-04-21 09:21 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-25 01:17 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-05-09 11:44 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-05-10 01:01 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-26 01:29 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-26 02:09 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-26 03:29 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-27 02:33 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-27 19:27 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-28 07:23 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
@ 2022-08-28 14:09 ` Tom Lane <[email protected]>
2022-08-28 15:41 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
0 siblings, 1 reply; 93+ messages in thread
From: Tom Lane @ 2022-08-28 14:09 UTC (permalink / raw)
To: Michael Paquier <[email protected]>; +Cc: Andres Freund <[email protected]>; Niyas Sait <[email protected]>; Thomas Munro <[email protected]>; Julien Rouhaud <[email protected]>; PostgreSQL Hackers <[email protected]>
Michael Paquier <[email protected]> writes:
> True enough. I have applied the patch to re-enable that on HEAD.
> Let's now see what happens in the next couple of days. Popcorn is
> ready here.
Hmm:
https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=bowerbird&dt=2022-08-28%2010%3A30%3A29
Maybe that's just unrelated noise, but it sure looks weird: after
passing the core regression tests in "make check", it failed in
pg_upgrade's run with
diff -w -U3 H:/prog/bf/root/HEAD/pgsql.build/src/test/regress/expected/xml.out H:/prog/bf/root/HEAD/pgsql.build/src/bin/pg_upgrade/tmp_check/results/xml.out
--- H:/prog/bf/root/HEAD/pgsql.build/src/test/regress/expected/xml.out Wed May 18 18:30:12 2022
+++ H:/prog/bf/root/HEAD/pgsql.build/src/bin/pg_upgrade/tmp_check/results/xml.out Sun Aug 28 06:55:14 2022
@@ -1557,7 +1557,7 @@
\\x
SELECT * FROM XMLTABLE('*' PASSING '<e>pre<!--c1--><?pi arg?><![CDATA[&ent1]]><n2>&deep</n2>post</e>' COLUMNS x xml PATH 'node()', y xml PATH '/');
-[ RECORD 1 ]-----------------------------------------------------------
-x | pre<!--c1--><?pi arg?><![CDATA[&ent1]]><n2>&deep</n2>post
+x | pre<?pi arg?><![CDATA[&ent1]]><!--c1--><n2>&deep</n2>post
y | <e>pre<!--c1--><?pi arg?><![CDATA[&ent1]]><n2>&deep</n2>post</e>+
|
I don't recall ever seeing a failure quite like this.
regards, tom lane
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: [PATCH] Add native windows on arm64 support
2022-04-07 17:42 Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-04-07 17:53 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-04-19 14:22 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-20 00:28 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-04-20 09:43 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-21 04:07 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-04-21 09:21 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-25 01:17 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-05-09 11:44 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-05-10 01:01 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-26 01:29 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-26 02:09 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-26 03:29 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-27 02:33 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-27 19:27 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-28 07:23 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-28 14:09 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
@ 2022-08-28 15:41 ` Andres Freund <[email protected]>
2022-08-28 15:51 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
0 siblings, 1 reply; 93+ messages in thread
From: Andres Freund @ 2022-08-28 15:41 UTC (permalink / raw)
To: Tom Lane <[email protected]>; +Cc: Michael Paquier <[email protected]>; Niyas Sait <[email protected]>; Thomas Munro <[email protected]>; Julien Rouhaud <[email protected]>; PostgreSQL Hackers <[email protected]>
Hi,
On 2022-08-28 10:09:53 -0400, Tom Lane wrote:
> Michael Paquier <[email protected]> writes:
> > True enough. I have applied the patch to re-enable that on HEAD.
> > Let's now see what happens in the next couple of days. Popcorn is
> > ready here.
>
> Hmm:
>
> https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=bowerbird&dt=2022-08-28%2010%3A30%3A29
>
> Maybe that's just unrelated noise, but it sure looks weird: after
> passing the core regression tests in "make check", it failed in
> pg_upgrade's run with
>
> diff -w -U3 H:/prog/bf/root/HEAD/pgsql.build/src/test/regress/expected/xml.out H:/prog/bf/root/HEAD/pgsql.build/src/bin/pg_upgrade/tmp_check/results/xml.out
> --- H:/prog/bf/root/HEAD/pgsql.build/src/test/regress/expected/xml.out Wed May 18 18:30:12 2022
> +++ H:/prog/bf/root/HEAD/pgsql.build/src/bin/pg_upgrade/tmp_check/results/xml.out Sun Aug 28 06:55:14 2022
> @@ -1557,7 +1557,7 @@
> \\x
> SELECT * FROM XMLTABLE('*' PASSING '<e>pre<!--c1--><?pi arg?><![CDATA[&ent1]]><n2>&deep</n2>post</e>' COLUMNS x xml PATH 'node()', y xml PATH '/');
> -[ RECORD 1 ]-----------------------------------------------------------
> -x | pre<!--c1--><?pi arg?><![CDATA[&ent1]]><n2>&deep</n2>post
> +x | pre<?pi arg?><![CDATA[&ent1]]><!--c1--><n2>&deep</n2>post
> y | <e>pre<!--c1--><?pi arg?><![CDATA[&ent1]]><n2>&deep</n2>post</e>+
> |
Pretty weird, agreed. But hard to see how it could be caused by the
randomization change, except that perhaps it could highlight a preexisting
bug?
Greetings,
Andres Freund
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: [PATCH] Add native windows on arm64 support
2022-04-07 17:42 Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-04-07 17:53 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-04-19 14:22 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-20 00:28 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-04-20 09:43 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-21 04:07 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-04-21 09:21 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-25 01:17 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-05-09 11:44 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-05-10 01:01 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-26 01:29 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-26 02:09 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-26 03:29 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-27 02:33 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-27 19:27 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-28 07:23 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-28 14:09 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-08-28 15:41 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
@ 2022-08-28 15:51 ` Tom Lane <[email protected]>
2022-08-29 01:12 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
0 siblings, 1 reply; 93+ messages in thread
From: Tom Lane @ 2022-08-28 15:51 UTC (permalink / raw)
To: Andres Freund <[email protected]>; +Cc: Michael Paquier <[email protected]>; Niyas Sait <[email protected]>; Thomas Munro <[email protected]>; Julien Rouhaud <[email protected]>; PostgreSQL Hackers <[email protected]>
Andres Freund <[email protected]> writes:
> On 2022-08-28 10:09:53 -0400, Tom Lane wrote:
>> -x | pre<!--c1--><?pi arg?><![CDATA[&ent1]]><n2>&deep</n2>post
>> +x | pre<?pi arg?><![CDATA[&ent1]]><!--c1--><n2>&deep</n2>post
> Pretty weird, agreed. But hard to see how it could be caused by the
> randomization change, except that perhaps it could highlight a preexisting
> bug?
I have no idea either. I agree there *shouldn't* be any connection,
so if ASLR is somehow triggering this then whatever is failing is
almost certainly buggy on its own terms. But there's a lot of
moving parts here (mumble libxml mumble). I'm going to wait to see
if it reproduces before spending much effort.
regards, tom lane
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: [PATCH] Add native windows on arm64 support
2022-04-07 17:42 Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-04-07 17:53 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-04-19 14:22 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-20 00:28 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-04-20 09:43 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-21 04:07 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-04-21 09:21 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-25 01:17 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-05-09 11:44 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-05-10 01:01 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-26 01:29 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-26 02:09 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-26 03:29 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-27 02:33 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-27 19:27 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-28 07:23 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-28 14:09 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-08-28 15:41 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-28 15:51 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
@ 2022-08-29 01:12 ` Michael Paquier <[email protected]>
2022-08-29 23:48 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
0 siblings, 1 reply; 93+ messages in thread
From: Michael Paquier @ 2022-08-29 01:12 UTC (permalink / raw)
To: Tom Lane <[email protected]>; +Cc: Andres Freund <[email protected]>; Niyas Sait <[email protected]>; Thomas Munro <[email protected]>; Julien Rouhaud <[email protected]>; PostgreSQL Hackers <[email protected]>
On Sun, Aug 28, 2022 at 11:51:19AM -0400, Tom Lane wrote:
> I have no idea either. I agree there *shouldn't* be any connection,
> so if ASLR is somehow triggering this then whatever is failing is
> almost certainly buggy on its own terms. But there's a lot of
> moving parts here (mumble libxml mumble). I'm going to wait to see
> if it reproduces before spending much effort.
I have noticed that yesterday, but cannot think much about it. This
basically changes the position of "<!--c1-->" for the first record,
leaving the second one untouched:
<!--c1--><?pi arg?><![CDATA[&ent1]]>
<?pi arg?><![CDATA[&ent1]]><!--c1-->
I am not used to xmltable(), but I wonder if there is something in one
of these support functions in xml.c that gets influenced by the
randomization. That sounds a bit hairy as make check passed in
bowerbird, and I have noticed at least two other Windows hosts running
TAP that passed. Or that's just something with libxml itself.
--
Michael
Attachments:
[application/pgp-signature] signature.asc (833B, ../../[email protected]/2-signature.asc)
download
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: [PATCH] Add native windows on arm64 support
2022-04-07 17:42 Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-04-07 17:53 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-04-19 14:22 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-20 00:28 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-04-20 09:43 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-21 04:07 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-04-21 09:21 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-25 01:17 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-05-09 11:44 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-05-10 01:01 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-26 01:29 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-26 02:09 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-26 03:29 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-27 02:33 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-27 19:27 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-28 07:23 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-28 14:09 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-08-28 15:41 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-28 15:51 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-08-29 01:12 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
@ 2022-08-29 23:48 ` Michael Paquier <[email protected]>
2022-08-29 23:58 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-08-30 00:09 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
0 siblings, 2 replies; 93+ messages in thread
From: Michael Paquier @ 2022-08-29 23:48 UTC (permalink / raw)
To: Tom Lane <[email protected]>; +Cc: Andres Freund <[email protected]>; Niyas Sait <[email protected]>; Thomas Munro <[email protected]>; Julien Rouhaud <[email protected]>; PostgreSQL Hackers <[email protected]>
On Mon, Aug 29, 2022 at 10:12:20AM +0900, Michael Paquier wrote:
> I have noticed that yesterday, but cannot think much about it. This
> basically changes the position of "<!--c1-->" for the first record,
> leaving the second one untouched:
> <!--c1--><?pi arg?><![CDATA[&ent1]]>
> <?pi arg?><![CDATA[&ent1]]><!--c1-->
>
> I am not used to xmltable(), but I wonder if there is something in one
> of these support functions in xml.c that gets influenced by the
> randomization. That sounds a bit hairy as make check passed in
> bowerbird, and I have noticed at least two other Windows hosts running
> TAP that passed. Or that's just something with libxml itself.
This is amazing. The issue has showed up a second time in a row in
bowerbird, as of:
https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=bowerbird&dt=2022-08-29%2013%3A30%3A32
I don't know what to think about ASLR that manipulates the comment in
this XML object under VS 2017 (perhaps a compiler issue?), but it
should be possible to go back to green simply by removing "<!--c1-->"
from the input string. Creating an extra output pattern here would be
very costly, as xml_2.out and xml.out have outputs for --with-libxml.
Would people object if I do that for now?
--
Michael
Attachments:
[application/pgp-signature] signature.asc (833B, ../../[email protected]/2-signature.asc)
download
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: [PATCH] Add native windows on arm64 support
2022-04-07 17:42 Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-04-07 17:53 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-04-19 14:22 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-20 00:28 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-04-20 09:43 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-21 04:07 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-04-21 09:21 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-25 01:17 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-05-09 11:44 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-05-10 01:01 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-26 01:29 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-26 02:09 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-26 03:29 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-27 02:33 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-27 19:27 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-28 07:23 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-28 14:09 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-08-28 15:41 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-28 15:51 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-08-29 01:12 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-29 23:48 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
@ 2022-08-29 23:58 ` Tom Lane <[email protected]>
2022-08-30 00:33 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
1 sibling, 1 reply; 93+ messages in thread
From: Tom Lane @ 2022-08-29 23:58 UTC (permalink / raw)
To: Michael Paquier <[email protected]>; +Cc: Andres Freund <[email protected]>; Niyas Sait <[email protected]>; Thomas Munro <[email protected]>; Julien Rouhaud <[email protected]>; PostgreSQL Hackers <[email protected]>
Michael Paquier <[email protected]> writes:
> This is amazing. The issue has showed up a second time in a row in
> bowerbird, as of:
> https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=bowerbird&dt=2022-08-29%2013%3A30%3A32
That is fascinating.
> I don't know what to think about ASLR that manipulates the comment in
> this XML object under VS 2017 (perhaps a compiler issue?), but it
> should be possible to go back to green simply by removing "<!--c1-->"
> from the input string. Creating an extra output pattern here would be
> very costly, as xml_2.out and xml.out have outputs for --with-libxml.
> Would people object if I do that for now?
Let's let it go for a few more runs. I want to know whether it
reproduces 100% or only sometimes.
regards, tom lane
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: [PATCH] Add native windows on arm64 support
2022-04-07 17:42 Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-04-07 17:53 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-04-19 14:22 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-20 00:28 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-04-20 09:43 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-21 04:07 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-04-21 09:21 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-25 01:17 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-05-09 11:44 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-05-10 01:01 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-26 01:29 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-26 02:09 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-26 03:29 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-27 02:33 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-27 19:27 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-28 07:23 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-28 14:09 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-08-28 15:41 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-28 15:51 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-08-29 01:12 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-29 23:48 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-29 23:58 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
@ 2022-08-30 00:33 ` Andres Freund <[email protected]>
2022-08-30 01:35 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
0 siblings, 1 reply; 93+ messages in thread
From: Andres Freund @ 2022-08-30 00:33 UTC (permalink / raw)
To: Tom Lane <[email protected]>; +Cc: Michael Paquier <[email protected]>; Niyas Sait <[email protected]>; Thomas Munro <[email protected]>; Julien Rouhaud <[email protected]>; PostgreSQL Hackers <[email protected]>
Hi,
On 2022-08-29 19:58:31 -0400, Tom Lane wrote:
> Michael Paquier <[email protected]> writes:
> > This is amazing. The issue has showed up a second time in a row in
> > bowerbird, as of:
> > https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=bowerbird&dt=2022-08-29%2013%3A30%3A32
>
> That is fascinating.
> > I don't know what to think about ASLR that manipulates the comment in
> > this XML object under VS 2017 (perhaps a compiler issue?), but it
> > should be possible to go back to green simply by removing "<!--c1-->"
> > from the input string. Creating an extra output pattern here would be
> > very costly, as xml_2.out and xml.out have outputs for --with-libxml.
>
> > Would people object if I do that for now?
>
> Let's let it go for a few more runs. I want to know whether it
> reproduces 100% or only sometimes.
The weirdest part is that it only happens as part of the the pg_upgrade test.
I just tested it in my test windows vm (win 10, vs 2019), with a build of
libxml I had around (2.9.7), and the regression tests passed both "normally"
and within pg_upgrade.
Greetings,
Andres Freund
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: [PATCH] Add native windows on arm64 support
2022-04-07 17:42 Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-04-07 17:53 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-04-19 14:22 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-20 00:28 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-04-20 09:43 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-21 04:07 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-04-21 09:21 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-25 01:17 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-05-09 11:44 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-05-10 01:01 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-26 01:29 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-26 02:09 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-26 03:29 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-27 02:33 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-27 19:27 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-28 07:23 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-28 14:09 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-08-28 15:41 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-28 15:51 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-08-29 01:12 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-29 23:48 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-29 23:58 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-08-30 00:33 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
@ 2022-08-30 01:35 ` Michael Paquier <[email protected]>
2022-08-30 02:00 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
0 siblings, 1 reply; 93+ messages in thread
From: Michael Paquier @ 2022-08-30 01:35 UTC (permalink / raw)
To: Andres Freund <[email protected]>; +Cc: Tom Lane <[email protected]>; Niyas Sait <[email protected]>; Thomas Munro <[email protected]>; Julien Rouhaud <[email protected]>; PostgreSQL Hackers <[email protected]>
On Mon, Aug 29, 2022 at 05:33:56PM -0700, Andres Freund wrote:
> The weirdest part is that it only happens as part of the the pg_upgrade test.
make check has just failed:
https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=bowerbird&dt=2022-08-30%2001%3A15%3A13
> I just tested it in my test windows vm (win 10, vs 2019), with a build of
> libxml I had around (2.9.7), and the regression tests passed both "normally"
> and within pg_upgrade.
bowerbird is feeling from c:\\prog\\3p64\\include\\libxml2 and
c:\\prog\\3p64\\lib\\libxml2.lib. I am not sure which version of
libxml this is, and the other animals of MSVC don't use libxml so it
is not possible to correlate that only to VS 2017, either.
--
Michael
Attachments:
[application/pgp-signature] signature.asc (833B, ../../Yw1pZ8X3rG%[email protected]/2-signature.asc)
download
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: [PATCH] Add native windows on arm64 support
2022-04-07 17:42 Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-04-07 17:53 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-04-19 14:22 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-20 00:28 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-04-20 09:43 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-21 04:07 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-04-21 09:21 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-25 01:17 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-05-09 11:44 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-05-10 01:01 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-26 01:29 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-26 02:09 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-26 03:29 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-27 02:33 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-27 19:27 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-28 07:23 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-28 14:09 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-08-28 15:41 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-28 15:51 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-08-29 01:12 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-29 23:48 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-29 23:58 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-08-30 00:33 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-30 01:35 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
@ 2022-08-30 02:00 ` Tom Lane <[email protected]>
2022-08-30 23:36 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
0 siblings, 1 reply; 93+ messages in thread
From: Tom Lane @ 2022-08-30 02:00 UTC (permalink / raw)
To: Michael Paquier <[email protected]>; +Cc: Andres Freund <[email protected]>; Niyas Sait <[email protected]>; Thomas Munro <[email protected]>; Julien Rouhaud <[email protected]>; PostgreSQL Hackers <[email protected]>
Michael Paquier <[email protected]> writes:
> On Mon, Aug 29, 2022 at 05:33:56PM -0700, Andres Freund wrote:
>> The weirdest part is that it only happens as part of the the pg_upgrade test.
> make check has just failed:
> https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=bowerbird&dt=2022-08-30%2001%3A15%3A13
So it *is* probabilistic, which is pretty much what you'd expect
if ASLR triggers it. That brings us no closer to understanding
what the mechanism is, though.
regards, tom lane
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: [PATCH] Add native windows on arm64 support
2022-04-07 17:42 Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-04-07 17:53 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-04-19 14:22 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-20 00:28 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-04-20 09:43 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-21 04:07 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-04-21 09:21 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-25 01:17 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-05-09 11:44 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-05-10 01:01 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-26 01:29 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-26 02:09 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-26 03:29 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-27 02:33 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-27 19:27 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-28 07:23 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-28 14:09 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-08-28 15:41 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-28 15:51 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-08-29 01:12 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-29 23:48 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-29 23:58 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-08-30 00:33 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-30 01:35 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-30 02:00 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
@ 2022-08-30 23:36 ` Michael Paquier <[email protected]>
2022-08-31 00:07 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-08-31 00:15 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
0 siblings, 2 replies; 93+ messages in thread
From: Michael Paquier @ 2022-08-30 23:36 UTC (permalink / raw)
To: Tom Lane <[email protected]>; +Cc: Andres Freund <[email protected]>; Niyas Sait <[email protected]>; Thomas Munro <[email protected]>; Julien Rouhaud <[email protected]>; PostgreSQL Hackers <[email protected]>
On Mon, Aug 29, 2022 at 10:00:10PM -0400, Tom Lane wrote:
> Michael Paquier <[email protected]> writes:
> > On Mon, Aug 29, 2022 at 05:33:56PM -0700, Andres Freund wrote:
> >> The weirdest part is that it only happens as part of the the pg_upgrade test.
>
> > make check has just failed:
> > https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=bowerbird&dt=2022-08-30%2001%3A15%3A13
>
> So it *is* probabilistic, which is pretty much what you'd expect
> if ASLR triggers it. That brings us no closer to understanding
> what the mechanism is, though.
There have been more failures, always switching the input from
"pre<!--c1--><?pi arg?><![CDATA[&ent1]]><n2>&deep</n2>post"
to "pre<?pi arg?><![CDATA[&ent1]]><!--c1--><n2>&deep</n2>post".
Using a PATH of node() influences the output. I am not verse unto
XMLTABLE, but could it be an issue where each node is parsed and we
have something like a qsort() applied on the pointer addresses for
each part or something like that, causing the output to become
unstable?
--
Michael
Attachments:
[application/pgp-signature] signature.asc (833B, ../../[email protected]/2-signature.asc)
download
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: [PATCH] Add native windows on arm64 support
2022-04-07 17:42 Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-04-07 17:53 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-04-19 14:22 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-20 00:28 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-04-20 09:43 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-21 04:07 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-04-21 09:21 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-25 01:17 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-05-09 11:44 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-05-10 01:01 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-26 01:29 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-26 02:09 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-26 03:29 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-27 02:33 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-27 19:27 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-28 07:23 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-28 14:09 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-08-28 15:41 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-28 15:51 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-08-29 01:12 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-29 23:48 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-29 23:58 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-08-30 00:33 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-30 01:35 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-30 02:00 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-08-30 23:36 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
@ 2022-08-31 00:07 ` Tom Lane <[email protected]>
2022-08-31 00:16 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
1 sibling, 1 reply; 93+ messages in thread
From: Tom Lane @ 2022-08-31 00:07 UTC (permalink / raw)
To: Michael Paquier <[email protected]>; +Cc: Andres Freund <[email protected]>; Niyas Sait <[email protected]>; Thomas Munro <[email protected]>; Julien Rouhaud <[email protected]>; PostgreSQL Hackers <[email protected]>
Michael Paquier <[email protected]> writes:
> Using a PATH of node() influences the output. I am not verse unto
> XMLTABLE, but could it be an issue where each node is parsed and we
> have something like a qsort() applied on the pointer addresses for
> each part or something like that, causing the output to become
> unstable?
I'm not sure. I dug into this enough to find that the output from
this query is generated in xml.c lines 4635ff:
/* Concatenate serialized values */
initStringInfo(&str);
for (int i = 0; i < count; i++)
{
textstr =
xml_xmlnodetoxmltype(xpathobj->nodesetval->nodeTab[i],
xtCxt->xmlerrcxt);
appendStringInfoText(&str, textstr);
}
cstr = str.data;
So evidently, the problem occurs because the elements of the
nodesetval->nodeTab[] array are in a different order than we expect.
I looked into <xpath.h> and found the definition of the "nodesetval"
struct, and the comments are eye-opening to say the least:
/*
* A node-set (an unordered collection of nodes without duplicates).
*/
typedef struct _xmlNodeSet xmlNodeSet;
typedef xmlNodeSet *xmlNodeSetPtr;
struct _xmlNodeSet {
int nodeNr; /* number of nodes in the set */
int nodeMax; /* size of the array as allocated */
xmlNodePtr *nodeTab; /* array of nodes in no particular order */
/* @@ with_ns to check wether namespace nodes should be looked at @@ */
};
It seems like maybe we're relying on an ordering we should not.
Yet surely the ordering of the pieces of this output is meaningful?
Are we using the wrong libxml API to create this result?
Anyway, I'm now suspicious that we've accidentally exposed a logic
bug in the XMLTABLE code, rather than anything wrong with the
ASLR stuff.
regards, tom lane
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: [PATCH] Add native windows on arm64 support
2022-04-07 17:42 Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-04-07 17:53 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-04-19 14:22 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-20 00:28 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-04-20 09:43 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-21 04:07 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-04-21 09:21 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-25 01:17 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-05-09 11:44 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-05-10 01:01 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-26 01:29 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-26 02:09 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-26 03:29 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-27 02:33 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-27 19:27 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-28 07:23 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-28 14:09 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-08-28 15:41 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-28 15:51 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-08-29 01:12 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-29 23:48 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-29 23:58 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-08-30 00:33 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-30 01:35 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-30 02:00 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-08-30 23:36 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-31 00:07 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
@ 2022-08-31 00:16 ` Michael Paquier <[email protected]>
0 siblings, 0 replies; 93+ messages in thread
From: Michael Paquier @ 2022-08-31 00:16 UTC (permalink / raw)
To: Tom Lane <[email protected]>; +Cc: Andres Freund <[email protected]>; Niyas Sait <[email protected]>; Thomas Munro <[email protected]>; Julien Rouhaud <[email protected]>; PostgreSQL Hackers <[email protected]>
On Tue, Aug 30, 2022 at 08:07:27PM -0400, Tom Lane wrote:
> It seems like maybe we're relying on an ordering we should not.
> Yet surely the ordering of the pieces of this output is meaningful?
> Are we using the wrong libxml API to create this result?
>
> Anyway, I'm now suspicious that we've accidentally exposed a logic
> bug in the XMLTABLE code, rather than anything wrong with the
> ASLR stuff.
Funny. I have reached basically the same conclusion as you a couple
of minutes ago, but I also think that I have found what we need to do
here to ensure the ordering of the nodes generated by the libxml
code.
--
Michael
Attachments:
[application/pgp-signature] signature.asc (833B, ../../[email protected]/2-signature.asc)
download
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: [PATCH] Add native windows on arm64 support
2022-04-07 17:42 Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-04-07 17:53 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-04-19 14:22 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-20 00:28 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-04-20 09:43 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-21 04:07 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-04-21 09:21 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-25 01:17 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-05-09 11:44 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-05-10 01:01 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-26 01:29 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-26 02:09 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-26 03:29 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-27 02:33 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-27 19:27 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-28 07:23 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-28 14:09 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-08-28 15:41 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-28 15:51 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-08-29 01:12 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-29 23:48 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-29 23:58 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-08-30 00:33 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-30 01:35 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-30 02:00 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-08-30 23:36 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
@ 2022-08-31 00:15 ` Michael Paquier <[email protected]>
2022-08-31 00:28 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
1 sibling, 1 reply; 93+ messages in thread
From: Michael Paquier @ 2022-08-31 00:15 UTC (permalink / raw)
To: Tom Lane <[email protected]>; +Cc: Andres Freund <[email protected]>; Niyas Sait <[email protected]>; Thomas Munro <[email protected]>; Julien Rouhaud <[email protected]>; PostgreSQL Hackers <[email protected]>
On Wed, Aug 31, 2022 at 08:36:01AM +0900, Michael Paquier wrote:
> There have been more failures, always switching the input from
> "pre<!--c1--><?pi arg?><![CDATA[&ent1]]><n2>&deep</n2>post"
> to "pre<?pi arg?><![CDATA[&ent1]]><!--c1--><n2>&deep</n2>post".
>
> Using a PATH of node() influences the output. I am not verse unto
> XMLTABLE, but could it be an issue where each node is parsed and we
> have something like a qsort() applied on the pointer addresses for
> each part or something like that, causing the output to become
> unstable?
Hmm. I think that I may have an idea here after looking at our xml.c
and xpath.c in libxml2/. From what I understand, we process the PATH
through XmlTableGetValue() that builds a XML node path in
xmlXPathCompiledEval(). The interesting part comes from libxml2's
xmlXPathCompiledEvalInternal(), where I think we don't apply a sort on
the contents generated. Hence, I am wondering if the solution here
would be to do one xmlXPathNodeSetSort(xpathobj->nodesetval) after
compiling the path with xmlXPathCompiledEval() in XmlTableGetValue().
This should ensure that the items are ordered even if ASLR mixes if
the pointer positions.
A complete solution would involve more code paths, but we'd need only
one change in XmlTableGetValue() for the current regression tests to
work. I don't have an environment where I can reproduce that, so that
would be up to the buildfarm to stress this solution..
Thoughts?
--
Michael
Attachments:
[application/pgp-signature] signature.asc (833B, ../../[email protected]/2-signature.asc)
download
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: [PATCH] Add native windows on arm64 support
2022-04-07 17:42 Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-04-07 17:53 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-04-19 14:22 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-20 00:28 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-04-20 09:43 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-21 04:07 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-04-21 09:21 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-25 01:17 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-05-09 11:44 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-05-10 01:01 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-26 01:29 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-26 02:09 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-26 03:29 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-27 02:33 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-27 19:27 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-28 07:23 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-28 14:09 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-08-28 15:41 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-28 15:51 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-08-29 01:12 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-29 23:48 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-29 23:58 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-08-30 00:33 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-30 01:35 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-30 02:00 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-08-30 23:36 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-31 00:15 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
@ 2022-08-31 00:28 ` Tom Lane <[email protected]>
2022-08-31 06:09 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
0 siblings, 1 reply; 93+ messages in thread
From: Tom Lane @ 2022-08-31 00:28 UTC (permalink / raw)
To: Michael Paquier <[email protected]>; +Cc: Andres Freund <[email protected]>; Niyas Sait <[email protected]>; Thomas Munro <[email protected]>; Julien Rouhaud <[email protected]>; PostgreSQL Hackers <[email protected]>
Michael Paquier <[email protected]> writes:
> Hence, I am wondering if the solution here
> would be to do one xmlXPathNodeSetSort(xpathobj->nodesetval) after
> compiling the path with xmlXPathCompiledEval() in XmlTableGetValue().
Hmm, I see that function declared in <xpathInternals.h>, which
sure doesn't give me a warm feeling that we're supposed to call it
directly. But maybe there's an approved way to get the result.
Or perhaps this test case is wrong, and instead of "node()" we
need to write something that specifies a sorted result?
regards, tom lane
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: [PATCH] Add native windows on arm64 support
2022-04-07 17:42 Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-04-07 17:53 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-04-19 14:22 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-20 00:28 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-04-20 09:43 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-21 04:07 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-04-21 09:21 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-25 01:17 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-05-09 11:44 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-05-10 01:01 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-26 01:29 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-26 02:09 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-26 03:29 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-27 02:33 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-27 19:27 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-28 07:23 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-28 14:09 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-08-28 15:41 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-28 15:51 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-08-29 01:12 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-29 23:48 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-29 23:58 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-08-30 00:33 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-30 01:35 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-30 02:00 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-08-30 23:36 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-31 00:15 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-31 00:28 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
@ 2022-08-31 06:09 ` Michael Paquier <[email protected]>
2022-08-31 17:33 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
0 siblings, 1 reply; 93+ messages in thread
From: Michael Paquier @ 2022-08-31 06:09 UTC (permalink / raw)
To: Tom Lane <[email protected]>; +Cc: Andres Freund <[email protected]>; Niyas Sait <[email protected]>; Thomas Munro <[email protected]>; Julien Rouhaud <[email protected]>; PostgreSQL Hackers <[email protected]>
On Tue, Aug 30, 2022 at 08:28:58PM -0400, Tom Lane wrote:
> Hmm, I see that function declared in <xpathInternals.h>, which
> sure doesn't give me a warm feeling that we're supposed to call it
> directly. But maybe there's an approved way to get the result.
>
> Or perhaps this test case is wrong, and instead of "node()" we
> need to write something that specifies a sorted result?
I am no specialist on this matter.. Still, looking around, this looks
to be the kind of job that xsl:sort would do? We cannot use it here
for an XML-only context, though, and it does not seem like there is a
direct way to enforce the ordering per the nature of the XPath
language, either. I may be missing something of course.
Please note that I am also getting a bit the cold feet with the idea
of enforcing a sorting of the elements in the generated output,
actually, as this could have a performance penalty for all users
particularly on large blobs of data.
At the end, I'd like to think that it would be wiser to just remove
entirely the test for node() or reduce the contents of the string to
be able to strictly control the output order (say a simple
'<e>pre<![CDATA[&ent1]]>post</e>' would do the trick). I cannot think
about a better idea now. Note that removing the test case where we
have node() has no impact on the coverage of xml.c.
--
Michael
Attachments:
[application/pgp-signature] signature.asc (833B, ../../[email protected]/2-signature.asc)
download
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: [PATCH] Add native windows on arm64 support
2022-04-07 17:42 Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-04-07 17:53 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-04-19 14:22 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-20 00:28 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-04-20 09:43 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-21 04:07 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-04-21 09:21 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-25 01:17 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-05-09 11:44 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-05-10 01:01 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-26 01:29 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-26 02:09 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-26 03:29 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-27 02:33 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-27 19:27 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-28 07:23 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-28 14:09 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-08-28 15:41 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-28 15:51 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-08-29 01:12 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-29 23:48 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-29 23:58 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-08-30 00:33 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-30 01:35 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-30 02:00 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-08-30 23:36 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-31 00:15 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-31 00:28 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-08-31 06:09 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
@ 2022-08-31 17:33 ` Tom Lane <[email protected]>
0 siblings, 0 replies; 93+ messages in thread
From: Tom Lane @ 2022-08-31 17:33 UTC (permalink / raw)
To: Michael Paquier <[email protected]>; +Cc: Andres Freund <[email protected]>; Niyas Sait <[email protected]>; Thomas Munro <[email protected]>; Julien Rouhaud <[email protected]>; PostgreSQL Hackers <[email protected]>
Michael Paquier <[email protected]> writes:
> At the end, I'd like to think that it would be wiser to just remove
> entirely the test for node() or reduce the contents of the string to
> be able to strictly control the output order (say a simple
> '<e>pre<![CDATA[&ent1]]>post</e>' would do the trick). I cannot think
> about a better idea now. Note that removing the test case where we
> have node() has no impact on the coverage of xml.c.
Yeah, I confirm that: local code-coverage testing shows no change
in the number of lines reached in xml.c when I remove that column:
-SELECT * FROM XMLTABLE('*' PASSING '<e>pre<!--c1--><?pi arg?><![CDATA[&ent1]]><n2>&deep</n2>post</e>' COLUMNS x xml PATH 'node()', y xml PATH '/');
+SELECT * FROM XMLTABLE('*' PASSING '<e>pre<!--c1--><?pi arg?><![CDATA[&ent1]]><n2>&deep</n2>post</e>' COLUMNS y xml PATH '/');
Dropping the query altogether does result in a reduction in the
number of lines hit.
I did not check the other XMLTABLE infrastructure, so what probably
is best to do is keep the two output columns but change 'node()'
to something with a more stable result; any preferences?
regards, tom lane
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: [PATCH] Add native windows on arm64 support
2022-04-07 17:42 Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-04-07 17:53 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-04-19 14:22 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-20 00:28 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-04-20 09:43 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-21 04:07 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-04-21 09:21 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-25 01:17 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-05-09 11:44 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-05-10 01:01 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-26 01:29 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-26 02:09 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-26 03:29 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-27 02:33 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-27 19:27 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-28 07:23 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-28 14:09 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-08-28 15:41 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-28 15:51 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-08-29 01:12 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-29 23:48 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
@ 2022-08-30 00:09 ` Andres Freund <[email protected]>
1 sibling, 0 replies; 93+ messages in thread
From: Andres Freund @ 2022-08-30 00:09 UTC (permalink / raw)
To: Michael Paquier <[email protected]>; Andrew Dunstan <[email protected]>; +Cc: Tom Lane <[email protected]>; Niyas Sait <[email protected]>; Thomas Munro <[email protected]>; Julien Rouhaud <[email protected]>; PostgreSQL Hackers <[email protected]>
Hi,
On 2022-08-30 08:48:38 +0900, Michael Paquier wrote:
> On Mon, Aug 29, 2022 at 10:12:20AM +0900, Michael Paquier wrote:
> > I have noticed that yesterday, but cannot think much about it. This
> > basically changes the position of "<!--c1-->" for the first record,
> > leaving the second one untouched:
> > <!--c1--><?pi arg?><![CDATA[&ent1]]>
> > <?pi arg?><![CDATA[&ent1]]><!--c1-->
> >
> > I am not used to xmltable(), but I wonder if there is something in one
> > of these support functions in xml.c that gets influenced by the
> > randomization. That sounds a bit hairy as make check passed in
> > bowerbird, and I have noticed at least two other Windows hosts running
> > TAP that passed. Or that's just something with libxml itself.
>
> This is amazing. The issue has showed up a second time in a row in
> bowerbird, as of:
> https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=bowerbird&dt=2022-08-29%2013%3A30%3A32
>
> I don't know what to think about ASLR that manipulates the comment in
> this XML object under VS 2017 (perhaps a compiler issue?), but it
> should be possible to go back to green simply by removing "<!--c1-->"
> from the input string. Creating an extra output pattern here would be
> very costly, as xml_2.out and xml.out have outputs for --with-libxml.
>
> Would people object if I do that for now?
I do. Clearly something is wrong, what do we gain by averting our eyes? An
alternative output file strikes me as an equally bad idea - it's not like this
is a case where there are legitimately different outputs?
Bowerbird is the only animal testing libxml with visual studio afaics. And CI
doesn't have libxml either. So we have no idea if it's the msvc version that
matters.
Andrew, what version of libxml is installed? Afaict we don't see that anywhere
with msvc.
Greetings,
Andres Freund
^ permalink raw reply [nested|flat] 93+ messages in thread
* [PATCH v2 05/11] Improve sentences in overview of system configuration parameters
@ 2023-09-25 20:32 Karl O. Pinc <[email protected]>
0 siblings, 0 replies; 93+ messages in thread
From: Karl O. Pinc @ 2023-09-25 20:32 UTC (permalink / raw)
Get rid of "we" wording. Remove extra words in sentences.
Line break after end of each sentence to ease future patch reading.
---
doc/src/sgml/config.sgml | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 6bc1b215db..97f9838bfb 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -10,9 +10,10 @@
<para>
There are many configuration parameters that affect the behavior of
- the database system. In the first section of this chapter we
- describe how to interact with configuration parameters. The subsequent sections
- discuss each parameter in detail.
+ the database system.
+ The first section of this chapter describes how to interact with
+ configuration parameters.
+ Subsequent sections discuss each parameter in detail.
</para>
<sect1 id="config-setting">
--
2.30.2
--MP_/RgO6TscyR9fMvkEm1k5N=yu
Content-Type: text/x-patch
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename=v2-0006-Provide-examples-of-listing-all-settings.patch
^ permalink raw reply [nested|flat] 93+ messages in thread
* [PATCH v7 05/16] Improve sentences in overview of system configuration parameters
@ 2023-09-25 20:32 Karl O. Pinc <[email protected]>
0 siblings, 0 replies; 93+ messages in thread
From: Karl O. Pinc @ 2023-09-25 20:32 UTC (permalink / raw)
Get rid of "we" wording. Remove extra words in sentences.
Line break after end of each sentence to ease future patch reading.
---
doc/src/sgml/config.sgml | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 6bc1b215db..97f9838bfb 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -10,9 +10,10 @@
<para>
There are many configuration parameters that affect the behavior of
- the database system. In the first section of this chapter we
- describe how to interact with configuration parameters. The subsequent sections
- discuss each parameter in detail.
+ the database system.
+ The first section of this chapter describes how to interact with
+ configuration parameters.
+ Subsequent sections discuss each parameter in detail.
</para>
<sect1 id="config-setting">
--
2.30.2
--MP_/VSGM3xNEmY7iJyL2wuWRCjV
Content-Type: text/x-patch
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename=v7-0006-Provide-examples-of-listing-all-settings.patch
^ permalink raw reply [nested|flat] 93+ messages in thread
* [PATCH v5 05/14] Improve sentences in overview of system configuration parameters
@ 2023-09-25 20:32 Karl O. Pinc <[email protected]>
0 siblings, 0 replies; 93+ messages in thread
From: Karl O. Pinc @ 2023-09-25 20:32 UTC (permalink / raw)
Get rid of "we" wording. Remove extra words in sentences.
Line break after end of each sentence to ease future patch reading.
---
doc/src/sgml/config.sgml | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 6bc1b215db..97f9838bfb 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -10,9 +10,10 @@
<para>
There are many configuration parameters that affect the behavior of
- the database system. In the first section of this chapter we
- describe how to interact with configuration parameters. The subsequent sections
- discuss each parameter in detail.
+ the database system.
+ The first section of this chapter describes how to interact with
+ configuration parameters.
+ Subsequent sections discuss each parameter in detail.
</para>
<sect1 id="config-setting">
--
2.30.2
--MP_//gBZFZYGWm7urqUgDbu6PSe
Content-Type: text/x-patch
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename=v5-0006-Provide-examples-of-listing-all-settings.patch
^ permalink raw reply [nested|flat] 93+ messages in thread
* [PATCH v6 05/15] Improve sentences in overview of system configuration parameters
@ 2023-09-25 20:32 Karl O. Pinc <[email protected]>
0 siblings, 0 replies; 93+ messages in thread
From: Karl O. Pinc @ 2023-09-25 20:32 UTC (permalink / raw)
Get rid of "we" wording. Remove extra words in sentences.
Line break after end of each sentence to ease future patch reading.
---
doc/src/sgml/config.sgml | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 6bc1b215db..97f9838bfb 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -10,9 +10,10 @@
<para>
There are many configuration parameters that affect the behavior of
- the database system. In the first section of this chapter we
- describe how to interact with configuration parameters. The subsequent sections
- discuss each parameter in detail.
+ the database system.
+ The first section of this chapter describes how to interact with
+ configuration parameters.
+ Subsequent sections discuss each parameter in detail.
</para>
<sect1 id="config-setting">
--
2.30.2
--MP_/74urtnrsBSymuH7bJczNOGS
Content-Type: text/x-patch
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename=v6-0006-Provide-examples-of-listing-all-settings.patch
^ permalink raw reply [nested|flat] 93+ messages in thread
* [PATCH v4 05/12] Improve sentences in overview of system configuration parameters
@ 2023-09-25 20:32 Karl O. Pinc <[email protected]>
0 siblings, 0 replies; 93+ messages in thread
From: Karl O. Pinc @ 2023-09-25 20:32 UTC (permalink / raw)
Get rid of "we" wording. Remove extra words in sentences.
Line break after end of each sentence to ease future patch reading.
---
doc/src/sgml/config.sgml | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 6bc1b215db..97f9838bfb 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -10,9 +10,10 @@
<para>
There are many configuration parameters that affect the behavior of
- the database system. In the first section of this chapter we
- describe how to interact with configuration parameters. The subsequent sections
- discuss each parameter in detail.
+ the database system.
+ The first section of this chapter describes how to interact with
+ configuration parameters.
+ Subsequent sections discuss each parameter in detail.
</para>
<sect1 id="config-setting">
--
2.30.2
--MP_/OOXZvOwbpccKfGOtE9/SwX6
Content-Type: text/x-patch
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename=v4-0006-Provide-examples-of-listing-all-settings.patch
^ permalink raw reply [nested|flat] 93+ messages in thread
* [PATCH v3 05/11] Improve sentences in overview of system configuration parameters
@ 2023-09-25 20:32 Karl O. Pinc <[email protected]>
0 siblings, 0 replies; 93+ messages in thread
From: Karl O. Pinc @ 2023-09-25 20:32 UTC (permalink / raw)
Get rid of "we" wording. Remove extra words in sentences.
Line break after end of each sentence to ease future patch reading.
---
doc/src/sgml/config.sgml | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 6bc1b215db..97f9838bfb 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -10,9 +10,10 @@
<para>
There are many configuration parameters that affect the behavior of
- the database system. In the first section of this chapter we
- describe how to interact with configuration parameters. The subsequent sections
- discuss each parameter in detail.
+ the database system.
+ The first section of this chapter describes how to interact with
+ configuration parameters.
+ Subsequent sections discuss each parameter in detail.
</para>
<sect1 id="config-setting">
--
2.30.2
--MP_/.arW0LC=Yi8JO9BRih4YlyS
Content-Type: text/x-patch
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename=v3-0006-Provide-examples-of-listing-all-settings.patch
^ permalink raw reply [nested|flat] 93+ messages in thread
* [PATCH v4 05/12] Improve sentences in overview of system configuration parameters
@ 2023-09-25 20:32 Karl O. Pinc <[email protected]>
0 siblings, 0 replies; 93+ messages in thread
From: Karl O. Pinc @ 2023-09-25 20:32 UTC (permalink / raw)
Get rid of "we" wording. Remove extra words in sentences.
Line break after end of each sentence to ease future patch reading.
---
doc/src/sgml/config.sgml | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 6bc1b215db..97f9838bfb 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -10,9 +10,10 @@
<para>
There are many configuration parameters that affect the behavior of
- the database system. In the first section of this chapter we
- describe how to interact with configuration parameters. The subsequent sections
- discuss each parameter in detail.
+ the database system.
+ The first section of this chapter describes how to interact with
+ configuration parameters.
+ Subsequent sections discuss each parameter in detail.
</para>
<sect1 id="config-setting">
--
2.30.2
--MP_/OOXZvOwbpccKfGOtE9/SwX6
Content-Type: text/x-patch
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename=v4-0006-Provide-examples-of-listing-all-settings.patch
^ permalink raw reply [nested|flat] 93+ messages in thread
* [PATCH v3 05/11] Improve sentences in overview of system configuration parameters
@ 2023-09-25 20:32 Karl O. Pinc <[email protected]>
0 siblings, 0 replies; 93+ messages in thread
From: Karl O. Pinc @ 2023-09-25 20:32 UTC (permalink / raw)
Get rid of "we" wording. Remove extra words in sentences.
Line break after end of each sentence to ease future patch reading.
---
doc/src/sgml/config.sgml | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 6bc1b215db..97f9838bfb 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -10,9 +10,10 @@
<para>
There are many configuration parameters that affect the behavior of
- the database system. In the first section of this chapter we
- describe how to interact with configuration parameters. The subsequent sections
- discuss each parameter in detail.
+ the database system.
+ The first section of this chapter describes how to interact with
+ configuration parameters.
+ Subsequent sections discuss each parameter in detail.
</para>
<sect1 id="config-setting">
--
2.30.2
--MP_/.arW0LC=Yi8JO9BRih4YlyS
Content-Type: text/x-patch
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename=v3-0006-Provide-examples-of-listing-all-settings.patch
^ permalink raw reply [nested|flat] 93+ messages in thread
* [PATCH v2 05/11] Improve sentences in overview of system configuration parameters
@ 2023-09-25 20:32 Karl O. Pinc <[email protected]>
0 siblings, 0 replies; 93+ messages in thread
From: Karl O. Pinc @ 2023-09-25 20:32 UTC (permalink / raw)
Get rid of "we" wording. Remove extra words in sentences.
Line break after end of each sentence to ease future patch reading.
---
doc/src/sgml/config.sgml | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 6bc1b215db..97f9838bfb 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -10,9 +10,10 @@
<para>
There are many configuration parameters that affect the behavior of
- the database system. In the first section of this chapter we
- describe how to interact with configuration parameters. The subsequent sections
- discuss each parameter in detail.
+ the database system.
+ The first section of this chapter describes how to interact with
+ configuration parameters.
+ Subsequent sections discuss each parameter in detail.
</para>
<sect1 id="config-setting">
--
2.30.2
--MP_/RgO6TscyR9fMvkEm1k5N=yu
Content-Type: text/x-patch
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename=v2-0006-Provide-examples-of-listing-all-settings.patch
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: Test to dump and restore objects left behind by regression
@ 2025-03-11 10:44 Ashutosh Bapat <[email protected]>
2025-03-12 12:05 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
0 siblings, 1 reply; 93+ messages in thread
From: Ashutosh Bapat @ 2025-03-11 10:44 UTC (permalink / raw)
To: Michael Paquier <[email protected]>; +Cc: Alvaro Herrera <[email protected]>; Daniel Gustafsson <[email protected]>; Tom Lane <[email protected]>; Peter Eisentraut <[email protected]>; PostgreSQL Hackers <[email protected]>
On Tue, Feb 25, 2025 at 11:59 AM Ashutosh Bapat
<[email protected]> wrote:
>
> On Tue, Feb 11, 2025 at 5:53 PM Ashutosh Bapat
> <[email protected]> wrote:
> >
> > Hi Michael,
> >
> >
> > On Sun, Feb 9, 2025 at 1:25 PM Michael Paquier <[email protected]> wrote:
> > >
> > > On Fri, Feb 07, 2025 at 07:11:25AM +0900, Michael Paquier wrote:
> > > > Okay, thanks for the feedback. We have been relying on diff -u for
> > > > the parts of the tests touched by 0001 for some time now, so if there
> > > > are no objections I would like to apply 0001 in a couple of days.
> > >
> > > This part has been applied as 169208092f5c.
> >
> > Thanks. PFA rebased patches.
>
> PFA rebased patches.
>
> After rebasing I found another bug and reported it at [1].
This bug has been fixed. But now that it's fixed, it's easy to see
another bug related to materialized view statistics. I have reported
it at [2]. That's the fourth bug identified by this test.
>
> For the time being I have added --no-statistics to the pg_dump command
> when taking a dump for comparison.
>
I have not taken out this option because of materialized view bug.
> [1] https://www.postgresql.org/message-id/[email protected]...
[2] https://www.postgresql.org/message-id/[email protected]...
--
Best Wishes,
Ashutosh Bapat
Attachments:
[text/x-patch] 0002-Filter-COPY-statements-with-differing-colum-20250311.patch (5.7K, ../../CAExHW5uQoyOddBKLBBJpfxXqqok=BTeMvt5OpnM6gw0SroiUUw@mail.gmail.com/2-0002-Filter-COPY-statements-with-differing-colum-20250311.patch)
download | inline diff:
From a140d50245249894a49c39a908163e9bac2fe4bb Mon Sep 17 00:00:00 2001
From: Ashutosh Bapat <[email protected]>
Date: Tue, 11 Feb 2025 16:31:10 +0530
Subject: [PATCH 2/3] Filter COPY statements with differing column order
---
src/bin/pg_upgrade/t/002_pg_upgrade.pl | 10 +---
src/test/perl/PostgreSQL/Test/AdjustDump.pm | 59 +++++++++++++++------
2 files changed, 45 insertions(+), 24 deletions(-)
diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl
index c6b99125d9e..e6d8ac9a757 100644
--- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl
+++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl
@@ -581,9 +581,6 @@ sub test_regression_dump_restore
my $dump_file = "$tempdir/regression_dump.$format";
my $restored_db = 'regression_' . $format;
- # Even though we compare only schema from the original and the restored
- # database (See get_dump_for_comparison() for details.), we dump and
- # restore data as well to catch any errors while doing so.
$src_node->command_ok(
[
'pg_dump', "-F$format", '--no-sync',
@@ -645,13 +642,10 @@ sub get_dump_for_comparison
my $dump_adjusted = "${dumpfile}_adjusted";
- # The order of columns in COPY statements dumped from the original database
- # and that from the restored database differs. These differences are hard to
- # adjust. Hence we compare only schema dumps for now.
$node->command_ok(
[
- 'pg_dump', '-s', '--no-sync', '-d',
- $node->connstr($db), '-f', $dumpfile
+ 'pg_dump', '--no-sync', '-d', $node->connstr($db), '-f',
+ $dumpfile
],
'dump for comparison succeeded');
diff --git a/src/test/perl/PostgreSQL/Test/AdjustDump.pm b/src/test/perl/PostgreSQL/Test/AdjustDump.pm
index e3e152b88fa..e00a00d1b2c 100644
--- a/src/test/perl/PostgreSQL/Test/AdjustDump.pm
+++ b/src/test/perl/PostgreSQL/Test/AdjustDump.pm
@@ -44,22 +44,36 @@ our @EXPORT = qw(
If we take dump of the regression database left behind after running regression
tests, restore the dump, and take dump of the restored regression database, the
-outputs of both the dumps differ. Some regression tests purposefully create
-some child tables in such a way that their column orders differ from column
-orders of their respective parents. In the restored database, however, their
-column orders are same as that of their respective parents. Thus the column
+outputs of both the dumps differ in the following cases. This routine adjusts
+the given dump so that dump outputs from the original and restored database,
+respectively, match.
+
+Case 1: Some regression tests purposefully create child tables in such a way
+that the order of their inherited columns differ from column orders of their
+respective parents. In the restored database, however, the order of their
+inherited columns are same as that of their respective parents. Thus the column
orders of these child tables in the original database and those in the restored
database differ, causing difference in the dump outputs. See MergeAttributes()
-and dumpTableSchema() for details.
-
-This routine rearranges the column declarations in the relevant
-C<CREATE TABLE... INHERITS> statements in the dump file from original database
-to match those from the restored database. We could instead adjust the
-statements in the dump from the restored database to match those from original
-database or adjust both to a canonical order. But we have chosen to adjust the
-statements in the dump from original database for no particular reason.
-
-Additionally it adjusts blank and new lines to avoid noise.
+and dumpTableSchema() for details. This routine rearranges the column
+declarations in the relevant C<CREATE TABLE... INHERITS> statements in the dump
+file from original database to match those from the restored database. We could,
+instead, adjust the statements in the dump from the restored database to match
+those from original database or adjust both to a canonical order. But we have
+chosen to adjust the statements in the dump from original database for no
+particular reason.
+
+Case 2: When dumping COPY statements the columns are ordered by their attribute
+number by fmtCopyColumnList(). If a column is added to a parent table after a
+child has inherited the parent and the child has its own columns, the attribute
+number of the column changes after restoring the child table. This is because
+when executing the dumped C<CREATE TABLE... INHERITS> statement all the parent
+attributes are created before any child attributes. Thus the order of columns in
+COPY statements dumped from the original and the restored databases,
+respectively, differs. Such tables in regression tests are listed below. It is
+hard to adjust the column order in the COPY statement along with the data. Hence
+we just remove such COPY statements from the dump output.
+
+Additionally the routine adjusts blank and new lines to avoid noise.
Arguments:
@@ -84,8 +98,6 @@ sub adjust_regress_dumpfile
# use Unix newlines
$dump =~ s/\r\n/\n/g;
- # Suppress blank lines, as some places in pg_dump emit more or fewer.
- $dump =~ s/\n\n+/\n/g;
# Adjust the CREATE TABLE ... INHERITS statements.
if ($adjust_child_columns)
@@ -122,6 +134,21 @@ sub adjust_regress_dumpfile
'applied public.test_type_diff2_c2 adjustments');
}
+ # Remove COPY statements with differing column order
+ for my $table (
+ 'public\.b_star', 'public\.c_star',
+ 'public\.cc2', 'public\.d_star',
+ 'public\.e_star', 'public\.f_star',
+ 'public\.renamecolumnanother', 'public\.renamecolumnchild',
+ 'public\.test_type_diff2_c1', 'public\.test_type_diff2_c2',
+ 'public\.test_type_diff_c')
+ {
+ $dump =~ s/^COPY\s$table\s\(.+?^\\\.$//sm;
+ }
+
+ # Suppress blank lines, as some places in pg_dump emit more or fewer.
+ $dump =~ s/\n\n+/\n/g;
+
return $dump;
}
--
2.34.1
[text/x-patch] 0001-Test-pg_dump-restore-of-regression-objects-20250311.patch (14.4K, ../../CAExHW5uQoyOddBKLBBJpfxXqqok=BTeMvt5OpnM6gw0SroiUUw@mail.gmail.com/3-0001-Test-pg_dump-restore-of-regression-objects-20250311.patch)
download | inline diff:
From 25c4c7e4ee754dd989d3fd8f015c7355fd9992d6 Mon Sep 17 00:00:00 2001
From: Ashutosh Bapat <[email protected]>
Date: Thu, 27 Jun 2024 10:03:53 +0530
Subject: [PATCH 1/3] Test pg_dump/restore of regression objects
002_pg_upgrade.pl tests pg_upgrade of the regression database left
behind by regression run. Modify it to test dump and restore of the
regression database as well.
Regression database created by regression run contains almost all the
database objects supported by PostgreSQL in various states. Hence the
new testcase covers dump and restore scenarios not covered by individual
dump/restore cases. Till now 002_pg_upgrade only tested dump/restore
through pg_upgrade which only uses binary mode. Many regression tests
mention that they leave objects behind for dump/restore testing but they
are not tested in a non-binary mode. The new testcase closes that
gap.
Testing dump and restore of regression database makes this test run
longer for a relatively smaller benefit. Hence run it only when
explicitly requested by user by specifying "regress_dump_test" in
PG_TEST_EXTRA.
Note For the reviewers:
The new test has uncovered two bugs so far in one year.
1. Introduced by 14e87ffa5c54. Fixed in fd41ba93e4630921a72ed5127cd0d552a8f3f8fc.
2. Introduced by 0413a556990ba628a3de8a0b58be020fd9a14ed0. Reverted in 74563f6b90216180fc13649725179fc119dddeb5.
Author: Ashutosh Bapat
Reviewed by: Michael Pacquire, Daniel Gustafsson, Tom Lane
Discussion: https://www.postgresql.org/message-id/CAExHW5uF5V=Cjecx3_Z=7xfh4rg2Wf61PT+hfquzjBqouRzQJQ@mail.gmail.com
---
doc/src/sgml/regress.sgml | 12 ++
src/bin/pg_upgrade/t/002_pg_upgrade.pl | 142 +++++++++++++++++++-
src/test/perl/Makefile | 2 +
src/test/perl/PostgreSQL/Test/AdjustDump.pm | 134 ++++++++++++++++++
src/test/perl/meson.build | 1 +
5 files changed, 289 insertions(+), 2 deletions(-)
create mode 100644 src/test/perl/PostgreSQL/Test/AdjustDump.pm
diff --git a/doc/src/sgml/regress.sgml b/doc/src/sgml/regress.sgml
index 0e5e8e8f309..237b974b3ab 100644
--- a/doc/src/sgml/regress.sgml
+++ b/doc/src/sgml/regress.sgml
@@ -357,6 +357,18 @@ make check-world PG_TEST_EXTRA='kerberos ldap ssl load_balance libpq_encryption'
</para>
</listitem>
</varlistentry>
+
+ <varlistentry>
+ <term><literal>regress_dump_test</literal></term>
+ <listitem>
+ <para>
+ When enabled, <filename>src/bin/pg_upgrade/t/002_pg_upgrade.pl</filename>
+ tests dump and restore of regression database left behind by the
+ regression run. Not enabled by default because it is time and resource
+ consuming.
+ </para>
+ </listitem>
+ </varlistentry>
</variablelist>
Tests for features that are not supported by the current build
diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl
index c00cf68d660..c6b99125d9e 100644
--- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl
+++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl
@@ -12,6 +12,7 @@ use File::Path qw(rmtree);
use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::Utils;
use PostgreSQL::Test::AdjustUpgrade;
+use PostgreSQL::Test::AdjustDump;
use Test::More;
# Can be changed to test the other modes.
@@ -35,8 +36,8 @@ sub generate_db
"created database with ASCII characters from $from_char to $to_char");
}
-# Filter the contents of a dump before its use in a content comparison.
-# This returns the path to the filtered dump.
+# Filter the contents of a dump before its use in a content comparison for
+# upgrade testing. This returns the path to the filtered dump.
sub filter_dump
{
my ($is_old, $old_version, $dump_file) = @_;
@@ -261,6 +262,21 @@ else
}
}
is($rc, 0, 'regression tests pass');
+
+ # Test dump/restore of the objects left behind by regression. Ideally it
+ # should be done in a separate TAP test, but doing it here saves us one full
+ # regression run.
+ #
+ # This step takes several extra seconds and some extra disk space, so
+ # requires an opt-in with the PG_TEST_EXTRA environment variable.
+ #
+ # Do this while the old cluster is running before it is shut down by the
+ # upgrade test.
+ if ( $ENV{PG_TEST_EXTRA}
+ && $ENV{PG_TEST_EXTRA} =~ /\bregress_dump_test\b/)
+ {
+ test_regression_dump_restore($oldnode, %node_params);
+ }
}
# Initialize a new node for the upgrade.
@@ -527,4 +543,126 @@ my $dump2_filtered = filter_dump(0, $oldnode->pg_version, $dump2_file);
compare_files($dump1_filtered, $dump2_filtered,
'old and new dumps match after pg_upgrade');
+# Test dump and restore of objects left behind by the regression run.
+#
+# It is expected that regression tests, which create `regression` database, are
+# run on `src_node`, which in turn, is left in running state. The dump from
+# `src_node` is restored on a fresh node created using given `node_params`.
+# Plain dumps from both the nodes are compared to make sure that all the dumped
+# objects are restored faithfully.
+sub test_regression_dump_restore
+{
+ my ($src_node, %node_params) = @_;
+ my $dst_node = PostgreSQL::Test::Cluster->new('dst_node');
+
+ # Make sure that the source and destination nodes have the same version and
+ # do not use custom install paths. In both the cases, the dump files may
+ # require additional adjustments unknown to code here. Do not run this test
+ # in such a case to avoid utilizing the time and resources unnecessarily.
+ if ($src_node->pg_version != $dst_node->pg_version
+ or defined $src_node->{_install_path})
+ {
+ fail("same version dump and restore test using default installation");
+ return;
+ }
+
+ # Dump the original database for comparison later.
+ my $src_dump =
+ get_dump_for_comparison($src_node, 'regression', 'src_dump', 1);
+
+ # Setup destination database cluster
+ $dst_node->init(%node_params);
+ # Stabilize stats for comparison.
+ $dst_node->append_conf('postgresql.conf', 'autovacuum = off');
+ $dst_node->start;
+
+ for my $format ('plain', 'tar', 'directory', 'custom')
+ {
+ my $dump_file = "$tempdir/regression_dump.$format";
+ my $restored_db = 'regression_' . $format;
+
+ # Even though we compare only schema from the original and the restored
+ # database (See get_dump_for_comparison() for details.), we dump and
+ # restore data as well to catch any errors while doing so.
+ $src_node->command_ok(
+ [
+ 'pg_dump', "-F$format", '--no-sync',
+ '-d', $src_node->connstr('regression'),
+ '-f', $dump_file
+ ],
+ "pg_dump on source instance in $format format");
+
+ # Create a new database for restoring dump from every format so that it
+ # is available for debugging in case the test fails.
+ $dst_node->command_ok([ 'createdb', $restored_db ],
+ "created destination database '$restored_db'");
+
+ # Restore into destination database.
+ my @restore_command;
+ if ($format eq 'plain')
+ {
+ # Restore dump in "plain" format using `psql`.
+ @restore_command = [
+ 'psql', '-d', $dst_node->connstr($restored_db),
+ '-f', $dump_file
+ ];
+ }
+ else
+ {
+ @restore_command = [
+ 'pg_restore', '-d',
+ $dst_node->connstr($restored_db), $dump_file
+ ];
+ }
+ $dst_node->command_ok(@restore_command,
+ "restored dump taken in $format format on destination instance");
+
+ my $dst_dump =
+ get_dump_for_comparison($dst_node, $restored_db,
+ 'dest_dump.' . $format, 0);
+
+ compare_files($src_dump, $dst_dump,
+ "dump outputs from original and restored regression database (using $format format) match"
+ );
+ }
+}
+
+# Dump database `db` from the given `node` in plain format and adjust it for
+# comparing dumps from the original and the restored database.
+#
+# `file_prefix` is used to create unique names for all dump files so that they
+# remain available for debugging in case the test fails.
+#
+# `adjust_child_columns` is passed to adjust_regress_dumpfile() which actually
+# adjusts the dump output.
+#
+# The name of the file containting adjusted dump is returned.
+sub get_dump_for_comparison
+{
+ my ($node, $db, $file_prefix, $adjust_child_columns) = @_;
+
+ my $dumpfile = $tempdir . '/' . $file_prefix . '.sql';
+ my $dump_adjusted = "${dumpfile}_adjusted";
+
+
+ # The order of columns in COPY statements dumped from the original database
+ # and that from the restored database differs. These differences are hard to
+ # adjust. Hence we compare only schema dumps for now.
+ $node->command_ok(
+ [
+ 'pg_dump', '-s', '--no-sync', '-d',
+ $node->connstr($db), '-f', $dumpfile
+ ],
+ 'dump for comparison succeeded');
+
+ open(my $dh, '>', $dump_adjusted)
+ || die
+ "could not open $dump_adjusted for writing the adjusted dump: $!";
+ print $dh adjust_regress_dumpfile(slurp_file($dumpfile),
+ $adjust_child_columns);
+ close($dh);
+
+ return $dump_adjusted;
+}
+
done_testing();
diff --git a/src/test/perl/Makefile b/src/test/perl/Makefile
index d82fb67540e..def89650ead 100644
--- a/src/test/perl/Makefile
+++ b/src/test/perl/Makefile
@@ -26,6 +26,7 @@ install: all installdirs
$(INSTALL_DATA) $(srcdir)/PostgreSQL/Test/Cluster.pm '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/Cluster.pm'
$(INSTALL_DATA) $(srcdir)/PostgreSQL/Test/BackgroundPsql.pm '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/BackgroundPsql.pm'
$(INSTALL_DATA) $(srcdir)/PostgreSQL/Test/AdjustUpgrade.pm '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/AdjustUpgrade.pm'
+ $(INSTALL_DATA) $(srcdir)/PostgreSQL/Test/AdjustDump.pm '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/AdjustDump.pm'
$(INSTALL_DATA) $(srcdir)/PostgreSQL/Version.pm '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Version.pm'
uninstall:
@@ -36,6 +37,7 @@ uninstall:
rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/Cluster.pm'
rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/BackgroundPsql.pm'
rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/AdjustUpgrade.pm'
+ rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/AdjustDump.pm'
rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Version.pm'
endif
diff --git a/src/test/perl/PostgreSQL/Test/AdjustDump.pm b/src/test/perl/PostgreSQL/Test/AdjustDump.pm
new file mode 100644
index 00000000000..e3e152b88fa
--- /dev/null
+++ b/src/test/perl/PostgreSQL/Test/AdjustDump.pm
@@ -0,0 +1,134 @@
+
+# Copyright (c) 2024-2025, PostgreSQL Global Development Group
+
+=pod
+
+=head1 NAME
+
+PostgreSQL::Test::AdjustDump - helper module for dump and restore tests
+
+=head1 SYNOPSIS
+
+ use PostgreSQL::Test::AdjustDump;
+
+ # Adjust contents of dump output file so that dump output from original
+ # regression database and that from the restored regression database match
+ $dump = adjust_regress_dumpfile($dump, $adjust_child_columns);
+
+=head1 DESCRIPTION
+
+C<PostgreSQL::Test::AdjustDump> encapsulates various hacks needed to
+compare the results of dump and restore tests
+
+=cut
+
+package PostgreSQL::Test::AdjustDump;
+
+use strict;
+use warnings FATAL => 'all';
+
+use Exporter 'import';
+use Test::More;
+
+our @EXPORT = qw(
+ adjust_regress_dumpfile
+);
+
+=pod
+
+=head1 ROUTINES
+
+=over
+
+=item $dump = adjust_regress_dumpfile($dump, $adjust_child_columns)
+
+If we take dump of the regression database left behind after running regression
+tests, restore the dump, and take dump of the restored regression database, the
+outputs of both the dumps differ. Some regression tests purposefully create
+some child tables in such a way that their column orders differ from column
+orders of their respective parents. In the restored database, however, their
+column orders are same as that of their respective parents. Thus the column
+orders of these child tables in the original database and those in the restored
+database differ, causing difference in the dump outputs. See MergeAttributes()
+and dumpTableSchema() for details.
+
+This routine rearranges the column declarations in the relevant
+C<CREATE TABLE... INHERITS> statements in the dump file from original database
+to match those from the restored database. We could instead adjust the
+statements in the dump from the restored database to match those from original
+database or adjust both to a canonical order. But we have chosen to adjust the
+statements in the dump from original database for no particular reason.
+
+Additionally it adjusts blank and new lines to avoid noise.
+
+Arguments:
+
+=over
+
+=item C<dump>: Contents of dump file
+
+=item C<adjust_child_columns>: 1 indicates that the given dump file requires
+adjusting columns in the child tables; usually when the dump is from original
+database. 0 indicates no such adjustment is needed; usually when the dump is
+from restored database.
+
+=back
+
+Returns the adjusted dump text.
+
+=cut
+
+sub adjust_regress_dumpfile
+{
+ my ($dump, $adjust_child_columns) = @_;
+
+ # use Unix newlines
+ $dump =~ s/\r\n/\n/g;
+ # Suppress blank lines, as some places in pg_dump emit more or fewer.
+ $dump =~ s/\n\n+/\n/g;
+
+ # Adjust the CREATE TABLE ... INHERITS statements.
+ if ($adjust_child_columns)
+ {
+ my $saved_dump = $dump;
+
+ $dump =~ s/(^CREATE\sTABLE\sgenerated_stored_tests\.gtestxx_4\s\()
+ (\n\s+b\sinteger),
+ (\n\s+a\sinteger\sNOT\sNULL)/$1$3,$2/mgx;
+ ok($saved_dump ne $dump,
+ 'applied generated_stored_tests.gtestxx_4 adjustments');
+
+ $saved_dump = $dump;
+ $dump =~ s/(^CREATE\sTABLE\sgenerated_virtual_tests\.gtestxx_4\s\()
+ (\n\s+b\sinteger),
+ (\n\s+a\sinteger\sNOT\sNULL)/$1$3,$2/mgx;
+ ok($saved_dump ne $dump,
+ 'applied generated_virtual_tests.gtestxx_4 adjustments');
+
+ $saved_dump = $dump;
+ $dump =~ s/(^CREATE\sTABLE\spublic\.test_type_diff2_c1\s\()
+ (\n\s+int_four\sbigint),
+ (\n\s+int_eight\sbigint),
+ (\n\s+int_two\ssmallint)/$1$4,$2,$3/mgx;
+ ok($saved_dump ne $dump,
+ 'applied public.test_type_diff2_c1 adjustments');
+
+ $saved_dump = $dump;
+ $dump =~ s/(^CREATE\sTABLE\spublic\.test_type_diff2_c2\s\()
+ (\n\s+int_eight\sbigint),
+ (\n\s+int_two\ssmallint),
+ (\n\s+int_four\sbigint)/$1$3,$4,$2/mgx;
+ ok($saved_dump ne $dump,
+ 'applied public.test_type_diff2_c2 adjustments');
+ }
+
+ return $dump;
+}
+
+=pod
+
+=back
+
+=cut
+
+1;
diff --git a/src/test/perl/meson.build b/src/test/perl/meson.build
index 58e30f15f9d..492ca571ff8 100644
--- a/src/test/perl/meson.build
+++ b/src/test/perl/meson.build
@@ -14,4 +14,5 @@ install_data(
'PostgreSQL/Test/Cluster.pm',
'PostgreSQL/Test/BackgroundPsql.pm',
'PostgreSQL/Test/AdjustUpgrade.pm',
+ 'PostgreSQL/Test/AdjustDump.pm',
install_dir: dir_pgxs / 'src/test/perl/PostgreSQL/Test')
base-commit: dabccf45139a8c7c3c2e7683a943c31077e55a78
--
2.34.1
[text/x-patch] 0003-Do-not-dump-statistics-in-the-file-dumped-f-20250311.patch (1.2K, ../../CAExHW5uQoyOddBKLBBJpfxXqqok=BTeMvt5OpnM6gw0SroiUUw@mail.gmail.com/4-0003-Do-not-dump-statistics-in-the-file-dumped-f-20250311.patch)
download | inline diff:
From 4258ed1bcad537418c4c3f4ba0e3712ec515e09e Mon Sep 17 00:00:00 2001
From: Ashutosh Bapat <[email protected]>
Date: Tue, 25 Feb 2025 11:42:51 +0530
Subject: [PATCH 3/3] Do not dump statistics in the file dumped for comparison
As reported at [1], the dumped and restored statistics may differ if there's a
primary key on the table. Hence do not dump the statistics to avoid differences
in the dump output from the original and restored database.
[1] https://www.postgresql.org/message-id/CAExHW5vf9D+8-a5_BEX3y=2y_xY9hiCxV1=C+FnxDvfprWvkng@mail.gmail.com
Ashutosh Bapat
---
src/bin/pg_upgrade/t/002_pg_upgrade.pl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl
index e6d8ac9a757..8924cf8344a 100644
--- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl
+++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl
@@ -644,7 +644,7 @@ sub get_dump_for_comparison
$node->command_ok(
[
- 'pg_dump', '--no-sync', '-d', $node->connstr($db), '-f',
+ 'pg_dump', '--no-sync', '--no-statistics', '-d', $node->connstr($db), '-f',
$dumpfile
],
'dump for comparison succeeded');
--
2.34.1
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: Test to dump and restore objects left behind by regression
2025-03-11 10:44 Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
@ 2025-03-12 12:05 ` Alvaro Herrera <[email protected]>
2025-03-12 15:58 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
0 siblings, 1 reply; 93+ messages in thread
From: Alvaro Herrera @ 2025-03-12 12:05 UTC (permalink / raw)
To: Ashutosh Bapat <[email protected]>; +Cc: Michael Paquier <[email protected]>; Daniel Gustafsson <[email protected]>; Tom Lane <[email protected]>; Peter Eisentraut <[email protected]>; PostgreSQL Hackers <[email protected]>
Hello
When running these tests, I encounter this strange diff in the dumps,
which seems to be that the locale for type money does not match. I
imagine the problem is that the locale is not set correctly when
initdb'ing one of them? Grepping the regress_log for initdb, I see
this:
$ grep -B1 'Running: initdb' tmp_check/log/regress_log_002_pg_upgrade
[13:00:57.580](0.003s) # initializing database system by running initdb
# Running: initdb -D /home/alvherre/Code/pgsql-build/master/src/bin/pg_upgrade/tmp_check/t_002_pg_upgrade_old_node_data/pgdata -A trust -N --wal-segsize 1 --allow-group-access --encoding UTF-8 --lc-collate C --lc-ctype C --locale-provider builtin --builtin-locale C.UTF-8 -k
--
[13:01:12.879](0.044s) # initializing database system by running initdb
# Running: initdb -D /home/alvherre/Code/pgsql-build/master/src/bin/pg_upgrade/tmp_check/t_002_pg_upgrade_dst_node_data/pgdata -A trust -N --wal-segsize 1 --allow-group-access --encoding UTF-8 --lc-collate C --lc-ctype C --locale-provider builtin --builtin-locale C.UTF-8 -k
--
[13:01:28.000](0.033s) # initializing database system by running initdb
# Running: initdb -D /home/alvherre/Code/pgsql-build/master/src/bin/pg_upgrade/tmp_check/t_002_pg_upgrade_new_node_data/pgdata -A trust -N --wal-segsize 1 --allow-group-access --encoding SQL_ASCII --locale-provider libc
[12:50:31.838](0.102s) not ok 15 - dump outputs from original and restored regression database (using plain format) match
[12:50:31.839](0.000s)
[12:50:31.839](0.000s) # Failed test 'dump outputs from original and restored regression database (using plain format) match'
# at /pgsql/source/master/src/test/perl/PostgreSQL/Test/Utils.pm line 797.
[12:50:31.839](0.000s) # got: '1'
# expected: '0'
=== diff of /home/alvherre/Code/pgsql-build/master/src/bin/pg_upgrade/tmp_check/tmp_test_vVew/src_dump.sql_adjusted and /home/alvherre/Code/pgsql-build/master/src/bin/pg_upgrade/tmp_check/tmp_test_vVew/dest_dump.plain.sql_adjusted
=== stdout ===
--- /home/alvherre/Code/pgsql-build/master/src/bin/pg_upgrade/tmp_check/tmp_test_vVew/src_dump.sql_adjusted 2025-03-12 12:50:27.674918597 +0100
+++ /home/alvherre/Code/pgsql-build/master/src/bin/pg_upgrade/tmp_check/tmp_test_vVew/dest_dump.plain.sql_adjusted 2025-03-12 12:50:31.778840338 +0100
@@ -208972,7 +208972,7 @@
-- Data for Name: money_data; Type: TABLE DATA; Schema: public; Owner: alvherre
--
COPY public.money_data (m) FROM stdin;
-$123.46
+$ 12.346,00
\.
--
-- Data for Name: mvtest_t; Type: TABLE DATA; Schema: public; Owner: alvherre
@@ -376231,7 +376231,7 @@
-- Data for Name: tab_core_types; Type: TABLE DATA; Schema: public; Owner: alvherre
--
COPY public.tab_core_types (point, line, lseg, box, openedpath, closedpath, polygon, circle, date, "time", "timestamp", timetz, timestamptz, "interval", "json", jsonb, jsonpath, inet, cidr, macaddr8, macaddr, int2, int4, int8, float4, float8, pi, "char", bpchar, "varchar", name, text, bool, bytea, "bit", varbit, money, refcursor, int2vector, oidvector, aclitem, tsvector, tsquery, uuid, xid8, regclass, type, regrole, oid, tid, xid, cid, txid_snapshot, pg_snapshot, pg_lsn, cardinal_number, character_data, sql_identifier, time_stamp, yes_or_no, int4range, int4multirange, int8range, int8multirange, numrange, nummultirange, daterange, datemultirange, tsrange, tsmultirange, tstzrange, tstzmultirange) FROM stdin;
-(11,12) {1,-1,0} [(11,11),(12,12)] (13,13),(11,11) ((11,12),(13,13),(14,14)) [(11,12),(13,13),(14,14)] ((11,12),(13,13),(14,14)) <(1,1),1> 2025-03-12 04:50:14.125899 2025-03-12 04:50:14.125899 04:50:14.125899-07 2025-03-12 12:50:14.125899+01 00:00:12 {"reason":"because"} {"when": "now"} $."a"[*]?(@ > 2) 127.0.0.1 127.0.0.0/8 00:01:03:ff:fe:86:1c:ba 00:01:03:86:1c:ba 2 4 8 4 8 3.14159265358979 f c abc name txt t \\xdeadbeef 1 10001 $12.34 abc 1 2 1 2 alvherre=UC/alvherre 'a' 'and' 'ate' 'cat' 'fat' 'mat' 'on' 'rat' 'sat' 'fat' & 'rat' a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11 11 pg_class regtype pg_monitor 1259 (1,1) 2 3 10:20:10,14,15 10:20:10,14,15 16/B374D848 1 l n 2025-03-12 12:50:14.13+01 YES empty {} empty {} (3,4) {(3,4)} [2020-01-03,2021-02-03) {[2020-01-03,2021-02-03)} ("2020-01-02 03:04:05","2021-02-03 06:07:08") {("2020-01-02 03:04:05","2021-02-03 06:07:08")} ("2020-01-02 12:04:05+01","2021-02-03 15:07:08+01") {("2020-01-02 12:04:05+01","2021-02-03 15:07:08+01")}
+(11,12) {1,-1,0} [(11,11),(12,12)] (13,13),(11,11) ((11,12),(13,13),(14,14)) [(11,12),(13,13),(14,14)] ((11,12),(13,13),(14,14)) <(1,1),1> 2025-03-12 04:50:14.125899 2025-03-12 04:50:14.125899 04:50:14.125899-07 2025-03-12 12:50:14.125899+01 00:00:12 {"reason":"because"} {"when": "now"} $."a"[*]?(@ > 2) 127.0.0.1 127.0.0.0/8 00:01:03:ff:fe:86:1c:ba 00:01:03:86:1c:ba 2 4 8 4 8 3.14159265358979 f c abc name txt t \\xdeadbeef 1 10001 $ 1.234,00 abc 1 2 1 2 alvherre=UC/alvherre 'a' 'and' 'ate' 'cat' 'fat' 'mat' 'on' 'rat' 'sat' 'fat' & 'rat' a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11 11 pg_class regtype pg_monitor 1259 (1,1) 2 3 10:20:10,14,15 10:20:10,14,15 16/B374D848 1 l n 2025-03-12 12:50:14.13+01 YES empty {} empty {} (3,4) {(3,4)} [2020-01-03,2021-02-03) {[2020-01-03,2021-02-03)} ("2020-01-02 03:04:05","2021-02-03 06:07:08") {("2020-01-02 03:04:05","2021-02-03 06:07:08")} ("2020-01-02 12:04:05+01","2021-02-03 15:07:08+01") {("2020-01-02 12:04:05+01","2021-02-03 15:07:08+01")}
\.
--
-- Data for Name: tableam_parted_a_heap2; Type: TABLE DATA; Schema: public; Owner: alvherre=== stderr ===
=== EOF ===
--
Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/
"¿Qué importan los años? Lo que realmente importa es comprobar que
a fin de cuentas la mejor edad de la vida es estar vivo" (Mafalda)
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: Test to dump and restore objects left behind by regression
2025-03-11 10:44 Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 12:05 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
@ 2025-03-12 15:58 ` Ashutosh Bapat <[email protected]>
2025-03-12 16:09 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
0 siblings, 1 reply; 93+ messages in thread
From: Ashutosh Bapat @ 2025-03-12 15:58 UTC (permalink / raw)
To: Alvaro Herrera <[email protected]>; +Cc: Michael Paquier <[email protected]>; Daniel Gustafsson <[email protected]>; Tom Lane <[email protected]>; Peter Eisentraut <[email protected]>; PostgreSQL Hackers <[email protected]>
On Wed, Mar 12, 2025 at 5:35 PM Alvaro Herrera <[email protected]> wrote:
>
> Hello
>
> When running these tests, I encounter this strange diff in the dumps,
> which seems to be that the locale for type money does not match. I
> imagine the problem is that the locale is not set correctly when
> initdb'ing one of them? Grepping the regress_log for initdb, I see
> this:
>
> $ grep -B1 'Running: initdb' tmp_check/log/regress_log_002_pg_upgrade
> [13:00:57.580](0.003s) # initializing database system by running initdb
> # Running: initdb -D /home/alvherre/Code/pgsql-build/master/src/bin/pg_upgrade/tmp_check/t_002_pg_upgrade_old_node_data/pgdata -A trust -N --wal-segsize 1 --allow-group-access --encoding UTF-8 --lc-collate C --lc-ctype C --locale-provider builtin --builtin-locale C.UTF-8 -k
> --
> [13:01:12.879](0.044s) # initializing database system by running initdb
> # Running: initdb -D /home/alvherre/Code/pgsql-build/master/src/bin/pg_upgrade/tmp_check/t_002_pg_upgrade_dst_node_data/pgdata -A trust -N --wal-segsize 1 --allow-group-access --encoding UTF-8 --lc-collate C --lc-ctype C --locale-provider builtin --builtin-locale C.UTF-8 -k
> --
> [13:01:28.000](0.033s) # initializing database system by running initdb
> # Running: initdb -D /home/alvherre/Code/pgsql-build/master/src/bin/pg_upgrade/tmp_check/t_002_pg_upgrade_new_node_data/pgdata -A trust -N --wal-segsize 1 --allow-group-access --encoding SQL_ASCII --locale-provider libc
>
The original node and the node where dump is restored have the same
initdb commands. It's the upgraded node which has different initdb
command. But that's how the test is written originally.
>
>
> [12:50:31.838](0.102s) not ok 15 - dump outputs from original and restored regression database (using plain format) match
> [12:50:31.839](0.000s)
> [12:50:31.839](0.000s) # Failed test 'dump outputs from original and restored regression database (using plain format) match'
> # at /pgsql/source/master/src/test/perl/PostgreSQL/Test/Utils.pm line 797.
> [12:50:31.839](0.000s) # got: '1'
> # expected: '0'
> === diff of /home/alvherre/Code/pgsql-build/master/src/bin/pg_upgrade/tmp_check/tmp_test_vVew/src_dump.sql_adjusted and /home/alvherre/Code/pgsql-build/master/src/bin/pg_upgrade/tmp_check/tmp_test_vVew/dest_dump.plain.sql_adjusted
> === stdout ===
> --- /home/alvherre/Code/pgsql-build/master/src/bin/pg_upgrade/tmp_check/tmp_test_vVew/src_dump.sql_adjusted 2025-03-12 12:50:27.674918597 +0100
> +++ /home/alvherre/Code/pgsql-build/master/src/bin/pg_upgrade/tmp_check/tmp_test_vVew/dest_dump.plain.sql_adjusted 2025-03-12 12:50:31.778840338 +0100
> @@ -208972,7 +208972,7 @@
> -- Data for Name: money_data; Type: TABLE DATA; Schema: public; Owner: alvherre
> --
> COPY public.money_data (m) FROM stdin;
> -$123.46
> +$ 12.346,00
> \.
> --
> -- Data for Name: mvtest_t; Type: TABLE DATA; Schema: public; Owner: alvherre
> @@ -376231,7 +376231,7 @@
> -- Data for Name: tab_core_types; Type: TABLE DATA; Schema: public; Owner: alvherre
> --
> COPY public.tab_core_types (point, line, lseg, box, openedpath, closedpath, polygon, circle, date, "time", "timestamp", timetz, timestamptz, "interval", "json", jsonb, jsonpath, inet, cidr, macaddr8, macaddr, int2, int4, int8, float4, float8, pi, "char", bpchar, "varchar", name, text, bool, bytea, "bit", varbit, money, refcursor, int2vector, oidvector, aclitem, tsvector, tsquery, uuid, xid8, regclass, type, regrole, oid, tid, xid, cid, txid_snapshot, pg_snapshot, pg_lsn, cardinal_number, character_data, sql_identifier, time_stamp, yes_or_no, int4range, int4multirange, int8range, int8multirange, numrange, nummultirange, daterange, datemultirange, tsrange, tsmultirange, tstzrange, tstzmultirange) FROM stdin;
> -(11,12) {1,-1,0} [(11,11),(12,12)] (13,13),(11,11) ((11,12),(13,13),(14,14)) [(11,12),(13,13),(14,14)] ((11,12),(13,13),(14,14)) <(1,1),1> 2025-03-12 04:50:14.125899 2025-03-12 04:50:14.125899 04:50:14.125899-07 2025-03-12 12:50:14.125899+01 00:00:12 {"reason":"because"} {"when": "now"} $."a"[*]?(@ > 2) 127.0.0.1 127.0.0.0/8 00:01:03:ff:fe:86:1c:ba 00:01:03:86:1c:ba 2 4 8 4 8 3.14159265358979 f c abc name txt t \\xdeadbeef 1 10001 $12.34 abc 1 2 1 2 alvherre=UC/alvherre 'a' 'and' 'ate' 'cat' 'fat' 'mat' 'on' 'rat' 'sat' 'fat' & 'rat' a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11 11 pg_class regtype pg_monitor 1259 (1,1) 2 3 10:20:10,14,15 10:20:10,14,15 16/B374D848 1 l n 2025-03-12 12:50:14.13+01 YES empty {} empty {} (3,4) {(3,4)} [2020-01-03,2021-02-03) {[2020-01-03,2021-02-03)} ("2020-01-02 03:04:05","2021-02-03 06:07:08") {("2020-01-02 03:04:05","2021-02-03 06:07:08")} ("2020-01-02 12:04:05+01","2021-02-03 15:07:08+01") {("2020-01-02 12:04:05+01","2021-02-03 15:07:08+01")}
> +(11,12) {1,-1,0} [(11,11),(12,12)] (13,13),(11,11) ((11,12),(13,13),(14,14)) [(11,12),(13,13),(14,14)] ((11,12),(13,13),(14,14)) <(1,1),1> 2025-03-12 04:50:14.125899 2025-03-12 04:50:14.125899 04:50:14.125899-07 2025-03-12 12:50:14.125899+01 00:00:12 {"reason":"because"} {"when": "now"} $."a"[*]?(@ > 2) 127.0.0.1 127.0.0.0/8 00:01:03:ff:fe:86:1c:ba 00:01:03:86:1c:ba 2 4 8 4 8 3.14159265358979 f c abc name txt t \\xdeadbeef 1 10001 $ 1.234,00 abc 1 2 1 2 alvherre=UC/alvherre 'a' 'and' 'ate' 'cat' 'fat' 'mat' 'on' 'rat' 'sat' 'fat' & 'rat' a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11 11 pg_class regtype pg_monitor 1259 (1,1) 2 3 10:20:10,14,15 10:20:10,14,15 16/B374D848 1 l n 2025-03-12 12:50:14.13+01 YES empty {} empty {} (3,4) {(3,4)} [2020-01-03,2021-02-03) {[2020-01-03,2021-02-03)} ("2020-01-02 03:04:05","2021-02-03 06:07:08") {("2020-01-02 03:04:05","2021-02-03 06:07:08")} ("2020-01-02 12:04:05+01","2021-02-03 15:07:08+01") {("2020-01-02 12:04:05+01","2021-02-03 15:07:08+01")}
> \.
> --
> -- Data for Name: tableam_parted_a_heap2; Type: TABLE DATA; Schema: public; Owner: alvherre=== stderr ===
> === EOF ===
>
However these differences are coming from original and restored
database which are using the same initdb options.
Does the test pass for you if you don't apply my patches?
Over at [1], I had seen a locale related failure without applying my patches.
[1] https://www.postgresql.org/message-id/[email protected]...
--
Best Wishes,
Ashutosh Bapat
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: Test to dump and restore objects left behind by regression
2025-03-11 10:44 Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 12:05 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-12 15:58 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
@ 2025-03-12 16:09 ` Alvaro Herrera <[email protected]>
2025-03-13 06:52 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
0 siblings, 1 reply; 93+ messages in thread
From: Alvaro Herrera @ 2025-03-12 16:09 UTC (permalink / raw)
To: Ashutosh Bapat <[email protected]>; +Cc: Michael Paquier <[email protected]>; Daniel Gustafsson <[email protected]>; Tom Lane <[email protected]>; Peter Eisentraut <[email protected]>; PostgreSQL Hackers <[email protected]>
On 2025-Mar-12, Ashutosh Bapat wrote:
> Does the test pass for you if you don't apply my patches?
Yes. It also passes if I keep PG_TEST_EXTRA empty.
--
Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: Test to dump and restore objects left behind by regression
2025-03-11 10:44 Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 12:05 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-12 15:58 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 16:09 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
@ 2025-03-13 06:52 ` Ashutosh Bapat <[email protected]>
2025-03-13 08:42 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
0 siblings, 1 reply; 93+ messages in thread
From: Ashutosh Bapat @ 2025-03-13 06:52 UTC (permalink / raw)
To: Alvaro Herrera <[email protected]>; +Cc: Michael Paquier <[email protected]>; Daniel Gustafsson <[email protected]>; Tom Lane <[email protected]>; Peter Eisentraut <[email protected]>; PostgreSQL Hackers <[email protected]>
Hi Alvaro,
On Wed, Mar 12, 2025 at 9:39 PM Alvaro Herrera <[email protected]> wrote:
>
> On 2025-Mar-12, Ashutosh Bapat wrote:
>
> > Does the test pass for you if you don't apply my patches?
>
> Yes. It also passes if I keep PG_TEST_EXTRA empty.
I am not able to reproduce this problem locally.
The test uses
In my case the money is printed $<digits before decimal>.<digits after
decimal> format in both the dumps. But in your case the money printed
from restored database has a space between $ and amount and the amount
also has decimal and comma in odd places - I can't figure out what
that means or what lc_monetary value would print something like that.
Can you please help me with
1. can you please run the test again and share the dump outputs. They
will be located in a temporary directory with names
src_dump.sql_adjusted and dest_dump.<format>.sql_adjusted.
2. Are you seeing this diff only with plain format or other formats as well?
Sorry for the trouble.
--
Best Wishes,
Ashutosh Bapat
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: Test to dump and restore objects left behind by regression
2025-03-11 10:44 Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 12:05 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-12 15:58 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 16:09 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 06:52 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
@ 2025-03-13 08:42 ` Alvaro Herrera <[email protected]>
2025-03-13 12:39 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
0 siblings, 1 reply; 93+ messages in thread
From: Alvaro Herrera @ 2025-03-13 08:42 UTC (permalink / raw)
To: Ashutosh Bapat <[email protected]>; +Cc: Michael Paquier <[email protected]>; Daniel Gustafsson <[email protected]>; Tom Lane <[email protected]>; Peter Eisentraut <[email protected]>; PostgreSQL Hackers <[email protected]>
Hello
On 2025-Mar-13, Ashutosh Bapat wrote:
> 1. can you please run the test again and share the dump outputs. They
> will be located in a temporary directory with names
> src_dump.sql_adjusted and dest_dump.<format>.sql_adjusted.
Ah, I see the problem :-) The first initdb does this:
# Running: initdb -D /home/alvherre/Code/pgsql-build/master/src/bin/pg_upgrade/tmp_check/t_002_pg_upgrade_old_node_data/pgdata -A trust -N --wal-segsize 1 --allow-group-access --encoding UTF-8 --lc-collate C --lc-ctype C --locale-provider builtin --builtin-locale C.UTF-8 -k
The files belonging to this database system will be owned by user "alvherre".
This user must also own the server process.
The database cluster will be initialized with this locale configuration:
locale provider: builtin
default collation: C.UTF-8
LC_COLLATE: C
LC_CTYPE: C
LC_MESSAGES: C
LC_MONETARY: es_CL.UTF-8
LC_NUMERIC: es_CL.UTF-8
LC_TIME: es_CL.UTF-8
The default text search configuration will be set to "english".
Data page checksums are enabled.
which for some reason used my environment setting for LC_MONETARY.
--
Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/
"But static content is just dynamic content that isn't moving!"
http://smylers.hates-software.com/2007/08/15/fe244d0c.html
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: Test to dump and restore objects left behind by regression
2025-03-11 10:44 Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 12:05 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-12 15:58 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 16:09 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 06:52 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 08:42 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
@ 2025-03-13 12:39 ` Ashutosh Bapat <[email protected]>
2025-03-13 12:40 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
0 siblings, 1 reply; 93+ messages in thread
From: Ashutosh Bapat @ 2025-03-13 12:39 UTC (permalink / raw)
To: Alvaro Herrera <[email protected]>; +Cc: Michael Paquier <[email protected]>; Daniel Gustafsson <[email protected]>; Tom Lane <[email protected]>; Peter Eisentraut <[email protected]>; PostgreSQL Hackers <[email protected]>
On Thu, Mar 13, 2025 at 2:12 PM Alvaro Herrera <[email protected]> wrote:
>
> Hello
>
> On 2025-Mar-13, Ashutosh Bapat wrote:
>
> > 1. can you please run the test again and share the dump outputs. They
> > will be located in a temporary directory with names
> > src_dump.sql_adjusted and dest_dump.<format>.sql_adjusted.
>
> Ah, I see the problem :-) The first initdb does this:
>
> # Running: initdb -D /home/alvherre/Code/pgsql-build/master/src/bin/pg_upgrade/tmp_check/t_002_pg_upgrade_old_node_data/pgdata -A trust -N --wal-segsize 1 --allow-group-access --encoding UTF-8 --lc-collate C --lc-ctype C --locale-provider builtin --builtin-locale C.UTF-8 -k
> The files belonging to this database system will be owned by user "alvherre".
> This user must also own the server process.
>
> The database cluster will be initialized with this locale configuration:
> locale provider: builtin
> default collation: C.UTF-8
> LC_COLLATE: C
> LC_CTYPE: C
> LC_MESSAGES: C
> LC_MONETARY: es_CL.UTF-8
> LC_NUMERIC: es_CL.UTF-8
> LC_TIME: es_CL.UTF-8
> The default text search configuration will be set to "english".
>
> Data page checksums are enabled.
>
> which for some reason used my environment setting for LC_MONETARY.
>
Thanks. This is super helpful. I am able to reproduce the problem
$ unset LC_MONETARY
$ export PG_TEST_EXTRA=regress_dump_test
$ meson test --suite setup && meson test pg_upgrade/002_pg_upgrade
... snip ...
1/1 postgresql:pg_upgrade / pg_upgrade/002_pg_upgrade OK
72.38s 44 subtests passed
Ok: 1
Expected Fail: 0
Fail: 0
Unexpected Pass: 0
Skipped: 0
Timeout: 0
Full log written to
/home/ashutosh/work/units/pg_dump_test/build/dev/meson-logs/testlog.txt
$ export LC_MONETARY="es_CL.UTF-8"
$ meson test --suite setup && meson test pg_upgrade/002_pg_upgrade
... snip ...
1/1 postgresql:pg_upgrade / pg_upgrade/002_pg_upgrade ERROR
69.18s exit status 4
>>> with_icu=no LD_LIBRARY_PATH=/home/ashutosh/work/units/pg_dump_test/build/dev/tmp_install//home/ashutosh/work/units/pg_dump_test/build/dev/lib/x86_64-linux-gnu REGRESS_SHLIB=/home/ashutosh/work/units/pg_dump_test/build/dev/src/test/regress/regress.so PATH=/home/ashutosh/work/units/pg_dump_test/build/dev/tmp_install//home/ashutosh/work/units/pg_dump_test/build/dev/bin:/home/ashutosh/work/units/pg_dump_test/build/dev/src/bin/pg_upgrade:/home/ashutosh/work/units/pg_dump_test/build/dev/src/bin/pg_upgrade/test:/home/ashutosh/work/units/pg_dump_test/build/dev/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin MALLOC_PERTURB_=30 share_contrib_dir=/home/ashutosh/work/units/pg_dump_test/build/dev/tmp_install//home/ashutosh/work/units/pg_dump_test/build/dev/share/postgresql/contrib PG_REGRESS=/home/ashutosh/work/units/pg_dump_test/build/dev/src/test/regress/pg_regress top_builddir=/home/ashutosh/work/units/pg_dump_test/build/dev INITDB_TEMPLATE=/home/ashutosh/work/units/pg_dump_test/build/dev/tmp_install/initdb-template /usr/bin/python3 /home/ashutosh/work/units/pg_dump_test/build/dev/../../coderoot/pg/src/tools/testwrap --basedir /home/ashutosh/work/units/pg_dump_test/build/dev --srcdir /home/ashutosh/work/units/pg_dump_test/coderoot/pg/src/bin/pg_upgrade --pg-test-extra '' --testgroup pg_upgrade --testname 002_pg_upgrade -- /usr/bin/perl -I /home/ashutosh/work/units/pg_dump_test/coderoot/pg/src/test/perl -I /home/ashutosh/work/units/pg_dump_test/coderoot/pg/src/bin/pg_upgrade /home/ashutosh/work/units/pg_dump_test/coderoot/pg/src/bin/pg_upgrade/t/002_pg_upgrade.pl
Ok: 0
Expected Fail: 0
Fail: 1
Unexpected Pass: 0
Skipped: 0
Timeout: 0
I see what's happening. If I set LC_MONETARY environment explicitly,
that's taken by initdb
$ export LC_MONETARY="es_CL.UTF-8";rm -rf $DataDir; $BinDir/initdb -D
$DataDir -A trust -N --wal-segsize 1 --allow-group-access --encoding
UTF-8 --lc-collate C --lc-ctype C --locale-provider builtin
--builtin-locale C.UTF-8 -k
The files belonging to this database system will be owned by user "ashutosh".
This user must also own the server process.
The database cluster will be initialized with this locale configuration:
locale provider: builtin
default collation: C.UTF-8
LC_COLLATE: C
LC_CTYPE: C
LC_MESSAGES: en_US.UTF-8
LC_MONETARY: es_CL.UTF-8
LC_NUMERIC: en_US.UTF-8
LC_TIME: en_US.UTF-8
The default text search configuration will be set to "english".
If I don't set it explicitly, it's taken from default settings
$ unset LC_MONETARY;rm -rf $DataDir; $BinDir/initdb -D $DataDir -A
trust -N --wal-segsize 1 --allow-group-access --encoding UTF-8
--lc-collate C --lc-ctype C --locale-provider builtin --builtin-locale
C.UTF-8 -k
The files belonging to this database system will be owned by user "ashutosh".
This user must also own the server process.
The database cluster will be initialized with this locale configuration:
locale provider: builtin
default collation: C.UTF-8
LC_COLLATE: C
LC_CTYPE: C
LC_MESSAGES: en_US.UTF-8
LC_MONETARY: en_US.UTF-8
LC_NUMERIC: en_US.UTF-8
LC_TIME: en_US.UTF-8
The default text search configuration will be set to "english".
In your case probably your default setting is es_CL.UTF-8 or have set
LC_MONETARY explicitly in your environment.
I think the fix is to explicitly pass --lc-monetary to the old cluster
and the restored cluster. 003 patch in the attached patch set does
that. Please check if it fixes the issue for you.
Additionally we should check that it gets copied to the new cluster as
well. But I haven't figured out how to get those settings yet. This
treatment is similar to how --lc-collate and --lc-ctype are treated. I
am wondering whether we should explicitly pass --lc-messages,
--lc-time and --lc-numeric as well.
2d819a08a1cbc11364e36f816b02e33e8dcc030b introduced buildin locale
provider and added overrides to LC_COLLATE and LC_TYPE. But it did not
override other LC_, which I think it should have. In pure upgrade
test, the upgraded node inherits the locale settings of the original
cluster, so this wasn't apparent. But with pg_dump testing, the
original and restored databases are independent. Hence I think we have
to override all LC_* settings by explicitly mentioning --lc-* options
to initdb. Please let me know what you think about this?
--
Best Wishes,
Ashutosh Bapat
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: Test to dump and restore objects left behind by regression
2025-03-11 10:44 Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 12:05 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-12 15:58 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 16:09 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 06:52 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 08:42 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 12:39 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
@ 2025-03-13 12:40 ` Ashutosh Bapat <[email protected]>
2025-03-19 11:43 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
0 siblings, 1 reply; 93+ messages in thread
From: Ashutosh Bapat @ 2025-03-13 12:40 UTC (permalink / raw)
To: Alvaro Herrera <[email protected]>; +Cc: Michael Paquier <[email protected]>; Daniel Gustafsson <[email protected]>; Tom Lane <[email protected]>; Peter Eisentraut <[email protected]>; PostgreSQL Hackers <[email protected]>
Here are patches missing in the previous email.
On Thu, Mar 13, 2025 at 6:09 PM Ashutosh Bapat
<[email protected]> wrote:
>
> On Thu, Mar 13, 2025 at 2:12 PM Alvaro Herrera <[email protected]> wrote:
> >
> > Hello
> >
> > On 2025-Mar-13, Ashutosh Bapat wrote:
> >
> > > 1. can you please run the test again and share the dump outputs. They
> > > will be located in a temporary directory with names
> > > src_dump.sql_adjusted and dest_dump.<format>.sql_adjusted.
> >
> > Ah, I see the problem :-) The first initdb does this:
> >
> > # Running: initdb -D /home/alvherre/Code/pgsql-build/master/src/bin/pg_upgrade/tmp_check/t_002_pg_upgrade_old_node_data/pgdata -A trust -N --wal-segsize 1 --allow-group-access --encoding UTF-8 --lc-collate C --lc-ctype C --locale-provider builtin --builtin-locale C.UTF-8 -k
> > The files belonging to this database system will be owned by user "alvherre".
> > This user must also own the server process.
> >
> > The database cluster will be initialized with this locale configuration:
> > locale provider: builtin
> > default collation: C.UTF-8
> > LC_COLLATE: C
> > LC_CTYPE: C
> > LC_MESSAGES: C
> > LC_MONETARY: es_CL.UTF-8
> > LC_NUMERIC: es_CL.UTF-8
> > LC_TIME: es_CL.UTF-8
> > The default text search configuration will be set to "english".
> >
> > Data page checksums are enabled.
> >
> > which for some reason used my environment setting for LC_MONETARY.
> >
>
> Thanks. This is super helpful. I am able to reproduce the problem
> $ unset LC_MONETARY
> $ export PG_TEST_EXTRA=regress_dump_test
> $ meson test --suite setup && meson test pg_upgrade/002_pg_upgrade
> ... snip ...
> 1/1 postgresql:pg_upgrade / pg_upgrade/002_pg_upgrade OK
> 72.38s 44 subtests passed
>
>
> Ok: 1
> Expected Fail: 0
> Fail: 0
> Unexpected Pass: 0
> Skipped: 0
> Timeout: 0
>
> Full log written to
> /home/ashutosh/work/units/pg_dump_test/build/dev/meson-logs/testlog.txt
> $ export LC_MONETARY="es_CL.UTF-8"
> $ meson test --suite setup && meson test pg_upgrade/002_pg_upgrade
> ... snip ...
> 1/1 postgresql:pg_upgrade / pg_upgrade/002_pg_upgrade ERROR
> 69.18s exit status 4
> >>> with_icu=no LD_LIBRARY_PATH=/home/ashutosh/work/units/pg_dump_test/build/dev/tmp_install//home/ashutosh/work/units/pg_dump_test/build/dev/lib/x86_64-linux-gnu REGRESS_SHLIB=/home/ashutosh/work/units/pg_dump_test/build/dev/src/test/regress/regress.so PATH=/home/ashutosh/work/units/pg_dump_test/build/dev/tmp_install//home/ashutosh/work/units/pg_dump_test/build/dev/bin:/home/ashutosh/work/units/pg_dump_test/build/dev/src/bin/pg_upgrade:/home/ashutosh/work/units/pg_dump_test/build/dev/src/bin/pg_upgrade/test:/home/ashutosh/work/units/pg_dump_test/build/dev/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin MALLOC_PERTURB_=30 share_contrib_dir=/home/ashutosh/work/units/pg_dump_test/build/dev/tmp_install//home/ashutosh/work/units/pg_dump_test/build/dev/share/postgresql/contrib PG_REGRESS=/home/ashutosh/work/units/pg_dump_test/build/dev/src/test/regress/pg_regress top_builddir=/home/ashutosh/work/units/pg_dump_test/build/dev INITDB_TEMPLATE=/home/ashutosh/work/units/pg_dump_test/build/dev/tmp_install/initdb-template /usr/bin/python3 /home/ashutosh/work/units/pg_dump_test/build/dev/../../coderoot/pg/src/tools/testwrap --basedir /home/ashutosh/work/units/pg_dump_test/build/dev --srcdir /home/ashutosh/work/units/pg_dump_test/coderoot/pg/src/bin/pg_upgrade --pg-test-extra '' --testgroup pg_upgrade --testname 002_pg_upgrade -- /usr/bin/perl -I /home/ashutosh/work/units/pg_dump_test/coderoot/pg/src/test/perl -I /home/ashutosh/work/units/pg_dump_test/coderoot/pg/src/bin/pg_upgrade /home/ashutosh/work/units/pg_dump_test/coderoot/pg/src/bin/pg_upgrade/t/002_pg_upgrade.pl
>
>
>
> Ok: 0
> Expected Fail: 0
> Fail: 1
> Unexpected Pass: 0
> Skipped: 0
> Timeout: 0
>
> I see what's happening. If I set LC_MONETARY environment explicitly,
> that's taken by initdb
> $ export LC_MONETARY="es_CL.UTF-8";rm -rf $DataDir; $BinDir/initdb -D
> $DataDir -A trust -N --wal-segsize 1 --allow-group-access --encoding
> UTF-8 --lc-collate C --lc-ctype C --locale-provider builtin
> --builtin-locale C.UTF-8 -k
> The files belonging to this database system will be owned by user "ashutosh".
> This user must also own the server process.
>
> The database cluster will be initialized with this locale configuration:
> locale provider: builtin
> default collation: C.UTF-8
> LC_COLLATE: C
> LC_CTYPE: C
> LC_MESSAGES: en_US.UTF-8
> LC_MONETARY: es_CL.UTF-8
> LC_NUMERIC: en_US.UTF-8
> LC_TIME: en_US.UTF-8
> The default text search configuration will be set to "english".
>
> If I don't set it explicitly, it's taken from default settings
> $ unset LC_MONETARY;rm -rf $DataDir; $BinDir/initdb -D $DataDir -A
> trust -N --wal-segsize 1 --allow-group-access --encoding UTF-8
> --lc-collate C --lc-ctype C --locale-provider builtin --builtin-locale
> C.UTF-8 -k
> The files belonging to this database system will be owned by user "ashutosh".
> This user must also own the server process.
>
> The database cluster will be initialized with this locale configuration:
> locale provider: builtin
> default collation: C.UTF-8
> LC_COLLATE: C
> LC_CTYPE: C
> LC_MESSAGES: en_US.UTF-8
> LC_MONETARY: en_US.UTF-8
> LC_NUMERIC: en_US.UTF-8
> LC_TIME: en_US.UTF-8
> The default text search configuration will be set to "english".
>
> In your case probably your default setting is es_CL.UTF-8 or have set
> LC_MONETARY explicitly in your environment.
>
> I think the fix is to explicitly pass --lc-monetary to the old cluster
> and the restored cluster. 003 patch in the attached patch set does
> that. Please check if it fixes the issue for you.
>
> Additionally we should check that it gets copied to the new cluster as
> well. But I haven't figured out how to get those settings yet. This
> treatment is similar to how --lc-collate and --lc-ctype are treated. I
> am wondering whether we should explicitly pass --lc-messages,
> --lc-time and --lc-numeric as well.
>
> 2d819a08a1cbc11364e36f816b02e33e8dcc030b introduced buildin locale
> provider and added overrides to LC_COLLATE and LC_TYPE. But it did not
> override other LC_, which I think it should have. In pure upgrade
> test, the upgraded node inherits the locale settings of the original
> cluster, so this wasn't apparent. But with pg_dump testing, the
> original and restored databases are independent. Hence I think we have
> to override all LC_* settings by explicitly mentioning --lc-* options
> to initdb. Please let me know what you think about this?
>
> --
> Best Wishes,
> Ashutosh Bapat
--
Best Wishes,
Ashutosh Bapat
Attachments:
[text/x-patch] 0001-Test-pg_dump-restore-of-regression-objects-20250313.patch (16.1K, ../../CAExHW5tOhQi2Fyf5My-YK3uzP8QwVJZQDfC3o-vvAxUUG-CNhg@mail.gmail.com/2-0001-Test-pg_dump-restore-of-regression-objects-20250313.patch)
download | inline diff:
From ec6c178ba0a1a20dc989fee94fdc8d53d531e2e4 Mon Sep 17 00:00:00 2001
From: Ashutosh Bapat <[email protected]>
Date: Thu, 27 Jun 2024 10:03:53 +0530
Subject: [PATCH 1/3] Test pg_dump/restore of regression objects
002_pg_upgrade.pl tests pg_upgrade of the regression database left
behind by regression run. Modify it to test dump and restore of the
regression database as well.
Regression database created by regression run contains almost all the
database objects supported by PostgreSQL in various states. Hence the
new testcase covers dump and restore scenarios not covered by individual
dump/restore cases. Till now 002_pg_upgrade only tested dump/restore
through pg_upgrade which only uses binary mode. Many regression tests
mention that they leave objects behind for dump/restore testing but they
are not tested in a non-binary mode. The new testcase closes that
gap.
Testing dump and restore of regression database makes this test run
longer for a relatively smaller benefit. Hence run it only when
explicitly requested by user by specifying "regress_dump_test" in
PG_TEST_EXTRA.
Note For the reviewers:
The new test has uncovered two bugs so far in one year.
1. Introduced by 14e87ffa5c54. Fixed in fd41ba93e4630921a72ed5127cd0d552a8f3f8fc.
2. Introduced by 0413a556990ba628a3de8a0b58be020fd9a14ed0. Reverted in 74563f6b90216180fc13649725179fc119dddeb5.
Author: Ashutosh Bapat
Reviewed by: Michael Pacquire, Daniel Gustafsson, Tom Lane, Alvaro Herrera
Discussion: https://www.postgresql.org/message-id/CAExHW5uF5V=Cjecx3_Z=7xfh4rg2Wf61PT+hfquzjBqouRzQJQ@mail.gmail.com
---
doc/src/sgml/regress.sgml | 12 ++
src/bin/pg_upgrade/t/002_pg_upgrade.pl | 141 ++++++++++++++++-
src/test/perl/Makefile | 2 +
src/test/perl/PostgreSQL/Test/AdjustDump.pm | 167 ++++++++++++++++++++
src/test/perl/meson.build | 1 +
5 files changed, 321 insertions(+), 2 deletions(-)
create mode 100644 src/test/perl/PostgreSQL/Test/AdjustDump.pm
diff --git a/doc/src/sgml/regress.sgml b/doc/src/sgml/regress.sgml
index 0e5e8e8f309..237b974b3ab 100644
--- a/doc/src/sgml/regress.sgml
+++ b/doc/src/sgml/regress.sgml
@@ -357,6 +357,18 @@ make check-world PG_TEST_EXTRA='kerberos ldap ssl load_balance libpq_encryption'
</para>
</listitem>
</varlistentry>
+
+ <varlistentry>
+ <term><literal>regress_dump_test</literal></term>
+ <listitem>
+ <para>
+ When enabled, <filename>src/bin/pg_upgrade/t/002_pg_upgrade.pl</filename>
+ tests dump and restore of regression database left behind by the
+ regression run. Not enabled by default because it is time and resource
+ consuming.
+ </para>
+ </listitem>
+ </varlistentry>
</variablelist>
Tests for features that are not supported by the current build
diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl
index c00cf68d660..bd8313cee6f 100644
--- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl
+++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl
@@ -12,6 +12,7 @@ use File::Path qw(rmtree);
use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::Utils;
use PostgreSQL::Test::AdjustUpgrade;
+use PostgreSQL::Test::AdjustDump;
use Test::More;
# Can be changed to test the other modes.
@@ -35,8 +36,8 @@ sub generate_db
"created database with ASCII characters from $from_char to $to_char");
}
-# Filter the contents of a dump before its use in a content comparison.
-# This returns the path to the filtered dump.
+# Filter the contents of a dump before its use in a content comparison for
+# upgrade testing. This returns the path to the filtered dump.
sub filter_dump
{
my ($is_old, $old_version, $dump_file) = @_;
@@ -261,6 +262,21 @@ else
}
}
is($rc, 0, 'regression tests pass');
+
+ # Test dump/restore of the objects left behind by regression. Ideally it
+ # should be done in a separate TAP test, but doing it here saves us one full
+ # regression run.
+ #
+ # This step takes several extra seconds and some extra disk space, so
+ # requires an opt-in with the PG_TEST_EXTRA environment variable.
+ #
+ # Do this while the old cluster is running before it is shut down by the
+ # upgrade test.
+ if ( $ENV{PG_TEST_EXTRA}
+ && $ENV{PG_TEST_EXTRA} =~ /\bregress_dump_test\b/)
+ {
+ test_regression_dump_restore($oldnode, %node_params);
+ }
}
# Initialize a new node for the upgrade.
@@ -527,4 +543,125 @@ my $dump2_filtered = filter_dump(0, $oldnode->pg_version, $dump2_file);
compare_files($dump1_filtered, $dump2_filtered,
'old and new dumps match after pg_upgrade');
+# Test dump and restore of objects left behind by the regression run.
+#
+# It is expected that regression tests, which create `regression` database, are
+# run on `src_node`, which in turn, is left in running state. The dump from
+# `src_node` is restored on a fresh node created using given `node_params`.
+# Plain dumps from both the nodes are compared to make sure that all the dumped
+# objects are restored faithfully.
+sub test_regression_dump_restore
+{
+ my ($src_node, %node_params) = @_;
+ my $dst_node = PostgreSQL::Test::Cluster->new('dst_node');
+
+ # Make sure that the source and destination nodes have the same version and
+ # do not use custom install paths. In both the cases, the dump files may
+ # require additional adjustments unknown to code here. Do not run this test
+ # in such a case to avoid utilizing the time and resources unnecessarily.
+ if ($src_node->pg_version != $dst_node->pg_version
+ or defined $src_node->{_install_path})
+ {
+ fail("same version dump and restore test using default installation");
+ return;
+ }
+
+ # Dump the original database for comparison later.
+ my $src_dump =
+ get_dump_for_comparison($src_node, 'regression', 'src_dump', 1);
+
+ # Setup destination database cluster
+ $dst_node->init(%node_params);
+ # Stabilize stats for comparison.
+ $dst_node->append_conf('postgresql.conf', 'autovacuum = off');
+ $dst_node->start;
+
+ for my $format ('plain', 'tar', 'directory', 'custom')
+ {
+ my $dump_file = "$tempdir/regression_dump.$format";
+ my $restored_db = 'regression_' . $format;
+
+ $src_node->command_ok(
+ [
+ 'pg_dump', "-F$format", '--no-sync',
+ '-d', $src_node->connstr('regression'),
+ '-f', $dump_file
+ ],
+ "pg_dump on source instance in $format format");
+
+ # Create a new database for restoring dump from every format so that it
+ # is available for debugging in case the test fails.
+ $dst_node->command_ok([ 'createdb', $restored_db ],
+ "created destination database '$restored_db'");
+
+ # Restore into destination database.
+ my @restore_command;
+ if ($format eq 'plain')
+ {
+ # Restore dump in "plain" format using `psql`.
+ @restore_command = [
+ 'psql', '-d', $dst_node->connstr($restored_db),
+ '-f', $dump_file
+ ];
+ }
+ else
+ {
+ @restore_command = [
+ 'pg_restore', '-d',
+ $dst_node->connstr($restored_db), $dump_file
+ ];
+ }
+ $dst_node->command_ok(@restore_command,
+ "restored dump taken in $format format on destination instance");
+
+ my $dst_dump =
+ get_dump_for_comparison($dst_node, $restored_db,
+ 'dest_dump.' . $format, 0);
+
+ compare_files($src_dump, $dst_dump,
+ "dump outputs from original and restored regression database (using $format format) match"
+ );
+ }
+}
+
+# Dump database `db` from the given `node` in plain format and adjust it for
+# comparing dumps from the original and the restored database.
+#
+# `file_prefix` is used to create unique names for all dump files so that they
+# remain available for debugging in case the test fails.
+#
+# `adjust_child_columns` is passed to adjust_regress_dumpfile() which actually
+# adjusts the dump output.
+#
+# The name of the file containting adjusted dump is returned.
+sub get_dump_for_comparison
+{
+ my ($node, $db, $file_prefix, $adjust_child_columns) = @_;
+
+ my $dumpfile = $tempdir . '/' . $file_prefix . '.sql';
+ my $dump_adjusted = "${dumpfile}_adjusted";
+
+ # Usually we avoid comparing statistics in our tests since it is flaky by
+ # nature. However, if statistics is dumped and restored it is expected to be
+ # restored as it is i.e. the statistics from the original database and that
+ # from the restored database should match. We turn off autovacuum on the
+ # source and the target database to avoid any statistics update during
+ # restore operation. Hence we do not exclude statistics from dump.
+ $node->command_ok(
+ [
+ 'pg_dump', '--no-sync', '-d', $node->connstr($db), '-f',
+ $dumpfile
+ ],
+ 'dump for comparison succeeded');
+
+ open(my $dh, '>', $dump_adjusted)
+ || die
+ "could not open $dump_adjusted for writing the adjusted dump: $!";
+ print $dh adjust_regress_dumpfile(slurp_file($dumpfile),
+ $adjust_child_columns);
+ close($dh);
+
+ return $dump_adjusted;
+}
+
done_testing();
diff --git a/src/test/perl/Makefile b/src/test/perl/Makefile
index d82fb67540e..def89650ead 100644
--- a/src/test/perl/Makefile
+++ b/src/test/perl/Makefile
@@ -26,6 +26,7 @@ install: all installdirs
$(INSTALL_DATA) $(srcdir)/PostgreSQL/Test/Cluster.pm '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/Cluster.pm'
$(INSTALL_DATA) $(srcdir)/PostgreSQL/Test/BackgroundPsql.pm '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/BackgroundPsql.pm'
$(INSTALL_DATA) $(srcdir)/PostgreSQL/Test/AdjustUpgrade.pm '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/AdjustUpgrade.pm'
+ $(INSTALL_DATA) $(srcdir)/PostgreSQL/Test/AdjustDump.pm '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/AdjustDump.pm'
$(INSTALL_DATA) $(srcdir)/PostgreSQL/Version.pm '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Version.pm'
uninstall:
@@ -36,6 +37,7 @@ uninstall:
rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/Cluster.pm'
rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/BackgroundPsql.pm'
rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/AdjustUpgrade.pm'
+ rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/AdjustDump.pm'
rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Version.pm'
endif
diff --git a/src/test/perl/PostgreSQL/Test/AdjustDump.pm b/src/test/perl/PostgreSQL/Test/AdjustDump.pm
new file mode 100644
index 00000000000..74b9a60cf34
--- /dev/null
+++ b/src/test/perl/PostgreSQL/Test/AdjustDump.pm
@@ -0,0 +1,167 @@
+
+# Copyright (c) 2024-2025, PostgreSQL Global Development Group
+
+=pod
+
+=head1 NAME
+
+PostgreSQL::Test::AdjustDump - helper module for dump and restore tests
+
+=head1 SYNOPSIS
+
+ use PostgreSQL::Test::AdjustDump;
+
+ # Adjust contents of dump output file so that dump output from original
+ # regression database and that from the restored regression database match
+ $dump = adjust_regress_dumpfile($dump, $adjust_child_columns);
+
+=head1 DESCRIPTION
+
+C<PostgreSQL::Test::AdjustDump> encapsulates various hacks needed to
+compare the results of dump and restore tests
+
+=cut
+
+package PostgreSQL::Test::AdjustDump;
+
+use strict;
+use warnings FATAL => 'all';
+
+use Exporter 'import';
+use Test::More;
+
+our @EXPORT = qw(
+ adjust_regress_dumpfile
+);
+
+=pod
+
+=head1 ROUTINES
+
+=over
+
+=item $dump = adjust_regress_dumpfile($dump, $adjust_child_columns)
+
+If we take dump of the regression database left behind after running regression
+tests, restore the dump, and take dump of the restored regression database, the
+outputs of both the dumps differ in the following cases. This routine adjusts
+the given dump so that dump outputs from the original and restored database,
+respectively, match.
+
+Case 1: Some regression tests purposefully create child tables in such a way
+that the order of their inherited columns differ from column orders of their
+respective parents. In the restored database, however, the order of their
+inherited columns are same as that of their respective parents. Thus the column
+orders of these child tables in the original database and those in the restored
+database differ, causing difference in the dump outputs. See MergeAttributes()
+and dumpTableSchema() for details. This routine rearranges the column
+declarations in the relevant C<CREATE TABLE... INHERITS> statements in the dump
+file from original database to match those from the restored database. We could,
+instead, adjust the statements in the dump from the restored database to match
+those from original database or adjust both to a canonical order. But we have
+chosen to adjust the statements in the dump from original database for no
+particular reason.
+
+Case 2: When dumping COPY statements the columns are ordered by their attribute
+number by fmtCopyColumnList(). If a column is added to a parent table after a
+child has inherited the parent and the child has its own columns, the attribute
+number of the column changes after restoring the child table. This is because
+when executing the dumped C<CREATE TABLE... INHERITS> statement all the parent
+attributes are created before any child attributes. Thus the order of columns in
+COPY statements dumped from the original and the restored databases,
+respectively, differs. Such tables in regression tests are listed below. It is
+hard to adjust the column order in the COPY statement along with the data. Hence
+we just remove such COPY statements from the dump output.
+
+Additionally the routine adjusts blank and new lines to avoid noise.
+
+Note: Usually we avoid comparing statistics in our tests since it is flaky by
+nature. However, if statistics is dumped and restored it is expected to be
+restored as it is i.e. the statistics from the original database and that from
+the restored database should match. Hence we do not filter statistics from dump,
+if it's dumped.
+
+Arguments:
+
+=over
+
+=item C<dump>: Contents of dump file
+
+=item C<adjust_child_columns>: 1 indicates that the given dump file requires
+adjusting columns in the child tables; usually when the dump is from original
+database. 0 indicates no such adjustment is needed; usually when the dump is
+from restored database.
+
+=back
+
+Returns the adjusted dump text.
+
+=cut
+
+sub adjust_regress_dumpfile
+{
+ my ($dump, $adjust_child_columns) = @_;
+
+ # use Unix newlines
+ $dump =~ s/\r\n/\n/g;
+
+ # Adjust the CREATE TABLE ... INHERITS statements.
+ if ($adjust_child_columns)
+ {
+ my $saved_dump = $dump;
+
+ $dump =~ s/(^CREATE\sTABLE\sgenerated_stored_tests\.gtestxx_4\s\()
+ (\n\s+b\sinteger),
+ (\n\s+a\sinteger\sNOT\sNULL)/$1$3,$2/mgx;
+ ok($saved_dump ne $dump,
+ 'applied generated_stored_tests.gtestxx_4 adjustments');
+
+ $saved_dump = $dump;
+ $dump =~ s/(^CREATE\sTABLE\sgenerated_virtual_tests\.gtestxx_4\s\()
+ (\n\s+b\sinteger),
+ (\n\s+a\sinteger\sNOT\sNULL)/$1$3,$2/mgx;
+ ok($saved_dump ne $dump,
+ 'applied generated_virtual_tests.gtestxx_4 adjustments');
+
+ $saved_dump = $dump;
+ $dump =~ s/(^CREATE\sTABLE\spublic\.test_type_diff2_c1\s\()
+ (\n\s+int_four\sbigint),
+ (\n\s+int_eight\sbigint),
+ (\n\s+int_two\ssmallint)/$1$4,$2,$3/mgx;
+ ok($saved_dump ne $dump,
+ 'applied public.test_type_diff2_c1 adjustments');
+
+ $saved_dump = $dump;
+ $dump =~ s/(^CREATE\sTABLE\spublic\.test_type_diff2_c2\s\()
+ (\n\s+int_eight\sbigint),
+ (\n\s+int_two\ssmallint),
+ (\n\s+int_four\sbigint)/$1$3,$4,$2/mgx;
+ ok($saved_dump ne $dump,
+ 'applied public.test_type_diff2_c2 adjustments');
+ }
+
+ # Remove COPY statements with differing column order
+ for my $table (
+ 'public\.b_star', 'public\.c_star',
+ 'public\.cc2', 'public\.d_star',
+ 'public\.e_star', 'public\.f_star',
+ 'public\.renamecolumnanother', 'public\.renamecolumnchild',
+ 'public\.test_type_diff2_c1', 'public\.test_type_diff2_c2',
+ 'public\.test_type_diff_c')
+ {
+ $dump =~ s/^COPY\s$table\s\(.+?^\\\.$//sm;
+ }
+
+ # Suppress blank lines, as some places in pg_dump emit more or fewer.
+ $dump =~ s/\n\n+/\n/g;
+
+ return $dump;
+}
+
+=pod
+
+=back
+
+=cut
+
+1;
diff --git a/src/test/perl/meson.build b/src/test/perl/meson.build
index 58e30f15f9d..492ca571ff8 100644
--- a/src/test/perl/meson.build
+++ b/src/test/perl/meson.build
@@ -14,4 +14,5 @@ install_data(
'PostgreSQL/Test/Cluster.pm',
'PostgreSQL/Test/BackgroundPsql.pm',
'PostgreSQL/Test/AdjustUpgrade.pm',
+ 'PostgreSQL/Test/AdjustDump.pm',
install_dir: dir_pgxs / 'src/test/perl/PostgreSQL/Test')
base-commit: 3691edfab97187789b8a1cbb9dce4acf0ecd8f5a
--
2.34.1
[text/x-patch] 0003-set-lc_monetary-explicitly-at-initdb-time-20250313.patch (1.2K, ../../CAExHW5tOhQi2Fyf5My-YK3uzP8QwVJZQDfC3o-vvAxUUG-CNhg@mail.gmail.com/3-0003-set-lc_monetary-explicitly-at-initdb-time-20250313.patch)
download | inline diff:
From 2f41b4371c0f0b8a3535537c4e4f9ddd1118d1ce Mon Sep 17 00:00:00 2001
From: Ashutosh Bapat <[email protected]>
Date: Thu, 13 Mar 2025 16:17:57 +0530
Subject: [PATCH 3/3] set lc_monetary explicitly at initdb time
---
src/bin/pg_upgrade/t/002_pg_upgrade.pl | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl
index 65f4c7d4f2b..51ba79c8589 100644
--- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl
+++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl
@@ -134,6 +134,7 @@ my $original_enc_name;
my $original_provider;
my $original_datcollate = "C";
my $original_datctype = "C";
+my $original_datmonetary = "C";
my $original_datlocale;
if ($oldnode->pg_version >= '17devel')
@@ -163,6 +164,7 @@ my @initdb_params = @custom_opts;
push @initdb_params, ('--encoding', $original_enc_name);
push @initdb_params, ('--lc-collate', $original_datcollate);
push @initdb_params, ('--lc-ctype', $original_datctype);
+push @initdb_params, ('--lc-monetary', $original_datmonetary);
# add --locale-provider, if supported
my %provider_name = ('b' => 'builtin', 'i' => 'icu', 'c' => 'libc');
--
2.34.1
[text/x-patch] 0002-Do-not-dump-statistics-in-the-file-dumped-f-20250313.patch (2.1K, ../../CAExHW5tOhQi2Fyf5My-YK3uzP8QwVJZQDfC3o-vvAxUUG-CNhg@mail.gmail.com/4-0002-Do-not-dump-statistics-in-the-file-dumped-f-20250313.patch)
download | inline diff:
From 75f2b869764d9db3ac5c548636ed5c2be8b47b36 Mon Sep 17 00:00:00 2001
From: Ashutosh Bapat <[email protected]>
Date: Tue, 25 Feb 2025 11:42:51 +0530
Subject: [PATCH 2/3] Do not dump statistics in the file dumped for comparison
The dumped and restored statistics of a materialized view may differ as
reported in [1]. Hence do not dump the statistics to avoid differences
in the dump output from the original and restored database.
[1] https://www.postgresql.org/message-id/CAExHW5s47kmubpbbRJzSM-Zfe0Tj2O3GBagB7YAyE8rQ-V24Uw@mail.gmail.com
Ashutosh Bapat
---
src/bin/pg_upgrade/t/002_pg_upgrade.pl | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl
index bd8313cee6f..65f4c7d4f2b 100644
--- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl
+++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl
@@ -641,15 +641,15 @@ sub get_dump_for_comparison
my $dumpfile = $tempdir . '/' . $file_prefix . '.sql';
my $dump_adjusted = "${dumpfile}_adjusted";
- # Usually we avoid comparing statistics in our tests since it is flaky by
- # nature. However, if statistics is dumped and restored it is expected to be
- # restored as it is i.e. the statistics from the original database and that
- # from the restored database should match. We turn off autovacuum on the
- # source and the target database to avoid any statistics update during
- # restore operation. Hence we do not exclude statistics from dump.
+ # If statistics is dumped and restored it is expected to be restored as it
+ # is i.e. the statistics from the original database and that from the
+ # restored database should match. We turn off autovacuum on the source and
+ # the target database to avoid any statistics update during restore
+ # operation. But as of now, there are cases when statistics is not being
+ # restored faithfully. Hence for now do not dump statistics.
$node->command_ok(
[
- 'pg_dump', '--no-sync', '-d', $node->connstr($db), '-f',
+ 'pg_dump', '--no-sync', '--no-statistics', '-d', $node->connstr($db), '-f',
$dumpfile
],
'dump for comparison succeeded');
--
2.34.1
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: Test to dump and restore objects left behind by regression
2025-03-11 10:44 Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 12:05 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-12 15:58 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 16:09 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 06:52 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 08:42 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 12:39 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 12:40 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
@ 2025-03-19 11:43 ` Ashutosh Bapat <[email protected]>
2025-03-20 15:06 ` Re: Test to dump and restore objects left behind by regression vignesh C <[email protected]>
0 siblings, 1 reply; 93+ messages in thread
From: Ashutosh Bapat @ 2025-03-19 11:43 UTC (permalink / raw)
To: Alvaro Herrera <[email protected]>; +Cc: Michael Paquier <[email protected]>; Daniel Gustafsson <[email protected]>; Tom Lane <[email protected]>; Peter Eisentraut <[email protected]>; PostgreSQL Hackers <[email protected]>
On Thu, Mar 13, 2025 at 6:10 PM Ashutosh Bapat
<[email protected]> wrote:
> >
> > I think the fix is to explicitly pass --lc-monetary to the old cluster
> > and the restored cluster. 003 patch in the attached patch set does
> > that. Please check if it fixes the issue for you.
> >
> > Additionally we should check that it gets copied to the new cluster as
> > well. But I haven't figured out how to get those settings yet. This
> > treatment is similar to how --lc-collate and --lc-ctype are treated. I
> > am wondering whether we should explicitly pass --lc-messages,
> > --lc-time and --lc-numeric as well.
> >
> > 2d819a08a1cbc11364e36f816b02e33e8dcc030b introduced buildin locale
> > provider and added overrides to LC_COLLATE and LC_TYPE. But it did not
> > override other LC_, which I think it should have. In pure upgrade
> > test, the upgraded node inherits the locale settings of the original
> > cluster, so this wasn't apparent. But with pg_dump testing, the
> > original and restored databases are independent. Hence I think we have
> > to override all LC_* settings by explicitly mentioning --lc-* options
> > to initdb. Please let me know what you think about this?
> >
Investigated this further. The problem is that the pg_regress run
creates regression database with specific properties but the restored
database does not have those properties. That led me to a better
solution. Additionally it's local to the new test. Use --create when
dumping and restoring the regression database. This way the database
properties or "configuration variable settings (as pg_dump
documentation calls them) are copied to the restored database as well.
Those properties include LC_MONETARY. Additionally now the test covers
--create option as well.
PFA patches.
--
Best Wishes,
Ashutosh Bapat
Attachments:
[text/x-patch] 0002-Do-not-dump-statistics-in-the-file-dumped-f-20250319.patch (2.1K, ../../CAExHW5tLVXNVSYwWaq9k8DuYNLZGAVqNzkyZTUCUGQ4OtbD3tQ@mail.gmail.com/2-0002-Do-not-dump-statistics-in-the-file-dumped-f-20250319.patch)
download | inline diff:
From 886e241e304a23bb31b5e59f12149741dfff2b14 Mon Sep 17 00:00:00 2001
From: Ashutosh Bapat <[email protected]>
Date: Tue, 25 Feb 2025 11:42:51 +0530
Subject: [PATCH 2/2] Do not dump statistics in the file dumped for comparison
The dumped and restored statistics of a materialized view may differ as
reported in [1]. Hence do not dump the statistics to avoid differences
in the dump output from the original and restored database.
[1] https://www.postgresql.org/message-id/CAExHW5s47kmubpbbRJzSM-Zfe0Tj2O3GBagB7YAyE8rQ-V24Uw@mail.gmail.com
Ashutosh Bapat
---
src/bin/pg_upgrade/t/002_pg_upgrade.pl | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl
index d08eea6693f..f931fef2307 100644
--- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl
+++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl
@@ -656,15 +656,15 @@ sub get_dump_for_comparison
my $dumpfile = $tempdir . '/' . $file_prefix . '.sql';
my $dump_adjusted = "${dumpfile}_adjusted";
- # Usually we avoid comparing statistics in our tests since it is flaky by
- # nature. However, if statistics is dumped and restored it is expected to be
- # restored as it is i.e. the statistics from the original database and that
- # from the restored database should match. We turn off autovacuum on the
- # source and the target database to avoid any statistics update during
- # restore operation. Hence we do not exclude statistics from dump.
+ # If statistics is dumped and restored it is expected to be restored as it
+ # is i.e. the statistics from the original database and that from the
+ # restored database should match. We turn off autovacuum on the source and
+ # the target database to avoid any statistics update during restore
+ # operation. But as of now, there are cases when statistics is not being
+ # restored faithfully. Hence for now do not dump statistics.
$node->command_ok(
[
- 'pg_dump', '--no-sync', '-d', $node->connstr($db), '-f',
+ 'pg_dump', '--no-sync', '--no-statistics', '-d', $node->connstr($db), '-f',
$dumpfile
],
'dump for comparison succeeded');
--
2.34.1
[text/x-patch] 0001-Test-pg_dump-restore-of-regression-objects-20250319.patch (16.5K, ../../CAExHW5tLVXNVSYwWaq9k8DuYNLZGAVqNzkyZTUCUGQ4OtbD3tQ@mail.gmail.com/3-0001-Test-pg_dump-restore-of-regression-objects-20250319.patch)
download | inline diff:
From 1723050dadb89f3187fef19c994d8c866ee5a788 Mon Sep 17 00:00:00 2001
From: Ashutosh Bapat <[email protected]>
Date: Thu, 27 Jun 2024 10:03:53 +0530
Subject: [PATCH 1/2] Test pg_dump/restore of regression objects
002_pg_upgrade.pl tests pg_upgrade of the regression database left
behind by regression run. Modify it to test dump and restore of the
regression database as well.
Regression database created by regression run contains almost all the
database objects supported by PostgreSQL in various states. Hence the
new testcase covers dump and restore scenarios not covered by individual
dump/restore cases. Till now 002_pg_upgrade only tested dump/restore
through pg_upgrade which only uses binary mode. Many regression tests
mention that they leave objects behind for dump/restore testing but they
are not tested in a non-binary mode. The new testcase closes that
gap.
Testing dump and restore of regression database makes this test run
longer for a relatively smaller benefit. Hence run it only when
explicitly requested by user by specifying "regress_dump_test" in
PG_TEST_EXTRA.
Note For the reviewers:
The new test has uncovered many bugs so far in one year.
1. Introduced by 14e87ffa5c54. Fixed in fd41ba93e4630921a72ed5127cd0d552a8f3f8fc.
2. Introduced by 0413a556990ba628a3de8a0b58be020fd9a14ed0. Reverted in 74563f6b90216180fc13649725179fc119dddeb5.
3. Fixed by d611f8b1587b8f30caa7c0da99ae5d28e914d54f
3. Being discussed on hackers at https://www.postgresql.org/message-id/CAExHW5s47kmubpbbRJzSM-Zfe0Tj2O3GBagB7YAyE8rQ-V24Uw@mail.gmail.com
Author: Ashutosh Bapat
Reviewed by: Michael Pacquire, Daniel Gustafsson, Tom Lane, Alvaro Herrera
Discussion: https://www.postgresql.org/message-id/CAExHW5uF5V=Cjecx3_Z=7xfh4rg2Wf61PT+hfquzjBqouRzQJQ@mail.gmail.com
---
doc/src/sgml/regress.sgml | 12 ++
src/bin/pg_upgrade/t/002_pg_upgrade.pl | 144 ++++++++++++++++-
src/test/perl/Makefile | 2 +
src/test/perl/PostgreSQL/Test/AdjustDump.pm | 167 ++++++++++++++++++++
src/test/perl/meson.build | 1 +
5 files changed, 324 insertions(+), 2 deletions(-)
create mode 100644 src/test/perl/PostgreSQL/Test/AdjustDump.pm
diff --git a/doc/src/sgml/regress.sgml b/doc/src/sgml/regress.sgml
index 0e5e8e8f309..237b974b3ab 100644
--- a/doc/src/sgml/regress.sgml
+++ b/doc/src/sgml/regress.sgml
@@ -357,6 +357,18 @@ make check-world PG_TEST_EXTRA='kerberos ldap ssl load_balance libpq_encryption'
</para>
</listitem>
</varlistentry>
+
+ <varlistentry>
+ <term><literal>regress_dump_test</literal></term>
+ <listitem>
+ <para>
+ When enabled, <filename>src/bin/pg_upgrade/t/002_pg_upgrade.pl</filename>
+ tests dump and restore of regression database left behind by the
+ regression run. Not enabled by default because it is time and resource
+ consuming.
+ </para>
+ </listitem>
+ </varlistentry>
</variablelist>
Tests for features that are not supported by the current build
diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl
index 00051b85035..d08eea6693f 100644
--- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl
+++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl
@@ -12,6 +12,7 @@ use File::Path qw(rmtree);
use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::Utils;
use PostgreSQL::Test::AdjustUpgrade;
+use PostgreSQL::Test::AdjustDump;
use Test::More;
# Can be changed to test the other modes.
@@ -35,8 +36,8 @@ sub generate_db
"created database with ASCII characters from $from_char to $to_char");
}
-# Filter the contents of a dump before its use in a content comparison.
-# This returns the path to the filtered dump.
+# Filter the contents of a dump before its use in a content comparison for
+# upgrade testing. This returns the path to the filtered dump.
sub filter_dump
{
my ($is_old, $old_version, $dump_file) = @_;
@@ -262,6 +263,21 @@ else
}
}
is($rc, 0, 'regression tests pass');
+
+ # Test dump/restore of the objects left behind by regression. Ideally it
+ # should be done in a separate TAP test, but doing it here saves us one full
+ # regression run.
+ #
+ # This step takes several extra seconds and some extra disk space, so
+ # requires an opt-in with the PG_TEST_EXTRA environment variable.
+ #
+ # Do this while the old cluster is running before it is shut down by the
+ # upgrade test.
+ if ( $ENV{PG_TEST_EXTRA}
+ && $ENV{PG_TEST_EXTRA} =~ /\bregress_dump_test\b/)
+ {
+ test_regression_dump_restore($oldnode, %node_params);
+ }
}
# Initialize a new node for the upgrade.
@@ -539,4 +555,128 @@ my $dump2_filtered = filter_dump(0, $oldnode->pg_version, $dump2_file);
compare_files($dump1_filtered, $dump2_filtered,
'old and new dumps match after pg_upgrade');
+# Test dump and restore of objects left behind by the regression run.
+#
+# It is expected that regression tests, which create `regression` database, are
+# run on `src_node`, which in turn, is left in running state. A fresh node is
+# created using given `node_params`, which are expected to be the same ones used
+# to create `src_node`, so as to avoid any differences in the databases.
+#
+# Plain dumps from both the nodes are compared to make sure that all the dumped
+# objects are restored faithfully.
+sub test_regression_dump_restore
+{
+ my ($src_node, %node_params) = @_;
+ my $dst_node = PostgreSQL::Test::Cluster->new('dst_node');
+
+ # Make sure that the source and destination nodes have the same version and
+ # do not use custom install paths. In both the cases, the dump files may
+ # require additional adjustments unknown to code here. Do not run this test
+ # in such a case to avoid utilizing the time and resources unnecessarily.
+ if ($src_node->pg_version != $dst_node->pg_version
+ or defined $src_node->{_install_path})
+ {
+ fail("same version dump and restore test using default installation");
+ return;
+ }
+
+ # Dump the original database for comparison later.
+ my $src_dump =
+ get_dump_for_comparison($src_node, 'regression', 'src_dump', 1);
+
+ # Setup destination database cluster
+ $dst_node->init(%node_params);
+ # Stabilize stats for comparison.
+ $dst_node->append_conf('postgresql.conf', 'autovacuum = off');
+ $dst_node->start;
+
+ # Test all formats one by one.
+ for my $format ('plain', 'tar', 'directory', 'custom')
+ {
+ my $dump_file = "$tempdir/regression_dump.$format";
+ my $restored_db = 'regression_' . $format;
+
+ # Use --create in dump and restore commands so that the restored
+ # database has the same configurable variable settings as the original
+ # database and the plain dumps taken for comparsion do not differ
+ # because of locale changes. Additionally this provides test coverage
+ # for --create option.
+ $src_node->command_ok(
+ [
+ 'pg_dump', "-F$format", '--no-sync',
+ '-d', $src_node->connstr('regression'),
+ '--create', '-f', $dump_file
+ ],
+ "pg_dump on source instance in $format format");
+
+ my @restore_command;
+ if ($format eq 'plain')
+ {
+ # Restore dump in "plain" format using `psql`.
+ @restore_command = [ 'psql', '-d', 'postgres', '-f', $dump_file ];
+ }
+ else
+ {
+ @restore_command = [
+ 'pg_restore', '--create',
+ '-d', 'postgres', $dump_file
+ ];
+ }
+ $dst_node->command_ok(@restore_command,
+ "restored dump taken in $format format on destination instance");
+
+ my $dst_dump =
+ get_dump_for_comparison($dst_node, 'regression',
+ 'dest_dump.' . $format, 0);
+
+ compare_files($src_dump, $dst_dump,
+ "dump outputs from original and restored regression database (using $format format) match"
+ );
+
+ # Rename the restored database so that it is available for debugging in
+ # case the test fails.
+ $dst_node->safe_psql('postgres', "ALTER DATABASE regression RENAME TO $restored_db");
+ }
+}
+
+# Dump database `db` from the given `node` in plain format and adjust it for
+# comparing dumps from the original and the restored database.
+#
+# `file_prefix` is used to create unique names for all dump files so that they
+# remain available for debugging in case the test fails.
+#
+# `adjust_child_columns` is passed to adjust_regress_dumpfile() which actually
+# adjusts the dump output.
+#
+# The name of the file containting adjusted dump is returned.
+sub get_dump_for_comparison
+{
+ my ($node, $db, $file_prefix, $adjust_child_columns) = @_;
+
+ my $dumpfile = $tempdir . '/' . $file_prefix . '.sql';
+ my $dump_adjusted = "${dumpfile}_adjusted";
+
+ # Usually we avoid comparing statistics in our tests since it is flaky by
+ # nature. However, if statistics is dumped and restored it is expected to be
+ # restored as it is i.e. the statistics from the original database and that
+ # from the restored database should match. We turn off autovacuum on the
+ # source and the target database to avoid any statistics update during
+ # restore operation. Hence we do not exclude statistics from dump.
+ $node->command_ok(
+ [
+ 'pg_dump', '--no-sync', '-d', $node->connstr($db), '-f',
+ $dumpfile
+ ],
+ 'dump for comparison succeeded');
+
+ open(my $dh, '>', $dump_adjusted)
+ || die
+ "could not open $dump_adjusted for writing the adjusted dump: $!";
+ print $dh adjust_regress_dumpfile(slurp_file($dumpfile),
+ $adjust_child_columns);
+ close($dh);
+
+ return $dump_adjusted;
+}
+
done_testing();
diff --git a/src/test/perl/Makefile b/src/test/perl/Makefile
index d82fb67540e..def89650ead 100644
--- a/src/test/perl/Makefile
+++ b/src/test/perl/Makefile
@@ -26,6 +26,7 @@ install: all installdirs
$(INSTALL_DATA) $(srcdir)/PostgreSQL/Test/Cluster.pm '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/Cluster.pm'
$(INSTALL_DATA) $(srcdir)/PostgreSQL/Test/BackgroundPsql.pm '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/BackgroundPsql.pm'
$(INSTALL_DATA) $(srcdir)/PostgreSQL/Test/AdjustUpgrade.pm '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/AdjustUpgrade.pm'
+ $(INSTALL_DATA) $(srcdir)/PostgreSQL/Test/AdjustDump.pm '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/AdjustDump.pm'
$(INSTALL_DATA) $(srcdir)/PostgreSQL/Version.pm '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Version.pm'
uninstall:
@@ -36,6 +37,7 @@ uninstall:
rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/Cluster.pm'
rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/BackgroundPsql.pm'
rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/AdjustUpgrade.pm'
+ rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/AdjustDump.pm'
rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Version.pm'
endif
diff --git a/src/test/perl/PostgreSQL/Test/AdjustDump.pm b/src/test/perl/PostgreSQL/Test/AdjustDump.pm
new file mode 100644
index 00000000000..74b9a60cf34
--- /dev/null
+++ b/src/test/perl/PostgreSQL/Test/AdjustDump.pm
@@ -0,0 +1,167 @@
+
+# Copyright (c) 2024-2025, PostgreSQL Global Development Group
+
+=pod
+
+=head1 NAME
+
+PostgreSQL::Test::AdjustDump - helper module for dump and restore tests
+
+=head1 SYNOPSIS
+
+ use PostgreSQL::Test::AdjustDump;
+
+ # Adjust contents of dump output file so that dump output from original
+ # regression database and that from the restored regression database match
+ $dump = adjust_regress_dumpfile($dump, $adjust_child_columns);
+
+=head1 DESCRIPTION
+
+C<PostgreSQL::Test::AdjustDump> encapsulates various hacks needed to
+compare the results of dump and restore tests
+
+=cut
+
+package PostgreSQL::Test::AdjustDump;
+
+use strict;
+use warnings FATAL => 'all';
+
+use Exporter 'import';
+use Test::More;
+
+our @EXPORT = qw(
+ adjust_regress_dumpfile
+);
+
+=pod
+
+=head1 ROUTINES
+
+=over
+
+=item $dump = adjust_regress_dumpfile($dump, $adjust_child_columns)
+
+If we take dump of the regression database left behind after running regression
+tests, restore the dump, and take dump of the restored regression database, the
+outputs of both the dumps differ in the following cases. This routine adjusts
+the given dump so that dump outputs from the original and restored database,
+respectively, match.
+
+Case 1: Some regression tests purposefully create child tables in such a way
+that the order of their inherited columns differ from column orders of their
+respective parents. In the restored database, however, the order of their
+inherited columns are same as that of their respective parents. Thus the column
+orders of these child tables in the original database and those in the restored
+database differ, causing difference in the dump outputs. See MergeAttributes()
+and dumpTableSchema() for details. This routine rearranges the column
+declarations in the relevant C<CREATE TABLE... INHERITS> statements in the dump
+file from original database to match those from the restored database. We could,
+instead, adjust the statements in the dump from the restored database to match
+those from original database or adjust both to a canonical order. But we have
+chosen to adjust the statements in the dump from original database for no
+particular reason.
+
+Case 2: When dumping COPY statements the columns are ordered by their attribute
+number by fmtCopyColumnList(). If a column is added to a parent table after a
+child has inherited the parent and the child has its own columns, the attribute
+number of the column changes after restoring the child table. This is because
+when executing the dumped C<CREATE TABLE... INHERITS> statement all the parent
+attributes are created before any child attributes. Thus the order of columns in
+COPY statements dumped from the original and the restored databases,
+respectively, differs. Such tables in regression tests are listed below. It is
+hard to adjust the column order in the COPY statement along with the data. Hence
+we just remove such COPY statements from the dump output.
+
+Additionally the routine adjusts blank and new lines to avoid noise.
+
+Note: Usually we avoid comparing statistics in our tests since it is flaky by
+nature. However, if statistics is dumped and restored it is expected to be
+restored as it is i.e. the statistics from the original database and that from
+the restored database should match. Hence we do not filter statistics from dump,
+if it's dumped.
+
+Arguments:
+
+=over
+
+=item C<dump>: Contents of dump file
+
+=item C<adjust_child_columns>: 1 indicates that the given dump file requires
+adjusting columns in the child tables; usually when the dump is from original
+database. 0 indicates no such adjustment is needed; usually when the dump is
+from restored database.
+
+=back
+
+Returns the adjusted dump text.
+
+=cut
+
+sub adjust_regress_dumpfile
+{
+ my ($dump, $adjust_child_columns) = @_;
+
+ # use Unix newlines
+ $dump =~ s/\r\n/\n/g;
+
+ # Adjust the CREATE TABLE ... INHERITS statements.
+ if ($adjust_child_columns)
+ {
+ my $saved_dump = $dump;
+
+ $dump =~ s/(^CREATE\sTABLE\sgenerated_stored_tests\.gtestxx_4\s\()
+ (\n\s+b\sinteger),
+ (\n\s+a\sinteger\sNOT\sNULL)/$1$3,$2/mgx;
+ ok($saved_dump ne $dump,
+ 'applied generated_stored_tests.gtestxx_4 adjustments');
+
+ $saved_dump = $dump;
+ $dump =~ s/(^CREATE\sTABLE\sgenerated_virtual_tests\.gtestxx_4\s\()
+ (\n\s+b\sinteger),
+ (\n\s+a\sinteger\sNOT\sNULL)/$1$3,$2/mgx;
+ ok($saved_dump ne $dump,
+ 'applied generated_virtual_tests.gtestxx_4 adjustments');
+
+ $saved_dump = $dump;
+ $dump =~ s/(^CREATE\sTABLE\spublic\.test_type_diff2_c1\s\()
+ (\n\s+int_four\sbigint),
+ (\n\s+int_eight\sbigint),
+ (\n\s+int_two\ssmallint)/$1$4,$2,$3/mgx;
+ ok($saved_dump ne $dump,
+ 'applied public.test_type_diff2_c1 adjustments');
+
+ $saved_dump = $dump;
+ $dump =~ s/(^CREATE\sTABLE\spublic\.test_type_diff2_c2\s\()
+ (\n\s+int_eight\sbigint),
+ (\n\s+int_two\ssmallint),
+ (\n\s+int_four\sbigint)/$1$3,$4,$2/mgx;
+ ok($saved_dump ne $dump,
+ 'applied public.test_type_diff2_c2 adjustments');
+ }
+
+ # Remove COPY statements with differing column order
+ for my $table (
+ 'public\.b_star', 'public\.c_star',
+ 'public\.cc2', 'public\.d_star',
+ 'public\.e_star', 'public\.f_star',
+ 'public\.renamecolumnanother', 'public\.renamecolumnchild',
+ 'public\.test_type_diff2_c1', 'public\.test_type_diff2_c2',
+ 'public\.test_type_diff_c')
+ {
+ $dump =~ s/^COPY\s$table\s\(.+?^\\\.$//sm;
+ }
+
+ # Suppress blank lines, as some places in pg_dump emit more or fewer.
+ $dump =~ s/\n\n+/\n/g;
+
+ return $dump;
+}
+
+=pod
+
+=back
+
+=cut
+
+1;
diff --git a/src/test/perl/meson.build b/src/test/perl/meson.build
index 58e30f15f9d..492ca571ff8 100644
--- a/src/test/perl/meson.build
+++ b/src/test/perl/meson.build
@@ -14,4 +14,5 @@ install_data(
'PostgreSQL/Test/Cluster.pm',
'PostgreSQL/Test/BackgroundPsql.pm',
'PostgreSQL/Test/AdjustUpgrade.pm',
+ 'PostgreSQL/Test/AdjustDump.pm',
install_dir: dir_pgxs / 'src/test/perl/PostgreSQL/Test')
base-commit: 190dc27998d5b7b4c36e12bebe62f7176f4b4507
--
2.34.1
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: Test to dump and restore objects left behind by regression
2025-03-11 10:44 Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 12:05 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-12 15:58 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 16:09 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 06:52 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 08:42 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 12:39 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 12:40 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-19 11:43 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
@ 2025-03-20 15:06 ` vignesh C <[email protected]>
2025-03-20 16:39 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-21 11:51 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
0 siblings, 2 replies; 93+ messages in thread
From: vignesh C @ 2025-03-20 15:06 UTC (permalink / raw)
To: Ashutosh Bapat <[email protected]>; +Cc: Alvaro Herrera <[email protected]>; Michael Paquier <[email protected]>; Daniel Gustafsson <[email protected]>; Tom Lane <[email protected]>; Peter Eisentraut <[email protected]>; PostgreSQL Hackers <[email protected]>
On Wed, 19 Mar 2025 at 17:13, Ashutosh Bapat
<[email protected]> wrote:
>
> On Thu, Mar 13, 2025 at 6:10 PM Ashutosh Bapat
> <[email protected]> wrote:
> > >
> > > I think the fix is to explicitly pass --lc-monetary to the old cluster
> > > and the restored cluster. 003 patch in the attached patch set does
> > > that. Please check if it fixes the issue for you.
> > >
> > > Additionally we should check that it gets copied to the new cluster as
> > > well. But I haven't figured out how to get those settings yet. This
> > > treatment is similar to how --lc-collate and --lc-ctype are treated. I
> > > am wondering whether we should explicitly pass --lc-messages,
> > > --lc-time and --lc-numeric as well.
> > >
> > > 2d819a08a1cbc11364e36f816b02e33e8dcc030b introduced buildin locale
> > > provider and added overrides to LC_COLLATE and LC_TYPE. But it did not
> > > override other LC_, which I think it should have. In pure upgrade
> > > test, the upgraded node inherits the locale settings of the original
> > > cluster, so this wasn't apparent. But with pg_dump testing, the
> > > original and restored databases are independent. Hence I think we have
> > > to override all LC_* settings by explicitly mentioning --lc-* options
> > > to initdb. Please let me know what you think about this?
> > >
>
> Investigated this further. The problem is that the pg_regress run
> creates regression database with specific properties but the restored
> database does not have those properties. That led me to a better
> solution. Additionally it's local to the new test. Use --create when
> dumping and restoring the regression database. This way the database
> properties or "configuration variable settings (as pg_dump
> documentation calls them) are copied to the restored database as well.
> Those properties include LC_MONETARY. Additionally now the test covers
> --create option as well.
>
> PFA patches.
Will it help the execution time if we use --jobs in case of pg_dump
and pg_restore wherever supported:
+ $src_node->command_ok(
+ [
+ 'pg_dump', "-F$format", '--no-sync',
+ '-d', $src_node->connstr('regression'),
+ '--create', '-f', $dump_file
+ ],
+ "pg_dump on source instance in $format format");
+
+ my @restore_command;
+ if ($format eq 'plain')
+ {
+ # Restore dump in "plain" format using `psql`.
+ @restore_command = [ 'psql', '-d', 'postgres',
'-f', $dump_file ];
+ }
+ else
+ {
+ @restore_command = [
+ 'pg_restore', '--create',
+ '-d', 'postgres', $dump_file
+ ];
+ }
Should the copyright be only 2025 in this case:
diff --git a/src/test/perl/PostgreSQL/Test/AdjustDump.pm
b/src/test/perl/PostgreSQL/Test/AdjustDump.pm
new file mode 100644
index 00000000000..74b9a60cf34
--- /dev/null
+++ b/src/test/perl/PostgreSQL/Test/AdjustDump.pm
@@ -0,0 +1,167 @@
+
+# Copyright (c) 2024-2025, PostgreSQL Global Development Group
Regards,
Vignesh
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: Test to dump and restore objects left behind by regression
2025-03-11 10:44 Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 12:05 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-12 15:58 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 16:09 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 06:52 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 08:42 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 12:39 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 12:40 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-19 11:43 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-20 15:06 ` Re: Test to dump and restore objects left behind by regression vignesh C <[email protected]>
@ 2025-03-20 16:39 ` Alvaro Herrera <[email protected]>
2025-03-21 12:45 ` Re: Test to dump and restore objects left behind by regression vignesh C <[email protected]>
2025-03-21 13:09 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
1 sibling, 2 replies; 93+ messages in thread
From: Alvaro Herrera @ 2025-03-20 16:39 UTC (permalink / raw)
To: vignesh C <[email protected]>; +Cc: Ashutosh Bapat <[email protected]>; Michael Paquier <[email protected]>; Daniel Gustafsson <[email protected]>; Tom Lane <[email protected]>; Peter Eisentraut <[email protected]>; PostgreSQL Hackers <[email protected]>
On 2025-Mar-20, vignesh C wrote:
> Will it help the execution time if we use --jobs in case of pg_dump
> and pg_restore wherever supported:
As I said in another thread, I think we should enable this test to run
without requiring any PG_TEST_EXTRA, because otherwise the only way to
know about problems is to commit a patch and wait for buildfarm to run
it. Furthermore, I think running all 4 dump format modes is a waste of
time; there isn't any extra coverage by running this test in additional
formats.
Putting those two thoughts together with yours about running with -j,
I propose that what we should do is make this test use -Fc with no
compression (to avoid wasting CPU on that) and use a lowish -j value for
both pg_dump and pg_restore, probably 2, or 3 at most. (Not more,
because this is likely to run in parallel with other tests anyway.)
--
Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/
"No renuncies a nada. No te aferres a nada."
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: Test to dump and restore objects left behind by regression
2025-03-11 10:44 Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 12:05 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-12 15:58 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 16:09 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 06:52 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 08:42 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 12:39 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 12:40 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-19 11:43 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-20 15:06 ` Re: Test to dump and restore objects left behind by regression vignesh C <[email protected]>
2025-03-20 16:39 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
@ 2025-03-21 12:45 ` vignesh C <[email protected]>
1 sibling, 0 replies; 93+ messages in thread
From: vignesh C @ 2025-03-21 12:45 UTC (permalink / raw)
To: Alvaro Herrera <[email protected]>; +Cc: Ashutosh Bapat <[email protected]>; Michael Paquier <[email protected]>; Daniel Gustafsson <[email protected]>; Tom Lane <[email protected]>; Peter Eisentraut <[email protected]>; PostgreSQL Hackers <[email protected]>
On Thu, 20 Mar 2025 at 22:09, Alvaro Herrera <[email protected]> wrote:
>
> On 2025-Mar-20, vignesh C wrote:
>
> > Will it help the execution time if we use --jobs in case of pg_dump
> > and pg_restore wherever supported:
>
> As I said in another thread, I think we should enable this test to run
> without requiring any PG_TEST_EXTRA, because otherwise the only way to
> know about problems is to commit a patch and wait for buildfarm to run
> it. Furthermore, I think running all 4 dump format modes is a waste of
> time; there isn't any extra coverage by running this test in additional
> formats.
+1 for running it in only one of the formats.
Regards,
Vignesh
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: Test to dump and restore objects left behind by regression
2025-03-11 10:44 Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 12:05 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-12 15:58 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 16:09 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 06:52 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 08:42 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 12:39 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 12:40 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-19 11:43 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-20 15:06 ` Re: Test to dump and restore objects left behind by regression vignesh C <[email protected]>
2025-03-20 16:39 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
@ 2025-03-21 13:09 ` Ashutosh Bapat <[email protected]>
2025-03-21 14:39 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
1 sibling, 1 reply; 93+ messages in thread
From: Ashutosh Bapat @ 2025-03-21 13:09 UTC (permalink / raw)
To: Alvaro Herrera <[email protected]>; +Cc: vignesh C <[email protected]>; Michael Paquier <[email protected]>; Daniel Gustafsson <[email protected]>; Tom Lane <[email protected]>; Peter Eisentraut <[email protected]>; PostgreSQL Hackers <[email protected]>
On Thu, Mar 20, 2025 at 10:09 PM Alvaro Herrera <[email protected]> wrote:
>
> On 2025-Mar-20, vignesh C wrote:
>
> > Will it help the execution time if we use --jobs in case of pg_dump
> > and pg_restore wherever supported:
>
> As I said in another thread, I think we should enable this test to run
> without requiring any PG_TEST_EXTRA, because otherwise the only way to
> know about problems is to commit a patch and wait for buildfarm to run
> it. Furthermore, I think running all 4 dump format modes is a waste of
> time; there isn't any extra coverage by running this test in additional
> formats.
>
> Putting those two thoughts together with yours about running with -j,
> I propose that what we should do is make this test use -Fc with no
> compression (to avoid wasting CPU on that) and use a lowish -j value for
> both pg_dump and pg_restore, probably 2, or 3 at most. (Not more,
> because this is likely to run in parallel with other tests anyway.)
-Fc and -j are not allowed. -j is only allowed for directory format.
$ pg_dump -Fc -j2
pg_dump: error: parallel backup only supported by the directory format
Using just directory format, on my laptop with dev build (because
that's what most developers will use when running the tests)
$ meson test -C $BuildDir pg_upgrade/002_pg_upgrade | grep 002_pg_upgrade
without dump/restore test
1/1 postgresql:pg_upgrade / pg_upgrade/002_pg_upgrade OK
33.51s 19 subtests passed
1/1 postgresql:pg_upgrade / pg_upgrade/002_pg_upgrade OK
34.22s 19 subtests passed
1/1 postgresql:pg_upgrade / pg_upgrade/002_pg_upgrade OK
34.64s 19 subtests passed
without -j, extra ~9 seconds
1/1 postgresql:pg_upgrade / pg_upgrade/002_pg_upgrade OK
43.33s 28 subtests passed
1/1 postgresql:pg_upgrade / pg_upgrade/002_pg_upgrade OK
43.25s 28 subtests passed
1/1 postgresql:pg_upgrade / pg_upgrade/002_pg_upgrade OK
43.10s 28 subtests passed
with -j2, extra 7.5 seconds
1/1 postgresql:pg_upgrade / pg_upgrade/002_pg_upgrade OK
42.77s 28 subtests passed
1/1 postgresql:pg_upgrade / pg_upgrade/002_pg_upgrade OK
41.67s 28 subtests passed
1/1 postgresql:pg_upgrade / pg_upgrade/002_pg_upgrade OK
41.88s 28 subtests passed
with -j3, extra 7 seconds
1/1 postgresql:pg_upgrade / pg_upgrade/002_pg_upgrade OK
40.77s 28 subtests passed
1/1 postgresql:pg_upgrade / pg_upgrade/002_pg_upgrade OK
41.05s 28 subtests passed
1/1 postgresql:pg_upgrade / pg_upgrade/002_pg_upgrade OK
41.28s 28 subtests passed
Between -j2 and -j3 there's not much difference so we could use -j2.
But it still takes 7.5 extra seconds which almost 20% extra time. Do
you think that will be acceptable? I saw somewhere Andres mentioning
that he runs this test quite frequently. Please note that I would very
much like this test to be run by default, but Tom Lane has expressed a
concern about adding even that much time [1] to run the test and
mentioned that he would like the test to be opt-in.
When I started writing the test one year before, people raised
concerns about how useful the test would be. Within a year it has
shown 4 bugs. I have similar feeling about the formats - it's doubtful
now but will prove useful soon especially with the work happening on
dump formats in nearby threads. If we run the test by default, we
could run directory with -j by default and leave other formats as
opt-in OR just forget those formats for now. But If we are going to
make it opt-in, testing all formats gives the extra coverage.
About the format coverage, consensus so far is me and Daniel are for
including all formats when running test as opt-in. Alvaro and Vignesh
are for just one format. We need a tie-breaker or someone amongst us
needs to change their vote :D.
--
Best Wishes,
Ashutosh Bapat
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: Test to dump and restore objects left behind by regression
2025-03-11 10:44 Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 12:05 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-12 15:58 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 16:09 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 06:52 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 08:42 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 12:39 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 12:40 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-19 11:43 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-20 15:06 ` Re: Test to dump and restore objects left behind by regression vignesh C <[email protected]>
2025-03-20 16:39 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-21 13:09 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
@ 2025-03-21 14:39 ` Alvaro Herrera <[email protected]>
2025-03-21 16:03 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
0 siblings, 1 reply; 93+ messages in thread
From: Alvaro Herrera @ 2025-03-21 14:39 UTC (permalink / raw)
To: Ashutosh Bapat <[email protected]>; +Cc: vignesh C <[email protected]>; Michael Paquier <[email protected]>; Daniel Gustafsson <[email protected]>; Tom Lane <[email protected]>; Peter Eisentraut <[email protected]>; PostgreSQL Hackers <[email protected]>
I passed PROVE_FLAGS="--timer -v" to get the timings and run under
--format=directory.
Without new test:
ok 23400 ms ( 0.00 usr 0.00 sys + 2.84 cusr 1.53 csys = 4.37 CPU)
ok 23409 ms ( 0.00 usr 0.01 sys + 2.81 cusr 1.53 csys = 4.35 CPU)
With new test, under --format=directory:
-j2 (parallel, default gzip compression)
ok 27517 ms ( 0.00 usr 0.00 sys + 3.92 cusr 1.86 csys = 5.78 CPU)
ok 27772 ms ( 0.01 usr 0.00 sys + 3.96 cusr 1.86 csys = 5.83 CPU)
ok 27654 ms ( 0.00 usr 0.00 sys + 3.81 cusr 1.94 csys = 5.75 CPU)
ok 27663 ms ( 0.00 usr 0.00 sys + 4.11 cusr 1.71 csys = 5.82 CPU)
-j2 --compress=0
ok 27710 ms ( 0.00 usr 0.00 sys + 3.79 cusr 1.86 csys = 5.65 CPU)
ok 27567 ms ( 0.01 usr 0.00 sys + 3.67 cusr 1.96 csys = 5.64 CPU)
ok 27582 ms ( 0.00 usr 0.00 sys + 3.60 cusr 1.90 csys = 5.50 CPU)
ok 27519 ms ( 0.01 usr 0.00 sys + 3.71 cusr 1.80 csys = 5.52 CPU)
-j2 --compress=zstd
ok 27240 ms ( 0.01 usr 0.00 sys + 3.65 cusr 2.10 csys = 5.76 CPU)
ok 27301 ms ( 0.01 usr 0.00 sys + 3.77 cusr 1.97 csys = 5.75 CPU)
-j2 --compress=zstd:1
ok 27695 ms ( 0.01 usr 0.00 sys + 3.66 cusr 2.05 csys = 5.72 CPU)
ok 27671 ms ( 0.01 usr 0.00 sys + 3.76 cusr 1.95 csys = 5.72 CPU)
--compress=zstd:1 (no parallelism)
ok 28417 ms ( 0.01 usr 0.00 sys + 3.90 cusr 1.75 csys = 5.66 CPU)
ok 28388 ms ( 0.00 usr 0.00 sys + 3.74 cusr 1.81 csys = 5.55 CPU)
--compress=zstd (no parallelism)
ok 28310 ms ( 0.00 usr 0.01 sys + 3.81 cusr 1.83 csys = 5.65 CPU)
ok 28277 ms ( 0.01 usr 0.00 sys + 3.71 cusr 1.87 csys = 5.59 CPU)
So apparently, zstd if available is a bit better than gzip and
parallelism is better than no. But the differences are small -- half a
second or so. The total increase in runtime in the best case is about
four seconds. In all cases I used the same parallelism in pg_restore
than pg_dump; not sure if that could cause a difference.
--
Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: Test to dump and restore objects left behind by regression
2025-03-11 10:44 Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 12:05 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-12 15:58 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 16:09 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 06:52 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 08:42 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 12:39 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 12:40 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-19 11:43 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-20 15:06 ` Re: Test to dump and restore objects left behind by regression vignesh C <[email protected]>
2025-03-20 16:39 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-21 13:09 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-21 14:39 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
@ 2025-03-21 16:03 ` Ashutosh Bapat <[email protected]>
2025-03-21 18:07 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
0 siblings, 1 reply; 93+ messages in thread
From: Ashutosh Bapat @ 2025-03-21 16:03 UTC (permalink / raw)
To: Alvaro Herrera <[email protected]>; +Cc: vignesh C <[email protected]>; Michael Paquier <[email protected]>; Daniel Gustafsson <[email protected]>; Tom Lane <[email protected]>; Peter Eisentraut <[email protected]>; PostgreSQL Hackers <[email protected]>
On Fri, Mar 21, 2025 at 8:13 PM Alvaro Herrera <[email protected]> wrote:
>
> I passed PROVE_FLAGS="--timer -v" to get the timings and run under
> --format=directory.
>
> Without new test:
> ok 23400 ms ( 0.00 usr 0.00 sys + 2.84 cusr 1.53 csys = 4.37 CPU)
> ok 23409 ms ( 0.00 usr 0.01 sys + 2.81 cusr 1.53 csys = 4.35 CPU)
>
>
> With new test, under --format=directory:
> -j2 (parallel, default gzip compression)
> ok 27517 ms ( 0.00 usr 0.00 sys + 3.92 cusr 1.86 csys = 5.78 CPU)
> ok 27772 ms ( 0.01 usr 0.00 sys + 3.96 cusr 1.86 csys = 5.83 CPU)
> ok 27654 ms ( 0.00 usr 0.00 sys + 3.81 cusr 1.94 csys = 5.75 CPU)
> ok 27663 ms ( 0.00 usr 0.00 sys + 4.11 cusr 1.71 csys = 5.82 CPU)
>
> -j2 --compress=0
> ok 27710 ms ( 0.00 usr 0.00 sys + 3.79 cusr 1.86 csys = 5.65 CPU)
> ok 27567 ms ( 0.01 usr 0.00 sys + 3.67 cusr 1.96 csys = 5.64 CPU)
> ok 27582 ms ( 0.00 usr 0.00 sys + 3.60 cusr 1.90 csys = 5.50 CPU)
> ok 27519 ms ( 0.01 usr 0.00 sys + 3.71 cusr 1.80 csys = 5.52 CPU)
>
> -j2 --compress=zstd
> ok 27240 ms ( 0.01 usr 0.00 sys + 3.65 cusr 2.10 csys = 5.76 CPU)
> ok 27301 ms ( 0.01 usr 0.00 sys + 3.77 cusr 1.97 csys = 5.75 CPU)
>
> -j2 --compress=zstd:1
> ok 27695 ms ( 0.01 usr 0.00 sys + 3.66 cusr 2.05 csys = 5.72 CPU)
> ok 27671 ms ( 0.01 usr 0.00 sys + 3.76 cusr 1.95 csys = 5.72 CPU)
>
> --compress=zstd:1 (no parallelism)
> ok 28417 ms ( 0.01 usr 0.00 sys + 3.90 cusr 1.75 csys = 5.66 CPU)
> ok 28388 ms ( 0.00 usr 0.00 sys + 3.74 cusr 1.81 csys = 5.55 CPU)
>
> --compress=zstd (no parallelism)
> ok 28310 ms ( 0.00 usr 0.01 sys + 3.81 cusr 1.83 csys = 5.65 CPU)
> ok 28277 ms ( 0.01 usr 0.00 sys + 3.71 cusr 1.87 csys = 5.59 CPU)
>
>
> So apparently, zstd if available is a bit better than gzip and
> parallelism is better than no. But the differences are small -- half a
> second or so. The total increase in runtime in the best case is about
> four seconds. In all cases I used the same parallelism in pg_restore
> than pg_dump; not sure if that could cause a difference.
I used the same parallelism in pg_restore and pg_dump too. And your
numbers seem to be similar to mine; slightly less than 20% slowdown.
But is that slowdown acceptable? From the earlier discussions, it
seems the answer is No. Haven't heard otherwise.
--
Best Wishes,
Ashutosh Bapat
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: Test to dump and restore objects left behind by regression
2025-03-11 10:44 Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 12:05 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-12 15:58 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 16:09 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 06:52 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 08:42 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 12:39 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 12:40 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-19 11:43 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-20 15:06 ` Re: Test to dump and restore objects left behind by regression vignesh C <[email protected]>
2025-03-20 16:39 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-21 13:09 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-21 14:39 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-21 16:03 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
@ 2025-03-21 18:07 ` Alvaro Herrera <[email protected]>
2025-03-24 09:54 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
0 siblings, 1 reply; 93+ messages in thread
From: Alvaro Herrera @ 2025-03-21 18:07 UTC (permalink / raw)
To: Ashutosh Bapat <[email protected]>; +Cc: vignesh C <[email protected]>; Michael Paquier <[email protected]>; Daniel Gustafsson <[email protected]>; Tom Lane <[email protected]>; Peter Eisentraut <[email protected]>; PostgreSQL Hackers <[email protected]>
On 2025-Mar-21, Ashutosh Bapat wrote:
> I used the same parallelism in pg_restore and pg_dump too. And your
> numbers seem to be similar to mine; slightly less than 20% slowdown.
> But is that slowdown acceptable? From the earlier discussions, it
> seems the answer is No. Haven't heard otherwise.
I don't think we need to see slowdown this in relative terms, the way we
would discuss a change in the executor. This is not a change that
would affect user-level stuff in any way. We need to see it in absolute
terms: in machines similar to mine, the pg_upgrade test would go from
taking 23s to taking 27s. This is 4s slower, but this isn't an increase
in total test runtime, because decently run test suites run multiple
tests in parallel. This is the same that Peter said in [1]. The total
test runtime change might not be *that* large. I'll take a few numbers
and report back.
[1] https://postgr.es/m/[email protected]
--
Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/
"I love the Postgres community. It's all about doing things _properly_. :-)"
(David Garamond)
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: Test to dump and restore objects left behind by regression
2025-03-11 10:44 Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 12:05 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-12 15:58 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 16:09 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 06:52 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 08:42 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 12:39 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 12:40 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-19 11:43 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-20 15:06 ` Re: Test to dump and restore objects left behind by regression vignesh C <[email protected]>
2025-03-20 16:39 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-21 13:09 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-21 14:39 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-21 16:03 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-21 18:07 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
@ 2025-03-24 09:54 ` Ashutosh Bapat <[email protected]>
2025-03-24 09:59 ` Re: Test to dump and restore objects left behind by regression Daniel Gustafsson <[email protected]>
2025-03-24 12:14 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
0 siblings, 2 replies; 93+ messages in thread
From: Ashutosh Bapat @ 2025-03-24 09:54 UTC (permalink / raw)
To: Alvaro Herrera <[email protected]>; +Cc: vignesh C <[email protected]>; Michael Paquier <[email protected]>; Daniel Gustafsson <[email protected]>; Tom Lane <[email protected]>; Peter Eisentraut <[email protected]>; PostgreSQL Hackers <[email protected]>
On Fri, Mar 21, 2025 at 11:38 PM Alvaro Herrera <[email protected]> wrote:
>
> On 2025-Mar-21, Ashutosh Bapat wrote:
>
> > I used the same parallelism in pg_restore and pg_dump too. And your
> > numbers seem to be similar to mine; slightly less than 20% slowdown.
> > But is that slowdown acceptable? From the earlier discussions, it
> > seems the answer is No. Haven't heard otherwise.
>
> I don't think we need to see slowdown this in relative terms, the way we
> would discuss a change in the executor. This is not a change that
> would affect user-level stuff in any way. We need to see it in absolute
> terms: in machines similar to mine, the pg_upgrade test would go from
> taking 23s to taking 27s. This is 4s slower, but this isn't an increase
> in total test runtime, because decently run test suites run multiple
> tests in parallel. This is the same that Peter said in [1]. The total
> test runtime change might not be *that* large. I'll take a few numbers
> and report back.
Using -j2 in pg_dump and -j3 in pg_restore does not improve timing
much on my laptop. I have used -j2 for both pg_dump and restore
instead of -j3 so as to avoid using more cores when tests are run in
parallel.
Further to reduce run time, I tried -1/--single-transaction but that's
not allowed with --create. I also tried --transaction-size=1000 but
that doesn't affect the run time of the test. Next I thought of using
standard output and input instead of files but it doesn't help since
1. directory format cannot use those and it's the only format allowing
parallelism, 2. that's slower than using files with --no-sync. Didn't
find any other way which can help us reduce the test time.
Please note that the dumps taken for comparison cannot use -j since
they are required to be in "plain" format so that text manipulation
comparison works on them.
One concern I have with directory format is the dumped database is not
readable. This might make investigating a but identified the test a
bit more complex. But I guess, in such a case investigator can either
use the dumps taken for comparison or change the code to use plain
format for investigation. So it's a price we pay for making test
faster.
Here's next patchset:
0001 - it's the same 0001 patch as previous one, includes the test
with all formats and also the PG_TEST_EXTRA option
0002 - removes PG_TEST_EXTRA and also tests only one format
--directory with -j2 with default compression. It should be merged
into 0001 before committing. This is a separate patch for now in case
we decide to go back to 0001.
0003 - same as 0002 in the previous patch set. It excludes statistics
from comparison, otherwise the test will fail because of bug reported
at [1]. Ideally we shouldn't commit this patch so as to test
statistics dump and restore, but in case we need the test to pass till
the bug is fixed, we should merge this patch to 0001 before
committing.
[1] https://www.postgresql.org/message-id/[email protected]...
--
Best Wishes,
Ashutosh Bapat
Attachments:
[text/x-patch] 0001-Test-pg_dump-restore-of-regression-objects-20250324.patch (16.5K, ../../CAExHW5vw_KaZrjWSNJx-QHF12D4KCmV=AAii3Zh3RHmY43gesw@mail.gmail.com/2-0001-Test-pg_dump-restore-of-regression-objects-20250324.patch)
download | inline diff:
From fcfd0d25ecd374d55970817b4d3ea2aecdd58251 Mon Sep 17 00:00:00 2001
From: Ashutosh Bapat <[email protected]>
Date: Thu, 27 Jun 2024 10:03:53 +0530
Subject: [PATCH 1/3] Test pg_dump/restore of regression objects
002_pg_upgrade.pl tests pg_upgrade of the regression database left
behind by regression run. Modify it to test dump and restore of the
regression database as well.
Regression database created by regression run contains almost all the
database objects supported by PostgreSQL in various states. Hence the
new testcase covers dump and restore scenarios not covered by individual
dump/restore cases. Till now 002_pg_upgrade only tested dump/restore
through pg_upgrade which only uses binary mode. Many regression tests
mention that they leave objects behind for dump/restore testing but they
are not tested in a non-binary mode. The new testcase closes that
gap.
Testing dump and restore of regression database makes this test run
longer for a relatively smaller benefit. Hence run it only when
explicitly requested by user by specifying "regress_dump_test" in
PG_TEST_EXTRA.
Note For the reviewers:
The new test has uncovered many bugs so far in one year.
1. Introduced by 14e87ffa5c54. Fixed in fd41ba93e4630921a72ed5127cd0d552a8f3f8fc.
2. Introduced by 0413a556990ba628a3de8a0b58be020fd9a14ed0. Reverted in 74563f6b90216180fc13649725179fc119dddeb5.
3. Fixed by d611f8b1587b8f30caa7c0da99ae5d28e914d54f
3. Being discussed on hackers at https://www.postgresql.org/message-id/CAExHW5s47kmubpbbRJzSM-Zfe0Tj2O3GBagB7YAyE8rQ-V24Uw@mail.gmail.com
Author: Ashutosh Bapat
Reviewed by: Michael Pacquire, Daniel Gustafsson, Tom Lane, Alvaro Herrera
Discussion: https://www.postgresql.org/message-id/CAExHW5uF5V=Cjecx3_Z=7xfh4rg2Wf61PT+hfquzjBqouRzQJQ@mail.gmail.com
---
doc/src/sgml/regress.sgml | 12 ++
src/bin/pg_upgrade/t/002_pg_upgrade.pl | 144 ++++++++++++++++-
src/test/perl/Makefile | 2 +
src/test/perl/PostgreSQL/Test/AdjustDump.pm | 167 ++++++++++++++++++++
src/test/perl/meson.build | 1 +
5 files changed, 324 insertions(+), 2 deletions(-)
create mode 100644 src/test/perl/PostgreSQL/Test/AdjustDump.pm
diff --git a/doc/src/sgml/regress.sgml b/doc/src/sgml/regress.sgml
index 0e5e8e8f309..237b974b3ab 100644
--- a/doc/src/sgml/regress.sgml
+++ b/doc/src/sgml/regress.sgml
@@ -357,6 +357,18 @@ make check-world PG_TEST_EXTRA='kerberos ldap ssl load_balance libpq_encryption'
</para>
</listitem>
</varlistentry>
+
+ <varlistentry>
+ <term><literal>regress_dump_test</literal></term>
+ <listitem>
+ <para>
+ When enabled, <filename>src/bin/pg_upgrade/t/002_pg_upgrade.pl</filename>
+ tests dump and restore of regression database left behind by the
+ regression run. Not enabled by default because it is time and resource
+ consuming.
+ </para>
+ </listitem>
+ </varlistentry>
</variablelist>
Tests for features that are not supported by the current build
diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl
index 00051b85035..d08eea6693f 100644
--- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl
+++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl
@@ -12,6 +12,7 @@ use File::Path qw(rmtree);
use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::Utils;
use PostgreSQL::Test::AdjustUpgrade;
+use PostgreSQL::Test::AdjustDump;
use Test::More;
# Can be changed to test the other modes.
@@ -35,8 +36,8 @@ sub generate_db
"created database with ASCII characters from $from_char to $to_char");
}
-# Filter the contents of a dump before its use in a content comparison.
-# This returns the path to the filtered dump.
+# Filter the contents of a dump before its use in a content comparison for
+# upgrade testing. This returns the path to the filtered dump.
sub filter_dump
{
my ($is_old, $old_version, $dump_file) = @_;
@@ -262,6 +263,21 @@ else
}
}
is($rc, 0, 'regression tests pass');
+
+ # Test dump/restore of the objects left behind by regression. Ideally it
+ # should be done in a separate TAP test, but doing it here saves us one full
+ # regression run.
+ #
+ # This step takes several extra seconds and some extra disk space, so
+ # requires an opt-in with the PG_TEST_EXTRA environment variable.
+ #
+ # Do this while the old cluster is running before it is shut down by the
+ # upgrade test.
+ if ( $ENV{PG_TEST_EXTRA}
+ && $ENV{PG_TEST_EXTRA} =~ /\bregress_dump_test\b/)
+ {
+ test_regression_dump_restore($oldnode, %node_params);
+ }
}
# Initialize a new node for the upgrade.
@@ -539,4 +555,128 @@ my $dump2_filtered = filter_dump(0, $oldnode->pg_version, $dump2_file);
compare_files($dump1_filtered, $dump2_filtered,
'old and new dumps match after pg_upgrade');
+# Test dump and restore of objects left behind by the regression run.
+#
+# It is expected that regression tests, which create `regression` database, are
+# run on `src_node`, which in turn, is left in running state. A fresh node is
+# created using given `node_params`, which are expected to be the same ones used
+# to create `src_node`, so as to avoid any differences in the databases.
+#
+# Plain dumps from both the nodes are compared to make sure that all the dumped
+# objects are restored faithfully.
+sub test_regression_dump_restore
+{
+ my ($src_node, %node_params) = @_;
+ my $dst_node = PostgreSQL::Test::Cluster->new('dst_node');
+
+ # Make sure that the source and destination nodes have the same version and
+ # do not use custom install paths. In both the cases, the dump files may
+ # require additional adjustments unknown to code here. Do not run this test
+ # in such a case to avoid utilizing the time and resources unnecessarily.
+ if ($src_node->pg_version != $dst_node->pg_version
+ or defined $src_node->{_install_path})
+ {
+ fail("same version dump and restore test using default installation");
+ return;
+ }
+
+ # Dump the original database for comparison later.
+ my $src_dump =
+ get_dump_for_comparison($src_node, 'regression', 'src_dump', 1);
+
+ # Setup destination database cluster
+ $dst_node->init(%node_params);
+ # Stabilize stats for comparison.
+ $dst_node->append_conf('postgresql.conf', 'autovacuum = off');
+ $dst_node->start;
+
+ # Test all formats one by one.
+ for my $format ('plain', 'tar', 'directory', 'custom')
+ {
+ my $dump_file = "$tempdir/regression_dump.$format";
+ my $restored_db = 'regression_' . $format;
+
+ # Use --create in dump and restore commands so that the restored
+ # database has the same configurable variable settings as the original
+ # database and the plain dumps taken for comparsion do not differ
+ # because of locale changes. Additionally this provides test coverage
+ # for --create option.
+ $src_node->command_ok(
+ [
+ 'pg_dump', "-F$format", '--no-sync',
+ '-d', $src_node->connstr('regression'),
+ '--create', '-f', $dump_file
+ ],
+ "pg_dump on source instance in $format format");
+
+ my @restore_command;
+ if ($format eq 'plain')
+ {
+ # Restore dump in "plain" format using `psql`.
+ @restore_command = [ 'psql', '-d', 'postgres', '-f', $dump_file ];
+ }
+ else
+ {
+ @restore_command = [
+ 'pg_restore', '--create',
+ '-d', 'postgres', $dump_file
+ ];
+ }
+ $dst_node->command_ok(@restore_command,
+ "restored dump taken in $format format on destination instance");
+
+ my $dst_dump =
+ get_dump_for_comparison($dst_node, 'regression',
+ 'dest_dump.' . $format, 0);
+
+ compare_files($src_dump, $dst_dump,
+ "dump outputs from original and restored regression database (using $format format) match"
+ );
+
+ # Rename the restored database so that it is available for debugging in
+ # case the test fails.
+ $dst_node->safe_psql('postgres', "ALTER DATABASE regression RENAME TO $restored_db");
+ }
+}
+
+# Dump database `db` from the given `node` in plain format and adjust it for
+# comparing dumps from the original and the restored database.
+#
+# `file_prefix` is used to create unique names for all dump files so that they
+# remain available for debugging in case the test fails.
+#
+# `adjust_child_columns` is passed to adjust_regress_dumpfile() which actually
+# adjusts the dump output.
+#
+# The name of the file containting adjusted dump is returned.
+sub get_dump_for_comparison
+{
+ my ($node, $db, $file_prefix, $adjust_child_columns) = @_;
+
+ my $dumpfile = $tempdir . '/' . $file_prefix . '.sql';
+ my $dump_adjusted = "${dumpfile}_adjusted";
+
+ # Usually we avoid comparing statistics in our tests since it is flaky by
+ # nature. However, if statistics is dumped and restored it is expected to be
+ # restored as it is i.e. the statistics from the original database and that
+ # from the restored database should match. We turn off autovacuum on the
+ # source and the target database to avoid any statistics update during
+ # restore operation. Hence we do not exclude statistics from dump.
+ $node->command_ok(
+ [
+ 'pg_dump', '--no-sync', '-d', $node->connstr($db), '-f',
+ $dumpfile
+ ],
+ 'dump for comparison succeeded');
+
+ open(my $dh, '>', $dump_adjusted)
+ || die
+ "could not open $dump_adjusted for writing the adjusted dump: $!";
+ print $dh adjust_regress_dumpfile(slurp_file($dumpfile),
+ $adjust_child_columns);
+ close($dh);
+
+ return $dump_adjusted;
+}
+
done_testing();
diff --git a/src/test/perl/Makefile b/src/test/perl/Makefile
index d82fb67540e..def89650ead 100644
--- a/src/test/perl/Makefile
+++ b/src/test/perl/Makefile
@@ -26,6 +26,7 @@ install: all installdirs
$(INSTALL_DATA) $(srcdir)/PostgreSQL/Test/Cluster.pm '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/Cluster.pm'
$(INSTALL_DATA) $(srcdir)/PostgreSQL/Test/BackgroundPsql.pm '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/BackgroundPsql.pm'
$(INSTALL_DATA) $(srcdir)/PostgreSQL/Test/AdjustUpgrade.pm '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/AdjustUpgrade.pm'
+ $(INSTALL_DATA) $(srcdir)/PostgreSQL/Test/AdjustDump.pm '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/AdjustDump.pm'
$(INSTALL_DATA) $(srcdir)/PostgreSQL/Version.pm '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Version.pm'
uninstall:
@@ -36,6 +37,7 @@ uninstall:
rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/Cluster.pm'
rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/BackgroundPsql.pm'
rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/AdjustUpgrade.pm'
+ rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/AdjustDump.pm'
rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Version.pm'
endif
diff --git a/src/test/perl/PostgreSQL/Test/AdjustDump.pm b/src/test/perl/PostgreSQL/Test/AdjustDump.pm
new file mode 100644
index 00000000000..74b9a60cf34
--- /dev/null
+++ b/src/test/perl/PostgreSQL/Test/AdjustDump.pm
@@ -0,0 +1,167 @@
+
+# Copyright (c) 2024-2025, PostgreSQL Global Development Group
+
+=pod
+
+=head1 NAME
+
+PostgreSQL::Test::AdjustDump - helper module for dump and restore tests
+
+=head1 SYNOPSIS
+
+ use PostgreSQL::Test::AdjustDump;
+
+ # Adjust contents of dump output file so that dump output from original
+ # regression database and that from the restored regression database match
+ $dump = adjust_regress_dumpfile($dump, $adjust_child_columns);
+
+=head1 DESCRIPTION
+
+C<PostgreSQL::Test::AdjustDump> encapsulates various hacks needed to
+compare the results of dump and restore tests
+
+=cut
+
+package PostgreSQL::Test::AdjustDump;
+
+use strict;
+use warnings FATAL => 'all';
+
+use Exporter 'import';
+use Test::More;
+
+our @EXPORT = qw(
+ adjust_regress_dumpfile
+);
+
+=pod
+
+=head1 ROUTINES
+
+=over
+
+=item $dump = adjust_regress_dumpfile($dump, $adjust_child_columns)
+
+If we take dump of the regression database left behind after running regression
+tests, restore the dump, and take dump of the restored regression database, the
+outputs of both the dumps differ in the following cases. This routine adjusts
+the given dump so that dump outputs from the original and restored database,
+respectively, match.
+
+Case 1: Some regression tests purposefully create child tables in such a way
+that the order of their inherited columns differ from column orders of their
+respective parents. In the restored database, however, the order of their
+inherited columns are same as that of their respective parents. Thus the column
+orders of these child tables in the original database and those in the restored
+database differ, causing difference in the dump outputs. See MergeAttributes()
+and dumpTableSchema() for details. This routine rearranges the column
+declarations in the relevant C<CREATE TABLE... INHERITS> statements in the dump
+file from original database to match those from the restored database. We could,
+instead, adjust the statements in the dump from the restored database to match
+those from original database or adjust both to a canonical order. But we have
+chosen to adjust the statements in the dump from original database for no
+particular reason.
+
+Case 2: When dumping COPY statements the columns are ordered by their attribute
+number by fmtCopyColumnList(). If a column is added to a parent table after a
+child has inherited the parent and the child has its own columns, the attribute
+number of the column changes after restoring the child table. This is because
+when executing the dumped C<CREATE TABLE... INHERITS> statement all the parent
+attributes are created before any child attributes. Thus the order of columns in
+COPY statements dumped from the original and the restored databases,
+respectively, differs. Such tables in regression tests are listed below. It is
+hard to adjust the column order in the COPY statement along with the data. Hence
+we just remove such COPY statements from the dump output.
+
+Additionally the routine adjusts blank and new lines to avoid noise.
+
+Note: Usually we avoid comparing statistics in our tests since it is flaky by
+nature. However, if statistics is dumped and restored it is expected to be
+restored as it is i.e. the statistics from the original database and that from
+the restored database should match. Hence we do not filter statistics from dump,
+if it's dumped.
+
+Arguments:
+
+=over
+
+=item C<dump>: Contents of dump file
+
+=item C<adjust_child_columns>: 1 indicates that the given dump file requires
+adjusting columns in the child tables; usually when the dump is from original
+database. 0 indicates no such adjustment is needed; usually when the dump is
+from restored database.
+
+=back
+
+Returns the adjusted dump text.
+
+=cut
+
+sub adjust_regress_dumpfile
+{
+ my ($dump, $adjust_child_columns) = @_;
+
+ # use Unix newlines
+ $dump =~ s/\r\n/\n/g;
+
+ # Adjust the CREATE TABLE ... INHERITS statements.
+ if ($adjust_child_columns)
+ {
+ my $saved_dump = $dump;
+
+ $dump =~ s/(^CREATE\sTABLE\sgenerated_stored_tests\.gtestxx_4\s\()
+ (\n\s+b\sinteger),
+ (\n\s+a\sinteger\sNOT\sNULL)/$1$3,$2/mgx;
+ ok($saved_dump ne $dump,
+ 'applied generated_stored_tests.gtestxx_4 adjustments');
+
+ $saved_dump = $dump;
+ $dump =~ s/(^CREATE\sTABLE\sgenerated_virtual_tests\.gtestxx_4\s\()
+ (\n\s+b\sinteger),
+ (\n\s+a\sinteger\sNOT\sNULL)/$1$3,$2/mgx;
+ ok($saved_dump ne $dump,
+ 'applied generated_virtual_tests.gtestxx_4 adjustments');
+
+ $saved_dump = $dump;
+ $dump =~ s/(^CREATE\sTABLE\spublic\.test_type_diff2_c1\s\()
+ (\n\s+int_four\sbigint),
+ (\n\s+int_eight\sbigint),
+ (\n\s+int_two\ssmallint)/$1$4,$2,$3/mgx;
+ ok($saved_dump ne $dump,
+ 'applied public.test_type_diff2_c1 adjustments');
+
+ $saved_dump = $dump;
+ $dump =~ s/(^CREATE\sTABLE\spublic\.test_type_diff2_c2\s\()
+ (\n\s+int_eight\sbigint),
+ (\n\s+int_two\ssmallint),
+ (\n\s+int_four\sbigint)/$1$3,$4,$2/mgx;
+ ok($saved_dump ne $dump,
+ 'applied public.test_type_diff2_c2 adjustments');
+ }
+
+ # Remove COPY statements with differing column order
+ for my $table (
+ 'public\.b_star', 'public\.c_star',
+ 'public\.cc2', 'public\.d_star',
+ 'public\.e_star', 'public\.f_star',
+ 'public\.renamecolumnanother', 'public\.renamecolumnchild',
+ 'public\.test_type_diff2_c1', 'public\.test_type_diff2_c2',
+ 'public\.test_type_diff_c')
+ {
+ $dump =~ s/^COPY\s$table\s\(.+?^\\\.$//sm;
+ }
+
+ # Suppress blank lines, as some places in pg_dump emit more or fewer.
+ $dump =~ s/\n\n+/\n/g;
+
+ return $dump;
+}
+
+=pod
+
+=back
+
+=cut
+
+1;
diff --git a/src/test/perl/meson.build b/src/test/perl/meson.build
index 58e30f15f9d..492ca571ff8 100644
--- a/src/test/perl/meson.build
+++ b/src/test/perl/meson.build
@@ -14,4 +14,5 @@ install_data(
'PostgreSQL/Test/Cluster.pm',
'PostgreSQL/Test/BackgroundPsql.pm',
'PostgreSQL/Test/AdjustUpgrade.pm',
+ 'PostgreSQL/Test/AdjustDump.pm',
install_dir: dir_pgxs / 'src/test/perl/PostgreSQL/Test')
base-commit: 73eba5004a06a744b6b8570e42432b9e9f75997b
--
2.34.1
[text/x-patch] 0003-Do-not-dump-statistics-in-the-file-dumped-f-20250324.patch (2.1K, ../../CAExHW5vw_KaZrjWSNJx-QHF12D4KCmV=AAii3Zh3RHmY43gesw@mail.gmail.com/3-0003-Do-not-dump-statistics-in-the-file-dumped-f-20250324.patch)
download | inline diff:
From 435c659489b34a803675abb65144fab6f0550432 Mon Sep 17 00:00:00 2001
From: Ashutosh Bapat <[email protected]>
Date: Tue, 25 Feb 2025 11:42:51 +0530
Subject: [PATCH 3/3] Do not dump statistics in the file dumped for comparison
The dumped and restored statistics of a materialized view may differ as
reported in [1]. Hence do not dump the statistics to avoid differences
in the dump output from the original and restored database.
[1] https://www.postgresql.org/message-id/CAExHW5s47kmubpbbRJzSM-Zfe0Tj2O3GBagB7YAyE8rQ-V24Uw@mail.gmail.com
Ashutosh Bapat
---
src/bin/pg_upgrade/t/002_pg_upgrade.pl | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl
index cbd9831bf9e..abe93a49258 100644
--- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl
+++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl
@@ -630,15 +630,15 @@ sub get_dump_for_comparison
my $dumpfile = $tempdir . '/' . $file_prefix . '.sql';
my $dump_adjusted = "${dumpfile}_adjusted";
- # Usually we avoid comparing statistics in our tests since it is flaky by
- # nature. However, if statistics is dumped and restored it is expected to be
- # restored as it is i.e. the statistics from the original database and that
- # from the restored database should match. We turn off autovacuum on the
- # source and the target database to avoid any statistics update during
- # restore operation. Hence we do not exclude statistics from dump.
+ # If statistics is dumped and restored it is expected to be restored as it
+ # is i.e. the statistics from the original database and that from the
+ # restored database should match. We turn off autovacuum on the source and
+ # the target database to avoid any statistics update during restore
+ # operation. But as of now, there are cases when statistics is not being
+ # restored faithfully. Hence for now do not dump statistics.
$node->command_ok(
[
- 'pg_dump', '--no-sync', '-d', $node->connstr($db), '-f',
+ 'pg_dump', '--no-sync', '--no-statistics', '-d', $node->connstr($db), '-f',
$dumpfile
],
'dump for comparison succeeded');
--
2.34.1
[text/x-patch] 0002-Use-only-one-format-and-make-the-test-run-d-20250324.patch (5.4K, ../../CAExHW5vw_KaZrjWSNJx-QHF12D4KCmV=AAii3Zh3RHmY43gesw@mail.gmail.com/4-0002-Use-only-one-format-and-make-the-test-run-d-20250324.patch)
download | inline diff:
From f26f88364a196dc9589ca451cb54f5e514e3422e Mon Sep 17 00:00:00 2001
From: Ashutosh Bapat <[email protected]>
Date: Mon, 24 Mar 2025 11:21:12 +0530
Subject: [PATCH 2/3] Use only one format and make the test run default
According to Alvaro (and I agree with him), the test should be run by
default. Otherwise we get to know about a bug only after buildfarm
animal where it's enabled reports a failure. Further testing only one
format may suffice; since all the formats have shown the same bugs till
now.
If we use --directory format we can use -j which reduces the time taken
by dump/restore test by about 12%.
This patch removes PG_TEST_EXTRA option as well as runs the test only in
directory format with parallelism enabled.
Note for committer: If we decide to accept this change, it should be
merged with the previous commit.
---
doc/src/sgml/regress.sgml | 12 ----
src/bin/pg_upgrade/t/002_pg_upgrade.pl | 76 +++++++++-----------------
2 files changed, 25 insertions(+), 63 deletions(-)
diff --git a/doc/src/sgml/regress.sgml b/doc/src/sgml/regress.sgml
index 237b974b3ab..0e5e8e8f309 100644
--- a/doc/src/sgml/regress.sgml
+++ b/doc/src/sgml/regress.sgml
@@ -357,18 +357,6 @@ make check-world PG_TEST_EXTRA='kerberos ldap ssl load_balance libpq_encryption'
</para>
</listitem>
</varlistentry>
-
- <varlistentry>
- <term><literal>regress_dump_test</literal></term>
- <listitem>
- <para>
- When enabled, <filename>src/bin/pg_upgrade/t/002_pg_upgrade.pl</filename>
- tests dump and restore of regression database left behind by the
- regression run. Not enabled by default because it is time and resource
- consuming.
- </para>
- </listitem>
- </varlistentry>
</variablelist>
Tests for features that are not supported by the current build
diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl
index d08eea6693f..cbd9831bf9e 100644
--- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl
+++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl
@@ -268,16 +268,9 @@ else
# should be done in a separate TAP test, but doing it here saves us one full
# regression run.
#
- # This step takes several extra seconds and some extra disk space, so
- # requires an opt-in with the PG_TEST_EXTRA environment variable.
- #
# Do this while the old cluster is running before it is shut down by the
# upgrade test.
- if ( $ENV{PG_TEST_EXTRA}
- && $ENV{PG_TEST_EXTRA} =~ /\bregress_dump_test\b/)
- {
- test_regression_dump_restore($oldnode, %node_params);
- }
+ test_regression_dump_restore($oldnode, %node_params);
}
# Initialize a new node for the upgrade.
@@ -590,53 +583,34 @@ sub test_regression_dump_restore
$dst_node->append_conf('postgresql.conf', 'autovacuum = off');
$dst_node->start;
- # Test all formats one by one.
- for my $format ('plain', 'tar', 'directory', 'custom')
- {
- my $dump_file = "$tempdir/regression_dump.$format";
- my $restored_db = 'regression_' . $format;
-
- # Use --create in dump and restore commands so that the restored
- # database has the same configurable variable settings as the original
- # database and the plain dumps taken for comparsion do not differ
- # because of locale changes. Additionally this provides test coverage
- # for --create option.
- $src_node->command_ok(
- [
- 'pg_dump', "-F$format", '--no-sync',
- '-d', $src_node->connstr('regression'),
- '--create', '-f', $dump_file
- ],
- "pg_dump on source instance in $format format");
+ my $dump_file = "$tempdir/regression.dump";
- my @restore_command;
- if ($format eq 'plain')
- {
- # Restore dump in "plain" format using `psql`.
- @restore_command = [ 'psql', '-d', 'postgres', '-f', $dump_file ];
- }
- else
- {
- @restore_command = [
- 'pg_restore', '--create',
- '-d', 'postgres', $dump_file
- ];
- }
- $dst_node->command_ok(@restore_command,
- "restored dump taken in $format format on destination instance");
+ # Use --create in dump and restore commands so that the restored database
+ # has the same configurable variable settings as the original database so
+ # that the plain dumps taken from both the database taken for comparisong do
+ # not differ because of locale changes. Additionally this provides test
+ # coverage for --create option.
+ #
+ # We use directory format which allows dumping and restoring in parallel to
+ # reduce the test's run time.
+ $src_node->command_ok(
+ [
+ 'pg_dump', '-Fd', '-j2', '--no-sync',
+ '-d', $src_node->connstr('regression'),
+ '--create', '-f', $dump_file
+ ],
+ "pg_dump on source instance succeeded");
- my $dst_dump =
- get_dump_for_comparison($dst_node, 'regression',
- 'dest_dump.' . $format, 0);
+ $dst_node->command_ok(
+ [ 'pg_restore', '--create', '-j2', '-d', 'postgres', $dump_file ],
+ "restored dump to destination instance");
- compare_files($src_dump, $dst_dump,
- "dump outputs from original and restored regression database (using $format format) match"
- );
+ my $dst_dump = get_dump_for_comparison($dst_node, 'regression',
+ 'dest_dump', 0);
- # Rename the restored database so that it is available for debugging in
- # case the test fails.
- $dst_node->safe_psql('postgres', "ALTER DATABASE regression RENAME TO $restored_db");
- }
+ compare_files($src_dump, $dst_dump,
+ "dump outputs from original and restored regression database match"
+ );
}
# Dump database `db` from the given `node` in plain format and adjust it for
--
2.34.1
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: Test to dump and restore objects left behind by regression
2025-03-11 10:44 Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 12:05 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-12 15:58 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 16:09 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 06:52 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 08:42 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 12:39 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 12:40 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-19 11:43 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-20 15:06 ` Re: Test to dump and restore objects left behind by regression vignesh C <[email protected]>
2025-03-20 16:39 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-21 13:09 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-21 14:39 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-21 16:03 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-21 18:07 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-24 09:54 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
@ 2025-03-24 09:59 ` Daniel Gustafsson <[email protected]>
1 sibling, 0 replies; 93+ messages in thread
From: Daniel Gustafsson @ 2025-03-24 09:59 UTC (permalink / raw)
To: Ashutosh Bapat <[email protected]>; +Cc: Alvaro Herrera <[email protected]>; vignesh C <[email protected]>; Michael Paquier <[email protected]>; Tom Lane <[email protected]>; Peter Eisentraut <[email protected]>; PostgreSQL Hackers <[email protected]>
> On 24 Mar 2025, at 10:54, Ashutosh Bapat <[email protected]> wrote:
> 0003 - same as 0002 in the previous patch set. It excludes statistics
> from comparison, otherwise the test will fail because of bug reported
> at [1]. Ideally we shouldn't commit this patch so as to test
> statistics dump and restore, but in case we need the test to pass till
> the bug is fixed, we should merge this patch to 0001 before
> committing.
If the reported bug isn't fixed before feature freeze I think we should commit
this regardless as it has clearly shown value by finding bugs (though perhaps
under PG_TEST_EXTRA or in some disconnected till the bug is fixed to limit the
blast-radius in the buildfarm).
--
Daniel Gustafsson
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: Test to dump and restore objects left behind by regression
2025-03-11 10:44 Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 12:05 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-12 15:58 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 16:09 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 06:52 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 08:42 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 12:39 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 12:40 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-19 11:43 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-20 15:06 ` Re: Test to dump and restore objects left behind by regression vignesh C <[email protected]>
2025-03-20 16:39 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-21 13:09 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-21 14:39 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-21 16:03 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-21 18:07 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-24 09:54 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
@ 2025-03-24 12:14 ` Alvaro Herrera <[email protected]>
2025-03-25 10:39 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
1 sibling, 1 reply; 93+ messages in thread
From: Alvaro Herrera @ 2025-03-24 12:14 UTC (permalink / raw)
To: Ashutosh Bapat <[email protected]>; +Cc: vignesh C <[email protected]>; Michael Paquier <[email protected]>; Daniel Gustafsson <[email protected]>; Tom Lane <[email protected]>; Peter Eisentraut <[email protected]>; PostgreSQL Hackers <[email protected]>
On 2025-Mar-24, Ashutosh Bapat wrote:
> One concern I have with directory format is the dumped database is not
> readable. This might make investigating a but identified the test a
> bit more complex.
Oh, it's readable all right. You just need to use `pg_restore -f-` to
read it. No big deal.
So I ran this a few times:
/usr/bin/time make -j8 -Otarget -C /pgsql/build/master check-world -s PROVE_FLAGS="-c -j6" > /dev/null
commenting out the call to test_regression_dump_restore() to test how
much additional runtime does the new test incur.
With test:
136.95user 116.56system 1:13.23elapsed 346%CPU (0avgtext+0avgdata 250704maxresident)k
4928inputs+55333008outputs (114major+14784937minor)pagefaults 0swaps
138.11user 117.43system 1:15.54elapsed 338%CPU (0avgtext+0avgdata 278592maxresident)k
48inputs+55333464outputs (80major+14794494minor)pagefaults 0swaps
137.05user 113.13system 1:08.19elapsed 366%CPU (0avgtext+0avgdata 279272maxresident)k
48inputs+55330064outputs (83major+14758028minor)pagefaults 0swaps
without the new test:
135.46user 114.55system 1:14.69elapsed 334%CPU (0avgtext+0avgdata 145372maxresident)k
32inputs+55155256outputs (105major+14737549minor)pagefaults 0swaps
135.48user 114.57system 1:09.60elapsed 359%CPU (0avgtext+0avgdata 148224maxresident)k
16inputs+55155432outputs (95major+14749502minor)pagefaults 0swaps
133.76user 113.26system 1:14.92elapsed 329%CPU (0avgtext+0avgdata 148064maxresident)k
48inputs+55154952outputs (84major+14749531minor)pagefaults 0swaps
134.06user 113.83system 1:16.09elapsed 325%CPU (0avgtext+0avgdata 145940maxresident)k
32inputs+55155032outputs (83major+14738602minor)pagefaults 0swaps
The increase in duration here is less than a second.
My conclusion with these numbers is that it's not worth hiding this test
in PG_TEST_EXTRA. If we really wanted to save some total test runtime,
it might be better to write a regress schedule file for
027_stream_regress.pl which only takes the test that emit useful WAL,
rather than all tests.
--
Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/
"The ability of users to misuse tools is, of course, legendary" (David Steele)
https://postgr.es/m/[email protected]
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: Test to dump and restore objects left behind by regression
2025-03-11 10:44 Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 12:05 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-12 15:58 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 16:09 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 06:52 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 08:42 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 12:39 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 12:40 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-19 11:43 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-20 15:06 ` Re: Test to dump and restore objects left behind by regression vignesh C <[email protected]>
2025-03-20 16:39 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-21 13:09 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-21 14:39 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-21 16:03 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-21 18:07 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-24 09:54 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-24 12:14 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
@ 2025-03-25 10:39 ` Ashutosh Bapat <[email protected]>
2025-03-27 12:31 ` Re: Test to dump and restore objects left behind by regression vignesh C <[email protected]>
0 siblings, 1 reply; 93+ messages in thread
From: Ashutosh Bapat @ 2025-03-25 10:39 UTC (permalink / raw)
To: Alvaro Herrera <[email protected]>; +Cc: vignesh C <[email protected]>; Michael Paquier <[email protected]>; Daniel Gustafsson <[email protected]>; Tom Lane <[email protected]>; Peter Eisentraut <[email protected]>; PostgreSQL Hackers <[email protected]>
On Mon, Mar 24, 2025 at 5:44 PM Alvaro Herrera <[email protected]> wrote:
>
> On 2025-Mar-24, Ashutosh Bapat wrote:
>
> > One concern I have with directory format is the dumped database is not
> > readable. This might make investigating a but identified the test a
> > bit more complex.
>
> Oh, it's readable all right. You just need to use `pg_restore -f-` to
> read it. No big deal.
>
>
> So I ran this a few times:
> /usr/bin/time make -j8 -Otarget -C /pgsql/build/master check-world -s PROVE_FLAGS="-c -j6" > /dev/null
>
> commenting out the call to test_regression_dump_restore() to test how
> much additional runtime does the new test incur.
>
> With test:
>
> 136.95user 116.56system 1:13.23elapsed 346%CPU (0avgtext+0avgdata 250704maxresident)k
> 4928inputs+55333008outputs (114major+14784937minor)pagefaults 0swaps
>
> 138.11user 117.43system 1:15.54elapsed 338%CPU (0avgtext+0avgdata 278592maxresident)k
> 48inputs+55333464outputs (80major+14794494minor)pagefaults 0swaps
>
> 137.05user 113.13system 1:08.19elapsed 366%CPU (0avgtext+0avgdata 279272maxresident)k
> 48inputs+55330064outputs (83major+14758028minor)pagefaults 0swaps
>
> without the new test:
>
> 135.46user 114.55system 1:14.69elapsed 334%CPU (0avgtext+0avgdata 145372maxresident)k
> 32inputs+55155256outputs (105major+14737549minor)pagefaults 0swaps
>
> 135.48user 114.57system 1:09.60elapsed 359%CPU (0avgtext+0avgdata 148224maxresident)k
> 16inputs+55155432outputs (95major+14749502minor)pagefaults 0swaps
>
> 133.76user 113.26system 1:14.92elapsed 329%CPU (0avgtext+0avgdata 148064maxresident)k
> 48inputs+55154952outputs (84major+14749531minor)pagefaults 0swaps
>
> 134.06user 113.83system 1:16.09elapsed 325%CPU (0avgtext+0avgdata 145940maxresident)k
> 32inputs+55155032outputs (83major+14738602minor)pagefaults 0swaps
>
> The increase in duration here is less than a second.
>
>
> My conclusion with these numbers is that it's not worth hiding this test
> in PG_TEST_EXTRA.
Thanks for the conclusion.
On Mon, Mar 24, 2025 at 3:29 PM Daniel Gustafsson <[email protected]> wrote:
>
> > On 24 Mar 2025, at 10:54, Ashutosh Bapat <[email protected]> wrote:
>
> > 0003 - same as 0002 in the previous patch set. It excludes statistics
> > from comparison, otherwise the test will fail because of bug reported
> > at [1]. Ideally we shouldn't commit this patch so as to test
> > statistics dump and restore, but in case we need the test to pass till
> > the bug is fixed, we should merge this patch to 0001 before
> > committing.
>
> If the reported bug isn't fixed before feature freeze I think we should commit
> this regardless as it has clearly shown value by finding bugs (though perhaps
> under PG_TEST_EXTRA or in some disconnected till the bug is fixed to limit the
> blast-radius in the buildfarm).
Combining Alvaro's and Daniel's recommendations, I think we should
squash all the three of my patches while committing the test if the
bug is not fixed by then. Otherwise we should squash first two patches
and commit it. Just attaching the patches again for reference.
> If we really wanted to save some total test runtime,
> it might be better to write a regress schedule file for
> 027_stream_regress.pl which only takes the test that emit useful WAL,
> rather than all tests.
That's out of scope for this patch, but it seems like an idea worth exploring.
--
Best Wishes,
Ashutosh Bapat
Attachments:
[text/x-patch] 0002-Use-only-one-format-and-make-the-test-run-d-20250324.patch (5.4K, ../../CAExHW5usOKfi-Q1jSi5F50H1mMykAsCayKWEXsES7QKtmwdxtA@mail.gmail.com/2-0002-Use-only-one-format-and-make-the-test-run-d-20250324.patch)
download | inline diff:
From f26f88364a196dc9589ca451cb54f5e514e3422e Mon Sep 17 00:00:00 2001
From: Ashutosh Bapat <[email protected]>
Date: Mon, 24 Mar 2025 11:21:12 +0530
Subject: [PATCH 2/3] Use only one format and make the test run default
According to Alvaro (and I agree with him), the test should be run by
default. Otherwise we get to know about a bug only after buildfarm
animal where it's enabled reports a failure. Further testing only one
format may suffice; since all the formats have shown the same bugs till
now.
If we use --directory format we can use -j which reduces the time taken
by dump/restore test by about 12%.
This patch removes PG_TEST_EXTRA option as well as runs the test only in
directory format with parallelism enabled.
Note for committer: If we decide to accept this change, it should be
merged with the previous commit.
---
doc/src/sgml/regress.sgml | 12 ----
src/bin/pg_upgrade/t/002_pg_upgrade.pl | 76 +++++++++-----------------
2 files changed, 25 insertions(+), 63 deletions(-)
diff --git a/doc/src/sgml/regress.sgml b/doc/src/sgml/regress.sgml
index 237b974b3ab..0e5e8e8f309 100644
--- a/doc/src/sgml/regress.sgml
+++ b/doc/src/sgml/regress.sgml
@@ -357,18 +357,6 @@ make check-world PG_TEST_EXTRA='kerberos ldap ssl load_balance libpq_encryption'
</para>
</listitem>
</varlistentry>
-
- <varlistentry>
- <term><literal>regress_dump_test</literal></term>
- <listitem>
- <para>
- When enabled, <filename>src/bin/pg_upgrade/t/002_pg_upgrade.pl</filename>
- tests dump and restore of regression database left behind by the
- regression run. Not enabled by default because it is time and resource
- consuming.
- </para>
- </listitem>
- </varlistentry>
</variablelist>
Tests for features that are not supported by the current build
diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl
index d08eea6693f..cbd9831bf9e 100644
--- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl
+++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl
@@ -268,16 +268,9 @@ else
# should be done in a separate TAP test, but doing it here saves us one full
# regression run.
#
- # This step takes several extra seconds and some extra disk space, so
- # requires an opt-in with the PG_TEST_EXTRA environment variable.
- #
# Do this while the old cluster is running before it is shut down by the
# upgrade test.
- if ( $ENV{PG_TEST_EXTRA}
- && $ENV{PG_TEST_EXTRA} =~ /\bregress_dump_test\b/)
- {
- test_regression_dump_restore($oldnode, %node_params);
- }
+ test_regression_dump_restore($oldnode, %node_params);
}
# Initialize a new node for the upgrade.
@@ -590,53 +583,34 @@ sub test_regression_dump_restore
$dst_node->append_conf('postgresql.conf', 'autovacuum = off');
$dst_node->start;
- # Test all formats one by one.
- for my $format ('plain', 'tar', 'directory', 'custom')
- {
- my $dump_file = "$tempdir/regression_dump.$format";
- my $restored_db = 'regression_' . $format;
-
- # Use --create in dump and restore commands so that the restored
- # database has the same configurable variable settings as the original
- # database and the plain dumps taken for comparsion do not differ
- # because of locale changes. Additionally this provides test coverage
- # for --create option.
- $src_node->command_ok(
- [
- 'pg_dump', "-F$format", '--no-sync',
- '-d', $src_node->connstr('regression'),
- '--create', '-f', $dump_file
- ],
- "pg_dump on source instance in $format format");
+ my $dump_file = "$tempdir/regression.dump";
- my @restore_command;
- if ($format eq 'plain')
- {
- # Restore dump in "plain" format using `psql`.
- @restore_command = [ 'psql', '-d', 'postgres', '-f', $dump_file ];
- }
- else
- {
- @restore_command = [
- 'pg_restore', '--create',
- '-d', 'postgres', $dump_file
- ];
- }
- $dst_node->command_ok(@restore_command,
- "restored dump taken in $format format on destination instance");
+ # Use --create in dump and restore commands so that the restored database
+ # has the same configurable variable settings as the original database so
+ # that the plain dumps taken from both the database taken for comparisong do
+ # not differ because of locale changes. Additionally this provides test
+ # coverage for --create option.
+ #
+ # We use directory format which allows dumping and restoring in parallel to
+ # reduce the test's run time.
+ $src_node->command_ok(
+ [
+ 'pg_dump', '-Fd', '-j2', '--no-sync',
+ '-d', $src_node->connstr('regression'),
+ '--create', '-f', $dump_file
+ ],
+ "pg_dump on source instance succeeded");
- my $dst_dump =
- get_dump_for_comparison($dst_node, 'regression',
- 'dest_dump.' . $format, 0);
+ $dst_node->command_ok(
+ [ 'pg_restore', '--create', '-j2', '-d', 'postgres', $dump_file ],
+ "restored dump to destination instance");
- compare_files($src_dump, $dst_dump,
- "dump outputs from original and restored regression database (using $format format) match"
- );
+ my $dst_dump = get_dump_for_comparison($dst_node, 'regression',
+ 'dest_dump', 0);
- # Rename the restored database so that it is available for debugging in
- # case the test fails.
- $dst_node->safe_psql('postgres', "ALTER DATABASE regression RENAME TO $restored_db");
- }
+ compare_files($src_dump, $dst_dump,
+ "dump outputs from original and restored regression database match"
+ );
}
# Dump database `db` from the given `node` in plain format and adjust it for
--
2.34.1
[text/x-patch] 0001-Test-pg_dump-restore-of-regression-objects-20250324.patch (16.5K, ../../CAExHW5usOKfi-Q1jSi5F50H1mMykAsCayKWEXsES7QKtmwdxtA@mail.gmail.com/3-0001-Test-pg_dump-restore-of-regression-objects-20250324.patch)
download | inline diff:
From fcfd0d25ecd374d55970817b4d3ea2aecdd58251 Mon Sep 17 00:00:00 2001
From: Ashutosh Bapat <[email protected]>
Date: Thu, 27 Jun 2024 10:03:53 +0530
Subject: [PATCH 1/3] Test pg_dump/restore of regression objects
002_pg_upgrade.pl tests pg_upgrade of the regression database left
behind by regression run. Modify it to test dump and restore of the
regression database as well.
Regression database created by regression run contains almost all the
database objects supported by PostgreSQL in various states. Hence the
new testcase covers dump and restore scenarios not covered by individual
dump/restore cases. Till now 002_pg_upgrade only tested dump/restore
through pg_upgrade which only uses binary mode. Many regression tests
mention that they leave objects behind for dump/restore testing but they
are not tested in a non-binary mode. The new testcase closes that
gap.
Testing dump and restore of regression database makes this test run
longer for a relatively smaller benefit. Hence run it only when
explicitly requested by user by specifying "regress_dump_test" in
PG_TEST_EXTRA.
Note For the reviewers:
The new test has uncovered many bugs so far in one year.
1. Introduced by 14e87ffa5c54. Fixed in fd41ba93e4630921a72ed5127cd0d552a8f3f8fc.
2. Introduced by 0413a556990ba628a3de8a0b58be020fd9a14ed0. Reverted in 74563f6b90216180fc13649725179fc119dddeb5.
3. Fixed by d611f8b1587b8f30caa7c0da99ae5d28e914d54f
3. Being discussed on hackers at https://www.postgresql.org/message-id/CAExHW5s47kmubpbbRJzSM-Zfe0Tj2O3GBagB7YAyE8rQ-V24Uw@mail.gmail.com
Author: Ashutosh Bapat
Reviewed by: Michael Pacquire, Daniel Gustafsson, Tom Lane, Alvaro Herrera
Discussion: https://www.postgresql.org/message-id/CAExHW5uF5V=Cjecx3_Z=7xfh4rg2Wf61PT+hfquzjBqouRzQJQ@mail.gmail.com
---
doc/src/sgml/regress.sgml | 12 ++
src/bin/pg_upgrade/t/002_pg_upgrade.pl | 144 ++++++++++++++++-
src/test/perl/Makefile | 2 +
src/test/perl/PostgreSQL/Test/AdjustDump.pm | 167 ++++++++++++++++++++
src/test/perl/meson.build | 1 +
5 files changed, 324 insertions(+), 2 deletions(-)
create mode 100644 src/test/perl/PostgreSQL/Test/AdjustDump.pm
diff --git a/doc/src/sgml/regress.sgml b/doc/src/sgml/regress.sgml
index 0e5e8e8f309..237b974b3ab 100644
--- a/doc/src/sgml/regress.sgml
+++ b/doc/src/sgml/regress.sgml
@@ -357,6 +357,18 @@ make check-world PG_TEST_EXTRA='kerberos ldap ssl load_balance libpq_encryption'
</para>
</listitem>
</varlistentry>
+
+ <varlistentry>
+ <term><literal>regress_dump_test</literal></term>
+ <listitem>
+ <para>
+ When enabled, <filename>src/bin/pg_upgrade/t/002_pg_upgrade.pl</filename>
+ tests dump and restore of regression database left behind by the
+ regression run. Not enabled by default because it is time and resource
+ consuming.
+ </para>
+ </listitem>
+ </varlistentry>
</variablelist>
Tests for features that are not supported by the current build
diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl
index 00051b85035..d08eea6693f 100644
--- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl
+++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl
@@ -12,6 +12,7 @@ use File::Path qw(rmtree);
use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::Utils;
use PostgreSQL::Test::AdjustUpgrade;
+use PostgreSQL::Test::AdjustDump;
use Test::More;
# Can be changed to test the other modes.
@@ -35,8 +36,8 @@ sub generate_db
"created database with ASCII characters from $from_char to $to_char");
}
-# Filter the contents of a dump before its use in a content comparison.
-# This returns the path to the filtered dump.
+# Filter the contents of a dump before its use in a content comparison for
+# upgrade testing. This returns the path to the filtered dump.
sub filter_dump
{
my ($is_old, $old_version, $dump_file) = @_;
@@ -262,6 +263,21 @@ else
}
}
is($rc, 0, 'regression tests pass');
+
+ # Test dump/restore of the objects left behind by regression. Ideally it
+ # should be done in a separate TAP test, but doing it here saves us one full
+ # regression run.
+ #
+ # This step takes several extra seconds and some extra disk space, so
+ # requires an opt-in with the PG_TEST_EXTRA environment variable.
+ #
+ # Do this while the old cluster is running before it is shut down by the
+ # upgrade test.
+ if ( $ENV{PG_TEST_EXTRA}
+ && $ENV{PG_TEST_EXTRA} =~ /\bregress_dump_test\b/)
+ {
+ test_regression_dump_restore($oldnode, %node_params);
+ }
}
# Initialize a new node for the upgrade.
@@ -539,4 +555,128 @@ my $dump2_filtered = filter_dump(0, $oldnode->pg_version, $dump2_file);
compare_files($dump1_filtered, $dump2_filtered,
'old and new dumps match after pg_upgrade');
+# Test dump and restore of objects left behind by the regression run.
+#
+# It is expected that regression tests, which create `regression` database, are
+# run on `src_node`, which in turn, is left in running state. A fresh node is
+# created using given `node_params`, which are expected to be the same ones used
+# to create `src_node`, so as to avoid any differences in the databases.
+#
+# Plain dumps from both the nodes are compared to make sure that all the dumped
+# objects are restored faithfully.
+sub test_regression_dump_restore
+{
+ my ($src_node, %node_params) = @_;
+ my $dst_node = PostgreSQL::Test::Cluster->new('dst_node');
+
+ # Make sure that the source and destination nodes have the same version and
+ # do not use custom install paths. In both the cases, the dump files may
+ # require additional adjustments unknown to code here. Do not run this test
+ # in such a case to avoid utilizing the time and resources unnecessarily.
+ if ($src_node->pg_version != $dst_node->pg_version
+ or defined $src_node->{_install_path})
+ {
+ fail("same version dump and restore test using default installation");
+ return;
+ }
+
+ # Dump the original database for comparison later.
+ my $src_dump =
+ get_dump_for_comparison($src_node, 'regression', 'src_dump', 1);
+
+ # Setup destination database cluster
+ $dst_node->init(%node_params);
+ # Stabilize stats for comparison.
+ $dst_node->append_conf('postgresql.conf', 'autovacuum = off');
+ $dst_node->start;
+
+ # Test all formats one by one.
+ for my $format ('plain', 'tar', 'directory', 'custom')
+ {
+ my $dump_file = "$tempdir/regression_dump.$format";
+ my $restored_db = 'regression_' . $format;
+
+ # Use --create in dump and restore commands so that the restored
+ # database has the same configurable variable settings as the original
+ # database and the plain dumps taken for comparsion do not differ
+ # because of locale changes. Additionally this provides test coverage
+ # for --create option.
+ $src_node->command_ok(
+ [
+ 'pg_dump', "-F$format", '--no-sync',
+ '-d', $src_node->connstr('regression'),
+ '--create', '-f', $dump_file
+ ],
+ "pg_dump on source instance in $format format");
+
+ my @restore_command;
+ if ($format eq 'plain')
+ {
+ # Restore dump in "plain" format using `psql`.
+ @restore_command = [ 'psql', '-d', 'postgres', '-f', $dump_file ];
+ }
+ else
+ {
+ @restore_command = [
+ 'pg_restore', '--create',
+ '-d', 'postgres', $dump_file
+ ];
+ }
+ $dst_node->command_ok(@restore_command,
+ "restored dump taken in $format format on destination instance");
+
+ my $dst_dump =
+ get_dump_for_comparison($dst_node, 'regression',
+ 'dest_dump.' . $format, 0);
+
+ compare_files($src_dump, $dst_dump,
+ "dump outputs from original and restored regression database (using $format format) match"
+ );
+
+ # Rename the restored database so that it is available for debugging in
+ # case the test fails.
+ $dst_node->safe_psql('postgres', "ALTER DATABASE regression RENAME TO $restored_db");
+ }
+}
+
+# Dump database `db` from the given `node` in plain format and adjust it for
+# comparing dumps from the original and the restored database.
+#
+# `file_prefix` is used to create unique names for all dump files so that they
+# remain available for debugging in case the test fails.
+#
+# `adjust_child_columns` is passed to adjust_regress_dumpfile() which actually
+# adjusts the dump output.
+#
+# The name of the file containting adjusted dump is returned.
+sub get_dump_for_comparison
+{
+ my ($node, $db, $file_prefix, $adjust_child_columns) = @_;
+
+ my $dumpfile = $tempdir . '/' . $file_prefix . '.sql';
+ my $dump_adjusted = "${dumpfile}_adjusted";
+
+ # Usually we avoid comparing statistics in our tests since it is flaky by
+ # nature. However, if statistics is dumped and restored it is expected to be
+ # restored as it is i.e. the statistics from the original database and that
+ # from the restored database should match. We turn off autovacuum on the
+ # source and the target database to avoid any statistics update during
+ # restore operation. Hence we do not exclude statistics from dump.
+ $node->command_ok(
+ [
+ 'pg_dump', '--no-sync', '-d', $node->connstr($db), '-f',
+ $dumpfile
+ ],
+ 'dump for comparison succeeded');
+
+ open(my $dh, '>', $dump_adjusted)
+ || die
+ "could not open $dump_adjusted for writing the adjusted dump: $!";
+ print $dh adjust_regress_dumpfile(slurp_file($dumpfile),
+ $adjust_child_columns);
+ close($dh);
+
+ return $dump_adjusted;
+}
+
done_testing();
diff --git a/src/test/perl/Makefile b/src/test/perl/Makefile
index d82fb67540e..def89650ead 100644
--- a/src/test/perl/Makefile
+++ b/src/test/perl/Makefile
@@ -26,6 +26,7 @@ install: all installdirs
$(INSTALL_DATA) $(srcdir)/PostgreSQL/Test/Cluster.pm '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/Cluster.pm'
$(INSTALL_DATA) $(srcdir)/PostgreSQL/Test/BackgroundPsql.pm '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/BackgroundPsql.pm'
$(INSTALL_DATA) $(srcdir)/PostgreSQL/Test/AdjustUpgrade.pm '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/AdjustUpgrade.pm'
+ $(INSTALL_DATA) $(srcdir)/PostgreSQL/Test/AdjustDump.pm '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/AdjustDump.pm'
$(INSTALL_DATA) $(srcdir)/PostgreSQL/Version.pm '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Version.pm'
uninstall:
@@ -36,6 +37,7 @@ uninstall:
rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/Cluster.pm'
rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/BackgroundPsql.pm'
rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/AdjustUpgrade.pm'
+ rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/AdjustDump.pm'
rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Version.pm'
endif
diff --git a/src/test/perl/PostgreSQL/Test/AdjustDump.pm b/src/test/perl/PostgreSQL/Test/AdjustDump.pm
new file mode 100644
index 00000000000..74b9a60cf34
--- /dev/null
+++ b/src/test/perl/PostgreSQL/Test/AdjustDump.pm
@@ -0,0 +1,167 @@
+
+# Copyright (c) 2024-2025, PostgreSQL Global Development Group
+
+=pod
+
+=head1 NAME
+
+PostgreSQL::Test::AdjustDump - helper module for dump and restore tests
+
+=head1 SYNOPSIS
+
+ use PostgreSQL::Test::AdjustDump;
+
+ # Adjust contents of dump output file so that dump output from original
+ # regression database and that from the restored regression database match
+ $dump = adjust_regress_dumpfile($dump, $adjust_child_columns);
+
+=head1 DESCRIPTION
+
+C<PostgreSQL::Test::AdjustDump> encapsulates various hacks needed to
+compare the results of dump and restore tests
+
+=cut
+
+package PostgreSQL::Test::AdjustDump;
+
+use strict;
+use warnings FATAL => 'all';
+
+use Exporter 'import';
+use Test::More;
+
+our @EXPORT = qw(
+ adjust_regress_dumpfile
+);
+
+=pod
+
+=head1 ROUTINES
+
+=over
+
+=item $dump = adjust_regress_dumpfile($dump, $adjust_child_columns)
+
+If we take dump of the regression database left behind after running regression
+tests, restore the dump, and take dump of the restored regression database, the
+outputs of both the dumps differ in the following cases. This routine adjusts
+the given dump so that dump outputs from the original and restored database,
+respectively, match.
+
+Case 1: Some regression tests purposefully create child tables in such a way
+that the order of their inherited columns differ from column orders of their
+respective parents. In the restored database, however, the order of their
+inherited columns are same as that of their respective parents. Thus the column
+orders of these child tables in the original database and those in the restored
+database differ, causing difference in the dump outputs. See MergeAttributes()
+and dumpTableSchema() for details. This routine rearranges the column
+declarations in the relevant C<CREATE TABLE... INHERITS> statements in the dump
+file from original database to match those from the restored database. We could,
+instead, adjust the statements in the dump from the restored database to match
+those from original database or adjust both to a canonical order. But we have
+chosen to adjust the statements in the dump from original database for no
+particular reason.
+
+Case 2: When dumping COPY statements the columns are ordered by their attribute
+number by fmtCopyColumnList(). If a column is added to a parent table after a
+child has inherited the parent and the child has its own columns, the attribute
+number of the column changes after restoring the child table. This is because
+when executing the dumped C<CREATE TABLE... INHERITS> statement all the parent
+attributes are created before any child attributes. Thus the order of columns in
+COPY statements dumped from the original and the restored databases,
+respectively, differs. Such tables in regression tests are listed below. It is
+hard to adjust the column order in the COPY statement along with the data. Hence
+we just remove such COPY statements from the dump output.
+
+Additionally the routine adjusts blank and new lines to avoid noise.
+
+Note: Usually we avoid comparing statistics in our tests since it is flaky by
+nature. However, if statistics is dumped and restored it is expected to be
+restored as it is i.e. the statistics from the original database and that from
+the restored database should match. Hence we do not filter statistics from dump,
+if it's dumped.
+
+Arguments:
+
+=over
+
+=item C<dump>: Contents of dump file
+
+=item C<adjust_child_columns>: 1 indicates that the given dump file requires
+adjusting columns in the child tables; usually when the dump is from original
+database. 0 indicates no such adjustment is needed; usually when the dump is
+from restored database.
+
+=back
+
+Returns the adjusted dump text.
+
+=cut
+
+sub adjust_regress_dumpfile
+{
+ my ($dump, $adjust_child_columns) = @_;
+
+ # use Unix newlines
+ $dump =~ s/\r\n/\n/g;
+
+ # Adjust the CREATE TABLE ... INHERITS statements.
+ if ($adjust_child_columns)
+ {
+ my $saved_dump = $dump;
+
+ $dump =~ s/(^CREATE\sTABLE\sgenerated_stored_tests\.gtestxx_4\s\()
+ (\n\s+b\sinteger),
+ (\n\s+a\sinteger\sNOT\sNULL)/$1$3,$2/mgx;
+ ok($saved_dump ne $dump,
+ 'applied generated_stored_tests.gtestxx_4 adjustments');
+
+ $saved_dump = $dump;
+ $dump =~ s/(^CREATE\sTABLE\sgenerated_virtual_tests\.gtestxx_4\s\()
+ (\n\s+b\sinteger),
+ (\n\s+a\sinteger\sNOT\sNULL)/$1$3,$2/mgx;
+ ok($saved_dump ne $dump,
+ 'applied generated_virtual_tests.gtestxx_4 adjustments');
+
+ $saved_dump = $dump;
+ $dump =~ s/(^CREATE\sTABLE\spublic\.test_type_diff2_c1\s\()
+ (\n\s+int_four\sbigint),
+ (\n\s+int_eight\sbigint),
+ (\n\s+int_two\ssmallint)/$1$4,$2,$3/mgx;
+ ok($saved_dump ne $dump,
+ 'applied public.test_type_diff2_c1 adjustments');
+
+ $saved_dump = $dump;
+ $dump =~ s/(^CREATE\sTABLE\spublic\.test_type_diff2_c2\s\()
+ (\n\s+int_eight\sbigint),
+ (\n\s+int_two\ssmallint),
+ (\n\s+int_four\sbigint)/$1$3,$4,$2/mgx;
+ ok($saved_dump ne $dump,
+ 'applied public.test_type_diff2_c2 adjustments');
+ }
+
+ # Remove COPY statements with differing column order
+ for my $table (
+ 'public\.b_star', 'public\.c_star',
+ 'public\.cc2', 'public\.d_star',
+ 'public\.e_star', 'public\.f_star',
+ 'public\.renamecolumnanother', 'public\.renamecolumnchild',
+ 'public\.test_type_diff2_c1', 'public\.test_type_diff2_c2',
+ 'public\.test_type_diff_c')
+ {
+ $dump =~ s/^COPY\s$table\s\(.+?^\\\.$//sm;
+ }
+
+ # Suppress blank lines, as some places in pg_dump emit more or fewer.
+ $dump =~ s/\n\n+/\n/g;
+
+ return $dump;
+}
+
+=pod
+
+=back
+
+=cut
+
+1;
diff --git a/src/test/perl/meson.build b/src/test/perl/meson.build
index 58e30f15f9d..492ca571ff8 100644
--- a/src/test/perl/meson.build
+++ b/src/test/perl/meson.build
@@ -14,4 +14,5 @@ install_data(
'PostgreSQL/Test/Cluster.pm',
'PostgreSQL/Test/BackgroundPsql.pm',
'PostgreSQL/Test/AdjustUpgrade.pm',
+ 'PostgreSQL/Test/AdjustDump.pm',
install_dir: dir_pgxs / 'src/test/perl/PostgreSQL/Test')
base-commit: 73eba5004a06a744b6b8570e42432b9e9f75997b
--
2.34.1
[text/x-patch] 0003-Do-not-dump-statistics-in-the-file-dumped-f-20250324.patch (2.1K, ../../CAExHW5usOKfi-Q1jSi5F50H1mMykAsCayKWEXsES7QKtmwdxtA@mail.gmail.com/4-0003-Do-not-dump-statistics-in-the-file-dumped-f-20250324.patch)
download | inline diff:
From 435c659489b34a803675abb65144fab6f0550432 Mon Sep 17 00:00:00 2001
From: Ashutosh Bapat <[email protected]>
Date: Tue, 25 Feb 2025 11:42:51 +0530
Subject: [PATCH 3/3] Do not dump statistics in the file dumped for comparison
The dumped and restored statistics of a materialized view may differ as
reported in [1]. Hence do not dump the statistics to avoid differences
in the dump output from the original and restored database.
[1] https://www.postgresql.org/message-id/CAExHW5s47kmubpbbRJzSM-Zfe0Tj2O3GBagB7YAyE8rQ-V24Uw@mail.gmail.com
Ashutosh Bapat
---
src/bin/pg_upgrade/t/002_pg_upgrade.pl | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl
index cbd9831bf9e..abe93a49258 100644
--- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl
+++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl
@@ -630,15 +630,15 @@ sub get_dump_for_comparison
my $dumpfile = $tempdir . '/' . $file_prefix . '.sql';
my $dump_adjusted = "${dumpfile}_adjusted";
- # Usually we avoid comparing statistics in our tests since it is flaky by
- # nature. However, if statistics is dumped and restored it is expected to be
- # restored as it is i.e. the statistics from the original database and that
- # from the restored database should match. We turn off autovacuum on the
- # source and the target database to avoid any statistics update during
- # restore operation. Hence we do not exclude statistics from dump.
+ # If statistics is dumped and restored it is expected to be restored as it
+ # is i.e. the statistics from the original database and that from the
+ # restored database should match. We turn off autovacuum on the source and
+ # the target database to avoid any statistics update during restore
+ # operation. But as of now, there are cases when statistics is not being
+ # restored faithfully. Hence for now do not dump statistics.
$node->command_ok(
[
- 'pg_dump', '--no-sync', '-d', $node->connstr($db), '-f',
+ 'pg_dump', '--no-sync', '--no-statistics', '-d', $node->connstr($db), '-f',
$dumpfile
],
'dump for comparison succeeded');
--
2.34.1
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: Test to dump and restore objects left behind by regression
2025-03-11 10:44 Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 12:05 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-12 15:58 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 16:09 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 06:52 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 08:42 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 12:39 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 12:40 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-19 11:43 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-20 15:06 ` Re: Test to dump and restore objects left behind by regression vignesh C <[email protected]>
2025-03-20 16:39 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-21 13:09 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-21 14:39 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-21 16:03 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-21 18:07 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-24 09:54 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-24 12:14 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-25 10:39 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
@ 2025-03-27 12:31 ` vignesh C <[email protected]>
2025-03-27 16:31 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
0 siblings, 1 reply; 93+ messages in thread
From: vignesh C @ 2025-03-27 12:31 UTC (permalink / raw)
To: Ashutosh Bapat <[email protected]>; +Cc: Alvaro Herrera <[email protected]>; Michael Paquier <[email protected]>; Daniel Gustafsson <[email protected]>; Tom Lane <[email protected]>; Peter Eisentraut <[email protected]>; PostgreSQL Hackers <[email protected]>
On Tue, 25 Mar 2025 at 16:09, Ashutosh Bapat
<[email protected]> wrote:
>
> On Mon, Mar 24, 2025 at 5:44 PM Alvaro Herrera <[email protected]> wrote:
> >
> > On 2025-Mar-24, Ashutosh Bapat wrote:
> >
> > > One concern I have with directory format is the dumped database is not
> > > readable. This might make investigating a but identified the test a
> > > bit more complex.
> >
> > Oh, it's readable all right. You just need to use `pg_restore -f-` to
> > read it. No big deal.
> >
> >
> > So I ran this a few times:
> > /usr/bin/time make -j8 -Otarget -C /pgsql/build/master check-world -s PROVE_FLAGS="-c -j6" > /dev/null
> >
> > commenting out the call to test_regression_dump_restore() to test how
> > much additional runtime does the new test incur.
> >
> > With test:
> >
> > 136.95user 116.56system 1:13.23elapsed 346%CPU (0avgtext+0avgdata 250704maxresident)k
> > 4928inputs+55333008outputs (114major+14784937minor)pagefaults 0swaps
> >
> > 138.11user 117.43system 1:15.54elapsed 338%CPU (0avgtext+0avgdata 278592maxresident)k
> > 48inputs+55333464outputs (80major+14794494minor)pagefaults 0swaps
> >
> > 137.05user 113.13system 1:08.19elapsed 366%CPU (0avgtext+0avgdata 279272maxresident)k
> > 48inputs+55330064outputs (83major+14758028minor)pagefaults 0swaps
> >
> > without the new test:
> >
> > 135.46user 114.55system 1:14.69elapsed 334%CPU (0avgtext+0avgdata 145372maxresident)k
> > 32inputs+55155256outputs (105major+14737549minor)pagefaults 0swaps
> >
> > 135.48user 114.57system 1:09.60elapsed 359%CPU (0avgtext+0avgdata 148224maxresident)k
> > 16inputs+55155432outputs (95major+14749502minor)pagefaults 0swaps
> >
> > 133.76user 113.26system 1:14.92elapsed 329%CPU (0avgtext+0avgdata 148064maxresident)k
> > 48inputs+55154952outputs (84major+14749531minor)pagefaults 0swaps
> >
> > 134.06user 113.83system 1:16.09elapsed 325%CPU (0avgtext+0avgdata 145940maxresident)k
> > 32inputs+55155032outputs (83major+14738602minor)pagefaults 0swaps
> >
> > The increase in duration here is less than a second.
> >
> >
> > My conclusion with these numbers is that it's not worth hiding this test
> > in PG_TEST_EXTRA.
>
> Thanks for the conclusion.
>
> On Mon, Mar 24, 2025 at 3:29 PM Daniel Gustafsson <[email protected]> wrote:
> >
> > > On 24 Mar 2025, at 10:54, Ashutosh Bapat <[email protected]> wrote:
> >
> > > 0003 - same as 0002 in the previous patch set. It excludes statistics
> > > from comparison, otherwise the test will fail because of bug reported
> > > at [1]. Ideally we shouldn't commit this patch so as to test
> > > statistics dump and restore, but in case we need the test to pass till
> > > the bug is fixed, we should merge this patch to 0001 before
> > > committing.
> >
> > If the reported bug isn't fixed before feature freeze I think we should commit
> > this regardless as it has clearly shown value by finding bugs (though perhaps
> > under PG_TEST_EXTRA or in some disconnected till the bug is fixed to limit the
> > blast-radius in the buildfarm).
>
> Combining Alvaro's and Daniel's recommendations, I think we should
> squash all the three of my patches while committing the test if the
> bug is not fixed by then. Otherwise we should squash first two patches
> and commit it. Just attaching the patches again for reference.
Couple of minor thoughts:
1) I felt this error message is not conveying the error message correctly:
+ if ($src_node->pg_version != $dst_node->pg_version
+ or defined $src_node->{_install_path})
+ {
+ fail("same version dump and restore test using default
installation");
+ return;
+ }
how about something like below:
fail("source and destination nodes must have the same PostgreSQL
version and default installation paths");
2) Should "`" be ' or " here, we generally use "`" to enclose commands:
+# It is expected that regression tests, which create `regression` database, are
+# run on `src_node`, which in turn, is left in running state. A fresh node is
+# created using given `node_params`, which are expected to be the
same ones used
+# to create `src_node`, so as to avoid any differences in the databases.
There are few other instances similarly in the file.
Regards,
Vignesh
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: Test to dump and restore objects left behind by regression
2025-03-11 10:44 Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 12:05 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-12 15:58 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 16:09 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 06:52 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 08:42 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 12:39 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 12:40 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-19 11:43 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-20 15:06 ` Re: Test to dump and restore objects left behind by regression vignesh C <[email protected]>
2025-03-20 16:39 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-21 13:09 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-21 14:39 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-21 16:03 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-21 18:07 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-24 09:54 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-24 12:14 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-25 10:39 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-27 12:31 ` Re: Test to dump and restore objects left behind by regression vignesh C <[email protected]>
@ 2025-03-27 16:31 ` Ashutosh Bapat <[email protected]>
2025-03-27 17:15 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
0 siblings, 1 reply; 93+ messages in thread
From: Ashutosh Bapat @ 2025-03-27 16:31 UTC (permalink / raw)
To: vignesh C <[email protected]>; +Cc: Alvaro Herrera <[email protected]>; Michael Paquier <[email protected]>; Daniel Gustafsson <[email protected]>; Tom Lane <[email protected]>; Peter Eisentraut <[email protected]>; PostgreSQL Hackers <[email protected]>
On Thu, Mar 27, 2025 at 6:01 PM vignesh C <[email protected]> wrote:
>
> On Tue, 25 Mar 2025 at 16:09, Ashutosh Bapat
> <[email protected]> wrote:
> >
> > On Mon, Mar 24, 2025 at 5:44 PM Alvaro Herrera <[email protected]> wrote:
> > >
> > > On 2025-Mar-24, Ashutosh Bapat wrote:
> > >
> > > > One concern I have with directory format is the dumped database is not
> > > > readable. This might make investigating a but identified the test a
> > > > bit more complex.
> > >
> > > Oh, it's readable all right. You just need to use `pg_restore -f-` to
> > > read it. No big deal.
> > >
> > >
> > > So I ran this a few times:
> > > /usr/bin/time make -j8 -Otarget -C /pgsql/build/master check-world -s PROVE_FLAGS="-c -j6" > /dev/null
> > >
> > > commenting out the call to test_regression_dump_restore() to test how
> > > much additional runtime does the new test incur.
> > >
> > > With test:
> > >
> > > 136.95user 116.56system 1:13.23elapsed 346%CPU (0avgtext+0avgdata 250704maxresident)k
> > > 4928inputs+55333008outputs (114major+14784937minor)pagefaults 0swaps
> > >
> > > 138.11user 117.43system 1:15.54elapsed 338%CPU (0avgtext+0avgdata 278592maxresident)k
> > > 48inputs+55333464outputs (80major+14794494minor)pagefaults 0swaps
> > >
> > > 137.05user 113.13system 1:08.19elapsed 366%CPU (0avgtext+0avgdata 279272maxresident)k
> > > 48inputs+55330064outputs (83major+14758028minor)pagefaults 0swaps
> > >
> > > without the new test:
> > >
> > > 135.46user 114.55system 1:14.69elapsed 334%CPU (0avgtext+0avgdata 145372maxresident)k
> > > 32inputs+55155256outputs (105major+14737549minor)pagefaults 0swaps
> > >
> > > 135.48user 114.57system 1:09.60elapsed 359%CPU (0avgtext+0avgdata 148224maxresident)k
> > > 16inputs+55155432outputs (95major+14749502minor)pagefaults 0swaps
> > >
> > > 133.76user 113.26system 1:14.92elapsed 329%CPU (0avgtext+0avgdata 148064maxresident)k
> > > 48inputs+55154952outputs (84major+14749531minor)pagefaults 0swaps
> > >
> > > 134.06user 113.83system 1:16.09elapsed 325%CPU (0avgtext+0avgdata 145940maxresident)k
> > > 32inputs+55155032outputs (83major+14738602minor)pagefaults 0swaps
> > >
> > > The increase in duration here is less than a second.
> > >
> > >
> > > My conclusion with these numbers is that it's not worth hiding this test
> > > in PG_TEST_EXTRA.
> >
> > Thanks for the conclusion.
> >
> > On Mon, Mar 24, 2025 at 3:29 PM Daniel Gustafsson <[email protected]> wrote:
> > >
> > > > On 24 Mar 2025, at 10:54, Ashutosh Bapat <[email protected]> wrote:
> > >
> > > > 0003 - same as 0002 in the previous patch set. It excludes statistics
> > > > from comparison, otherwise the test will fail because of bug reported
> > > > at [1]. Ideally we shouldn't commit this patch so as to test
> > > > statistics dump and restore, but in case we need the test to pass till
> > > > the bug is fixed, we should merge this patch to 0001 before
> > > > committing.
> > >
> > > If the reported bug isn't fixed before feature freeze I think we should commit
> > > this regardless as it has clearly shown value by finding bugs (though perhaps
> > > under PG_TEST_EXTRA or in some disconnected till the bug is fixed to limit the
> > > blast-radius in the buildfarm).
> >
> > Combining Alvaro's and Daniel's recommendations, I think we should
> > squash all the three of my patches while committing the test if the
> > bug is not fixed by then. Otherwise we should squash first two patches
> > and commit it. Just attaching the patches again for reference.
>
> Couple of minor thoughts:
> 1) I felt this error message is not conveying the error message correctly:
> + if ($src_node->pg_version != $dst_node->pg_version
> + or defined $src_node->{_install_path})
> + {
> + fail("same version dump and restore test using default
> installation");
> + return;
> + }
>
> how about something like below:
> fail("source and destination nodes must have the same PostgreSQL
> version and default installation paths");
The text in ok(), fail() etc. are test names and not error messages.
See [1]. Your suggestion and other versions that I came up with became
too verbose to be test names. So I think the text here is compromise
between conveying enough information and not being too long. We
usually have to pick the testname and lookup the test code to
investigate the failure. This text serves that purpose.
>
> 2) Should "`" be ' or " here, we generally use "`" to enclose commands:
> +# It is expected that regression tests, which create `regression` database, are
> +# run on `src_node`, which in turn, is left in running state. A fresh node is
> +# created using given `node_params`, which are expected to be the
> same ones used
> +# to create `src_node`, so as to avoid any differences in the databases.
Looking at prologues or some other functions, I see that we don't add
any decoration around the name of the argument. Hence dropped ``
altogether. Will post it with the next set of patches.
[1] https://metacpan.org/pod/Test::More
--
Best Wishes,
Ashutosh Bapat
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: Test to dump and restore objects left behind by regression
2025-03-11 10:44 Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 12:05 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-12 15:58 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 16:09 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 06:52 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 08:42 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 12:39 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 12:40 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-19 11:43 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-20 15:06 ` Re: Test to dump and restore objects left behind by regression vignesh C <[email protected]>
2025-03-20 16:39 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-21 13:09 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-21 14:39 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-21 16:03 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-21 18:07 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-24 09:54 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-24 12:14 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-25 10:39 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-27 12:31 ` Re: Test to dump and restore objects left behind by regression vignesh C <[email protected]>
2025-03-27 16:31 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
@ 2025-03-27 17:15 ` Alvaro Herrera <[email protected]>
2025-03-28 01:36 ` Re: Test to dump and restore objects left behind by regression Michael Paquier <[email protected]>
2025-03-28 06:32 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
0 siblings, 2 replies; 93+ messages in thread
From: Alvaro Herrera @ 2025-03-27 17:15 UTC (permalink / raw)
To: Ashutosh Bapat <[email protected]>; +Cc: vignesh C <[email protected]>; Michael Paquier <[email protected]>; Daniel Gustafsson <[email protected]>; Tom Lane <[email protected]>; Peter Eisentraut <[email protected]>; PostgreSQL Hackers <[email protected]>
On 2025-Mar-27, Ashutosh Bapat wrote:
> On Thu, Mar 27, 2025 at 6:01 PM vignesh C <[email protected]> wrote:
> > Couple of minor thoughts:
> > 1) I felt this error message is not conveying the error message correctly:
> > + if ($src_node->pg_version != $dst_node->pg_version
> > + or defined $src_node->{_install_path})
> > + {
> > + fail("same version dump and restore test using default
> > installation");
> > + return;
> > + }
> >
> > how about something like below:
> > fail("source and destination nodes must have the same PostgreSQL
> > version and default installation paths");
>
> The text in ok(), fail() etc. are test names and not error messages.
> See [1]. Your suggestion and other versions that I came up with became
> too verbose to be test names. So I think the text here is compromise
> between conveying enough information and not being too long. We
> usually have to pick the testname and lookup the test code to
> investigate the failure. This text serves that purpose.
Maybe
fail("roundtrip dump/restore of the regression database")
BTW another idea to shorten this tests's runtime might be to try and
identify which of parallel_schedule tests leave objects behind and
create a shorter schedule with only those (a possible implementation
might keep a list of the slow tests that don't leave any useful object
behind, then filter parallel_schedule to exclude those; this ensures
test files created in the future are still used.)
--
Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/
"I love the Postgres community. It's all about doing things _properly_. :-)"
(David Garamond)
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: Test to dump and restore objects left behind by regression
2025-03-11 10:44 Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 12:05 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-12 15:58 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 16:09 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 06:52 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 08:42 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 12:39 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 12:40 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-19 11:43 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-20 15:06 ` Re: Test to dump and restore objects left behind by regression vignesh C <[email protected]>
2025-03-20 16:39 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-21 13:09 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-21 14:39 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-21 16:03 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-21 18:07 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-24 09:54 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-24 12:14 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-25 10:39 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-27 12:31 ` Re: Test to dump and restore objects left behind by regression vignesh C <[email protected]>
2025-03-27 16:31 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-27 17:15 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
@ 2025-03-28 01:36 ` Michael Paquier <[email protected]>
2025-03-28 06:50 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
1 sibling, 1 reply; 93+ messages in thread
From: Michael Paquier @ 2025-03-28 01:36 UTC (permalink / raw)
To: Alvaro Herrera <[email protected]>; +Cc: Ashutosh Bapat <[email protected]>; vignesh C <[email protected]>; Daniel Gustafsson <[email protected]>; Tom Lane <[email protected]>; Peter Eisentraut <[email protected]>; PostgreSQL Hackers <[email protected]>
On Thu, Mar 27, 2025 at 06:15:06PM +0100, Alvaro Herrera wrote:
> BTW another idea to shorten this tests's runtime might be to try and
> identify which of parallel_schedule tests leave objects behind and
> create a shorter schedule with only those (a possible implementation
> might keep a list of the slow tests that don't leave any useful object
> behind, then filter parallel_schedule to exclude those; this ensures
> test files created in the future are still used.)
I'm not much a fan of approaches that require an extra schedule,
because this is prone to forget the addition of objects that we'd want
to cover for the scope of this thread with the dump/restore
inter-dependencies, failing our goal of having more coverage. And
history has proven that we are quite bad at maintaining multiple
schedules for the regression test suite (remember the serial one or
the standby one in pg_regress?). So we should really do things so as
the schedules are down to a strict minimum: 1.
If we're worried about the time taken by the test (spoiler: I am and
the upgrade tests already show always as last to finish in parallel
runs), I would recommend to put that under a PG_TEST_EXTRA. I'm OK to
add the switch to my buildfarm animals if this option is the consensus
and if it gets into the tree.
--
Michael
Attachments:
[application/pgp-signature] signature.asc (833B, ../../[email protected]/2-signature.asc)
download
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: Test to dump and restore objects left behind by regression
2025-03-11 10:44 Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 12:05 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-12 15:58 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 16:09 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 06:52 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 08:42 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 12:39 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 12:40 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-19 11:43 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-20 15:06 ` Re: Test to dump and restore objects left behind by regression vignesh C <[email protected]>
2025-03-20 16:39 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-21 13:09 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-21 14:39 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-21 16:03 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-21 18:07 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-24 09:54 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-24 12:14 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-25 10:39 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-27 12:31 ` Re: Test to dump and restore objects left behind by regression vignesh C <[email protected]>
2025-03-27 16:31 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-27 17:15 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-28 01:36 ` Re: Test to dump and restore objects left behind by regression Michael Paquier <[email protected]>
@ 2025-03-28 06:50 ` Ashutosh Bapat <[email protected]>
2025-03-28 12:27 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
0 siblings, 1 reply; 93+ messages in thread
From: Ashutosh Bapat @ 2025-03-28 06:50 UTC (permalink / raw)
To: Michael Paquier <[email protected]>; +Cc: Alvaro Herrera <[email protected]>; vignesh C <[email protected]>; Daniel Gustafsson <[email protected]>; Tom Lane <[email protected]>; Peter Eisentraut <[email protected]>; PostgreSQL Hackers <[email protected]>
On Fri, Mar 28, 2025 at 7:07 AM Michael Paquier <[email protected]> wrote:
>
> On Thu, Mar 27, 2025 at 06:15:06PM +0100, Alvaro Herrera wrote:
> > BTW another idea to shorten this tests's runtime might be to try and
> > identify which of parallel_schedule tests leave objects behind and
> > create a shorter schedule with only those (a possible implementation
> > might keep a list of the slow tests that don't leave any useful object
> > behind, then filter parallel_schedule to exclude those; this ensures
> > test files created in the future are still used.)
>
> I'm not much a fan of approaches that require an extra schedule,
> because this is prone to forget the addition of objects that we'd want
> to cover for the scope of this thread with the dump/restore
> inter-dependencies, failing our goal of having more coverage. And
> history has proven that we are quite bad at maintaining multiple
> schedules for the regression test suite (remember the serial one or
> the standby one in pg_regress?). So we should really do things so as
> the schedules are down to a strict minimum: 1.
I see Alvaro's point about using a different and minimal schedule. We
already have 002_pg_upgrade and 027_stream_ as candidates which could
use schedules other than default and avoid wasting CPU cycles.
But I also agree with your opinion that maintaining multiple schedules
is painful and prone to errors.
What we could do is to create the schedule files automatically during
build. The automation script will require to know which file to place
in which schedules. That information could be either part of the sql
file itself or could be in a separate text file. For example, every
SQL file has the following line listing all the schedules that this
SQL file should be part of. E.g.
-- schedules: parallel, serial, upgrade
The automated script looks at every .sql file in a given sql directory
and creates the schedule files containing all the SQL files which had
respective schedules mentioned in their "schedule" annotation. The
automation script would flag SQL files that do not have scheduled
annotation so any new file added won't be missed. However, we will
still miss a SQL file if it wasn't part of a given schedule and later
acquired some changes which required it to be added to a new schedule.
If we go this route, we could make 'make check-tests' better. We could
add another annotation for depends listing all the SQL files that a
given SQL file depends upon. make check-tests would collect all
dependencies, sort them and run all the dependencies as well.
Of course that's out of scope for this patch. We don't have time left
for this in PG 18.
>
> If we're worried about the time taken by the test (spoiler: I am and
> the upgrade tests already show always as last to finish in parallel
> runs), I would recommend to put that under a PG_TEST_EXTRA. I'm OK to
> add the switch to my buildfarm animals if this option is the consensus
> and if it gets into the tree.
I would prefer to run this test by default as Alvaro mentioned
previously. But if that means that we won't get this test committed at
all, I am ok putting it under PG_TEST_EXTRA. (Hence I have kept 0001
and 0002 separate.) But I will be disappointed if the test, which has
unearthed four bugs in a year alone, does not get committed to PG 18
because of this debate.
--
Best Wishes,
Ashutosh Bapat
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: Test to dump and restore objects left behind by regression
2025-03-11 10:44 Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 12:05 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-12 15:58 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 16:09 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 06:52 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 08:42 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 12:39 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 12:40 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-19 11:43 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-20 15:06 ` Re: Test to dump and restore objects left behind by regression vignesh C <[email protected]>
2025-03-20 16:39 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-21 13:09 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-21 14:39 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-21 16:03 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-21 18:07 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-24 09:54 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-24 12:14 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-25 10:39 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-27 12:31 ` Re: Test to dump and restore objects left behind by regression vignesh C <[email protected]>
2025-03-27 16:31 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-27 17:15 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-28 01:36 ` Re: Test to dump and restore objects left behind by regression Michael Paquier <[email protected]>
2025-03-28 06:50 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
@ 2025-03-28 12:27 ` Ashutosh Bapat <[email protected]>
2025-03-28 14:11 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
0 siblings, 1 reply; 93+ messages in thread
From: Ashutosh Bapat @ 2025-03-28 12:27 UTC (permalink / raw)
To: Michael Paquier <[email protected]>; +Cc: Alvaro Herrera <[email protected]>; vignesh C <[email protected]>; Daniel Gustafsson <[email protected]>; Tom Lane <[email protected]>; Peter Eisentraut <[email protected]>; PostgreSQL Hackers <[email protected]>
On Fri, Mar 28, 2025 at 12:20 PM Ashutosh Bapat
<[email protected]> wrote:
>
> On Fri, Mar 28, 2025 at 7:07 AM Michael Paquier <[email protected]> wrote:
> >
> > On Thu, Mar 27, 2025 at 06:15:06PM +0100, Alvaro Herrera wrote:
> > > BTW another idea to shorten this tests's runtime might be to try and
> > > identify which of parallel_schedule tests leave objects behind and
> > > create a shorter schedule with only those (a possible implementation
> > > might keep a list of the slow tests that don't leave any useful object
> > > behind, then filter parallel_schedule to exclude those; this ensures
> > > test files created in the future are still used.)
> >
> > I'm not much a fan of approaches that require an extra schedule,
> > because this is prone to forget the addition of objects that we'd want
> > to cover for the scope of this thread with the dump/restore
> > inter-dependencies, failing our goal of having more coverage. And
> > history has proven that we are quite bad at maintaining multiple
> > schedules for the regression test suite (remember the serial one or
> > the standby one in pg_regress?). So we should really do things so as
> > the schedules are down to a strict minimum: 1.
>
> I see Alvaro's point about using a different and minimal schedule. We
> already have 002_pg_upgrade and 027_stream_ as candidates which could
> use schedules other than default and avoid wasting CPU cycles.
> But I also agree with your opinion that maintaining multiple schedules
> is painful and prone to errors.
>
> What we could do is to create the schedule files automatically during
> build. The automation script will require to know which file to place
> in which schedules. That information could be either part of the sql
> file itself or could be in a separate text file. For example, every
> SQL file has the following line listing all the schedules that this
> SQL file should be part of. E.g.
>
> -- schedules: parallel, serial, upgrade
>
> The automated script looks at every .sql file in a given sql directory
> and creates the schedule files containing all the SQL files which had
> respective schedules mentioned in their "schedule" annotation. The
> automation script would flag SQL files that do not have scheduled
> annotation so any new file added won't be missed. However, we will
> still miss a SQL file if it wasn't part of a given schedule and later
> acquired some changes which required it to be added to a new schedule.
>
> If we go this route, we could make 'make check-tests' better. We could
> add another annotation for depends listing all the SQL files that a
> given SQL file depends upon. make check-tests would collect all
> dependencies, sort them and run all the dependencies as well.
>
> Of course that's out of scope for this patch. We don't have time left
> for this in PG 18.
I spent several hours today examining each SQL file to decide whether
or not it has "interesting" objects that it leaves behind for
dump/restore test. I came up with attached schedule - which may not be
accurate since I it would require much more time to examine all tests
to get an accurate schedule. But what I have got may be close enough.
With that we could save about 6 seconds on my laptop. If we further
compact the schedule reorganizing the parallel groups we may shave
some more seconds.
no modifications to parallel schedule
1/1 postgresql:pg_upgrade / pg_upgrade/002_pg_upgrade OK
41.84s 28 subtests passed
1/1 postgresql:pg_upgrade / pg_upgrade/002_pg_upgrade OK
41.80s 28 subtests passed
1/1 postgresql:pg_upgrade / pg_upgrade/002_pg_upgrade OK
41.37s 28 subtests passed
with attached modified parallel schedule
1/1 postgresql:pg_upgrade / pg_upgrade/002_pg_upgrade OK
36.13s 28 subtests passed
1/1 postgresql:pg_upgrade / pg_upgrade/002_pg_upgrade OK
35.86s 28 subtests passed
1/1 postgresql:pg_upgrade / pg_upgrade/002_pg_upgrade OK
36.33s 28 subtests passed
1/1 postgresql:pg_upgrade / pg_upgrade/002_pg_upgrade OK
36.02s 28 subtests passed
However, it's a very painful process to come up with the schedule and
more painful and error prone to maintain it. It could take many days
to come up with the right schedule which can become inaccurate the
moment next SQL file is added OR an existing file is modified to
add/drop "interesting" objects.
--
Best Wishes,
Ashutosh Bapat
Attachments:
[application/octet-stream] parallel_schedule_dump_restore (4.6K, ../../CAExHW5teUDXYR+DyoTP=NJw_=gUy1g=bCmVbKP5+UhRW=Nm0qw@mail.gmail.com/2-parallel_schedule_dump_restore)
download
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: Test to dump and restore objects left behind by regression
2025-03-11 10:44 Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 12:05 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-12 15:58 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 16:09 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 06:52 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 08:42 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 12:39 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 12:40 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-19 11:43 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-20 15:06 ` Re: Test to dump and restore objects left behind by regression vignesh C <[email protected]>
2025-03-20 16:39 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-21 13:09 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-21 14:39 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-21 16:03 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-21 18:07 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-24 09:54 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-24 12:14 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-25 10:39 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-27 12:31 ` Re: Test to dump and restore objects left behind by regression vignesh C <[email protected]>
2025-03-27 16:31 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-27 17:15 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-28 01:36 ` Re: Test to dump and restore objects left behind by regression Michael Paquier <[email protected]>
2025-03-28 06:50 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-28 12:27 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
@ 2025-03-28 14:11 ` Alvaro Herrera <[email protected]>
2025-03-28 14:22 ` Re: Test to dump and restore objects left behind by regression Tom Lane <[email protected]>
0 siblings, 1 reply; 93+ messages in thread
From: Alvaro Herrera @ 2025-03-28 14:11 UTC (permalink / raw)
To: Ashutosh Bapat <[email protected]>; +Cc: Michael Paquier <[email protected]>; vignesh C <[email protected]>; Daniel Gustafsson <[email protected]>; Tom Lane <[email protected]>; Peter Eisentraut <[email protected]>; PostgreSQL Hackers <[email protected]>
On 2025-Mar-28, Ashutosh Bapat wrote:
> However, it's a very painful process to come up with the schedule and
> more painful and error prone to maintain it. It could take many days
> to come up with the right schedule which can become inaccurate the
> moment next SQL file is added OR an existing file is modified to
> add/drop "interesting" objects.
Hmm, I didn't mean that we'd maintain a separate schedule. I meant that
we'd take the existing schedule, then apply some Perl magic to it that
grep-outs the tests that we know to contribute nothing, and generate a
new schedule file dynamically. We don't need to maintain a separate
schedule file.
You're right that if an existing uninteresting test is modified to
create interesting objects, we'd lose coverage of those objects. That
seems a much smaller problem to me. So it's just a matter of doing some
Perl map/grep to generate a new schedule file using the attached
exclusion file.
(For what it's worth, what I did to try to determine which tests to
include, rather than scan each file manually, is to run pg_regress with
"test_setup thetest tablespace", then dump the regression database, and
see if anything is there that's not in the dump when I just with just
"test_setup tablespace". I didn't carry the experiment to completion
though.)
For the future, we could annotate each test as you said, either by
adding a marker on the test file itself, or by adding something next to
its name in the schedule file, so the schedule file could look like:
test: plancache(dump_ignore) limit(stream_ignore) plpgsql copy2
temp(stream_ignore,dump_ignore) domain rangefuncs(stream_ignore)
prepare conversion truncate alter_table
sequence polymorphism rowtypes returning largeobject with xml
... and so on.
--
Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/
# This file lists tests to skip on pg_upgrade/t/002_pg_upgrade.pl
advisory_lock
amutils
async
bitmapops
char
combocid
comments
copy
copy2
copydml
copyencoding
copyselect
database
dbsize
delete
drop_if_exists
drop_operator
equivclass
errors
explain
expressions
functional_deps
groupingsets
guc
hash_func
horology
incremental_sort
infinite_recurse
join_hash
json_encoding
jsonb_jsonpath
jsonpath
jsonpath_encoding
lock
md5
memoize
merge
misc_sanity
mvcc
oidjoins
opr_sanity
partition_aggregate
partition_join
partition_prune
plancache
portals
portals_p2
predicate
prepare
prepared_xacts
psql
psql_crosstab
psql_pipeline
regex
regproc
returning
sanity_check
select
select_distinct
select_distinct_on
select_having
select_implicit
select_parallel
stats_import
strings
subselect
sysviews
tablesample
temp
text
tid
tidrangescan
tidscan
transactions
truncate
tsrf
tstypes
txid
type_sanity
unicode
union
update
vacuum
vacuum_parallel
window
xmlmap
Attachments:
[text/plain] dump_roundtrip_exclude (940B, ../../[email protected]/2-dump_roundtrip_exclude)
download | inline:
# This file lists tests to skip on pg_upgrade/t/002_pg_upgrade.pl
advisory_lock
amutils
async
bitmapops
char
combocid
comments
copy
copy2
copydml
copyencoding
copyselect
database
dbsize
delete
drop_if_exists
drop_operator
equivclass
errors
explain
expressions
functional_deps
groupingsets
guc
hash_func
horology
incremental_sort
infinite_recurse
join_hash
json_encoding
jsonb_jsonpath
jsonpath
jsonpath_encoding
lock
md5
memoize
merge
misc_sanity
mvcc
oidjoins
opr_sanity
partition_aggregate
partition_join
partition_prune
plancache
portals
portals_p2
predicate
prepare
prepared_xacts
psql
psql_crosstab
psql_pipeline
regex
regproc
returning
sanity_check
select
select_distinct
select_distinct_on
select_having
select_implicit
select_parallel
stats_import
strings
subselect
sysviews
tablesample
temp
text
tid
tidrangescan
tidscan
transactions
truncate
tsrf
tstypes
txid
type_sanity
unicode
union
update
vacuum
vacuum_parallel
window
xmlmap
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: Test to dump and restore objects left behind by regression
2025-03-11 10:44 Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 12:05 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-12 15:58 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 16:09 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 06:52 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 08:42 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 12:39 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 12:40 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-19 11:43 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-20 15:06 ` Re: Test to dump and restore objects left behind by regression vignesh C <[email protected]>
2025-03-20 16:39 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-21 13:09 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-21 14:39 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-21 16:03 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-21 18:07 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-24 09:54 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-24 12:14 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-25 10:39 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-27 12:31 ` Re: Test to dump and restore objects left behind by regression vignesh C <[email protected]>
2025-03-27 16:31 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-27 17:15 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-28 01:36 ` Re: Test to dump and restore objects left behind by regression Michael Paquier <[email protected]>
2025-03-28 06:50 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-28 12:27 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-28 14:11 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
@ 2025-03-28 14:22 ` Tom Lane <[email protected]>
2025-03-28 18:12 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
0 siblings, 1 reply; 93+ messages in thread
From: Tom Lane @ 2025-03-28 14:22 UTC (permalink / raw)
To: Alvaro Herrera <[email protected]>; +Cc: Ashutosh Bapat <[email protected]>; Michael Paquier <[email protected]>; vignesh C <[email protected]>; Daniel Gustafsson <[email protected]>; Peter Eisentraut <[email protected]>; PostgreSQL Hackers <[email protected]>
Alvaro Herrera <[email protected]> writes:
> Hmm, I didn't mean that we'd maintain a separate schedule. I meant that
> we'd take the existing schedule, then apply some Perl magic to it that
> grep-outs the tests that we know to contribute nothing, and generate a
> new schedule file dynamically. We don't need to maintain a separate
> schedule file.
This seems like a fundamentally broken approach to me.
The entire argument for using the core regression tests as a source of
data to test dump/restore is that, more or less "for free", we can
expect to get coverage when new SQL language features are added.
That's always been a little bit questionable --- there's a temptation
to drop objects again at the end of a test script. But with this,
it becomes a complete crapshoot whether the objects you need will be
included in the dump.
I think instead of going this direction, we really need to create a
separately-purposed script that simply creates "one of everything"
without doing anything else (except maybe loading a little data).
I believe it'd be a lot easier to remember to add to that when
inventing new SQL than to remember to leave something behind from the
core regression tests. This would also be far faster to run than any
approach that involves picking a random subset of the core test
scripts.
regards, tom lane
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: Test to dump and restore objects left behind by regression
2025-03-11 10:44 Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 12:05 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-12 15:58 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 16:09 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 06:52 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 08:42 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 12:39 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 12:40 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-19 11:43 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-20 15:06 ` Re: Test to dump and restore objects left behind by regression vignesh C <[email protected]>
2025-03-20 16:39 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-21 13:09 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-21 14:39 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-21 16:03 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-21 18:07 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-24 09:54 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-24 12:14 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-25 10:39 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-27 12:31 ` Re: Test to dump and restore objects left behind by regression vignesh C <[email protected]>
2025-03-27 16:31 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-27 17:15 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-28 01:36 ` Re: Test to dump and restore objects left behind by regression Michael Paquier <[email protected]>
2025-03-28 06:50 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-28 12:27 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-28 14:11 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-28 14:22 ` Re: Test to dump and restore objects left behind by regression Tom Lane <[email protected]>
@ 2025-03-28 18:12 ` Alvaro Herrera <[email protected]>
2025-03-31 11:37 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-31 21:17 ` Re: Test to dump and restore objects left behind by regression Daniel Gustafsson <[email protected]>
0 siblings, 2 replies; 93+ messages in thread
From: Alvaro Herrera @ 2025-03-28 18:12 UTC (permalink / raw)
To: Tom Lane <[email protected]>; +Cc: Ashutosh Bapat <[email protected]>; Michael Paquier <[email protected]>; vignesh C <[email protected]>; Daniel Gustafsson <[email protected]>; Peter Eisentraut <[email protected]>; PostgreSQL Hackers <[email protected]>
On 2025-Mar-28, Tom Lane wrote:
> I think instead of going this direction, we really need to create a
> separately-purposed script that simply creates "one of everything"
> without doing anything else (except maybe loading a little data).
> I believe it'd be a lot easier to remember to add to that when
> inventing new SQL than to remember to leave something behind from the
> core regression tests. This would also be far faster to run than any
> approach that involves picking a random subset of the core test
> scripts.
FWIW this sounds closely related to what I tried to do with
src/test/modules/test_ddl_deparse; it's currently incomplete, but maybe
we can use that as a starting point.
--
Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/
"Always assume the user will do much worse than the stupidest thing
you can imagine." (Julien PUYDT)
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: Test to dump and restore objects left behind by regression
2025-03-11 10:44 Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 12:05 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-12 15:58 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 16:09 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 06:52 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 08:42 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 12:39 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 12:40 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-19 11:43 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-20 15:06 ` Re: Test to dump and restore objects left behind by regression vignesh C <[email protected]>
2025-03-20 16:39 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-21 13:09 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-21 14:39 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-21 16:03 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-21 18:07 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-24 09:54 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-24 12:14 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-25 10:39 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-27 12:31 ` Re: Test to dump and restore objects left behind by regression vignesh C <[email protected]>
2025-03-27 16:31 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-27 17:15 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-28 01:36 ` Re: Test to dump and restore objects left behind by regression Michael Paquier <[email protected]>
2025-03-28 06:50 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-28 12:27 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-28 14:11 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-28 14:22 ` Re: Test to dump and restore objects left behind by regression Tom Lane <[email protected]>
2025-03-28 18:12 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
@ 2025-03-31 11:37 ` Ashutosh Bapat <[email protected]>
2025-03-31 11:54 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
1 sibling, 1 reply; 93+ messages in thread
From: Ashutosh Bapat @ 2025-03-31 11:37 UTC (permalink / raw)
To: Alvaro Herrera <[email protected]>; +Cc: Tom Lane <[email protected]>; Michael Paquier <[email protected]>; vignesh C <[email protected]>; Daniel Gustafsson <[email protected]>; Peter Eisentraut <[email protected]>; PostgreSQL Hackers <[email protected]>
On Fri, Mar 28, 2025 at 11:43 PM Alvaro Herrera <[email protected]> wrote:
>
> On 2025-Mar-28, Tom Lane wrote:
>
> > I think instead of going this direction, we really need to create a
> > separately-purposed script that simply creates "one of everything"
> > without doing anything else (except maybe loading a little data).
> > I believe it'd be a lot easier to remember to add to that when
> > inventing new SQL than to remember to leave something behind from the
> > core regression tests. This would also be far faster to run than any
> > approach that involves picking a random subset of the core test
> > scripts.
It's easier to remember to do something or not do something in the
same file than in some other file. I find it hard to believe that
introducing another set of SQL files somewhere far from regress would
make this problem easier.
The number of states in which objects can be left behind in the
regress/sql is very large - and maintaining that 1:1 in some other set
of scripts is impossible unless it's automated.
> FWIW this sounds closely related to what I tried to do with
> src/test/modules/test_ddl_deparse; it's currently incomplete, but maybe
> we can use that as a starting point.
create_table.sql in test_ddl_deparse has only one statement creating
an inheritance table whereas there are dozens of different states of
parent/child tables created by regress. It will require a lot of work
to bridge the gap between regress_ddl_deparse and regress and more
work to maintain it.
I might be missing something in your ideas.
IMO, whatever we do it should rely on a single set of files. One
possible way could be to break the existing files into three files
each, containing DDL, DML and queries from those files respectively
and create three schedules DDL, DML and queries containing the
respective files. These schedules will be run as required. Standard
regression run runs all the three schedules one by one. But
002_pg_upgrade will run DDL and DML on the source database and run
queries on target - thus checking sanity of the dump/restore or
pg_upgrade beyond just the dump comparison. 027_stream_regress might
run DDL, DML on the source server and queries on the target.
But that too is easier said than done for:
1. Our tests mix all three kinds of statements and also rely on the
order in which they are run. It will require some significant effort
to carefully separate the statements.
2. With the new set of files backpatching would become hard.
--
Best Wishes,
Ashutosh Bapat
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: Test to dump and restore objects left behind by regression
2025-03-11 10:44 Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 12:05 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-12 15:58 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 16:09 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 06:52 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 08:42 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 12:39 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 12:40 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-19 11:43 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-20 15:06 ` Re: Test to dump and restore objects left behind by regression vignesh C <[email protected]>
2025-03-20 16:39 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-21 13:09 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-21 14:39 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-21 16:03 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-21 18:07 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-24 09:54 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-24 12:14 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-25 10:39 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-27 12:31 ` Re: Test to dump and restore objects left behind by regression vignesh C <[email protected]>
2025-03-27 16:31 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-27 17:15 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-28 01:36 ` Re: Test to dump and restore objects left behind by regression Michael Paquier <[email protected]>
2025-03-28 06:50 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-28 12:27 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-28 14:11 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-28 14:22 ` Re: Test to dump and restore objects left behind by regression Tom Lane <[email protected]>
2025-03-28 18:12 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-31 11:37 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
@ 2025-03-31 11:54 ` Ashutosh Bapat <[email protected]>
0 siblings, 0 replies; 93+ messages in thread
From: Ashutosh Bapat @ 2025-03-31 11:54 UTC (permalink / raw)
To: Alvaro Herrera <[email protected]>; +Cc: Tom Lane <[email protected]>; Michael Paquier <[email protected]>; vignesh C <[email protected]>; Daniel Gustafsson <[email protected]>; Peter Eisentraut <[email protected]>; PostgreSQL Hackers <[email protected]>
On Mon, Mar 31, 2025 at 5:07 PM Ashutosh Bapat
<[email protected]> wrote:
>
The bug related to materialized views has been fixed and now the test
passes even if we compare statistics from dumped and restored
databases. Hence removing 0003. In the attached patchset I have also
addressed Vignesh's below comment
On Thu, Mar 27, 2025 at 10:01 PM Ashutosh Bapat
<[email protected]> wrote:
>
> On Thu, Mar 27, 2025 at 6:01 PM vignesh C <[email protected]> wrote:
> >
> > 2) Should "`" be ' or " here, we generally use "`" to enclose commands:
> > +# It is expected that regression tests, which create `regression` database, are
> > +# run on `src_node`, which in turn, is left in running state. A fresh node is
> > +# created using given `node_params`, which are expected to be the
> > same ones used
> > +# to create `src_node`, so as to avoid any differences in the databases.
>
> Looking at prologues or some other functions, I see that we don't add
> any decoration around the name of the argument. Hence dropped ``
> altogether. Will post it with the next set of patches.
--
Best Wishes,
Ashutosh Bapat
Attachments:
[text/x-patch] 0002-Use-only-one-format-and-make-the-test-run-d-20250331.patch (5.4K, ../../CAExHW5vVFtCejh+UYzNxMGSXOfJ_1xwi5aQHQfemqJgFmkyK5Q@mail.gmail.com/2-0002-Use-only-one-format-and-make-the-test-run-d-20250331.patch)
download | inline diff:
From 5ef4a15bf229d104028eac3a046636453e1e05fc Mon Sep 17 00:00:00 2001
From: Ashutosh Bapat <[email protected]>
Date: Mon, 24 Mar 2025 11:21:12 +0530
Subject: [PATCH 2/2] Use only one format and make the test run default
According to Alvaro (and I agree with him), the test should be run by
default. Otherwise we get to know about a bug only after buildfarm
animal where it's enabled reports a failure. Further testing only one
format may suffice; since all the formats have shown the same bugs till
now.
If we use --directory format we can use -j which reduces the time taken
by dump/restore test by about 12%.
This patch removes PG_TEST_EXTRA option as well as runs the test only in
directory format with parallelism enabled.
Note for committer: If we decide to accept this change, it should be
merged with the previous commit.
---
doc/src/sgml/regress.sgml | 12 ----
src/bin/pg_upgrade/t/002_pg_upgrade.pl | 76 +++++++++-----------------
2 files changed, 25 insertions(+), 63 deletions(-)
diff --git a/doc/src/sgml/regress.sgml b/doc/src/sgml/regress.sgml
index 237b974b3ab..0e5e8e8f309 100644
--- a/doc/src/sgml/regress.sgml
+++ b/doc/src/sgml/regress.sgml
@@ -357,18 +357,6 @@ make check-world PG_TEST_EXTRA='kerberos ldap ssl load_balance libpq_encryption'
</para>
</listitem>
</varlistentry>
-
- <varlistentry>
- <term><literal>regress_dump_test</literal></term>
- <listitem>
- <para>
- When enabled, <filename>src/bin/pg_upgrade/t/002_pg_upgrade.pl</filename>
- tests dump and restore of regression database left behind by the
- regression run. Not enabled by default because it is time and resource
- consuming.
- </para>
- </listitem>
- </varlistentry>
</variablelist>
Tests for features that are not supported by the current build
diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl
index 8d22d538529..f7d5b96ecd2 100644
--- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl
+++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl
@@ -268,16 +268,9 @@ else
# should be done in a separate TAP test, but doing it here saves us one full
# regression run.
#
- # This step takes several extra seconds and some extra disk space, so
- # requires an opt-in with the PG_TEST_EXTRA environment variable.
- #
# Do this while the old cluster is running before it is shut down by the
# upgrade test.
- if ( $ENV{PG_TEST_EXTRA}
- && $ENV{PG_TEST_EXTRA} =~ /\bregress_dump_test\b/)
- {
- test_regression_dump_restore($oldnode, %node_params);
- }
+ test_regression_dump_restore($oldnode, %node_params);
}
# Initialize a new node for the upgrade.
@@ -590,53 +583,34 @@ sub test_regression_dump_restore
$dst_node->append_conf('postgresql.conf', 'autovacuum = off');
$dst_node->start;
- # Test all formats one by one.
- for my $format ('plain', 'tar', 'directory', 'custom')
- {
- my $dump_file = "$tempdir/regression_dump.$format";
- my $restored_db = 'regression_' . $format;
-
- # Use --create in dump and restore commands so that the restored
- # database has the same configurable variable settings as the original
- # database and the plain dumps taken for comparsion do not differ
- # because of locale changes. Additionally this provides test coverage
- # for --create option.
- $src_node->command_ok(
- [
- 'pg_dump', "-F$format", '--no-sync',
- '-d', $src_node->connstr('regression'),
- '--create', '-f', $dump_file
- ],
- "pg_dump on source instance in $format format");
+ my $dump_file = "$tempdir/regression.dump";
- my @restore_command;
- if ($format eq 'plain')
- {
- # Restore dump in "plain" format using `psql`.
- @restore_command = [ 'psql', '-d', 'postgres', '-f', $dump_file ];
- }
- else
- {
- @restore_command = [
- 'pg_restore', '--create',
- '-d', 'postgres', $dump_file
- ];
- }
- $dst_node->command_ok(@restore_command,
- "restored dump taken in $format format on destination instance");
+ # Use --create in dump and restore commands so that the restored database
+ # has the same configurable variable settings as the original database so
+ # that the plain dumps taken from both the database taken for comparisong do
+ # not differ because of locale changes. Additionally this provides test
+ # coverage for --create option.
+ #
+ # We use directory format which allows dumping and restoring in parallel to
+ # reduce the test's run time.
+ $src_node->command_ok(
+ [
+ 'pg_dump', '-Fd', '-j2', '--no-sync',
+ '-d', $src_node->connstr('regression'),
+ '--create', '-f', $dump_file
+ ],
+ "pg_dump on source instance succeeded");
- my $dst_dump =
- get_dump_for_comparison($dst_node, 'regression',
- 'dest_dump.' . $format, 0);
+ $dst_node->command_ok(
+ [ 'pg_restore', '--create', '-j2', '-d', 'postgres', $dump_file ],
+ "restored dump to destination instance");
- compare_files($src_dump, $dst_dump,
- "dump outputs from original and restored regression database (using $format format) match"
- );
+ my $dst_dump = get_dump_for_comparison($dst_node, 'regression',
+ 'dest_dump', 0);
- # Rename the restored database so that it is available for debugging in
- # case the test fails.
- $dst_node->safe_psql('postgres', "ALTER DATABASE regression RENAME TO $restored_db");
- }
+ compare_files($src_dump, $dst_dump,
+ "dump outputs from original and restored regression database match"
+ );
}
# Dump database db from the given node in plain format and adjust it for
--
2.34.1
[text/x-patch] 0001-Test-pg_dump-restore-of-regression-objects-20250331.patch (16.5K, ../../CAExHW5vVFtCejh+UYzNxMGSXOfJ_1xwi5aQHQfemqJgFmkyK5Q@mail.gmail.com/3-0001-Test-pg_dump-restore-of-regression-objects-20250331.patch)
download | inline diff:
From aa1c74951b3b557de8330230185fd5f2ee46ecda Mon Sep 17 00:00:00 2001
From: Ashutosh Bapat <[email protected]>
Date: Thu, 27 Jun 2024 10:03:53 +0530
Subject: [PATCH 1/2] Test pg_dump/restore of regression objects
002_pg_upgrade.pl tests pg_upgrade of the regression database left
behind by regression run. Modify it to test dump and restore of the
regression database as well.
Regression database created by regression run contains almost all the
database objects supported by PostgreSQL in various states. Hence the
new testcase covers dump and restore scenarios not covered by individual
dump/restore cases. Till now 002_pg_upgrade only tested dump/restore
through pg_upgrade which only uses binary mode. Many regression tests
mention that they leave objects behind for dump/restore testing but they
are not tested in a non-binary mode. The new testcase closes that
gap.
Testing dump and restore of regression database makes this test run
longer for a relatively smaller benefit. Hence run it only when
explicitly requested by user by specifying "regress_dump_test" in
PG_TEST_EXTRA.
Note For the reviewers:
The new test has uncovered many bugs so far in one year.
1. Introduced by 14e87ffa5c54. Fixed in fd41ba93e4630921a72ed5127cd0d552a8f3f8fc.
2. Introduced by 0413a556990ba628a3de8a0b58be020fd9a14ed0. Reverted in 74563f6b90216180fc13649725179fc119dddeb5.
3. Fixed by d611f8b1587b8f30caa7c0da99ae5d28e914d54f
3. Being discussed on hackers at https://www.postgresql.org/message-id/CAExHW5s47kmubpbbRJzSM-Zfe0Tj2O3GBagB7YAyE8rQ-V24Uw@mail.gmail.com
Author: Ashutosh Bapat
Reviewed by: Michael Pacquire, Daniel Gustafsson, Tom Lane, Alvaro Herrera
Discussion: https://www.postgresql.org/message-id/CAExHW5uF5V=Cjecx3_Z=7xfh4rg2Wf61PT+hfquzjBqouRzQJQ@mail.gmail.com
---
doc/src/sgml/regress.sgml | 12 ++
src/bin/pg_upgrade/t/002_pg_upgrade.pl | 144 ++++++++++++++++-
src/test/perl/Makefile | 2 +
src/test/perl/PostgreSQL/Test/AdjustDump.pm | 167 ++++++++++++++++++++
src/test/perl/meson.build | 1 +
5 files changed, 324 insertions(+), 2 deletions(-)
create mode 100644 src/test/perl/PostgreSQL/Test/AdjustDump.pm
diff --git a/doc/src/sgml/regress.sgml b/doc/src/sgml/regress.sgml
index 0e5e8e8f309..237b974b3ab 100644
--- a/doc/src/sgml/regress.sgml
+++ b/doc/src/sgml/regress.sgml
@@ -357,6 +357,18 @@ make check-world PG_TEST_EXTRA='kerberos ldap ssl load_balance libpq_encryption'
</para>
</listitem>
</varlistentry>
+
+ <varlistentry>
+ <term><literal>regress_dump_test</literal></term>
+ <listitem>
+ <para>
+ When enabled, <filename>src/bin/pg_upgrade/t/002_pg_upgrade.pl</filename>
+ tests dump and restore of regression database left behind by the
+ regression run. Not enabled by default because it is time and resource
+ consuming.
+ </para>
+ </listitem>
+ </varlistentry>
</variablelist>
Tests for features that are not supported by the current build
diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl
index 00051b85035..8d22d538529 100644
--- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl
+++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl
@@ -12,6 +12,7 @@ use File::Path qw(rmtree);
use PostgreSQL::Test::Cluster;
use PostgreSQL::Test::Utils;
use PostgreSQL::Test::AdjustUpgrade;
+use PostgreSQL::Test::AdjustDump;
use Test::More;
# Can be changed to test the other modes.
@@ -35,8 +36,8 @@ sub generate_db
"created database with ASCII characters from $from_char to $to_char");
}
-# Filter the contents of a dump before its use in a content comparison.
-# This returns the path to the filtered dump.
+# Filter the contents of a dump before its use in a content comparison for
+# upgrade testing. This returns the path to the filtered dump.
sub filter_dump
{
my ($is_old, $old_version, $dump_file) = @_;
@@ -262,6 +263,21 @@ else
}
}
is($rc, 0, 'regression tests pass');
+
+ # Test dump/restore of the objects left behind by regression. Ideally it
+ # should be done in a separate TAP test, but doing it here saves us one full
+ # regression run.
+ #
+ # This step takes several extra seconds and some extra disk space, so
+ # requires an opt-in with the PG_TEST_EXTRA environment variable.
+ #
+ # Do this while the old cluster is running before it is shut down by the
+ # upgrade test.
+ if ( $ENV{PG_TEST_EXTRA}
+ && $ENV{PG_TEST_EXTRA} =~ /\bregress_dump_test\b/)
+ {
+ test_regression_dump_restore($oldnode, %node_params);
+ }
}
# Initialize a new node for the upgrade.
@@ -539,4 +555,128 @@ my $dump2_filtered = filter_dump(0, $oldnode->pg_version, $dump2_file);
compare_files($dump1_filtered, $dump2_filtered,
'old and new dumps match after pg_upgrade');
+# Test dump and restore of objects left behind by the regression run.
+#
+# It is expected that regression tests, which create 'regression' database, are
+# run on src_node, which in turn, is left in running state. A fresh node is
+# created using given node_params, which are expected to be the same ones use
+# to create src_node, so as to avoid any differences in the databases.
+#
+# Plain dumps from both the nodes are compared to make sure that all the dumped
+# objects are restored faithfully.
+sub test_regression_dump_restore
+{
+ my ($src_node, %node_params) = @_;
+ my $dst_node = PostgreSQL::Test::Cluster->new('dst_node');
+
+ # Make sure that the source and destination nodes have the same version and
+ # do not use custom install paths. In both the cases, the dump files may
+ # require additional adjustments unknown to code here. Do not run this test
+ # in such a case to avoid utilizing the time and resources unnecessarily.
+ if ($src_node->pg_version != $dst_node->pg_version
+ or defined $src_node->{_install_path})
+ {
+ fail("same version dump and restore test using default installation");
+ return;
+ }
+
+ # Dump the original database for comparison later.
+ my $src_dump =
+ get_dump_for_comparison($src_node, 'regression', 'src_dump', 1);
+
+ # Setup destination database cluster
+ $dst_node->init(%node_params);
+ # Stabilize stats for comparison.
+ $dst_node->append_conf('postgresql.conf', 'autovacuum = off');
+ $dst_node->start;
+
+ # Test all formats one by one.
+ for my $format ('plain', 'tar', 'directory', 'custom')
+ {
+ my $dump_file = "$tempdir/regression_dump.$format";
+ my $restored_db = 'regression_' . $format;
+
+ # Use --create in dump and restore commands so that the restored
+ # database has the same configurable variable settings as the original
+ # database and the plain dumps taken for comparsion do not differ
+ # because of locale changes. Additionally this provides test coverage
+ # for --create option.
+ $src_node->command_ok(
+ [
+ 'pg_dump', "-F$format", '--no-sync',
+ '-d', $src_node->connstr('regression'),
+ '--create', '-f', $dump_file
+ ],
+ "pg_dump on source instance in $format format");
+
+ my @restore_command;
+ if ($format eq 'plain')
+ {
+ # Restore dump in "plain" format using `psql`.
+ @restore_command = [ 'psql', '-d', 'postgres', '-f', $dump_file ];
+ }
+ else
+ {
+ @restore_command = [
+ 'pg_restore', '--create',
+ '-d', 'postgres', $dump_file
+ ];
+ }
+ $dst_node->command_ok(@restore_command,
+ "restored dump taken in $format format on destination instance");
+
+ my $dst_dump =
+ get_dump_for_comparison($dst_node, 'regression',
+ 'dest_dump.' . $format, 0);
+
+ compare_files($src_dump, $dst_dump,
+ "dump outputs from original and restored regression database (using $format format) match"
+ );
+
+ # Rename the restored database so that it is available for debugging in
+ # case the test fails.
+ $dst_node->safe_psql('postgres', "ALTER DATABASE regression RENAME TO $restored_db");
+ }
+}
+
+# Dump database db from the given node in plain format and adjust it for
+# comparing dumps from the original and the restored database.
+#
+# file_prefix is used to create unique names for all dump files so that they
+# remain available for debugging in case the test fails.
+#
+# adjust_child_columns is passed to adjust_regress_dumpfile() which actually
+# adjusts the dump output.
+#
+# The name of the file containting adjusted dump is returned.
+sub get_dump_for_comparison
+{
+ my ($node, $db, $file_prefix, $adjust_child_columns) = @_;
+
+ my $dumpfile = $tempdir . '/' . $file_prefix . '.sql';
+ my $dump_adjusted = "${dumpfile}_adjusted";
+
+ # Usually we avoid comparing statistics in our tests since it is flaky by
+ # nature. However, if statistics is dumped and restored it is expected to be
+ # restored as it is i.e. the statistics from the original database and that
+ # from the restored database should match. We turn off autovacuum on the
+ # source and the target database to avoid any statistics update during
+ # restore operation. Hence we do not exclude statistics from dump.
+ $node->command_ok(
+ [
+ 'pg_dump', '--no-sync', '-d', $node->connstr($db), '-f',
+ $dumpfile
+ ],
+ 'dump for comparison succeeded');
+
+ open(my $dh, '>', $dump_adjusted)
+ || die
+ "could not open $dump_adjusted for writing the adjusted dump: $!";
+ print $dh adjust_regress_dumpfile(slurp_file($dumpfile),
+ $adjust_child_columns);
+ close($dh);
+
+ return $dump_adjusted;
+}
+
done_testing();
diff --git a/src/test/perl/Makefile b/src/test/perl/Makefile
index d82fb67540e..def89650ead 100644
--- a/src/test/perl/Makefile
+++ b/src/test/perl/Makefile
@@ -26,6 +26,7 @@ install: all installdirs
$(INSTALL_DATA) $(srcdir)/PostgreSQL/Test/Cluster.pm '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/Cluster.pm'
$(INSTALL_DATA) $(srcdir)/PostgreSQL/Test/BackgroundPsql.pm '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/BackgroundPsql.pm'
$(INSTALL_DATA) $(srcdir)/PostgreSQL/Test/AdjustUpgrade.pm '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/AdjustUpgrade.pm'
+ $(INSTALL_DATA) $(srcdir)/PostgreSQL/Test/AdjustDump.pm '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/AdjustDump.pm'
$(INSTALL_DATA) $(srcdir)/PostgreSQL/Version.pm '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Version.pm'
uninstall:
@@ -36,6 +37,7 @@ uninstall:
rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/Cluster.pm'
rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/BackgroundPsql.pm'
rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/AdjustUpgrade.pm'
+ rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Test/AdjustDump.pm'
rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/PostgreSQL/Version.pm'
endif
diff --git a/src/test/perl/PostgreSQL/Test/AdjustDump.pm b/src/test/perl/PostgreSQL/Test/AdjustDump.pm
new file mode 100644
index 00000000000..74b9a60cf34
--- /dev/null
+++ b/src/test/perl/PostgreSQL/Test/AdjustDump.pm
@@ -0,0 +1,167 @@
+
+# Copyright (c) 2024-2025, PostgreSQL Global Development Group
+
+=pod
+
+=head1 NAME
+
+PostgreSQL::Test::AdjustDump - helper module for dump and restore tests
+
+=head1 SYNOPSIS
+
+ use PostgreSQL::Test::AdjustDump;
+
+ # Adjust contents of dump output file so that dump output from original
+ # regression database and that from the restored regression database match
+ $dump = adjust_regress_dumpfile($dump, $adjust_child_columns);
+
+=head1 DESCRIPTION
+
+C<PostgreSQL::Test::AdjustDump> encapsulates various hacks needed to
+compare the results of dump and restore tests
+
+=cut
+
+package PostgreSQL::Test::AdjustDump;
+
+use strict;
+use warnings FATAL => 'all';
+
+use Exporter 'import';
+use Test::More;
+
+our @EXPORT = qw(
+ adjust_regress_dumpfile
+);
+
+=pod
+
+=head1 ROUTINES
+
+=over
+
+=item $dump = adjust_regress_dumpfile($dump, $adjust_child_columns)
+
+If we take dump of the regression database left behind after running regression
+tests, restore the dump, and take dump of the restored regression database, the
+outputs of both the dumps differ in the following cases. This routine adjusts
+the given dump so that dump outputs from the original and restored database,
+respectively, match.
+
+Case 1: Some regression tests purposefully create child tables in such a way
+that the order of their inherited columns differ from column orders of their
+respective parents. In the restored database, however, the order of their
+inherited columns are same as that of their respective parents. Thus the column
+orders of these child tables in the original database and those in the restored
+database differ, causing difference in the dump outputs. See MergeAttributes()
+and dumpTableSchema() for details. This routine rearranges the column
+declarations in the relevant C<CREATE TABLE... INHERITS> statements in the dump
+file from original database to match those from the restored database. We could,
+instead, adjust the statements in the dump from the restored database to match
+those from original database or adjust both to a canonical order. But we have
+chosen to adjust the statements in the dump from original database for no
+particular reason.
+
+Case 2: When dumping COPY statements the columns are ordered by their attribute
+number by fmtCopyColumnList(). If a column is added to a parent table after a
+child has inherited the parent and the child has its own columns, the attribute
+number of the column changes after restoring the child table. This is because
+when executing the dumped C<CREATE TABLE... INHERITS> statement all the parent
+attributes are created before any child attributes. Thus the order of columns in
+COPY statements dumped from the original and the restored databases,
+respectively, differs. Such tables in regression tests are listed below. It is
+hard to adjust the column order in the COPY statement along with the data. Hence
+we just remove such COPY statements from the dump output.
+
+Additionally the routine adjusts blank and new lines to avoid noise.
+
+Note: Usually we avoid comparing statistics in our tests since it is flaky by
+nature. However, if statistics is dumped and restored it is expected to be
+restored as it is i.e. the statistics from the original database and that from
+the restored database should match. Hence we do not filter statistics from dump,
+if it's dumped.
+
+Arguments:
+
+=over
+
+=item C<dump>: Contents of dump file
+
+=item C<adjust_child_columns>: 1 indicates that the given dump file requires
+adjusting columns in the child tables; usually when the dump is from original
+database. 0 indicates no such adjustment is needed; usually when the dump is
+from restored database.
+
+=back
+
+Returns the adjusted dump text.
+
+=cut
+
+sub adjust_regress_dumpfile
+{
+ my ($dump, $adjust_child_columns) = @_;
+
+ # use Unix newlines
+ $dump =~ s/\r\n/\n/g;
+
+ # Adjust the CREATE TABLE ... INHERITS statements.
+ if ($adjust_child_columns)
+ {
+ my $saved_dump = $dump;
+
+ $dump =~ s/(^CREATE\sTABLE\sgenerated_stored_tests\.gtestxx_4\s\()
+ (\n\s+b\sinteger),
+ (\n\s+a\sinteger\sNOT\sNULL)/$1$3,$2/mgx;
+ ok($saved_dump ne $dump,
+ 'applied generated_stored_tests.gtestxx_4 adjustments');
+
+ $saved_dump = $dump;
+ $dump =~ s/(^CREATE\sTABLE\sgenerated_virtual_tests\.gtestxx_4\s\()
+ (\n\s+b\sinteger),
+ (\n\s+a\sinteger\sNOT\sNULL)/$1$3,$2/mgx;
+ ok($saved_dump ne $dump,
+ 'applied generated_virtual_tests.gtestxx_4 adjustments');
+
+ $saved_dump = $dump;
+ $dump =~ s/(^CREATE\sTABLE\spublic\.test_type_diff2_c1\s\()
+ (\n\s+int_four\sbigint),
+ (\n\s+int_eight\sbigint),
+ (\n\s+int_two\ssmallint)/$1$4,$2,$3/mgx;
+ ok($saved_dump ne $dump,
+ 'applied public.test_type_diff2_c1 adjustments');
+
+ $saved_dump = $dump;
+ $dump =~ s/(^CREATE\sTABLE\spublic\.test_type_diff2_c2\s\()
+ (\n\s+int_eight\sbigint),
+ (\n\s+int_two\ssmallint),
+ (\n\s+int_four\sbigint)/$1$3,$4,$2/mgx;
+ ok($saved_dump ne $dump,
+ 'applied public.test_type_diff2_c2 adjustments');
+ }
+
+ # Remove COPY statements with differing column order
+ for my $table (
+ 'public\.b_star', 'public\.c_star',
+ 'public\.cc2', 'public\.d_star',
+ 'public\.e_star', 'public\.f_star',
+ 'public\.renamecolumnanother', 'public\.renamecolumnchild',
+ 'public\.test_type_diff2_c1', 'public\.test_type_diff2_c2',
+ 'public\.test_type_diff_c')
+ {
+ $dump =~ s/^COPY\s$table\s\(.+?^\\\.$//sm;
+ }
+
+ # Suppress blank lines, as some places in pg_dump emit more or fewer.
+ $dump =~ s/\n\n+/\n/g;
+
+ return $dump;
+}
+
+=pod
+
+=back
+
+=cut
+
+1;
diff --git a/src/test/perl/meson.build b/src/test/perl/meson.build
index 58e30f15f9d..492ca571ff8 100644
--- a/src/test/perl/meson.build
+++ b/src/test/perl/meson.build
@@ -14,4 +14,5 @@ install_data(
'PostgreSQL/Test/Cluster.pm',
'PostgreSQL/Test/BackgroundPsql.pm',
'PostgreSQL/Test/AdjustUpgrade.pm',
+ 'PostgreSQL/Test/AdjustDump.pm',
install_dir: dir_pgxs / 'src/test/perl/PostgreSQL/Test')
base-commit: e2809e3a1015697832ee4d37b75ba1cd0caac0f0
--
2.34.1
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: Test to dump and restore objects left behind by regression
2025-03-11 10:44 Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 12:05 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-12 15:58 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 16:09 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 06:52 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 08:42 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 12:39 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 12:40 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-19 11:43 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-20 15:06 ` Re: Test to dump and restore objects left behind by regression vignesh C <[email protected]>
2025-03-20 16:39 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-21 13:09 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-21 14:39 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-21 16:03 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-21 18:07 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-24 09:54 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-24 12:14 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-25 10:39 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-27 12:31 ` Re: Test to dump and restore objects left behind by regression vignesh C <[email protected]>
2025-03-27 16:31 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-27 17:15 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-28 01:36 ` Re: Test to dump and restore objects left behind by regression Michael Paquier <[email protected]>
2025-03-28 06:50 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-28 12:27 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-28 14:11 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-28 14:22 ` Re: Test to dump and restore objects left behind by regression Tom Lane <[email protected]>
2025-03-28 18:12 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
@ 2025-03-31 21:17 ` Daniel Gustafsson <[email protected]>
1 sibling, 0 replies; 93+ messages in thread
From: Daniel Gustafsson @ 2025-03-31 21:17 UTC (permalink / raw)
To: Alvaro Herrera <[email protected]>; +Cc: Tom Lane <[email protected]>; Ashutosh Bapat <[email protected]>; Michael Paquier <[email protected]>; vignesh C <[email protected]>; Peter Eisentraut <[email protected]>; PostgreSQL Hackers <[email protected]>
> On 28 Mar 2025, at 19:12, Alvaro Herrera <[email protected]> wrote:
>
> On 2025-Mar-28, Tom Lane wrote:
>
>> I think instead of going this direction, we really need to create a
>> separately-purposed script that simply creates "one of everything"
>> without doing anything else (except maybe loading a little data).
>> I believe it'd be a lot easier to remember to add to that when
>> inventing new SQL than to remember to leave something behind from the
>> core regression tests. This would also be far faster to run than any
>> approach that involves picking a random subset of the core test
>> scripts.
>
> FWIW this sounds closely related to what I tried to do with
> src/test/modules/test_ddl_deparse; it's currently incomplete, but maybe
> we can use that as a starting point.
Given where we are in the cycle, it seems to make sense to stick to using the
schedule we already have rather than invent a new process for generating it,
and work on that for 19?
--
Daniel Gustafsson
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: Test to dump and restore objects left behind by regression
2025-03-11 10:44 Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 12:05 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-12 15:58 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 16:09 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 06:52 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 08:42 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 12:39 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 12:40 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-19 11:43 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-20 15:06 ` Re: Test to dump and restore objects left behind by regression vignesh C <[email protected]>
2025-03-20 16:39 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-21 13:09 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-21 14:39 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-21 16:03 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-21 18:07 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-24 09:54 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-24 12:14 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-25 10:39 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-27 12:31 ` Re: Test to dump and restore objects left behind by regression vignesh C <[email protected]>
2025-03-27 16:31 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-27 17:15 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
@ 2025-03-28 06:32 ` Ashutosh Bapat <[email protected]>
2025-03-28 09:28 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-28 10:35 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
1 sibling, 2 replies; 93+ messages in thread
From: Ashutosh Bapat @ 2025-03-28 06:32 UTC (permalink / raw)
To: Alvaro Herrera <[email protected]>; +Cc: vignesh C <[email protected]>; Michael Paquier <[email protected]>; Daniel Gustafsson <[email protected]>; Tom Lane <[email protected]>; Peter Eisentraut <[email protected]>; PostgreSQL Hackers <[email protected]>
On Thu, Mar 27, 2025 at 10:45 PM Alvaro Herrera <[email protected]> wrote:
>
> On 2025-Mar-27, Ashutosh Bapat wrote:
>
> > On Thu, Mar 27, 2025 at 6:01 PM vignesh C <[email protected]> wrote:
>
> > > Couple of minor thoughts:
> > > 1) I felt this error message is not conveying the error message correctly:
> > > + if ($src_node->pg_version != $dst_node->pg_version
> > > + or defined $src_node->{_install_path})
> > > + {
> > > + fail("same version dump and restore test using default
> > > installation");
> > > + return;
> > > + }
> > >
> > > how about something like below:
> > > fail("source and destination nodes must have the same PostgreSQL
> > > version and default installation paths");
> >
> > The text in ok(), fail() etc. are test names and not error messages.
> > See [1]. Your suggestion and other versions that I came up with became
> > too verbose to be test names. So I think the text here is compromise
> > between conveying enough information and not being too long. We
> > usually have to pick the testname and lookup the test code to
> > investigate the failure. This text serves that purpose.
>
> Maybe
> fail("roundtrip dump/restore of the regression database")
No, that's losing some information like default installation and the
same version.
--
Best Wishes,
Ashutosh Bapat
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: Test to dump and restore objects left behind by regression
2025-03-11 10:44 Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 12:05 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-12 15:58 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 16:09 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 06:52 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 08:42 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 12:39 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 12:40 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-19 11:43 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-20 15:06 ` Re: Test to dump and restore objects left behind by regression vignesh C <[email protected]>
2025-03-20 16:39 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-21 13:09 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-21 14:39 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-21 16:03 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-21 18:07 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-24 09:54 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-24 12:14 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-25 10:39 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-27 12:31 ` Re: Test to dump and restore objects left behind by regression vignesh C <[email protected]>
2025-03-27 16:31 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-27 17:15 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-28 06:32 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
@ 2025-03-28 09:28 ` Ashutosh Bapat <[email protected]>
1 sibling, 0 replies; 93+ messages in thread
From: Ashutosh Bapat @ 2025-03-28 09:28 UTC (permalink / raw)
To: Alvaro Herrera <[email protected]>; +Cc: vignesh C <[email protected]>; Michael Paquier <[email protected]>; Daniel Gustafsson <[email protected]>; Tom Lane <[email protected]>; Peter Eisentraut <[email protected]>; PostgreSQL Hackers <[email protected]>
Vignesh and Alvaro
On Fri, Mar 28, 2025 at 12:02 PM Ashutosh Bapat
<[email protected]> wrote:
> >
> > Maybe
> > fail("roundtrip dump/restore of the regression database")
>
> No, that's losing some information like default installation and the
> same version.
How about "dump and restore across servers with same PostgreSQL
version using default installation". That's still mouthful but is more
readable.
--
Best Wishes,
Ashutosh Bapat
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: Test to dump and restore objects left behind by regression
2025-03-11 10:44 Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 12:05 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-12 15:58 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 16:09 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 06:52 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 08:42 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 12:39 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 12:40 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-19 11:43 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-20 15:06 ` Re: Test to dump and restore objects left behind by regression vignesh C <[email protected]>
2025-03-20 16:39 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-21 13:09 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-21 14:39 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-21 16:03 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-21 18:07 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-24 09:54 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-24 12:14 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-25 10:39 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-27 12:31 ` Re: Test to dump and restore objects left behind by regression vignesh C <[email protected]>
2025-03-27 16:31 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-27 17:15 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-28 06:32 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
@ 2025-03-28 10:35 ` Alvaro Herrera <[email protected]>
2025-03-28 11:20 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
1 sibling, 1 reply; 93+ messages in thread
From: Alvaro Herrera @ 2025-03-28 10:35 UTC (permalink / raw)
To: Ashutosh Bapat <[email protected]>; +Cc: vignesh C <[email protected]>; Michael Paquier <[email protected]>; Daniel Gustafsson <[email protected]>; Tom Lane <[email protected]>; Peter Eisentraut <[email protected]>; PostgreSQL Hackers <[email protected]>
On 2025-Mar-28, Ashutosh Bapat wrote:
> No, that's losing some information like default installation and the
> same version.
You don't need to preserve such information. This is just a test name.
People looking for more details can grep for the name and they will find
the comments.
--
Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/
"Pido que me den el Nobel por razones humanitarias" (Nicanor Parra)
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: Test to dump and restore objects left behind by regression
2025-03-11 10:44 Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 12:05 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-12 15:58 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 16:09 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 06:52 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 08:42 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 12:39 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 12:40 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-19 11:43 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-20 15:06 ` Re: Test to dump and restore objects left behind by regression vignesh C <[email protected]>
2025-03-20 16:39 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-21 13:09 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-21 14:39 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-21 16:03 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-21 18:07 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-24 09:54 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-24 12:14 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-25 10:39 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-27 12:31 ` Re: Test to dump and restore objects left behind by regression vignesh C <[email protected]>
2025-03-27 16:31 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-27 17:15 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-28 06:32 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-28 10:35 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
@ 2025-03-28 11:20 ` Ashutosh Bapat <[email protected]>
0 siblings, 0 replies; 93+ messages in thread
From: Ashutosh Bapat @ 2025-03-28 11:20 UTC (permalink / raw)
To: Alvaro Herrera <[email protected]>; +Cc: vignesh C <[email protected]>; Michael Paquier <[email protected]>; Daniel Gustafsson <[email protected]>; Tom Lane <[email protected]>; Peter Eisentraut <[email protected]>; PostgreSQL Hackers <[email protected]>
On Fri, Mar 28, 2025 at 4:05 PM Alvaro Herrera <[email protected]> wrote:
>
> On 2025-Mar-28, Ashutosh Bapat wrote:
>
> > No, that's losing some information like default installation and the
> > same version.
>
> You don't need to preserve such information. This is just a test name.
> People looking for more details can grep for the name and they will find
> the comments.
Ok. In that case what's wrong with the testname I have in the patch?
--
Best Wishes,
Ashutosh Bapat
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: Test to dump and restore objects left behind by regression
2025-03-11 10:44 Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 12:05 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-12 15:58 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 16:09 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 06:52 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 08:42 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 12:39 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 12:40 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-19 11:43 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-20 15:06 ` Re: Test to dump and restore objects left behind by regression vignesh C <[email protected]>
@ 2025-03-21 11:51 ` Ashutosh Bapat <[email protected]>
2025-03-21 12:34 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
1 sibling, 1 reply; 93+ messages in thread
From: Ashutosh Bapat @ 2025-03-21 11:51 UTC (permalink / raw)
To: vignesh C <[email protected]>; +Cc: Alvaro Herrera <[email protected]>; Michael Paquier <[email protected]>; Daniel Gustafsson <[email protected]>; Tom Lane <[email protected]>; Peter Eisentraut <[email protected]>; PostgreSQL Hackers <[email protected]>
On Thu, Mar 20, 2025 at 8:37 PM vignesh C <[email protected]> wrote:
>
> Will it help the execution time if we use --jobs in case of pg_dump
> and pg_restore wherever supported:
> + $src_node->command_ok(
> + [
> + 'pg_dump', "-F$format", '--no-sync',
> + '-d', $src_node->connstr('regression'),
> + '--create', '-f', $dump_file
> + ],
> + "pg_dump on source instance in $format format");
> +
> + my @restore_command;
> + if ($format eq 'plain')
> + {
> + # Restore dump in "plain" format using `psql`.
> + @restore_command = [ 'psql', '-d', 'postgres',
> '-f', $dump_file ];
> + }
> + else
> + {
> + @restore_command = [
> + 'pg_restore', '--create',
> + '-d', 'postgres', $dump_file
> + ];
> + }
Will reply to this separately along with reply to Alvaro's comments.
>
> Should the copyright be only 2025 in this case:
> diff --git a/src/test/perl/PostgreSQL/Test/AdjustDump.pm
> b/src/test/perl/PostgreSQL/Test/AdjustDump.pm
> new file mode 100644
> index 00000000000..74b9a60cf34
> --- /dev/null
> +++ b/src/test/perl/PostgreSQL/Test/AdjustDump.pm
> @@ -0,0 +1,167 @@
> +
> +# Copyright (c) 2024-2025, PostgreSQL Global Development Group
The patch was posted in 2024 to this mailing list. So we better
protect the copyright since then. I remember a hackers discussion
where a senior member of the community mentioned that there's not harm
in mentioning longer copyright periods than being stricter about it. I
couldn't find the discussion though.
--
Best Wishes,
Ashutosh Bapat
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: Test to dump and restore objects left behind by regression
2025-03-11 10:44 Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 12:05 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-12 15:58 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 16:09 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 06:52 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 08:42 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 12:39 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 12:40 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-19 11:43 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-20 15:06 ` Re: Test to dump and restore objects left behind by regression vignesh C <[email protected]>
2025-03-21 11:51 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
@ 2025-03-21 12:34 ` Alvaro Herrera <[email protected]>
2025-03-21 12:41 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
0 siblings, 1 reply; 93+ messages in thread
From: Alvaro Herrera @ 2025-03-21 12:34 UTC (permalink / raw)
To: Ashutosh Bapat <[email protected]>; +Cc: vignesh C <[email protected]>; Michael Paquier <[email protected]>; Daniel Gustafsson <[email protected]>; Tom Lane <[email protected]>; Peter Eisentraut <[email protected]>; PostgreSQL Hackers <[email protected]>
On 2025-Mar-21, Ashutosh Bapat wrote:
> On Thu, Mar 20, 2025 at 8:37 PM vignesh C <[email protected]> wrote:
> > Should the copyright be only 2025 in this case:
> The patch was posted in 2024 to this mailing list. So we better
> protect the copyright since then. I remember a hackers discussion
> where a senior member of the community mentioned that there's not harm
> in mentioning longer copyright periods than being stricter about it. I
> couldn't find the discussion though.
On the other hand, my impression is that we do update copyright years to
current year, when committing new files of patches that have been around
for long.
And there's always
https://liferay.dev/blogs/-/blogs/how-and-why-to-properly-write-copyright-statements-in-your-code
--
Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/
"Las cosas son buenas o malas segun las hace nuestra opinión" (Lisias)
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: Test to dump and restore objects left behind by regression
2025-03-11 10:44 Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 12:05 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-12 15:58 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 16:09 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 06:52 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 08:42 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 12:39 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 12:40 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-19 11:43 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-20 15:06 ` Re: Test to dump and restore objects left behind by regression vignesh C <[email protected]>
2025-03-21 11:51 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-21 12:34 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
@ 2025-03-21 12:41 ` Ashutosh Bapat <[email protected]>
0 siblings, 0 replies; 93+ messages in thread
From: Ashutosh Bapat @ 2025-03-21 12:41 UTC (permalink / raw)
To: Alvaro Herrera <[email protected]>; +Cc: vignesh C <[email protected]>; Michael Paquier <[email protected]>; Daniel Gustafsson <[email protected]>; Tom Lane <[email protected]>; Peter Eisentraut <[email protected]>; PostgreSQL Hackers <[email protected]>
On Fri, Mar 21, 2025 at 6:04 PM Alvaro Herrera <[email protected]> wrote:
>
> On 2025-Mar-21, Ashutosh Bapat wrote:
>
> > On Thu, Mar 20, 2025 at 8:37 PM vignesh C <[email protected]> wrote:
>
> > > Should the copyright be only 2025 in this case:
>
> > The patch was posted in 2024 to this mailing list. So we better
> > protect the copyright since then. I remember a hackers discussion
> > where a senior member of the community mentioned that there's not harm
> > in mentioning longer copyright periods than being stricter about it. I
> > couldn't find the discussion though.
>
> On the other hand, my impression is that we do update copyright years to
> current year, when committing new files of patches that have been around
> for long.
>
> And there's always
> https://liferay.dev/blogs/-/blogs/how-and-why-to-properly-write-copyright-statements-in-your-code
Right. So shouldn't the copyright notice be 2024-2025 and not just
only 2025? - Next year it will be changed to 2024-2026.
--
Best Wishes,
Ashutosh Bapat
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: Test to dump and restore objects left behind by regression
@ 2025-04-03 03:59 vignesh C <[email protected]>
0 siblings, 0 replies; 93+ messages in thread
From: vignesh C @ 2025-04-03 03:59 UTC (permalink / raw)
To: Ashutosh Bapat <[email protected]>; +Cc: Alvaro Herrera <[email protected]>; Daniel Gustafsson <[email protected]>; Tom Lane <[email protected]>; Michael Paquier <[email protected]>; Peter Eisentraut <[email protected]>; PostgreSQL Hackers <[email protected]>
On Wed, 2 Apr 2025 at 13:49, Ashutosh Bapat
<[email protected]> wrote:
>
> On Tue, Apr 1, 2025 at 10:31 PM Alvaro Herrera <[email protected]> wrote:
> >
> > On 2025-Apr-01, Ashutosh Bapat wrote:
> >
> > > Just today morning, I found something which looks like another bug in
> > > statistics dump/restore [1]. As Daniel has expressed upthread [2], we
> > > should go ahead and commit the test even if the bug is not fixed. But
> > > in case it creates a lot of noise and makes the build farm red, we
> > > could suppress the failure by not dumping statistics for comparison
> > > till the bug is fixed. PFA patchset which reintroduces 0003 which
> > > suppresses the statistics dump - in case we think it's needed. I have
> > > made some minor cosmetic changes to 0001 and 0002 as well.
> >
> > I have made some changes of my own, and included --no-statistics.
> > But I had already started messing with your patch, so I didn't look at
> > the cosmetic changes you did here. If they're still relevant, please
> > send them my way.
>
> Thanks a lot. I hope the test will now reveal the problems before they
> are committed :)
>
> You have edited those places anyway. So it's ok.
>
> I have closed the CF entry
> https://commitfest.postgresql.org/patch/4564/ committed. I will
> create another CF entry to park --no-statistics reversal change. That
> way, we will know when statistics dump/restore has become stable.
>
> >
> > Hopefully it won't break, and if it does, it's likely fault of the
> > changes I made. I've run it through CI and all is well though, so
> > fingers crossed.
> > https://cirrus-ci.com/build/6327169669922816
> >
> >
> > I observe in the CI results that the pg_upgrade test is not necessarily
> > the last one to finish. In one case it even finished in place 12!
> >
> > [16:36:48.447] 12/332 postgresql:pg_upgrade / pg_upgrade/002_pg_upgrade OK 112.16s 22 subtests passed
> > https://api.cirrus-ci.com/v1/task/5803071017582592/logs/test_world.log
>
> Yes. Few animals that I sampled, the test is finishing pretty early
> even though it's taking longer than many other tests. But it's not the
> longest. I also looked at red animals, but none of them report this
> test to be failing.
I believe this commitfest entry at [1] can be closed now, as the
buildfarm has been running stably for the past few days.
[1] - https://commitfest.postgresql.org/patch/4956/
Regards,
Vignesh
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: Test to dump and restore objects left behind by regression
@ 2025-04-03 13:40 Andres Freund <[email protected]>
2025-04-04 16:07 ` Re: Test to dump and restore objects left behind by regression Andres Freund <[email protected]>
0 siblings, 1 reply; 93+ messages in thread
From: Andres Freund @ 2025-04-03 13:40 UTC (permalink / raw)
To: Alvaro Herrera <[email protected]>; +Cc: Ashutosh Bapat <[email protected]>; Daniel Gustafsson <[email protected]>; Tom Lane <[email protected]>; Michael Paquier <[email protected]>; vignesh C <[email protected]>; Peter Eisentraut <[email protected]>; PostgreSQL Hackers <[email protected]>
Hi,
On 2025-04-03 10:20:09 +0200, Alvaro Herrera wrote:
> On 2025-Apr-03, Ashutosh Bapat wrote:
>
> > Looks like the problem is in the test itself as pointed out by Jeff in
> > [1]. PFA patch fixing the test and enabling statistics back.
>
> Thanks, pushed.
Since then the pg_upgrade tests have been failing on skink/valgrind, due to
exceeding the already substantially increased timeout.
https://buildfarm.postgresql.org/cgi-bin/show_stage_log.pl?nm=skink&dt=2025-04-03%2007%3A06%3A19...
(note that there are other issues in that run)
284/333 postgresql:pg_upgrade / pg_upgrade/002_pg_upgrade TIMEOUT 10000.66s killed by signal 15 SIGTERM
[10:38:19.815](16.712s) ok 20 - check that locales in new cluster match original cluster
...
# Running: pg_dumpall --no-sync --dbname port=15114 host=/tmp/bh_AdT5uvQ dbname='postgres' --file /home/bf/bf-build/skink-master/HEAD/pgsql.build/testrun/pg_upgrade/002_pg_upgrade/data/tmp_test_gp2G/dump2.sql
death by signal at /home/bf/bf-build/skink-master/HEAD/pgsql/src/test/perl/PostgreSQL/Test/Cluster.pm line 181.
...
[10:44:11.720](351.905s) # Tests were run but no plan was declared and done_testing() was not seen.
I've increased the timeout even further, but I can't say that I am happy about
the slowest test getting even slower. Adding test time in the serially slowest
test is way worse than adding the same time in a concurrent test.
I suspect that the test will go a bit faster if log_statement weren't forced
on, printing that many log lines, with context, does make valgrind slower,
IME. But Cluster.pm forces it to on, and I suspect that putting a global
log_statement=false into TEMP_CONFIG would have it's own disadvantages.
/me and checks prices for increasing the size of skink's host.
Greetings,
Andres
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: Test to dump and restore objects left behind by regression
2025-04-03 13:40 Re: Test to dump and restore objects left behind by regression Andres Freund <[email protected]>
@ 2025-04-04 16:07 ` Andres Freund <[email protected]>
2025-08-05 14:33 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
0 siblings, 1 reply; 93+ messages in thread
From: Andres Freund @ 2025-04-04 16:07 UTC (permalink / raw)
To: Alvaro Herrera <[email protected]>; +Cc: Ashutosh Bapat <[email protected]>; Daniel Gustafsson <[email protected]>; Tom Lane <[email protected]>; Michael Paquier <[email protected]>; vignesh C <[email protected]>; Peter Eisentraut <[email protected]>; PostgreSQL Hackers <[email protected]>
Hi,
On 2025-04-04 12:01:16 -0400, Andres Freund wrote:
> FWIW, for me 027 is actually considerably faster. In an cassert -O0 build (my
> normal development env, I find even -Og too problematic for debugging):
>
> pg_upgrade/002_pg_upgrade 96.61s
> recovery/027_stream_regress 66.04s
>
> After
> git revert 8806e4e8deb1e21715e031e17181d904825a410e abe56227b2e213755dd3e194c530f5f06467bd7c 172259afb563d35001410dc6daad78b250924038
>
> pg_upgrade/002_pg_upgrade 75.09s
>
> Slower by 29%, far from the 3s increased time I saw mentioned somewhere.
>
>
> And this really affects the overall test time:
>
> All tests before:
> real 1m38.173s
> user 5m52.500s
> sys 4m23.574s
>
> All tests after:
> real 2m0.397s
> user 5m53.625s
> sys 4m30.518s
>
> The CPU time increase is rather minimal, but the wall clock time increase is
> 22%.
>
> 17:
> real 1m14.822s
> user 4m2.630s
> sys 3m22.384s
>
> We regressed wall clock time *60%* from 17->18. Some test cycle increase is
> reasonable and can largely be compensated with hardware, but this cycle we're
> growing way faster than hardware gets faster. I don't think that's
> sustainable.
FWIW, with cassert and -O2, it's:
17:
real 0m53.981s
user 3m22.837s
sys 3m24.237s
HEAD:
real 1m19.749s
user 4m54.526s
sys 4m15.657s
so this isn't just due to me using -O0. A 48% increase is better than a 60%
increase, but it's still not sustainable.
Greetings,
Andres Freund
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: Test to dump and restore objects left behind by regression
2025-04-03 13:40 Re: Test to dump and restore objects left behind by regression Andres Freund <[email protected]>
2025-04-04 16:07 ` Re: Test to dump and restore objects left behind by regression Andres Freund <[email protected]>
@ 2025-08-05 14:33 ` Alvaro Herrera <[email protected]>
2025-08-05 14:41 ` Re: Test to dump and restore objects left behind by regression Daniel Gustafsson <[email protected]>
0 siblings, 1 reply; 93+ messages in thread
From: Alvaro Herrera @ 2025-08-05 14:33 UTC (permalink / raw)
To: Andres Freund <[email protected]>; +Cc: Ashutosh Bapat <[email protected]>; Daniel Gustafsson <[email protected]>; Tom Lane <[email protected]>; Michael Paquier <[email protected]>; vignesh C <[email protected]>; Peter Eisentraut <[email protected]>; PostgreSQL Hackers <[email protected]>
Hello,
On 2025-Apr-04, Andres Freund wrote:
> FWIW, with cassert and -O2, it's:
>
> 17:
> real 0m53.981s
> user 3m22.837s
> sys 3m24.237s
>
> HEAD:
> real 1m19.749s
> user 4m54.526s
> sys 4m15.657s
>
> so this isn't just due to me using -O0. A 48% increase is better than a 60%
> increase, but it's still not sustainable.
I happened to notice that this item was still open in the commitfest,
and rereading the thread I now have second thoughts about having it
enabled by default, giving your complaints about speed. How about
applying this to 18 and master?
--
Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/
"This is a foot just waiting to be shot" (Andrew Dunstan)
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: Test to dump and restore objects left behind by regression
2025-04-03 13:40 Re: Test to dump and restore objects left behind by regression Andres Freund <[email protected]>
2025-04-04 16:07 ` Re: Test to dump and restore objects left behind by regression Andres Freund <[email protected]>
2025-08-05 14:33 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
@ 2025-08-05 14:41 ` Daniel Gustafsson <[email protected]>
2025-08-05 14:59 ` Re: Test to dump and restore objects left behind by regression Tom Lane <[email protected]>
0 siblings, 1 reply; 93+ messages in thread
From: Daniel Gustafsson @ 2025-08-05 14:41 UTC (permalink / raw)
To: Alvaro Herrera <[email protected]>; +Cc: Andres Freund <[email protected]>; Ashutosh Bapat <[email protected]>; Tom Lane <[email protected]>; Michael Paquier <[email protected]>; vignesh C <[email protected]>; Peter Eisentraut <[email protected]>; PostgreSQL Hackers <[email protected]>
> On 5 Aug 2025, at 16:33, Alvaro Herrera <[email protected]> wrote:
> I happened to notice that this item was still open in the commitfest,
> and rereading the thread I now have second thoughts about having it
> enabled by default, giving your complaints about speed. How about
> applying this to 18 and master?
Thanks for reviving this. I am +1 on placing this behind PG_TEST_EXTRA as was
discussed upthread.
--
Daniel Gustafsson
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: Test to dump and restore objects left behind by regression
2025-04-03 13:40 Re: Test to dump and restore objects left behind by regression Andres Freund <[email protected]>
2025-04-04 16:07 ` Re: Test to dump and restore objects left behind by regression Andres Freund <[email protected]>
2025-08-05 14:33 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-08-05 14:41 ` Re: Test to dump and restore objects left behind by regression Daniel Gustafsson <[email protected]>
@ 2025-08-05 14:59 ` Tom Lane <[email protected]>
2025-08-05 18:11 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
0 siblings, 1 reply; 93+ messages in thread
From: Tom Lane @ 2025-08-05 14:59 UTC (permalink / raw)
To: Daniel Gustafsson <[email protected]>; +Cc: Alvaro Herrera <[email protected]>; Andres Freund <[email protected]>; Ashutosh Bapat <[email protected]>; Michael Paquier <[email protected]>; vignesh C <[email protected]>; Peter Eisentraut <[email protected]>; PostgreSQL Hackers <[email protected]>
Daniel Gustafsson <[email protected]> writes:
> Thanks for reviving this. I am +1 on placing this behind PG_TEST_EXTRA as was
> discussed upthread.
+1 here too.
regards, tom lane
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: Test to dump and restore objects left behind by regression
2025-04-03 13:40 Re: Test to dump and restore objects left behind by regression Andres Freund <[email protected]>
2025-04-04 16:07 ` Re: Test to dump and restore objects left behind by regression Andres Freund <[email protected]>
2025-08-05 14:33 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-08-05 14:41 ` Re: Test to dump and restore objects left behind by regression Daniel Gustafsson <[email protected]>
2025-08-05 14:59 ` Re: Test to dump and restore objects left behind by regression Tom Lane <[email protected]>
@ 2025-08-05 18:11 ` Alvaro Herrera <[email protected]>
2025-08-06 01:22 ` Re: Test to dump and restore objects left behind by regression Michael Paquier <[email protected]>
2025-08-06 15:10 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
0 siblings, 2 replies; 93+ messages in thread
From: Alvaro Herrera @ 2025-08-05 18:11 UTC (permalink / raw)
To: Tom Lane <[email protected]>; +Cc: Daniel Gustafsson <[email protected]>; Andres Freund <[email protected]>; Ashutosh Bapat <[email protected]>; Michael Paquier <[email protected]>; vignesh C <[email protected]>; Peter Eisentraut <[email protected]>; PostgreSQL Hackers <[email protected]>
On 2025-Aug-05, Tom Lane wrote:
> Daniel Gustafsson <[email protected]> writes:
> > Thanks for reviving this. I am +1 on placing this behind PG_TEST_EXTRA as was
> > discussed upthread.
>
> +1 here too.
Cool, thanks, done. Now we need a volunteer to set up a buildfarm
animal with this flag ...
--
Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/
"If it is not right, do not do it.
If it is not true, do not say it." (Marcus Aurelius, Meditations)
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: Test to dump and restore objects left behind by regression
2025-04-03 13:40 Re: Test to dump and restore objects left behind by regression Andres Freund <[email protected]>
2025-04-04 16:07 ` Re: Test to dump and restore objects left behind by regression Andres Freund <[email protected]>
2025-08-05 14:33 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-08-05 14:41 ` Re: Test to dump and restore objects left behind by regression Daniel Gustafsson <[email protected]>
2025-08-05 14:59 ` Re: Test to dump and restore objects left behind by regression Tom Lane <[email protected]>
2025-08-05 18:11 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
@ 2025-08-06 01:22 ` Michael Paquier <[email protected]>
1 sibling, 0 replies; 93+ messages in thread
From: Michael Paquier @ 2025-08-06 01:22 UTC (permalink / raw)
To: Alvaro Herrera <[email protected]>; +Cc: Tom Lane <[email protected]>; Daniel Gustafsson <[email protected]>; Andres Freund <[email protected]>; Ashutosh Bapat <[email protected]>; vignesh C <[email protected]>; Peter Eisentraut <[email protected]>; PostgreSQL Hackers <[email protected]>
On Tue, Aug 05, 2025 at 08:11:41PM +0200, Alvaro Herrera wrote:
> Cool, thanks, done. Now we need a volunteer to set up a buildfarm
> animal with this flag ...
Sure. I have added regress_dump_restore to the configuration of
batta, hachi and gokiburi.
--
Michael
Attachments:
[application/pgp-signature] signature.asc (833B, ../../[email protected]/2-signature.asc)
download
^ permalink raw reply [nested|flat] 93+ messages in thread
* Re: Test to dump and restore objects left behind by regression
2025-04-03 13:40 Re: Test to dump and restore objects left behind by regression Andres Freund <[email protected]>
2025-04-04 16:07 ` Re: Test to dump and restore objects left behind by regression Andres Freund <[email protected]>
2025-08-05 14:33 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-08-05 14:41 ` Re: Test to dump and restore objects left behind by regression Daniel Gustafsson <[email protected]>
2025-08-05 14:59 ` Re: Test to dump and restore objects left behind by regression Tom Lane <[email protected]>
2025-08-05 18:11 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
@ 2025-08-06 15:10 ` Ashutosh Bapat <[email protected]>
1 sibling, 0 replies; 93+ messages in thread
From: Ashutosh Bapat @ 2025-08-06 15:10 UTC (permalink / raw)
To: Alvaro Herrera <[email protected]>; +Cc: Tom Lane <[email protected]>; Daniel Gustafsson <[email protected]>; Andres Freund <[email protected]>; Michael Paquier <[email protected]>; vignesh C <[email protected]>; Peter Eisentraut <[email protected]>; PostgreSQL Hackers <[email protected]>
On Wed, Aug 6, 2025 at 8:21 AM Alvaro Herrera <[email protected]> wrote:
>
> On 2025-Aug-05, Tom Lane wrote:
>
> > Daniel Gustafsson <[email protected]> writes:
> > > Thanks for reviving this. I am +1 on placing this behind PG_TEST_EXTRA as was
> > > discussed upthread.
> >
> > +1 here too.
>
> Cool, thanks, done. Now we need a volunteer to set up a buildfarm
> animal with this flag ...
Your patch didn't contain doc changes. But the commit has it. Thanks.
--
Best Wishes,
Ashutosh Bapat
^ permalink raw reply [nested|flat] 93+ messages in thread
end of thread, other threads:[~2025-08-06 15:10 UTC | newest]
Thread overview: 93+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-10-16 04:04 [PATCH 3/5] Remove entries that haven't been used for a certain time Kyotaro Horiguchi <[email protected]>
2022-04-07 17:42 Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-04-07 17:53 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-04-19 14:22 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-20 00:28 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-04-20 09:43 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-21 04:07 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-04-21 09:21 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-04-25 01:17 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-05-09 11:44 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-05-10 01:01 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-07-14 08:36 ` Re: [PATCH] Add native windows on arm64 support Niyas Sait <[email protected]>
2022-08-26 01:29 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-26 02:09 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-26 03:29 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-27 02:33 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-27 03:02 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-08-27 19:27 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-28 07:23 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-28 14:09 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-08-28 15:41 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-28 15:51 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-08-29 01:12 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-29 23:48 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-29 23:58 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-08-30 00:33 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2022-08-30 01:35 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-30 02:00 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-08-30 23:36 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-31 00:07 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-08-31 00:16 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-31 00:15 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-31 00:28 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-08-31 06:09 ` Re: [PATCH] Add native windows on arm64 support Michael Paquier <[email protected]>
2022-08-31 17:33 ` Re: [PATCH] Add native windows on arm64 support Tom Lane <[email protected]>
2022-08-30 00:09 ` Re: [PATCH] Add native windows on arm64 support Andres Freund <[email protected]>
2023-09-25 20:32 [PATCH v2 05/11] Improve sentences in overview of system configuration parameters Karl O. Pinc <[email protected]>
2023-09-25 20:32 [PATCH v7 05/16] Improve sentences in overview of system configuration parameters Karl O. Pinc <[email protected]>
2023-09-25 20:32 [PATCH v5 05/14] Improve sentences in overview of system configuration parameters Karl O. Pinc <[email protected]>
2023-09-25 20:32 [PATCH v6 05/15] Improve sentences in overview of system configuration parameters Karl O. Pinc <[email protected]>
2023-09-25 20:32 [PATCH v4 05/12] Improve sentences in overview of system configuration parameters Karl O. Pinc <[email protected]>
2023-09-25 20:32 [PATCH v3 05/11] Improve sentences in overview of system configuration parameters Karl O. Pinc <[email protected]>
2023-09-25 20:32 [PATCH v4 05/12] Improve sentences in overview of system configuration parameters Karl O. Pinc <[email protected]>
2023-09-25 20:32 [PATCH v3 05/11] Improve sentences in overview of system configuration parameters Karl O. Pinc <[email protected]>
2023-09-25 20:32 [PATCH v2 05/11] Improve sentences in overview of system configuration parameters Karl O. Pinc <[email protected]>
2025-03-11 10:44 Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 12:05 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-12 15:58 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-12 16:09 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 06:52 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 08:42 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-13 12:39 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-13 12:40 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-19 11:43 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-20 15:06 ` Re: Test to dump and restore objects left behind by regression vignesh C <[email protected]>
2025-03-20 16:39 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-21 12:45 ` Re: Test to dump and restore objects left behind by regression vignesh C <[email protected]>
2025-03-21 13:09 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-21 14:39 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-21 16:03 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-21 18:07 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-24 09:54 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-24 09:59 ` Re: Test to dump and restore objects left behind by regression Daniel Gustafsson <[email protected]>
2025-03-24 12:14 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-25 10:39 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-27 12:31 ` Re: Test to dump and restore objects left behind by regression vignesh C <[email protected]>
2025-03-27 16:31 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-27 17:15 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-28 01:36 ` Re: Test to dump and restore objects left behind by regression Michael Paquier <[email protected]>
2025-03-28 06:50 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-28 12:27 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-28 14:11 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-28 14:22 ` Re: Test to dump and restore objects left behind by regression Tom Lane <[email protected]>
2025-03-28 18:12 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-31 11:37 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-31 11:54 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-31 21:17 ` Re: Test to dump and restore objects left behind by regression Daniel Gustafsson <[email protected]>
2025-03-28 06:32 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-28 09:28 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-28 10:35 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-28 11:20 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-21 11:51 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-03-21 12:34 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-03-21 12:41 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[email protected]>
2025-04-03 03:59 Re: Test to dump and restore objects left behind by regression vignesh C <[email protected]>
2025-04-03 13:40 Re: Test to dump and restore objects left behind by regression Andres Freund <[email protected]>
2025-04-04 16:07 ` Re: Test to dump and restore objects left behind by regression Andres Freund <[email protected]>
2025-08-05 14:33 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-08-05 14:41 ` Re: Test to dump and restore objects left behind by regression Daniel Gustafsson <[email protected]>
2025-08-05 14:59 ` Re: Test to dump and restore objects left behind by regression Tom Lane <[email protected]>
2025-08-05 18:11 ` Re: Test to dump and restore objects left behind by regression Alvaro Herrera <[email protected]>
2025-08-06 01:22 ` Re: Test to dump and restore objects left behind by regression Michael Paquier <[email protected]>
2025-08-06 15:10 ` Re: Test to dump and restore objects left behind by regression Ashutosh Bapat <[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