agora inbox for pgsql-hackers@postgresql.org  
help / color / mirror / Atom feed
[PATCH 04/10] wal_compression_method: default to zlib..
3+ messages / 2 participants
[nested] [flat]

* [PATCH 04/10] wal_compression_method: default to zlib..
@ 2021-03-11 23:36 Justin Pryzby <pryzbyj@telsasoft.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Justin Pryzby @ 2021-03-11 23:36 UTC (permalink / raw)

this is meant to exercise the CIs, and not meant to be merged
---
 src/backend/access/transam/xlog.c | 2 +-
 src/backend/utils/misc/guc.c      | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 0183589b4d..8bae73b4ec 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -99,7 +99,7 @@ bool		EnableHotStandby = false;
 bool		fullPageWrites = true;
 bool		wal_log_hints = false;
 bool		wal_compression = false;
-int			wal_compression_method = WAL_COMPRESSION_PGLZ;
+int			wal_compression_method = WAL_COMPRESSION_ZLIB;
 char	   *wal_consistency_checking_string = NULL;
 bool	   *wal_consistency_checking = NULL;
 bool		wal_init_zero = true;
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 8084027465..c37a8313d3 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -1269,7 +1269,7 @@ static struct config_bool ConfigureNamesBool[] =
 			NULL
 		},
 		&wal_compression,
-		false,
+		true,
 		NULL, NULL, NULL
 	},
 
@@ -4728,7 +4728,7 @@ static struct config_enum ConfigureNamesEnum[] =
 			NULL
 		},
 		&wal_compression_method,
-		WAL_COMPRESSION_PGLZ, wal_compression_options,
+		WAL_COMPRESSION_ZLIB, wal_compression_options,
 		NULL, NULL, NULL
 	},
 
-- 
2.17.0


--0qVF/w3MHQqLSynd
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
 filename="0005-re-add-wal_compression_method-lz4.patch"



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* [PATCH v2 3/4] Debugging: automatically shuffle all table attributes physical position.
@ 2022-06-04 19:06 Julien Rouhaud <julien.rouhaud@free.fr>
  0 siblings, 0 replies; 3+ messages in thread

From: Julien Rouhaud @ 2022-06-04 19:06 UTC (permalink / raw)

Author: Julien Rouhaud
Reviewed-by: FIXME
Discussion: FIXME
---
 src/backend/commands/tablecmds.c | 55 ++++++++++++++++++++++++++++++++
 1 file changed, 55 insertions(+)

diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 007e355d9d..06b9733717 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -635,6 +635,18 @@ static void ATDetachCheckNoForeignKeyRefs(Relation partition);
 static char GetAttributeCompression(Oid atttypid, char *compression);
 
 
+static int
+cmp_att_reversed(const void *a, const void *b)
+{
+	FormData_pg_attribute *atta = (FormData_pg_attribute *) a;
+	FormData_pg_attribute *attb = (FormData_pg_attribute *) b;
+
+	return (atta->attphysnum > attb->attphysnum) ? -1
+		: (atta->attphysnum == attb->attphysnum) ? 0
+		: 1;
+}
+
+
 /* ----------------------------------------------------------------
  *		DefineRelation
  *				Creates a new relation.
@@ -933,6 +945,49 @@ DefineRelation(CreateStmt *stmt, char relkind, Oid ownerId,
 														   colDef->compression);
 	}
 
+	/*
+	 * FIXME
+	 * testing mode: inverse all attribute positions.  This has to be done
+	 * after that defaults have been computed.
+	 */
+	if (relkind == RELKIND_RELATION && inheritOids == NIL
+			&& descriptor->natts > 1
+			/* lame attempt to discard CTAS */
+			&& queryString != NULL)
+	{
+		AttrNumber *mappings;
+
+		mappings = palloc(sizeof(AttrNumber) * (descriptor->natts + 1));
+
+		qsort(descriptor->attrs, descriptor->natts,
+			  sizeof(FormData_pg_attribute),
+			  cmp_att_reversed);
+
+		for (int i = 0; i < descriptor->natts; i++)
+		{
+			Form_pg_attribute att = TupleDescAttr(descriptor, i);
+
+			mappings[att->attphysnum] = i + 1;
+
+			att->attnum = att->attphysnum;
+			att->attphysnum = i + 1;
+		}
+
+		/* Fixup the defautls references */
+		foreach(listptr, rawDefaults)
+		{
+			RawColumnDefault *rowEnt = lfirst(listptr);
+
+			rowEnt->attphysnum = mappings[rowEnt->attphysnum];
+		}
+		foreach(listptr, cookedDefaults)
+		{
+			CookedConstraint *cooked = lfirst(listptr);
+
+			cooked->attphysnum = mappings[cooked->attphysnum];
+		}
+	}
+
 	/*
 	 * If the statement hasn't specified an access method, but we're defining
 	 * a type of relation that needs one, use the default.
-- 
2.33.1


--5462ml7mocwud3y7
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename="v2-0004-POC-Add-naive-grammar-to-specify-the-column-logic.patch"



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* [PATCH v1 4/5] Debugging: automatically shuffle all table attributes physical position.
@ 2022-06-04 19:06 Julien Rouhaud <julien.rouhaud@free.fr>
  0 siblings, 0 replies; 3+ messages in thread

From: Julien Rouhaud @ 2022-06-04 19:06 UTC (permalink / raw)

Author: Julien Rouhaud
Reviewed-by: FIXME
Discussion: FIXME
---
 src/backend/commands/tablecmds.c | 55 ++++++++++++++++++++++++++++++++
 1 file changed, 55 insertions(+)

diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 007e355d9d..06b9733717 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -635,6 +635,18 @@ static void ATDetachCheckNoForeignKeyRefs(Relation partition);
 static char GetAttributeCompression(Oid atttypid, char *compression);
 
 
+static int
+cmp_att_reversed(const void *a, const void *b)
+{
+	FormData_pg_attribute *atta = (FormData_pg_attribute *) a;
+	FormData_pg_attribute *attb = (FormData_pg_attribute *) b;
+
+	return (atta->attphysnum > attb->attphysnum) ? -1
+		: (atta->attphysnum == attb->attphysnum) ? 0
+		: 1;
+}
+
+
 /* ----------------------------------------------------------------
  *		DefineRelation
  *				Creates a new relation.
@@ -933,6 +945,49 @@ DefineRelation(CreateStmt *stmt, char relkind, Oid ownerId,
 														   colDef->compression);
 	}
 
+	/*
+	 * FIXME
+	 * testing mode: inverse all attribute positions.  This has to be done
+	 * after that defaults have been computed.
+	 */
+	if (relkind == RELKIND_RELATION && inheritOids == NIL
+			&& descriptor->natts > 1
+			/* lame attempt to discard CTAS */
+			&& queryString != NULL)
+	{
+		AttrNumber *mappings;
+
+		mappings = palloc(sizeof(AttrNumber) * (descriptor->natts + 1));
+
+		qsort(descriptor->attrs, descriptor->natts,
+			  sizeof(FormData_pg_attribute),
+			  cmp_att_reversed);
+
+		for (int i = 0; i < descriptor->natts; i++)
+		{
+			Form_pg_attribute att = TupleDescAttr(descriptor, i);
+
+			mappings[att->attphysnum] = i + 1;
+
+			att->attnum = att->attphysnum;
+			att->attphysnum = i + 1;
+		}
+
+		/* Fixup the defautls references */
+		foreach(listptr, rawDefaults)
+		{
+			RawColumnDefault *rowEnt = lfirst(listptr);
+
+			rowEnt->attphysnum = mappings[rowEnt->attphysnum];
+		}
+		foreach(listptr, cookedDefaults)
+		{
+			CookedConstraint *cooked = lfirst(listptr);
+
+			cooked->attphysnum = mappings[cooked->attphysnum];
+		}
+	}
+
 	/*
 	 * If the statement hasn't specified an access method, but we're defining
 	 * a type of relation that needs one, use the default.
-- 
2.33.1


--niuvl3z5xzutv25e
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename="v1-0005-POC-Add-naive-grammar-to-specify-the-column-logic.patch"



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2022-06-04 19:06 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-03-11 23:36 [PATCH 04/10] wal_compression_method: default to zlib.. Justin Pryzby <pryzbyj@telsasoft.com>
2022-06-04 19:06 [PATCH v2 3/4] Debugging: automatically shuffle all table attributes physical position. Julien Rouhaud <julien.rouhaud@free.fr>
2022-06-04 19:06 [PATCH v1 4/5] Debugging: automatically shuffle all table attributes physical position. Julien Rouhaud <julien.rouhaud@free.fr>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox