public inbox for [email protected]help / color / mirror / Atom feed
[PATCH 06/12] fixups.patch 46+ messages / 2 participants [nested] [flat]
* [PATCH v24 05/10] fixups.patch @ 2021-02-10 21:56 Robert Haas <[email protected]> 0 siblings, 0 replies; 46+ messages in thread From: Robert Haas @ 2021-02-10 21:56 UTC (permalink / raw) --- doc/src/sgml/ddl.sgml | 3 --- doc/src/sgml/ref/create_table.sgml | 15 +++++++++++---- src/backend/access/common/detoast.c | 5 ++--- src/backend/access/compression/compress_lz4.c | 10 +++++----- src/backend/executor/nodeModifyTable.c | 2 +- src/include/nodes/execnodes.h | 4 ++-- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml index 4d7ed698b9..1e9a4625cc 100644 --- a/doc/src/sgml/ddl.sgml +++ b/doc/src/sgml/ddl.sgml @@ -3762,9 +3762,6 @@ CREATE TABLE measurement ( <productname>PostgreSQL</productname> tables (or, possibly, foreign tables). It is possible to specify a tablespace and storage parameters for each partition separately. - By default, each column in a partition inherits the compression method - from parent table's column, however a different compression method can be - set for each partition. </para> <para> diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index 51a7a977a5..a4b297340f 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -997,10 +997,17 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM <term><literal>COMPRESSION <replaceable class="parameter">compression_method</replaceable></literal></term> <listitem> <para> - This sets the compression method for a column. The supported compression - methods are <literal>pglz</literal> and <literal>lz4</literal>. - <literal>lz4</literal> is available only if <literal>--with-lz4</literal> - was used when building <productname>PostgreSQL</productname>. The default + The <literal>COMPRESSION</literal> clause sets the compression method + for a column. Compression is supported only for variable-width data + types, and is used only for columns whose storage type is main or + extended. (See <xref linkend="sql-altertable"/> for information on + column storage types.) Setting this property for a partitioned table + has no direct effect, because such tables have no storage of their own, + but the configured value is inherited by newly-created partitions. + The supported compression methods are <literal>pglz</literal> and + <literal>lz4</literal>. <literal>lz4</literal> is available only if + <literal>--with-lz4</literal> was used when building + <productname>PostgreSQL</productname>. The default is <literal>pglz</literal>. </para> </listitem> diff --git a/src/backend/access/common/detoast.c b/src/backend/access/common/detoast.c index b78d49167b..95d5b1c12a 100644 --- a/src/backend/access/common/detoast.c +++ b/src/backend/access/common/detoast.c @@ -477,8 +477,8 @@ toast_get_compression_oid(struct varlena *attr) return InvalidOid; /* - * Just fetch the toast compress header to know the compression method - * in the compressed data. + * Fetch just enough of the value to examine the compression header, + * so that we can find out the compression method. */ attr = toast_fetch_datum_slice(attr, 0, VARHDRSZ_COMPRESS); } @@ -503,7 +503,6 @@ toast_get_compression_handler(struct varlena *attr) cmid = TOAST_COMPRESS_METHOD(attr); - /* Get the handler routines for the compression method */ switch (cmid) { case PGLZ_COMPRESSION_ID: diff --git a/src/backend/access/compression/compress_lz4.c b/src/backend/access/compression/compress_lz4.c index 1856cf7df7..3079eff7eb 100644 --- a/src/backend/access/compression/compress_lz4.c +++ b/src/backend/access/compression/compress_lz4.c @@ -23,7 +23,7 @@ /* * lz4_cmcompress - compression routine for lz4 compression method * - * Compresses source into dest using the default strategy. Returns the + * Compresses source into dest using the LZ4 defaults. Returns the * compressed varlena, or NULL if compression fails. */ static struct varlena * @@ -42,8 +42,8 @@ lz4_cmcompress(const struct varlena *value) valsize = VARSIZE_ANY_EXHDR(value); /* - * Get maximum size of the compressed data that lz4 compression may output - * and allocate the memory for holding the compressed data and the header. + * Figure out the maximum possible size of the LZ4 output, add the bytes + * that will be needed for varlena overhead, and allocate that amount. */ max_size = LZ4_compressBound(valsize); tmp = (struct varlena *) palloc(max_size + VARHDRSZ_COMPRESS); @@ -83,10 +83,10 @@ lz4_cmdecompress(const struct varlena *value) int32 rawsize; struct varlena *result; - /* allocate memory for holding the uncompressed data */ + /* allocate memory for the uncompressed data */ result = (struct varlena *) palloc(VARRAWSIZE_4B_C(value) + VARHDRSZ); - /* decompress data using lz4 routine */ + /* decompress the data */ rawsize = LZ4_decompress_safe((char *) value + VARHDRSZ_COMPRESS, VARDATA(result), VARSIZE(value) - VARHDRSZ_COMPRESS, diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c index f77deee399..920d9dd0d5 100644 --- a/src/backend/executor/nodeModifyTable.c +++ b/src/backend/executor/nodeModifyTable.c @@ -2117,7 +2117,7 @@ CompareCompressionMethodAndDecompress(TupleTableSlot *slot, TupleTableSlot *newslot = *outslot; /* - * If the called has passed an invalid slot then create a new slot. + * If the caller has passed an invalid slot then create a new slot. * Otherwise, just clear the existing tuple from the slot. This slot * should be stored by the caller so that it can be reused for * decompressing the subsequent tuples. diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index 18e8ecfd90..d8483c36b3 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -1183,8 +1183,8 @@ typedef struct ModifyTableState TupleTableSlot *mt_root_tuple_slot; /* - * Slot for storing the modified tuple, incase the target attribute's - * compression method doesn't match with the source table. + * Slot for storing the modified tuple, in case the target attribute's + * compression method doesn't match that of the source table. */ TupleTableSlot *mt_decompress_tuple_slot; -- 2.17.0 --m51xatjYGsM+13rf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v24-0006-alter-table-set-compression.patch" ^ permalink raw reply [nested|flat] 46+ messages in thread
* [PATCH v24 05/10] fixups.patch @ 2021-02-10 21:56 Robert Haas <[email protected]> 0 siblings, 0 replies; 46+ messages in thread From: Robert Haas @ 2021-02-10 21:56 UTC (permalink / raw) --- doc/src/sgml/ddl.sgml | 3 --- doc/src/sgml/ref/create_table.sgml | 15 +++++++++++---- src/backend/access/common/detoast.c | 5 ++--- src/backend/access/compression/compress_lz4.c | 10 +++++----- src/backend/executor/nodeModifyTable.c | 2 +- src/include/nodes/execnodes.h | 4 ++-- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml index 4d7ed698b9..1e9a4625cc 100644 --- a/doc/src/sgml/ddl.sgml +++ b/doc/src/sgml/ddl.sgml @@ -3762,9 +3762,6 @@ CREATE TABLE measurement ( <productname>PostgreSQL</productname> tables (or, possibly, foreign tables). It is possible to specify a tablespace and storage parameters for each partition separately. - By default, each column in a partition inherits the compression method - from parent table's column, however a different compression method can be - set for each partition. </para> <para> diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index 51a7a977a5..a4b297340f 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -997,10 +997,17 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM <term><literal>COMPRESSION <replaceable class="parameter">compression_method</replaceable></literal></term> <listitem> <para> - This sets the compression method for a column. The supported compression - methods are <literal>pglz</literal> and <literal>lz4</literal>. - <literal>lz4</literal> is available only if <literal>--with-lz4</literal> - was used when building <productname>PostgreSQL</productname>. The default + The <literal>COMPRESSION</literal> clause sets the compression method + for a column. Compression is supported only for variable-width data + types, and is used only for columns whose storage type is main or + extended. (See <xref linkend="sql-altertable"/> for information on + column storage types.) Setting this property for a partitioned table + has no direct effect, because such tables have no storage of their own, + but the configured value is inherited by newly-created partitions. + The supported compression methods are <literal>pglz</literal> and + <literal>lz4</literal>. <literal>lz4</literal> is available only if + <literal>--with-lz4</literal> was used when building + <productname>PostgreSQL</productname>. The default is <literal>pglz</literal>. </para> </listitem> diff --git a/src/backend/access/common/detoast.c b/src/backend/access/common/detoast.c index b78d49167b..95d5b1c12a 100644 --- a/src/backend/access/common/detoast.c +++ b/src/backend/access/common/detoast.c @@ -477,8 +477,8 @@ toast_get_compression_oid(struct varlena *attr) return InvalidOid; /* - * Just fetch the toast compress header to know the compression method - * in the compressed data. + * Fetch just enough of the value to examine the compression header, + * so that we can find out the compression method. */ attr = toast_fetch_datum_slice(attr, 0, VARHDRSZ_COMPRESS); } @@ -503,7 +503,6 @@ toast_get_compression_handler(struct varlena *attr) cmid = TOAST_COMPRESS_METHOD(attr); - /* Get the handler routines for the compression method */ switch (cmid) { case PGLZ_COMPRESSION_ID: diff --git a/src/backend/access/compression/compress_lz4.c b/src/backend/access/compression/compress_lz4.c index 1856cf7df7..3079eff7eb 100644 --- a/src/backend/access/compression/compress_lz4.c +++ b/src/backend/access/compression/compress_lz4.c @@ -23,7 +23,7 @@ /* * lz4_cmcompress - compression routine for lz4 compression method * - * Compresses source into dest using the default strategy. Returns the + * Compresses source into dest using the LZ4 defaults. Returns the * compressed varlena, or NULL if compression fails. */ static struct varlena * @@ -42,8 +42,8 @@ lz4_cmcompress(const struct varlena *value) valsize = VARSIZE_ANY_EXHDR(value); /* - * Get maximum size of the compressed data that lz4 compression may output - * and allocate the memory for holding the compressed data and the header. + * Figure out the maximum possible size of the LZ4 output, add the bytes + * that will be needed for varlena overhead, and allocate that amount. */ max_size = LZ4_compressBound(valsize); tmp = (struct varlena *) palloc(max_size + VARHDRSZ_COMPRESS); @@ -83,10 +83,10 @@ lz4_cmdecompress(const struct varlena *value) int32 rawsize; struct varlena *result; - /* allocate memory for holding the uncompressed data */ + /* allocate memory for the uncompressed data */ result = (struct varlena *) palloc(VARRAWSIZE_4B_C(value) + VARHDRSZ); - /* decompress data using lz4 routine */ + /* decompress the data */ rawsize = LZ4_decompress_safe((char *) value + VARHDRSZ_COMPRESS, VARDATA(result), VARSIZE(value) - VARHDRSZ_COMPRESS, diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c index f77deee399..920d9dd0d5 100644 --- a/src/backend/executor/nodeModifyTable.c +++ b/src/backend/executor/nodeModifyTable.c @@ -2117,7 +2117,7 @@ CompareCompressionMethodAndDecompress(TupleTableSlot *slot, TupleTableSlot *newslot = *outslot; /* - * If the called has passed an invalid slot then create a new slot. + * If the caller has passed an invalid slot then create a new slot. * Otherwise, just clear the existing tuple from the slot. This slot * should be stored by the caller so that it can be reused for * decompressing the subsequent tuples. diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index 18e8ecfd90..d8483c36b3 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -1183,8 +1183,8 @@ typedef struct ModifyTableState TupleTableSlot *mt_root_tuple_slot; /* - * Slot for storing the modified tuple, incase the target attribute's - * compression method doesn't match with the source table. + * Slot for storing the modified tuple, in case the target attribute's + * compression method doesn't match that of the source table. */ TupleTableSlot *mt_decompress_tuple_slot; -- 2.17.0 --m51xatjYGsM+13rf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v24-0006-alter-table-set-compression.patch" ^ permalink raw reply [nested|flat] 46+ messages in thread
* [PATCH v24 05/10] fixups.patch @ 2021-02-10 21:56 Robert Haas <[email protected]> 0 siblings, 0 replies; 46+ messages in thread From: Robert Haas @ 2021-02-10 21:56 UTC (permalink / raw) --- doc/src/sgml/ddl.sgml | 3 --- doc/src/sgml/ref/create_table.sgml | 15 +++++++++++---- src/backend/access/common/detoast.c | 5 ++--- src/backend/access/compression/compress_lz4.c | 10 +++++----- src/backend/executor/nodeModifyTable.c | 2 +- src/include/nodes/execnodes.h | 4 ++-- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml index 4d7ed698b9..1e9a4625cc 100644 --- a/doc/src/sgml/ddl.sgml +++ b/doc/src/sgml/ddl.sgml @@ -3762,9 +3762,6 @@ CREATE TABLE measurement ( <productname>PostgreSQL</productname> tables (or, possibly, foreign tables). It is possible to specify a tablespace and storage parameters for each partition separately. - By default, each column in a partition inherits the compression method - from parent table's column, however a different compression method can be - set for each partition. </para> <para> diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index 51a7a977a5..a4b297340f 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -997,10 +997,17 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM <term><literal>COMPRESSION <replaceable class="parameter">compression_method</replaceable></literal></term> <listitem> <para> - This sets the compression method for a column. The supported compression - methods are <literal>pglz</literal> and <literal>lz4</literal>. - <literal>lz4</literal> is available only if <literal>--with-lz4</literal> - was used when building <productname>PostgreSQL</productname>. The default + The <literal>COMPRESSION</literal> clause sets the compression method + for a column. Compression is supported only for variable-width data + types, and is used only for columns whose storage type is main or + extended. (See <xref linkend="sql-altertable"/> for information on + column storage types.) Setting this property for a partitioned table + has no direct effect, because such tables have no storage of their own, + but the configured value is inherited by newly-created partitions. + The supported compression methods are <literal>pglz</literal> and + <literal>lz4</literal>. <literal>lz4</literal> is available only if + <literal>--with-lz4</literal> was used when building + <productname>PostgreSQL</productname>. The default is <literal>pglz</literal>. </para> </listitem> diff --git a/src/backend/access/common/detoast.c b/src/backend/access/common/detoast.c index b78d49167b..95d5b1c12a 100644 --- a/src/backend/access/common/detoast.c +++ b/src/backend/access/common/detoast.c @@ -477,8 +477,8 @@ toast_get_compression_oid(struct varlena *attr) return InvalidOid; /* - * Just fetch the toast compress header to know the compression method - * in the compressed data. + * Fetch just enough of the value to examine the compression header, + * so that we can find out the compression method. */ attr = toast_fetch_datum_slice(attr, 0, VARHDRSZ_COMPRESS); } @@ -503,7 +503,6 @@ toast_get_compression_handler(struct varlena *attr) cmid = TOAST_COMPRESS_METHOD(attr); - /* Get the handler routines for the compression method */ switch (cmid) { case PGLZ_COMPRESSION_ID: diff --git a/src/backend/access/compression/compress_lz4.c b/src/backend/access/compression/compress_lz4.c index 1856cf7df7..3079eff7eb 100644 --- a/src/backend/access/compression/compress_lz4.c +++ b/src/backend/access/compression/compress_lz4.c @@ -23,7 +23,7 @@ /* * lz4_cmcompress - compression routine for lz4 compression method * - * Compresses source into dest using the default strategy. Returns the + * Compresses source into dest using the LZ4 defaults. Returns the * compressed varlena, or NULL if compression fails. */ static struct varlena * @@ -42,8 +42,8 @@ lz4_cmcompress(const struct varlena *value) valsize = VARSIZE_ANY_EXHDR(value); /* - * Get maximum size of the compressed data that lz4 compression may output - * and allocate the memory for holding the compressed data and the header. + * Figure out the maximum possible size of the LZ4 output, add the bytes + * that will be needed for varlena overhead, and allocate that amount. */ max_size = LZ4_compressBound(valsize); tmp = (struct varlena *) palloc(max_size + VARHDRSZ_COMPRESS); @@ -83,10 +83,10 @@ lz4_cmdecompress(const struct varlena *value) int32 rawsize; struct varlena *result; - /* allocate memory for holding the uncompressed data */ + /* allocate memory for the uncompressed data */ result = (struct varlena *) palloc(VARRAWSIZE_4B_C(value) + VARHDRSZ); - /* decompress data using lz4 routine */ + /* decompress the data */ rawsize = LZ4_decompress_safe((char *) value + VARHDRSZ_COMPRESS, VARDATA(result), VARSIZE(value) - VARHDRSZ_COMPRESS, diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c index f77deee399..920d9dd0d5 100644 --- a/src/backend/executor/nodeModifyTable.c +++ b/src/backend/executor/nodeModifyTable.c @@ -2117,7 +2117,7 @@ CompareCompressionMethodAndDecompress(TupleTableSlot *slot, TupleTableSlot *newslot = *outslot; /* - * If the called has passed an invalid slot then create a new slot. + * If the caller has passed an invalid slot then create a new slot. * Otherwise, just clear the existing tuple from the slot. This slot * should be stored by the caller so that it can be reused for * decompressing the subsequent tuples. diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index 18e8ecfd90..d8483c36b3 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -1183,8 +1183,8 @@ typedef struct ModifyTableState TupleTableSlot *mt_root_tuple_slot; /* - * Slot for storing the modified tuple, incase the target attribute's - * compression method doesn't match with the source table. + * Slot for storing the modified tuple, in case the target attribute's + * compression method doesn't match that of the source table. */ TupleTableSlot *mt_decompress_tuple_slot; -- 2.17.0 --m51xatjYGsM+13rf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v24-0006-alter-table-set-compression.patch" ^ permalink raw reply [nested|flat] 46+ messages in thread
* [PATCH v24 5/7] fixups.patch @ 2021-02-10 21:56 Robert Haas <[email protected]> 0 siblings, 0 replies; 46+ messages in thread From: Robert Haas @ 2021-02-10 21:56 UTC (permalink / raw) --- doc/src/sgml/ddl.sgml | 3 --- doc/src/sgml/ref/create_table.sgml | 15 +++++++++++---- src/backend/access/common/detoast.c | 5 ++--- src/backend/access/compression/compress_lz4.c | 10 +++++----- src/backend/executor/nodeModifyTable.c | 2 +- src/include/nodes/execnodes.h | 4 ++-- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml index 4d7ed698b9..1e9a4625cc 100644 --- a/doc/src/sgml/ddl.sgml +++ b/doc/src/sgml/ddl.sgml @@ -3762,9 +3762,6 @@ CREATE TABLE measurement ( <productname>PostgreSQL</productname> tables (or, possibly, foreign tables). It is possible to specify a tablespace and storage parameters for each partition separately. - By default, each column in a partition inherits the compression method - from parent table's column, however a different compression method can be - set for each partition. </para> <para> diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index 51a7a977a5..a4b297340f 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -997,10 +997,17 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM <term><literal>COMPRESSION <replaceable class="parameter">compression_method</replaceable></literal></term> <listitem> <para> - This sets the compression method for a column. The supported compression - methods are <literal>pglz</literal> and <literal>lz4</literal>. - <literal>lz4</literal> is available only if <literal>--with-lz4</literal> - was used when building <productname>PostgreSQL</productname>. The default + The <literal>COMPRESSION</literal> clause sets the compression method + for a column. Compression is supported only for variable-width data + types, and is used only for columns whose storage type is main or + extended. (See <xref linkend="sql-altertable"/> for information on + column storage types.) Setting this property for a partitioned table + has no direct effect, because such tables have no storage of their own, + but the configured value is inherited by newly-created partitions. + The supported compression methods are <literal>pglz</literal> and + <literal>lz4</literal>. <literal>lz4</literal> is available only if + <literal>--with-lz4</literal> was used when building + <productname>PostgreSQL</productname>. The default is <literal>pglz</literal>. </para> </listitem> diff --git a/src/backend/access/common/detoast.c b/src/backend/access/common/detoast.c index b78d49167b..95d5b1c12a 100644 --- a/src/backend/access/common/detoast.c +++ b/src/backend/access/common/detoast.c @@ -477,8 +477,8 @@ toast_get_compression_oid(struct varlena *attr) return InvalidOid; /* - * Just fetch the toast compress header to know the compression method - * in the compressed data. + * Fetch just enough of the value to examine the compression header, + * so that we can find out the compression method. */ attr = toast_fetch_datum_slice(attr, 0, VARHDRSZ_COMPRESS); } @@ -503,7 +503,6 @@ toast_get_compression_handler(struct varlena *attr) cmid = TOAST_COMPRESS_METHOD(attr); - /* Get the handler routines for the compression method */ switch (cmid) { case PGLZ_COMPRESSION_ID: diff --git a/src/backend/access/compression/compress_lz4.c b/src/backend/access/compression/compress_lz4.c index 1856cf7df7..3079eff7eb 100644 --- a/src/backend/access/compression/compress_lz4.c +++ b/src/backend/access/compression/compress_lz4.c @@ -23,7 +23,7 @@ /* * lz4_cmcompress - compression routine for lz4 compression method * - * Compresses source into dest using the default strategy. Returns the + * Compresses source into dest using the LZ4 defaults. Returns the * compressed varlena, or NULL if compression fails. */ static struct varlena * @@ -42,8 +42,8 @@ lz4_cmcompress(const struct varlena *value) valsize = VARSIZE_ANY_EXHDR(value); /* - * Get maximum size of the compressed data that lz4 compression may output - * and allocate the memory for holding the compressed data and the header. + * Figure out the maximum possible size of the LZ4 output, add the bytes + * that will be needed for varlena overhead, and allocate that amount. */ max_size = LZ4_compressBound(valsize); tmp = (struct varlena *) palloc(max_size + VARHDRSZ_COMPRESS); @@ -83,10 +83,10 @@ lz4_cmdecompress(const struct varlena *value) int32 rawsize; struct varlena *result; - /* allocate memory for holding the uncompressed data */ + /* allocate memory for the uncompressed data */ result = (struct varlena *) palloc(VARRAWSIZE_4B_C(value) + VARHDRSZ); - /* decompress data using lz4 routine */ + /* decompress the data */ rawsize = LZ4_decompress_safe((char *) value + VARHDRSZ_COMPRESS, VARDATA(result), VARSIZE(value) - VARHDRSZ_COMPRESS, diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c index f77deee399..920d9dd0d5 100644 --- a/src/backend/executor/nodeModifyTable.c +++ b/src/backend/executor/nodeModifyTable.c @@ -2117,7 +2117,7 @@ CompareCompressionMethodAndDecompress(TupleTableSlot *slot, TupleTableSlot *newslot = *outslot; /* - * If the called has passed an invalid slot then create a new slot. + * If the caller has passed an invalid slot then create a new slot. * Otherwise, just clear the existing tuple from the slot. This slot * should be stored by the caller so that it can be reused for * decompressing the subsequent tuples. diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index 18e8ecfd90..d8483c36b3 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -1183,8 +1183,8 @@ typedef struct ModifyTableState TupleTableSlot *mt_root_tuple_slot; /* - * Slot for storing the modified tuple, incase the target attribute's - * compression method doesn't match with the source table. + * Slot for storing the modified tuple, in case the target attribute's + * compression method doesn't match that of the source table. */ TupleTableSlot *mt_decompress_tuple_slot; -- 2.17.0 --YZ5djTAD1cGYuMQK Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v24-0006-alter-table-set-compression.patch" ^ permalink raw reply [nested|flat] 46+ messages in thread
* [PATCH v24 05/10] fixups.patch @ 2021-02-10 21:56 Robert Haas <[email protected]> 0 siblings, 0 replies; 46+ messages in thread From: Robert Haas @ 2021-02-10 21:56 UTC (permalink / raw) --- doc/src/sgml/ddl.sgml | 3 --- doc/src/sgml/ref/create_table.sgml | 15 +++++++++++---- src/backend/access/common/detoast.c | 5 ++--- src/backend/access/compression/compress_lz4.c | 10 +++++----- src/backend/executor/nodeModifyTable.c | 2 +- src/include/nodes/execnodes.h | 4 ++-- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml index 4d7ed698b9..1e9a4625cc 100644 --- a/doc/src/sgml/ddl.sgml +++ b/doc/src/sgml/ddl.sgml @@ -3762,9 +3762,6 @@ CREATE TABLE measurement ( <productname>PostgreSQL</productname> tables (or, possibly, foreign tables). It is possible to specify a tablespace and storage parameters for each partition separately. - By default, each column in a partition inherits the compression method - from parent table's column, however a different compression method can be - set for each partition. </para> <para> diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index 51a7a977a5..a4b297340f 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -997,10 +997,17 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM <term><literal>COMPRESSION <replaceable class="parameter">compression_method</replaceable></literal></term> <listitem> <para> - This sets the compression method for a column. The supported compression - methods are <literal>pglz</literal> and <literal>lz4</literal>. - <literal>lz4</literal> is available only if <literal>--with-lz4</literal> - was used when building <productname>PostgreSQL</productname>. The default + The <literal>COMPRESSION</literal> clause sets the compression method + for a column. Compression is supported only for variable-width data + types, and is used only for columns whose storage type is main or + extended. (See <xref linkend="sql-altertable"/> for information on + column storage types.) Setting this property for a partitioned table + has no direct effect, because such tables have no storage of their own, + but the configured value is inherited by newly-created partitions. + The supported compression methods are <literal>pglz</literal> and + <literal>lz4</literal>. <literal>lz4</literal> is available only if + <literal>--with-lz4</literal> was used when building + <productname>PostgreSQL</productname>. The default is <literal>pglz</literal>. </para> </listitem> diff --git a/src/backend/access/common/detoast.c b/src/backend/access/common/detoast.c index b78d49167b..95d5b1c12a 100644 --- a/src/backend/access/common/detoast.c +++ b/src/backend/access/common/detoast.c @@ -477,8 +477,8 @@ toast_get_compression_oid(struct varlena *attr) return InvalidOid; /* - * Just fetch the toast compress header to know the compression method - * in the compressed data. + * Fetch just enough of the value to examine the compression header, + * so that we can find out the compression method. */ attr = toast_fetch_datum_slice(attr, 0, VARHDRSZ_COMPRESS); } @@ -503,7 +503,6 @@ toast_get_compression_handler(struct varlena *attr) cmid = TOAST_COMPRESS_METHOD(attr); - /* Get the handler routines for the compression method */ switch (cmid) { case PGLZ_COMPRESSION_ID: diff --git a/src/backend/access/compression/compress_lz4.c b/src/backend/access/compression/compress_lz4.c index 1856cf7df7..3079eff7eb 100644 --- a/src/backend/access/compression/compress_lz4.c +++ b/src/backend/access/compression/compress_lz4.c @@ -23,7 +23,7 @@ /* * lz4_cmcompress - compression routine for lz4 compression method * - * Compresses source into dest using the default strategy. Returns the + * Compresses source into dest using the LZ4 defaults. Returns the * compressed varlena, or NULL if compression fails. */ static struct varlena * @@ -42,8 +42,8 @@ lz4_cmcompress(const struct varlena *value) valsize = VARSIZE_ANY_EXHDR(value); /* - * Get maximum size of the compressed data that lz4 compression may output - * and allocate the memory for holding the compressed data and the header. + * Figure out the maximum possible size of the LZ4 output, add the bytes + * that will be needed for varlena overhead, and allocate that amount. */ max_size = LZ4_compressBound(valsize); tmp = (struct varlena *) palloc(max_size + VARHDRSZ_COMPRESS); @@ -83,10 +83,10 @@ lz4_cmdecompress(const struct varlena *value) int32 rawsize; struct varlena *result; - /* allocate memory for holding the uncompressed data */ + /* allocate memory for the uncompressed data */ result = (struct varlena *) palloc(VARRAWSIZE_4B_C(value) + VARHDRSZ); - /* decompress data using lz4 routine */ + /* decompress the data */ rawsize = LZ4_decompress_safe((char *) value + VARHDRSZ_COMPRESS, VARDATA(result), VARSIZE(value) - VARHDRSZ_COMPRESS, diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c index f77deee399..920d9dd0d5 100644 --- a/src/backend/executor/nodeModifyTable.c +++ b/src/backend/executor/nodeModifyTable.c @@ -2117,7 +2117,7 @@ CompareCompressionMethodAndDecompress(TupleTableSlot *slot, TupleTableSlot *newslot = *outslot; /* - * If the called has passed an invalid slot then create a new slot. + * If the caller has passed an invalid slot then create a new slot. * Otherwise, just clear the existing tuple from the slot. This slot * should be stored by the caller so that it can be reused for * decompressing the subsequent tuples. diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index 18e8ecfd90..d8483c36b3 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -1183,8 +1183,8 @@ typedef struct ModifyTableState TupleTableSlot *mt_root_tuple_slot; /* - * Slot for storing the modified tuple, incase the target attribute's - * compression method doesn't match with the source table. + * Slot for storing the modified tuple, in case the target attribute's + * compression method doesn't match that of the source table. */ TupleTableSlot *mt_decompress_tuple_slot; -- 2.17.0 --m51xatjYGsM+13rf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v24-0006-alter-table-set-compression.patch" ^ permalink raw reply [nested|flat] 46+ messages in thread
* [PATCH v24 05/10] fixups.patch @ 2021-02-10 21:56 Robert Haas <[email protected]> 0 siblings, 0 replies; 46+ messages in thread From: Robert Haas @ 2021-02-10 21:56 UTC (permalink / raw) --- doc/src/sgml/ddl.sgml | 3 --- doc/src/sgml/ref/create_table.sgml | 15 +++++++++++---- src/backend/access/common/detoast.c | 5 ++--- src/backend/access/compression/compress_lz4.c | 10 +++++----- src/backend/executor/nodeModifyTable.c | 2 +- src/include/nodes/execnodes.h | 4 ++-- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml index 4d7ed698b9..1e9a4625cc 100644 --- a/doc/src/sgml/ddl.sgml +++ b/doc/src/sgml/ddl.sgml @@ -3762,9 +3762,6 @@ CREATE TABLE measurement ( <productname>PostgreSQL</productname> tables (or, possibly, foreign tables). It is possible to specify a tablespace and storage parameters for each partition separately. - By default, each column in a partition inherits the compression method - from parent table's column, however a different compression method can be - set for each partition. </para> <para> diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index 51a7a977a5..a4b297340f 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -997,10 +997,17 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM <term><literal>COMPRESSION <replaceable class="parameter">compression_method</replaceable></literal></term> <listitem> <para> - This sets the compression method for a column. The supported compression - methods are <literal>pglz</literal> and <literal>lz4</literal>. - <literal>lz4</literal> is available only if <literal>--with-lz4</literal> - was used when building <productname>PostgreSQL</productname>. The default + The <literal>COMPRESSION</literal> clause sets the compression method + for a column. Compression is supported only for variable-width data + types, and is used only for columns whose storage type is main or + extended. (See <xref linkend="sql-altertable"/> for information on + column storage types.) Setting this property for a partitioned table + has no direct effect, because such tables have no storage of their own, + but the configured value is inherited by newly-created partitions. + The supported compression methods are <literal>pglz</literal> and + <literal>lz4</literal>. <literal>lz4</literal> is available only if + <literal>--with-lz4</literal> was used when building + <productname>PostgreSQL</productname>. The default is <literal>pglz</literal>. </para> </listitem> diff --git a/src/backend/access/common/detoast.c b/src/backend/access/common/detoast.c index b78d49167b..95d5b1c12a 100644 --- a/src/backend/access/common/detoast.c +++ b/src/backend/access/common/detoast.c @@ -477,8 +477,8 @@ toast_get_compression_oid(struct varlena *attr) return InvalidOid; /* - * Just fetch the toast compress header to know the compression method - * in the compressed data. + * Fetch just enough of the value to examine the compression header, + * so that we can find out the compression method. */ attr = toast_fetch_datum_slice(attr, 0, VARHDRSZ_COMPRESS); } @@ -503,7 +503,6 @@ toast_get_compression_handler(struct varlena *attr) cmid = TOAST_COMPRESS_METHOD(attr); - /* Get the handler routines for the compression method */ switch (cmid) { case PGLZ_COMPRESSION_ID: diff --git a/src/backend/access/compression/compress_lz4.c b/src/backend/access/compression/compress_lz4.c index 1856cf7df7..3079eff7eb 100644 --- a/src/backend/access/compression/compress_lz4.c +++ b/src/backend/access/compression/compress_lz4.c @@ -23,7 +23,7 @@ /* * lz4_cmcompress - compression routine for lz4 compression method * - * Compresses source into dest using the default strategy. Returns the + * Compresses source into dest using the LZ4 defaults. Returns the * compressed varlena, or NULL if compression fails. */ static struct varlena * @@ -42,8 +42,8 @@ lz4_cmcompress(const struct varlena *value) valsize = VARSIZE_ANY_EXHDR(value); /* - * Get maximum size of the compressed data that lz4 compression may output - * and allocate the memory for holding the compressed data and the header. + * Figure out the maximum possible size of the LZ4 output, add the bytes + * that will be needed for varlena overhead, and allocate that amount. */ max_size = LZ4_compressBound(valsize); tmp = (struct varlena *) palloc(max_size + VARHDRSZ_COMPRESS); @@ -83,10 +83,10 @@ lz4_cmdecompress(const struct varlena *value) int32 rawsize; struct varlena *result; - /* allocate memory for holding the uncompressed data */ + /* allocate memory for the uncompressed data */ result = (struct varlena *) palloc(VARRAWSIZE_4B_C(value) + VARHDRSZ); - /* decompress data using lz4 routine */ + /* decompress the data */ rawsize = LZ4_decompress_safe((char *) value + VARHDRSZ_COMPRESS, VARDATA(result), VARSIZE(value) - VARHDRSZ_COMPRESS, diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c index f77deee399..920d9dd0d5 100644 --- a/src/backend/executor/nodeModifyTable.c +++ b/src/backend/executor/nodeModifyTable.c @@ -2117,7 +2117,7 @@ CompareCompressionMethodAndDecompress(TupleTableSlot *slot, TupleTableSlot *newslot = *outslot; /* - * If the called has passed an invalid slot then create a new slot. + * If the caller has passed an invalid slot then create a new slot. * Otherwise, just clear the existing tuple from the slot. This slot * should be stored by the caller so that it can be reused for * decompressing the subsequent tuples. diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index 18e8ecfd90..d8483c36b3 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -1183,8 +1183,8 @@ typedef struct ModifyTableState TupleTableSlot *mt_root_tuple_slot; /* - * Slot for storing the modified tuple, incase the target attribute's - * compression method doesn't match with the source table. + * Slot for storing the modified tuple, in case the target attribute's + * compression method doesn't match that of the source table. */ TupleTableSlot *mt_decompress_tuple_slot; -- 2.17.0 --m51xatjYGsM+13rf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v24-0006-alter-table-set-compression.patch" ^ permalink raw reply [nested|flat] 46+ messages in thread
* [PATCH v24 5/7] fixups.patch @ 2021-02-10 21:56 Robert Haas <[email protected]> 0 siblings, 0 replies; 46+ messages in thread From: Robert Haas @ 2021-02-10 21:56 UTC (permalink / raw) --- doc/src/sgml/ddl.sgml | 3 --- doc/src/sgml/ref/create_table.sgml | 15 +++++++++++---- src/backend/access/common/detoast.c | 5 ++--- src/backend/access/compression/compress_lz4.c | 10 +++++----- src/backend/executor/nodeModifyTable.c | 2 +- src/include/nodes/execnodes.h | 4 ++-- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml index 4d7ed698b9..1e9a4625cc 100644 --- a/doc/src/sgml/ddl.sgml +++ b/doc/src/sgml/ddl.sgml @@ -3762,9 +3762,6 @@ CREATE TABLE measurement ( <productname>PostgreSQL</productname> tables (or, possibly, foreign tables). It is possible to specify a tablespace and storage parameters for each partition separately. - By default, each column in a partition inherits the compression method - from parent table's column, however a different compression method can be - set for each partition. </para> <para> diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index 51a7a977a5..a4b297340f 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -997,10 +997,17 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM <term><literal>COMPRESSION <replaceable class="parameter">compression_method</replaceable></literal></term> <listitem> <para> - This sets the compression method for a column. The supported compression - methods are <literal>pglz</literal> and <literal>lz4</literal>. - <literal>lz4</literal> is available only if <literal>--with-lz4</literal> - was used when building <productname>PostgreSQL</productname>. The default + The <literal>COMPRESSION</literal> clause sets the compression method + for a column. Compression is supported only for variable-width data + types, and is used only for columns whose storage type is main or + extended. (See <xref linkend="sql-altertable"/> for information on + column storage types.) Setting this property for a partitioned table + has no direct effect, because such tables have no storage of their own, + but the configured value is inherited by newly-created partitions. + The supported compression methods are <literal>pglz</literal> and + <literal>lz4</literal>. <literal>lz4</literal> is available only if + <literal>--with-lz4</literal> was used when building + <productname>PostgreSQL</productname>. The default is <literal>pglz</literal>. </para> </listitem> diff --git a/src/backend/access/common/detoast.c b/src/backend/access/common/detoast.c index b78d49167b..95d5b1c12a 100644 --- a/src/backend/access/common/detoast.c +++ b/src/backend/access/common/detoast.c @@ -477,8 +477,8 @@ toast_get_compression_oid(struct varlena *attr) return InvalidOid; /* - * Just fetch the toast compress header to know the compression method - * in the compressed data. + * Fetch just enough of the value to examine the compression header, + * so that we can find out the compression method. */ attr = toast_fetch_datum_slice(attr, 0, VARHDRSZ_COMPRESS); } @@ -503,7 +503,6 @@ toast_get_compression_handler(struct varlena *attr) cmid = TOAST_COMPRESS_METHOD(attr); - /* Get the handler routines for the compression method */ switch (cmid) { case PGLZ_COMPRESSION_ID: diff --git a/src/backend/access/compression/compress_lz4.c b/src/backend/access/compression/compress_lz4.c index 1856cf7df7..3079eff7eb 100644 --- a/src/backend/access/compression/compress_lz4.c +++ b/src/backend/access/compression/compress_lz4.c @@ -23,7 +23,7 @@ /* * lz4_cmcompress - compression routine for lz4 compression method * - * Compresses source into dest using the default strategy. Returns the + * Compresses source into dest using the LZ4 defaults. Returns the * compressed varlena, or NULL if compression fails. */ static struct varlena * @@ -42,8 +42,8 @@ lz4_cmcompress(const struct varlena *value) valsize = VARSIZE_ANY_EXHDR(value); /* - * Get maximum size of the compressed data that lz4 compression may output - * and allocate the memory for holding the compressed data and the header. + * Figure out the maximum possible size of the LZ4 output, add the bytes + * that will be needed for varlena overhead, and allocate that amount. */ max_size = LZ4_compressBound(valsize); tmp = (struct varlena *) palloc(max_size + VARHDRSZ_COMPRESS); @@ -83,10 +83,10 @@ lz4_cmdecompress(const struct varlena *value) int32 rawsize; struct varlena *result; - /* allocate memory for holding the uncompressed data */ + /* allocate memory for the uncompressed data */ result = (struct varlena *) palloc(VARRAWSIZE_4B_C(value) + VARHDRSZ); - /* decompress data using lz4 routine */ + /* decompress the data */ rawsize = LZ4_decompress_safe((char *) value + VARHDRSZ_COMPRESS, VARDATA(result), VARSIZE(value) - VARHDRSZ_COMPRESS, diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c index f77deee399..920d9dd0d5 100644 --- a/src/backend/executor/nodeModifyTable.c +++ b/src/backend/executor/nodeModifyTable.c @@ -2117,7 +2117,7 @@ CompareCompressionMethodAndDecompress(TupleTableSlot *slot, TupleTableSlot *newslot = *outslot; /* - * If the called has passed an invalid slot then create a new slot. + * If the caller has passed an invalid slot then create a new slot. * Otherwise, just clear the existing tuple from the slot. This slot * should be stored by the caller so that it can be reused for * decompressing the subsequent tuples. diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index 18e8ecfd90..d8483c36b3 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -1183,8 +1183,8 @@ typedef struct ModifyTableState TupleTableSlot *mt_root_tuple_slot; /* - * Slot for storing the modified tuple, incase the target attribute's - * compression method doesn't match with the source table. + * Slot for storing the modified tuple, in case the target attribute's + * compression method doesn't match that of the source table. */ TupleTableSlot *mt_decompress_tuple_slot; -- 2.17.0 --YZ5djTAD1cGYuMQK Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v24-0006-alter-table-set-compression.patch" ^ permalink raw reply [nested|flat] 46+ messages in thread
* [PATCH v24 05/10] fixups.patch @ 2021-02-10 21:56 Robert Haas <[email protected]> 0 siblings, 0 replies; 46+ messages in thread From: Robert Haas @ 2021-02-10 21:56 UTC (permalink / raw) --- doc/src/sgml/ddl.sgml | 3 --- doc/src/sgml/ref/create_table.sgml | 15 +++++++++++---- src/backend/access/common/detoast.c | 5 ++--- src/backend/access/compression/compress_lz4.c | 10 +++++----- src/backend/executor/nodeModifyTable.c | 2 +- src/include/nodes/execnodes.h | 4 ++-- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml index 4d7ed698b9..1e9a4625cc 100644 --- a/doc/src/sgml/ddl.sgml +++ b/doc/src/sgml/ddl.sgml @@ -3762,9 +3762,6 @@ CREATE TABLE measurement ( <productname>PostgreSQL</productname> tables (or, possibly, foreign tables). It is possible to specify a tablespace and storage parameters for each partition separately. - By default, each column in a partition inherits the compression method - from parent table's column, however a different compression method can be - set for each partition. </para> <para> diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index 51a7a977a5..a4b297340f 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -997,10 +997,17 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM <term><literal>COMPRESSION <replaceable class="parameter">compression_method</replaceable></literal></term> <listitem> <para> - This sets the compression method for a column. The supported compression - methods are <literal>pglz</literal> and <literal>lz4</literal>. - <literal>lz4</literal> is available only if <literal>--with-lz4</literal> - was used when building <productname>PostgreSQL</productname>. The default + The <literal>COMPRESSION</literal> clause sets the compression method + for a column. Compression is supported only for variable-width data + types, and is used only for columns whose storage type is main or + extended. (See <xref linkend="sql-altertable"/> for information on + column storage types.) Setting this property for a partitioned table + has no direct effect, because such tables have no storage of their own, + but the configured value is inherited by newly-created partitions. + The supported compression methods are <literal>pglz</literal> and + <literal>lz4</literal>. <literal>lz4</literal> is available only if + <literal>--with-lz4</literal> was used when building + <productname>PostgreSQL</productname>. The default is <literal>pglz</literal>. </para> </listitem> diff --git a/src/backend/access/common/detoast.c b/src/backend/access/common/detoast.c index b78d49167b..95d5b1c12a 100644 --- a/src/backend/access/common/detoast.c +++ b/src/backend/access/common/detoast.c @@ -477,8 +477,8 @@ toast_get_compression_oid(struct varlena *attr) return InvalidOid; /* - * Just fetch the toast compress header to know the compression method - * in the compressed data. + * Fetch just enough of the value to examine the compression header, + * so that we can find out the compression method. */ attr = toast_fetch_datum_slice(attr, 0, VARHDRSZ_COMPRESS); } @@ -503,7 +503,6 @@ toast_get_compression_handler(struct varlena *attr) cmid = TOAST_COMPRESS_METHOD(attr); - /* Get the handler routines for the compression method */ switch (cmid) { case PGLZ_COMPRESSION_ID: diff --git a/src/backend/access/compression/compress_lz4.c b/src/backend/access/compression/compress_lz4.c index 1856cf7df7..3079eff7eb 100644 --- a/src/backend/access/compression/compress_lz4.c +++ b/src/backend/access/compression/compress_lz4.c @@ -23,7 +23,7 @@ /* * lz4_cmcompress - compression routine for lz4 compression method * - * Compresses source into dest using the default strategy. Returns the + * Compresses source into dest using the LZ4 defaults. Returns the * compressed varlena, or NULL if compression fails. */ static struct varlena * @@ -42,8 +42,8 @@ lz4_cmcompress(const struct varlena *value) valsize = VARSIZE_ANY_EXHDR(value); /* - * Get maximum size of the compressed data that lz4 compression may output - * and allocate the memory for holding the compressed data and the header. + * Figure out the maximum possible size of the LZ4 output, add the bytes + * that will be needed for varlena overhead, and allocate that amount. */ max_size = LZ4_compressBound(valsize); tmp = (struct varlena *) palloc(max_size + VARHDRSZ_COMPRESS); @@ -83,10 +83,10 @@ lz4_cmdecompress(const struct varlena *value) int32 rawsize; struct varlena *result; - /* allocate memory for holding the uncompressed data */ + /* allocate memory for the uncompressed data */ result = (struct varlena *) palloc(VARRAWSIZE_4B_C(value) + VARHDRSZ); - /* decompress data using lz4 routine */ + /* decompress the data */ rawsize = LZ4_decompress_safe((char *) value + VARHDRSZ_COMPRESS, VARDATA(result), VARSIZE(value) - VARHDRSZ_COMPRESS, diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c index f77deee399..920d9dd0d5 100644 --- a/src/backend/executor/nodeModifyTable.c +++ b/src/backend/executor/nodeModifyTable.c @@ -2117,7 +2117,7 @@ CompareCompressionMethodAndDecompress(TupleTableSlot *slot, TupleTableSlot *newslot = *outslot; /* - * If the called has passed an invalid slot then create a new slot. + * If the caller has passed an invalid slot then create a new slot. * Otherwise, just clear the existing tuple from the slot. This slot * should be stored by the caller so that it can be reused for * decompressing the subsequent tuples. diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index 18e8ecfd90..d8483c36b3 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -1183,8 +1183,8 @@ typedef struct ModifyTableState TupleTableSlot *mt_root_tuple_slot; /* - * Slot for storing the modified tuple, incase the target attribute's - * compression method doesn't match with the source table. + * Slot for storing the modified tuple, in case the target attribute's + * compression method doesn't match that of the source table. */ TupleTableSlot *mt_decompress_tuple_slot; -- 2.17.0 --m51xatjYGsM+13rf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v24-0006-alter-table-set-compression.patch" ^ permalink raw reply [nested|flat] 46+ messages in thread
* [PATCH v24 5/7] fixups.patch @ 2021-02-10 21:56 Robert Haas <[email protected]> 0 siblings, 0 replies; 46+ messages in thread From: Robert Haas @ 2021-02-10 21:56 UTC (permalink / raw) --- doc/src/sgml/ddl.sgml | 3 --- doc/src/sgml/ref/create_table.sgml | 15 +++++++++++---- src/backend/access/common/detoast.c | 5 ++--- src/backend/access/compression/compress_lz4.c | 10 +++++----- src/backend/executor/nodeModifyTable.c | 2 +- src/include/nodes/execnodes.h | 4 ++-- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml index 4d7ed698b9..1e9a4625cc 100644 --- a/doc/src/sgml/ddl.sgml +++ b/doc/src/sgml/ddl.sgml @@ -3762,9 +3762,6 @@ CREATE TABLE measurement ( <productname>PostgreSQL</productname> tables (or, possibly, foreign tables). It is possible to specify a tablespace and storage parameters for each partition separately. - By default, each column in a partition inherits the compression method - from parent table's column, however a different compression method can be - set for each partition. </para> <para> diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index 51a7a977a5..a4b297340f 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -997,10 +997,17 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM <term><literal>COMPRESSION <replaceable class="parameter">compression_method</replaceable></literal></term> <listitem> <para> - This sets the compression method for a column. The supported compression - methods are <literal>pglz</literal> and <literal>lz4</literal>. - <literal>lz4</literal> is available only if <literal>--with-lz4</literal> - was used when building <productname>PostgreSQL</productname>. The default + The <literal>COMPRESSION</literal> clause sets the compression method + for a column. Compression is supported only for variable-width data + types, and is used only for columns whose storage type is main or + extended. (See <xref linkend="sql-altertable"/> for information on + column storage types.) Setting this property for a partitioned table + has no direct effect, because such tables have no storage of their own, + but the configured value is inherited by newly-created partitions. + The supported compression methods are <literal>pglz</literal> and + <literal>lz4</literal>. <literal>lz4</literal> is available only if + <literal>--with-lz4</literal> was used when building + <productname>PostgreSQL</productname>. The default is <literal>pglz</literal>. </para> </listitem> diff --git a/src/backend/access/common/detoast.c b/src/backend/access/common/detoast.c index b78d49167b..95d5b1c12a 100644 --- a/src/backend/access/common/detoast.c +++ b/src/backend/access/common/detoast.c @@ -477,8 +477,8 @@ toast_get_compression_oid(struct varlena *attr) return InvalidOid; /* - * Just fetch the toast compress header to know the compression method - * in the compressed data. + * Fetch just enough of the value to examine the compression header, + * so that we can find out the compression method. */ attr = toast_fetch_datum_slice(attr, 0, VARHDRSZ_COMPRESS); } @@ -503,7 +503,6 @@ toast_get_compression_handler(struct varlena *attr) cmid = TOAST_COMPRESS_METHOD(attr); - /* Get the handler routines for the compression method */ switch (cmid) { case PGLZ_COMPRESSION_ID: diff --git a/src/backend/access/compression/compress_lz4.c b/src/backend/access/compression/compress_lz4.c index 1856cf7df7..3079eff7eb 100644 --- a/src/backend/access/compression/compress_lz4.c +++ b/src/backend/access/compression/compress_lz4.c @@ -23,7 +23,7 @@ /* * lz4_cmcompress - compression routine for lz4 compression method * - * Compresses source into dest using the default strategy. Returns the + * Compresses source into dest using the LZ4 defaults. Returns the * compressed varlena, or NULL if compression fails. */ static struct varlena * @@ -42,8 +42,8 @@ lz4_cmcompress(const struct varlena *value) valsize = VARSIZE_ANY_EXHDR(value); /* - * Get maximum size of the compressed data that lz4 compression may output - * and allocate the memory for holding the compressed data and the header. + * Figure out the maximum possible size of the LZ4 output, add the bytes + * that will be needed for varlena overhead, and allocate that amount. */ max_size = LZ4_compressBound(valsize); tmp = (struct varlena *) palloc(max_size + VARHDRSZ_COMPRESS); @@ -83,10 +83,10 @@ lz4_cmdecompress(const struct varlena *value) int32 rawsize; struct varlena *result; - /* allocate memory for holding the uncompressed data */ + /* allocate memory for the uncompressed data */ result = (struct varlena *) palloc(VARRAWSIZE_4B_C(value) + VARHDRSZ); - /* decompress data using lz4 routine */ + /* decompress the data */ rawsize = LZ4_decompress_safe((char *) value + VARHDRSZ_COMPRESS, VARDATA(result), VARSIZE(value) - VARHDRSZ_COMPRESS, diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c index f77deee399..920d9dd0d5 100644 --- a/src/backend/executor/nodeModifyTable.c +++ b/src/backend/executor/nodeModifyTable.c @@ -2117,7 +2117,7 @@ CompareCompressionMethodAndDecompress(TupleTableSlot *slot, TupleTableSlot *newslot = *outslot; /* - * If the called has passed an invalid slot then create a new slot. + * If the caller has passed an invalid slot then create a new slot. * Otherwise, just clear the existing tuple from the slot. This slot * should be stored by the caller so that it can be reused for * decompressing the subsequent tuples. diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index 18e8ecfd90..d8483c36b3 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -1183,8 +1183,8 @@ typedef struct ModifyTableState TupleTableSlot *mt_root_tuple_slot; /* - * Slot for storing the modified tuple, incase the target attribute's - * compression method doesn't match with the source table. + * Slot for storing the modified tuple, in case the target attribute's + * compression method doesn't match that of the source table. */ TupleTableSlot *mt_decompress_tuple_slot; -- 2.17.0 --YZ5djTAD1cGYuMQK Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v24-0006-alter-table-set-compression.patch" ^ permalink raw reply [nested|flat] 46+ messages in thread
* [PATCH v24 5/7] fixups.patch @ 2021-02-10 21:56 Robert Haas <[email protected]> 0 siblings, 0 replies; 46+ messages in thread From: Robert Haas @ 2021-02-10 21:56 UTC (permalink / raw) --- doc/src/sgml/ddl.sgml | 3 --- doc/src/sgml/ref/create_table.sgml | 15 +++++++++++---- src/backend/access/common/detoast.c | 5 ++--- src/backend/access/compression/compress_lz4.c | 10 +++++----- src/backend/executor/nodeModifyTable.c | 2 +- src/include/nodes/execnodes.h | 4 ++-- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml index 4d7ed698b9..1e9a4625cc 100644 --- a/doc/src/sgml/ddl.sgml +++ b/doc/src/sgml/ddl.sgml @@ -3762,9 +3762,6 @@ CREATE TABLE measurement ( <productname>PostgreSQL</productname> tables (or, possibly, foreign tables). It is possible to specify a tablespace and storage parameters for each partition separately. - By default, each column in a partition inherits the compression method - from parent table's column, however a different compression method can be - set for each partition. </para> <para> diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index 51a7a977a5..a4b297340f 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -997,10 +997,17 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM <term><literal>COMPRESSION <replaceable class="parameter">compression_method</replaceable></literal></term> <listitem> <para> - This sets the compression method for a column. The supported compression - methods are <literal>pglz</literal> and <literal>lz4</literal>. - <literal>lz4</literal> is available only if <literal>--with-lz4</literal> - was used when building <productname>PostgreSQL</productname>. The default + The <literal>COMPRESSION</literal> clause sets the compression method + for a column. Compression is supported only for variable-width data + types, and is used only for columns whose storage type is main or + extended. (See <xref linkend="sql-altertable"/> for information on + column storage types.) Setting this property for a partitioned table + has no direct effect, because such tables have no storage of their own, + but the configured value is inherited by newly-created partitions. + The supported compression methods are <literal>pglz</literal> and + <literal>lz4</literal>. <literal>lz4</literal> is available only if + <literal>--with-lz4</literal> was used when building + <productname>PostgreSQL</productname>. The default is <literal>pglz</literal>. </para> </listitem> diff --git a/src/backend/access/common/detoast.c b/src/backend/access/common/detoast.c index b78d49167b..95d5b1c12a 100644 --- a/src/backend/access/common/detoast.c +++ b/src/backend/access/common/detoast.c @@ -477,8 +477,8 @@ toast_get_compression_oid(struct varlena *attr) return InvalidOid; /* - * Just fetch the toast compress header to know the compression method - * in the compressed data. + * Fetch just enough of the value to examine the compression header, + * so that we can find out the compression method. */ attr = toast_fetch_datum_slice(attr, 0, VARHDRSZ_COMPRESS); } @@ -503,7 +503,6 @@ toast_get_compression_handler(struct varlena *attr) cmid = TOAST_COMPRESS_METHOD(attr); - /* Get the handler routines for the compression method */ switch (cmid) { case PGLZ_COMPRESSION_ID: diff --git a/src/backend/access/compression/compress_lz4.c b/src/backend/access/compression/compress_lz4.c index 1856cf7df7..3079eff7eb 100644 --- a/src/backend/access/compression/compress_lz4.c +++ b/src/backend/access/compression/compress_lz4.c @@ -23,7 +23,7 @@ /* * lz4_cmcompress - compression routine for lz4 compression method * - * Compresses source into dest using the default strategy. Returns the + * Compresses source into dest using the LZ4 defaults. Returns the * compressed varlena, or NULL if compression fails. */ static struct varlena * @@ -42,8 +42,8 @@ lz4_cmcompress(const struct varlena *value) valsize = VARSIZE_ANY_EXHDR(value); /* - * Get maximum size of the compressed data that lz4 compression may output - * and allocate the memory for holding the compressed data and the header. + * Figure out the maximum possible size of the LZ4 output, add the bytes + * that will be needed for varlena overhead, and allocate that amount. */ max_size = LZ4_compressBound(valsize); tmp = (struct varlena *) palloc(max_size + VARHDRSZ_COMPRESS); @@ -83,10 +83,10 @@ lz4_cmdecompress(const struct varlena *value) int32 rawsize; struct varlena *result; - /* allocate memory for holding the uncompressed data */ + /* allocate memory for the uncompressed data */ result = (struct varlena *) palloc(VARRAWSIZE_4B_C(value) + VARHDRSZ); - /* decompress data using lz4 routine */ + /* decompress the data */ rawsize = LZ4_decompress_safe((char *) value + VARHDRSZ_COMPRESS, VARDATA(result), VARSIZE(value) - VARHDRSZ_COMPRESS, diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c index f77deee399..920d9dd0d5 100644 --- a/src/backend/executor/nodeModifyTable.c +++ b/src/backend/executor/nodeModifyTable.c @@ -2117,7 +2117,7 @@ CompareCompressionMethodAndDecompress(TupleTableSlot *slot, TupleTableSlot *newslot = *outslot; /* - * If the called has passed an invalid slot then create a new slot. + * If the caller has passed an invalid slot then create a new slot. * Otherwise, just clear the existing tuple from the slot. This slot * should be stored by the caller so that it can be reused for * decompressing the subsequent tuples. diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index 18e8ecfd90..d8483c36b3 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -1183,8 +1183,8 @@ typedef struct ModifyTableState TupleTableSlot *mt_root_tuple_slot; /* - * Slot for storing the modified tuple, incase the target attribute's - * compression method doesn't match with the source table. + * Slot for storing the modified tuple, in case the target attribute's + * compression method doesn't match that of the source table. */ TupleTableSlot *mt_decompress_tuple_slot; -- 2.17.0 --YZ5djTAD1cGYuMQK Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v24-0006-alter-table-set-compression.patch" ^ permalink raw reply [nested|flat] 46+ messages in thread
* [PATCH v24 5/7] fixups.patch @ 2021-02-10 21:56 Robert Haas <[email protected]> 0 siblings, 0 replies; 46+ messages in thread From: Robert Haas @ 2021-02-10 21:56 UTC (permalink / raw) --- doc/src/sgml/ddl.sgml | 3 --- doc/src/sgml/ref/create_table.sgml | 15 +++++++++++---- src/backend/access/common/detoast.c | 5 ++--- src/backend/access/compression/compress_lz4.c | 10 +++++----- src/backend/executor/nodeModifyTable.c | 2 +- src/include/nodes/execnodes.h | 4 ++-- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml index 4d7ed698b9..1e9a4625cc 100644 --- a/doc/src/sgml/ddl.sgml +++ b/doc/src/sgml/ddl.sgml @@ -3762,9 +3762,6 @@ CREATE TABLE measurement ( <productname>PostgreSQL</productname> tables (or, possibly, foreign tables). It is possible to specify a tablespace and storage parameters for each partition separately. - By default, each column in a partition inherits the compression method - from parent table's column, however a different compression method can be - set for each partition. </para> <para> diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index 51a7a977a5..a4b297340f 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -997,10 +997,17 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM <term><literal>COMPRESSION <replaceable class="parameter">compression_method</replaceable></literal></term> <listitem> <para> - This sets the compression method for a column. The supported compression - methods are <literal>pglz</literal> and <literal>lz4</literal>. - <literal>lz4</literal> is available only if <literal>--with-lz4</literal> - was used when building <productname>PostgreSQL</productname>. The default + The <literal>COMPRESSION</literal> clause sets the compression method + for a column. Compression is supported only for variable-width data + types, and is used only for columns whose storage type is main or + extended. (See <xref linkend="sql-altertable"/> for information on + column storage types.) Setting this property for a partitioned table + has no direct effect, because such tables have no storage of their own, + but the configured value is inherited by newly-created partitions. + The supported compression methods are <literal>pglz</literal> and + <literal>lz4</literal>. <literal>lz4</literal> is available only if + <literal>--with-lz4</literal> was used when building + <productname>PostgreSQL</productname>. The default is <literal>pglz</literal>. </para> </listitem> diff --git a/src/backend/access/common/detoast.c b/src/backend/access/common/detoast.c index b78d49167b..95d5b1c12a 100644 --- a/src/backend/access/common/detoast.c +++ b/src/backend/access/common/detoast.c @@ -477,8 +477,8 @@ toast_get_compression_oid(struct varlena *attr) return InvalidOid; /* - * Just fetch the toast compress header to know the compression method - * in the compressed data. + * Fetch just enough of the value to examine the compression header, + * so that we can find out the compression method. */ attr = toast_fetch_datum_slice(attr, 0, VARHDRSZ_COMPRESS); } @@ -503,7 +503,6 @@ toast_get_compression_handler(struct varlena *attr) cmid = TOAST_COMPRESS_METHOD(attr); - /* Get the handler routines for the compression method */ switch (cmid) { case PGLZ_COMPRESSION_ID: diff --git a/src/backend/access/compression/compress_lz4.c b/src/backend/access/compression/compress_lz4.c index 1856cf7df7..3079eff7eb 100644 --- a/src/backend/access/compression/compress_lz4.c +++ b/src/backend/access/compression/compress_lz4.c @@ -23,7 +23,7 @@ /* * lz4_cmcompress - compression routine for lz4 compression method * - * Compresses source into dest using the default strategy. Returns the + * Compresses source into dest using the LZ4 defaults. Returns the * compressed varlena, or NULL if compression fails. */ static struct varlena * @@ -42,8 +42,8 @@ lz4_cmcompress(const struct varlena *value) valsize = VARSIZE_ANY_EXHDR(value); /* - * Get maximum size of the compressed data that lz4 compression may output - * and allocate the memory for holding the compressed data and the header. + * Figure out the maximum possible size of the LZ4 output, add the bytes + * that will be needed for varlena overhead, and allocate that amount. */ max_size = LZ4_compressBound(valsize); tmp = (struct varlena *) palloc(max_size + VARHDRSZ_COMPRESS); @@ -83,10 +83,10 @@ lz4_cmdecompress(const struct varlena *value) int32 rawsize; struct varlena *result; - /* allocate memory for holding the uncompressed data */ + /* allocate memory for the uncompressed data */ result = (struct varlena *) palloc(VARRAWSIZE_4B_C(value) + VARHDRSZ); - /* decompress data using lz4 routine */ + /* decompress the data */ rawsize = LZ4_decompress_safe((char *) value + VARHDRSZ_COMPRESS, VARDATA(result), VARSIZE(value) - VARHDRSZ_COMPRESS, diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c index f77deee399..920d9dd0d5 100644 --- a/src/backend/executor/nodeModifyTable.c +++ b/src/backend/executor/nodeModifyTable.c @@ -2117,7 +2117,7 @@ CompareCompressionMethodAndDecompress(TupleTableSlot *slot, TupleTableSlot *newslot = *outslot; /* - * If the called has passed an invalid slot then create a new slot. + * If the caller has passed an invalid slot then create a new slot. * Otherwise, just clear the existing tuple from the slot. This slot * should be stored by the caller so that it can be reused for * decompressing the subsequent tuples. diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index 18e8ecfd90..d8483c36b3 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -1183,8 +1183,8 @@ typedef struct ModifyTableState TupleTableSlot *mt_root_tuple_slot; /* - * Slot for storing the modified tuple, incase the target attribute's - * compression method doesn't match with the source table. + * Slot for storing the modified tuple, in case the target attribute's + * compression method doesn't match that of the source table. */ TupleTableSlot *mt_decompress_tuple_slot; -- 2.17.0 --YZ5djTAD1cGYuMQK Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v24-0006-alter-table-set-compression.patch" ^ permalink raw reply [nested|flat] 46+ messages in thread
* [PATCH v24 5/7] fixups.patch @ 2021-02-10 21:56 Robert Haas <[email protected]> 0 siblings, 0 replies; 46+ messages in thread From: Robert Haas @ 2021-02-10 21:56 UTC (permalink / raw) --- doc/src/sgml/ddl.sgml | 3 --- doc/src/sgml/ref/create_table.sgml | 15 +++++++++++---- src/backend/access/common/detoast.c | 5 ++--- src/backend/access/compression/compress_lz4.c | 10 +++++----- src/backend/executor/nodeModifyTable.c | 2 +- src/include/nodes/execnodes.h | 4 ++-- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml index 4d7ed698b9..1e9a4625cc 100644 --- a/doc/src/sgml/ddl.sgml +++ b/doc/src/sgml/ddl.sgml @@ -3762,9 +3762,6 @@ CREATE TABLE measurement ( <productname>PostgreSQL</productname> tables (or, possibly, foreign tables). It is possible to specify a tablespace and storage parameters for each partition separately. - By default, each column in a partition inherits the compression method - from parent table's column, however a different compression method can be - set for each partition. </para> <para> diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index 51a7a977a5..a4b297340f 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -997,10 +997,17 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM <term><literal>COMPRESSION <replaceable class="parameter">compression_method</replaceable></literal></term> <listitem> <para> - This sets the compression method for a column. The supported compression - methods are <literal>pglz</literal> and <literal>lz4</literal>. - <literal>lz4</literal> is available only if <literal>--with-lz4</literal> - was used when building <productname>PostgreSQL</productname>. The default + The <literal>COMPRESSION</literal> clause sets the compression method + for a column. Compression is supported only for variable-width data + types, and is used only for columns whose storage type is main or + extended. (See <xref linkend="sql-altertable"/> for information on + column storage types.) Setting this property for a partitioned table + has no direct effect, because such tables have no storage of their own, + but the configured value is inherited by newly-created partitions. + The supported compression methods are <literal>pglz</literal> and + <literal>lz4</literal>. <literal>lz4</literal> is available only if + <literal>--with-lz4</literal> was used when building + <productname>PostgreSQL</productname>. The default is <literal>pglz</literal>. </para> </listitem> diff --git a/src/backend/access/common/detoast.c b/src/backend/access/common/detoast.c index b78d49167b..95d5b1c12a 100644 --- a/src/backend/access/common/detoast.c +++ b/src/backend/access/common/detoast.c @@ -477,8 +477,8 @@ toast_get_compression_oid(struct varlena *attr) return InvalidOid; /* - * Just fetch the toast compress header to know the compression method - * in the compressed data. + * Fetch just enough of the value to examine the compression header, + * so that we can find out the compression method. */ attr = toast_fetch_datum_slice(attr, 0, VARHDRSZ_COMPRESS); } @@ -503,7 +503,6 @@ toast_get_compression_handler(struct varlena *attr) cmid = TOAST_COMPRESS_METHOD(attr); - /* Get the handler routines for the compression method */ switch (cmid) { case PGLZ_COMPRESSION_ID: diff --git a/src/backend/access/compression/compress_lz4.c b/src/backend/access/compression/compress_lz4.c index 1856cf7df7..3079eff7eb 100644 --- a/src/backend/access/compression/compress_lz4.c +++ b/src/backend/access/compression/compress_lz4.c @@ -23,7 +23,7 @@ /* * lz4_cmcompress - compression routine for lz4 compression method * - * Compresses source into dest using the default strategy. Returns the + * Compresses source into dest using the LZ4 defaults. Returns the * compressed varlena, or NULL if compression fails. */ static struct varlena * @@ -42,8 +42,8 @@ lz4_cmcompress(const struct varlena *value) valsize = VARSIZE_ANY_EXHDR(value); /* - * Get maximum size of the compressed data that lz4 compression may output - * and allocate the memory for holding the compressed data and the header. + * Figure out the maximum possible size of the LZ4 output, add the bytes + * that will be needed for varlena overhead, and allocate that amount. */ max_size = LZ4_compressBound(valsize); tmp = (struct varlena *) palloc(max_size + VARHDRSZ_COMPRESS); @@ -83,10 +83,10 @@ lz4_cmdecompress(const struct varlena *value) int32 rawsize; struct varlena *result; - /* allocate memory for holding the uncompressed data */ + /* allocate memory for the uncompressed data */ result = (struct varlena *) palloc(VARRAWSIZE_4B_C(value) + VARHDRSZ); - /* decompress data using lz4 routine */ + /* decompress the data */ rawsize = LZ4_decompress_safe((char *) value + VARHDRSZ_COMPRESS, VARDATA(result), VARSIZE(value) - VARHDRSZ_COMPRESS, diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c index f77deee399..920d9dd0d5 100644 --- a/src/backend/executor/nodeModifyTable.c +++ b/src/backend/executor/nodeModifyTable.c @@ -2117,7 +2117,7 @@ CompareCompressionMethodAndDecompress(TupleTableSlot *slot, TupleTableSlot *newslot = *outslot; /* - * If the called has passed an invalid slot then create a new slot. + * If the caller has passed an invalid slot then create a new slot. * Otherwise, just clear the existing tuple from the slot. This slot * should be stored by the caller so that it can be reused for * decompressing the subsequent tuples. diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index 18e8ecfd90..d8483c36b3 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -1183,8 +1183,8 @@ typedef struct ModifyTableState TupleTableSlot *mt_root_tuple_slot; /* - * Slot for storing the modified tuple, incase the target attribute's - * compression method doesn't match with the source table. + * Slot for storing the modified tuple, in case the target attribute's + * compression method doesn't match that of the source table. */ TupleTableSlot *mt_decompress_tuple_slot; -- 2.17.0 --YZ5djTAD1cGYuMQK Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v24-0006-alter-table-set-compression.patch" ^ permalink raw reply [nested|flat] 46+ messages in thread
* [PATCH v24 5/7] fixups.patch @ 2021-02-10 21:56 Robert Haas <[email protected]> 0 siblings, 0 replies; 46+ messages in thread From: Robert Haas @ 2021-02-10 21:56 UTC (permalink / raw) --- doc/src/sgml/ddl.sgml | 3 --- doc/src/sgml/ref/create_table.sgml | 15 +++++++++++---- src/backend/access/common/detoast.c | 5 ++--- src/backend/access/compression/compress_lz4.c | 10 +++++----- src/backend/executor/nodeModifyTable.c | 2 +- src/include/nodes/execnodes.h | 4 ++-- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml index 4d7ed698b9..1e9a4625cc 100644 --- a/doc/src/sgml/ddl.sgml +++ b/doc/src/sgml/ddl.sgml @@ -3762,9 +3762,6 @@ CREATE TABLE measurement ( <productname>PostgreSQL</productname> tables (or, possibly, foreign tables). It is possible to specify a tablespace and storage parameters for each partition separately. - By default, each column in a partition inherits the compression method - from parent table's column, however a different compression method can be - set for each partition. </para> <para> diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index 51a7a977a5..a4b297340f 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -997,10 +997,17 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM <term><literal>COMPRESSION <replaceable class="parameter">compression_method</replaceable></literal></term> <listitem> <para> - This sets the compression method for a column. The supported compression - methods are <literal>pglz</literal> and <literal>lz4</literal>. - <literal>lz4</literal> is available only if <literal>--with-lz4</literal> - was used when building <productname>PostgreSQL</productname>. The default + The <literal>COMPRESSION</literal> clause sets the compression method + for a column. Compression is supported only for variable-width data + types, and is used only for columns whose storage type is main or + extended. (See <xref linkend="sql-altertable"/> for information on + column storage types.) Setting this property for a partitioned table + has no direct effect, because such tables have no storage of their own, + but the configured value is inherited by newly-created partitions. + The supported compression methods are <literal>pglz</literal> and + <literal>lz4</literal>. <literal>lz4</literal> is available only if + <literal>--with-lz4</literal> was used when building + <productname>PostgreSQL</productname>. The default is <literal>pglz</literal>. </para> </listitem> diff --git a/src/backend/access/common/detoast.c b/src/backend/access/common/detoast.c index b78d49167b..95d5b1c12a 100644 --- a/src/backend/access/common/detoast.c +++ b/src/backend/access/common/detoast.c @@ -477,8 +477,8 @@ toast_get_compression_oid(struct varlena *attr) return InvalidOid; /* - * Just fetch the toast compress header to know the compression method - * in the compressed data. + * Fetch just enough of the value to examine the compression header, + * so that we can find out the compression method. */ attr = toast_fetch_datum_slice(attr, 0, VARHDRSZ_COMPRESS); } @@ -503,7 +503,6 @@ toast_get_compression_handler(struct varlena *attr) cmid = TOAST_COMPRESS_METHOD(attr); - /* Get the handler routines for the compression method */ switch (cmid) { case PGLZ_COMPRESSION_ID: diff --git a/src/backend/access/compression/compress_lz4.c b/src/backend/access/compression/compress_lz4.c index 1856cf7df7..3079eff7eb 100644 --- a/src/backend/access/compression/compress_lz4.c +++ b/src/backend/access/compression/compress_lz4.c @@ -23,7 +23,7 @@ /* * lz4_cmcompress - compression routine for lz4 compression method * - * Compresses source into dest using the default strategy. Returns the + * Compresses source into dest using the LZ4 defaults. Returns the * compressed varlena, or NULL if compression fails. */ static struct varlena * @@ -42,8 +42,8 @@ lz4_cmcompress(const struct varlena *value) valsize = VARSIZE_ANY_EXHDR(value); /* - * Get maximum size of the compressed data that lz4 compression may output - * and allocate the memory for holding the compressed data and the header. + * Figure out the maximum possible size of the LZ4 output, add the bytes + * that will be needed for varlena overhead, and allocate that amount. */ max_size = LZ4_compressBound(valsize); tmp = (struct varlena *) palloc(max_size + VARHDRSZ_COMPRESS); @@ -83,10 +83,10 @@ lz4_cmdecompress(const struct varlena *value) int32 rawsize; struct varlena *result; - /* allocate memory for holding the uncompressed data */ + /* allocate memory for the uncompressed data */ result = (struct varlena *) palloc(VARRAWSIZE_4B_C(value) + VARHDRSZ); - /* decompress data using lz4 routine */ + /* decompress the data */ rawsize = LZ4_decompress_safe((char *) value + VARHDRSZ_COMPRESS, VARDATA(result), VARSIZE(value) - VARHDRSZ_COMPRESS, diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c index f77deee399..920d9dd0d5 100644 --- a/src/backend/executor/nodeModifyTable.c +++ b/src/backend/executor/nodeModifyTable.c @@ -2117,7 +2117,7 @@ CompareCompressionMethodAndDecompress(TupleTableSlot *slot, TupleTableSlot *newslot = *outslot; /* - * If the called has passed an invalid slot then create a new slot. + * If the caller has passed an invalid slot then create a new slot. * Otherwise, just clear the existing tuple from the slot. This slot * should be stored by the caller so that it can be reused for * decompressing the subsequent tuples. diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index 18e8ecfd90..d8483c36b3 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -1183,8 +1183,8 @@ typedef struct ModifyTableState TupleTableSlot *mt_root_tuple_slot; /* - * Slot for storing the modified tuple, incase the target attribute's - * compression method doesn't match with the source table. + * Slot for storing the modified tuple, in case the target attribute's + * compression method doesn't match that of the source table. */ TupleTableSlot *mt_decompress_tuple_slot; -- 2.17.0 --YZ5djTAD1cGYuMQK Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v24-0006-alter-table-set-compression.patch" ^ permalink raw reply [nested|flat] 46+ messages in thread
* [PATCH v24 5/7] fixups.patch @ 2021-02-10 21:56 Robert Haas <[email protected]> 0 siblings, 0 replies; 46+ messages in thread From: Robert Haas @ 2021-02-10 21:56 UTC (permalink / raw) --- doc/src/sgml/ddl.sgml | 3 --- doc/src/sgml/ref/create_table.sgml | 15 +++++++++++---- src/backend/access/common/detoast.c | 5 ++--- src/backend/access/compression/compress_lz4.c | 10 +++++----- src/backend/executor/nodeModifyTable.c | 2 +- src/include/nodes/execnodes.h | 4 ++-- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml index 4d7ed698b9..1e9a4625cc 100644 --- a/doc/src/sgml/ddl.sgml +++ b/doc/src/sgml/ddl.sgml @@ -3762,9 +3762,6 @@ CREATE TABLE measurement ( <productname>PostgreSQL</productname> tables (or, possibly, foreign tables). It is possible to specify a tablespace and storage parameters for each partition separately. - By default, each column in a partition inherits the compression method - from parent table's column, however a different compression method can be - set for each partition. </para> <para> diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index 51a7a977a5..a4b297340f 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -997,10 +997,17 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM <term><literal>COMPRESSION <replaceable class="parameter">compression_method</replaceable></literal></term> <listitem> <para> - This sets the compression method for a column. The supported compression - methods are <literal>pglz</literal> and <literal>lz4</literal>. - <literal>lz4</literal> is available only if <literal>--with-lz4</literal> - was used when building <productname>PostgreSQL</productname>. The default + The <literal>COMPRESSION</literal> clause sets the compression method + for a column. Compression is supported only for variable-width data + types, and is used only for columns whose storage type is main or + extended. (See <xref linkend="sql-altertable"/> for information on + column storage types.) Setting this property for a partitioned table + has no direct effect, because such tables have no storage of their own, + but the configured value is inherited by newly-created partitions. + The supported compression methods are <literal>pglz</literal> and + <literal>lz4</literal>. <literal>lz4</literal> is available only if + <literal>--with-lz4</literal> was used when building + <productname>PostgreSQL</productname>. The default is <literal>pglz</literal>. </para> </listitem> diff --git a/src/backend/access/common/detoast.c b/src/backend/access/common/detoast.c index b78d49167b..95d5b1c12a 100644 --- a/src/backend/access/common/detoast.c +++ b/src/backend/access/common/detoast.c @@ -477,8 +477,8 @@ toast_get_compression_oid(struct varlena *attr) return InvalidOid; /* - * Just fetch the toast compress header to know the compression method - * in the compressed data. + * Fetch just enough of the value to examine the compression header, + * so that we can find out the compression method. */ attr = toast_fetch_datum_slice(attr, 0, VARHDRSZ_COMPRESS); } @@ -503,7 +503,6 @@ toast_get_compression_handler(struct varlena *attr) cmid = TOAST_COMPRESS_METHOD(attr); - /* Get the handler routines for the compression method */ switch (cmid) { case PGLZ_COMPRESSION_ID: diff --git a/src/backend/access/compression/compress_lz4.c b/src/backend/access/compression/compress_lz4.c index 1856cf7df7..3079eff7eb 100644 --- a/src/backend/access/compression/compress_lz4.c +++ b/src/backend/access/compression/compress_lz4.c @@ -23,7 +23,7 @@ /* * lz4_cmcompress - compression routine for lz4 compression method * - * Compresses source into dest using the default strategy. Returns the + * Compresses source into dest using the LZ4 defaults. Returns the * compressed varlena, or NULL if compression fails. */ static struct varlena * @@ -42,8 +42,8 @@ lz4_cmcompress(const struct varlena *value) valsize = VARSIZE_ANY_EXHDR(value); /* - * Get maximum size of the compressed data that lz4 compression may output - * and allocate the memory for holding the compressed data and the header. + * Figure out the maximum possible size of the LZ4 output, add the bytes + * that will be needed for varlena overhead, and allocate that amount. */ max_size = LZ4_compressBound(valsize); tmp = (struct varlena *) palloc(max_size + VARHDRSZ_COMPRESS); @@ -83,10 +83,10 @@ lz4_cmdecompress(const struct varlena *value) int32 rawsize; struct varlena *result; - /* allocate memory for holding the uncompressed data */ + /* allocate memory for the uncompressed data */ result = (struct varlena *) palloc(VARRAWSIZE_4B_C(value) + VARHDRSZ); - /* decompress data using lz4 routine */ + /* decompress the data */ rawsize = LZ4_decompress_safe((char *) value + VARHDRSZ_COMPRESS, VARDATA(result), VARSIZE(value) - VARHDRSZ_COMPRESS, diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c index f77deee399..920d9dd0d5 100644 --- a/src/backend/executor/nodeModifyTable.c +++ b/src/backend/executor/nodeModifyTable.c @@ -2117,7 +2117,7 @@ CompareCompressionMethodAndDecompress(TupleTableSlot *slot, TupleTableSlot *newslot = *outslot; /* - * If the called has passed an invalid slot then create a new slot. + * If the caller has passed an invalid slot then create a new slot. * Otherwise, just clear the existing tuple from the slot. This slot * should be stored by the caller so that it can be reused for * decompressing the subsequent tuples. diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index 18e8ecfd90..d8483c36b3 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -1183,8 +1183,8 @@ typedef struct ModifyTableState TupleTableSlot *mt_root_tuple_slot; /* - * Slot for storing the modified tuple, incase the target attribute's - * compression method doesn't match with the source table. + * Slot for storing the modified tuple, in case the target attribute's + * compression method doesn't match that of the source table. */ TupleTableSlot *mt_decompress_tuple_slot; -- 2.17.0 --YZ5djTAD1cGYuMQK Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v24-0006-alter-table-set-compression.patch" ^ permalink raw reply [nested|flat] 46+ messages in thread
* [PATCH v24 5/7] fixups.patch @ 2021-02-10 21:56 Robert Haas <[email protected]> 0 siblings, 0 replies; 46+ messages in thread From: Robert Haas @ 2021-02-10 21:56 UTC (permalink / raw) --- doc/src/sgml/ddl.sgml | 3 --- doc/src/sgml/ref/create_table.sgml | 15 +++++++++++---- src/backend/access/common/detoast.c | 5 ++--- src/backend/access/compression/compress_lz4.c | 10 +++++----- src/backend/executor/nodeModifyTable.c | 2 +- src/include/nodes/execnodes.h | 4 ++-- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml index 4d7ed698b9..1e9a4625cc 100644 --- a/doc/src/sgml/ddl.sgml +++ b/doc/src/sgml/ddl.sgml @@ -3762,9 +3762,6 @@ CREATE TABLE measurement ( <productname>PostgreSQL</productname> tables (or, possibly, foreign tables). It is possible to specify a tablespace and storage parameters for each partition separately. - By default, each column in a partition inherits the compression method - from parent table's column, however a different compression method can be - set for each partition. </para> <para> diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index 51a7a977a5..a4b297340f 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -997,10 +997,17 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM <term><literal>COMPRESSION <replaceable class="parameter">compression_method</replaceable></literal></term> <listitem> <para> - This sets the compression method for a column. The supported compression - methods are <literal>pglz</literal> and <literal>lz4</literal>. - <literal>lz4</literal> is available only if <literal>--with-lz4</literal> - was used when building <productname>PostgreSQL</productname>. The default + The <literal>COMPRESSION</literal> clause sets the compression method + for a column. Compression is supported only for variable-width data + types, and is used only for columns whose storage type is main or + extended. (See <xref linkend="sql-altertable"/> for information on + column storage types.) Setting this property for a partitioned table + has no direct effect, because such tables have no storage of their own, + but the configured value is inherited by newly-created partitions. + The supported compression methods are <literal>pglz</literal> and + <literal>lz4</literal>. <literal>lz4</literal> is available only if + <literal>--with-lz4</literal> was used when building + <productname>PostgreSQL</productname>. The default is <literal>pglz</literal>. </para> </listitem> diff --git a/src/backend/access/common/detoast.c b/src/backend/access/common/detoast.c index b78d49167b..95d5b1c12a 100644 --- a/src/backend/access/common/detoast.c +++ b/src/backend/access/common/detoast.c @@ -477,8 +477,8 @@ toast_get_compression_oid(struct varlena *attr) return InvalidOid; /* - * Just fetch the toast compress header to know the compression method - * in the compressed data. + * Fetch just enough of the value to examine the compression header, + * so that we can find out the compression method. */ attr = toast_fetch_datum_slice(attr, 0, VARHDRSZ_COMPRESS); } @@ -503,7 +503,6 @@ toast_get_compression_handler(struct varlena *attr) cmid = TOAST_COMPRESS_METHOD(attr); - /* Get the handler routines for the compression method */ switch (cmid) { case PGLZ_COMPRESSION_ID: diff --git a/src/backend/access/compression/compress_lz4.c b/src/backend/access/compression/compress_lz4.c index 1856cf7df7..3079eff7eb 100644 --- a/src/backend/access/compression/compress_lz4.c +++ b/src/backend/access/compression/compress_lz4.c @@ -23,7 +23,7 @@ /* * lz4_cmcompress - compression routine for lz4 compression method * - * Compresses source into dest using the default strategy. Returns the + * Compresses source into dest using the LZ4 defaults. Returns the * compressed varlena, or NULL if compression fails. */ static struct varlena * @@ -42,8 +42,8 @@ lz4_cmcompress(const struct varlena *value) valsize = VARSIZE_ANY_EXHDR(value); /* - * Get maximum size of the compressed data that lz4 compression may output - * and allocate the memory for holding the compressed data and the header. + * Figure out the maximum possible size of the LZ4 output, add the bytes + * that will be needed for varlena overhead, and allocate that amount. */ max_size = LZ4_compressBound(valsize); tmp = (struct varlena *) palloc(max_size + VARHDRSZ_COMPRESS); @@ -83,10 +83,10 @@ lz4_cmdecompress(const struct varlena *value) int32 rawsize; struct varlena *result; - /* allocate memory for holding the uncompressed data */ + /* allocate memory for the uncompressed data */ result = (struct varlena *) palloc(VARRAWSIZE_4B_C(value) + VARHDRSZ); - /* decompress data using lz4 routine */ + /* decompress the data */ rawsize = LZ4_decompress_safe((char *) value + VARHDRSZ_COMPRESS, VARDATA(result), VARSIZE(value) - VARHDRSZ_COMPRESS, diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c index f77deee399..920d9dd0d5 100644 --- a/src/backend/executor/nodeModifyTable.c +++ b/src/backend/executor/nodeModifyTable.c @@ -2117,7 +2117,7 @@ CompareCompressionMethodAndDecompress(TupleTableSlot *slot, TupleTableSlot *newslot = *outslot; /* - * If the called has passed an invalid slot then create a new slot. + * If the caller has passed an invalid slot then create a new slot. * Otherwise, just clear the existing tuple from the slot. This slot * should be stored by the caller so that it can be reused for * decompressing the subsequent tuples. diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index 18e8ecfd90..d8483c36b3 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -1183,8 +1183,8 @@ typedef struct ModifyTableState TupleTableSlot *mt_root_tuple_slot; /* - * Slot for storing the modified tuple, incase the target attribute's - * compression method doesn't match with the source table. + * Slot for storing the modified tuple, in case the target attribute's + * compression method doesn't match that of the source table. */ TupleTableSlot *mt_decompress_tuple_slot; -- 2.17.0 --YZ5djTAD1cGYuMQK Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v24-0006-alter-table-set-compression.patch" ^ permalink raw reply [nested|flat] 46+ messages in thread
* [PATCH v24 05/10] fixups.patch @ 2021-02-10 21:56 Robert Haas <[email protected]> 0 siblings, 0 replies; 46+ messages in thread From: Robert Haas @ 2021-02-10 21:56 UTC (permalink / raw) --- doc/src/sgml/ddl.sgml | 3 --- doc/src/sgml/ref/create_table.sgml | 15 +++++++++++---- src/backend/access/common/detoast.c | 5 ++--- src/backend/access/compression/compress_lz4.c | 10 +++++----- src/backend/executor/nodeModifyTable.c | 2 +- src/include/nodes/execnodes.h | 4 ++-- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml index 4d7ed698b9..1e9a4625cc 100644 --- a/doc/src/sgml/ddl.sgml +++ b/doc/src/sgml/ddl.sgml @@ -3762,9 +3762,6 @@ CREATE TABLE measurement ( <productname>PostgreSQL</productname> tables (or, possibly, foreign tables). It is possible to specify a tablespace and storage parameters for each partition separately. - By default, each column in a partition inherits the compression method - from parent table's column, however a different compression method can be - set for each partition. </para> <para> diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index 51a7a977a5..a4b297340f 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -997,10 +997,17 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM <term><literal>COMPRESSION <replaceable class="parameter">compression_method</replaceable></literal></term> <listitem> <para> - This sets the compression method for a column. The supported compression - methods are <literal>pglz</literal> and <literal>lz4</literal>. - <literal>lz4</literal> is available only if <literal>--with-lz4</literal> - was used when building <productname>PostgreSQL</productname>. The default + The <literal>COMPRESSION</literal> clause sets the compression method + for a column. Compression is supported only for variable-width data + types, and is used only for columns whose storage type is main or + extended. (See <xref linkend="sql-altertable"/> for information on + column storage types.) Setting this property for a partitioned table + has no direct effect, because such tables have no storage of their own, + but the configured value is inherited by newly-created partitions. + The supported compression methods are <literal>pglz</literal> and + <literal>lz4</literal>. <literal>lz4</literal> is available only if + <literal>--with-lz4</literal> was used when building + <productname>PostgreSQL</productname>. The default is <literal>pglz</literal>. </para> </listitem> diff --git a/src/backend/access/common/detoast.c b/src/backend/access/common/detoast.c index b78d49167b..95d5b1c12a 100644 --- a/src/backend/access/common/detoast.c +++ b/src/backend/access/common/detoast.c @@ -477,8 +477,8 @@ toast_get_compression_oid(struct varlena *attr) return InvalidOid; /* - * Just fetch the toast compress header to know the compression method - * in the compressed data. + * Fetch just enough of the value to examine the compression header, + * so that we can find out the compression method. */ attr = toast_fetch_datum_slice(attr, 0, VARHDRSZ_COMPRESS); } @@ -503,7 +503,6 @@ toast_get_compression_handler(struct varlena *attr) cmid = TOAST_COMPRESS_METHOD(attr); - /* Get the handler routines for the compression method */ switch (cmid) { case PGLZ_COMPRESSION_ID: diff --git a/src/backend/access/compression/compress_lz4.c b/src/backend/access/compression/compress_lz4.c index 1856cf7df7..3079eff7eb 100644 --- a/src/backend/access/compression/compress_lz4.c +++ b/src/backend/access/compression/compress_lz4.c @@ -23,7 +23,7 @@ /* * lz4_cmcompress - compression routine for lz4 compression method * - * Compresses source into dest using the default strategy. Returns the + * Compresses source into dest using the LZ4 defaults. Returns the * compressed varlena, or NULL if compression fails. */ static struct varlena * @@ -42,8 +42,8 @@ lz4_cmcompress(const struct varlena *value) valsize = VARSIZE_ANY_EXHDR(value); /* - * Get maximum size of the compressed data that lz4 compression may output - * and allocate the memory for holding the compressed data and the header. + * Figure out the maximum possible size of the LZ4 output, add the bytes + * that will be needed for varlena overhead, and allocate that amount. */ max_size = LZ4_compressBound(valsize); tmp = (struct varlena *) palloc(max_size + VARHDRSZ_COMPRESS); @@ -83,10 +83,10 @@ lz4_cmdecompress(const struct varlena *value) int32 rawsize; struct varlena *result; - /* allocate memory for holding the uncompressed data */ + /* allocate memory for the uncompressed data */ result = (struct varlena *) palloc(VARRAWSIZE_4B_C(value) + VARHDRSZ); - /* decompress data using lz4 routine */ + /* decompress the data */ rawsize = LZ4_decompress_safe((char *) value + VARHDRSZ_COMPRESS, VARDATA(result), VARSIZE(value) - VARHDRSZ_COMPRESS, diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c index f77deee399..920d9dd0d5 100644 --- a/src/backend/executor/nodeModifyTable.c +++ b/src/backend/executor/nodeModifyTable.c @@ -2117,7 +2117,7 @@ CompareCompressionMethodAndDecompress(TupleTableSlot *slot, TupleTableSlot *newslot = *outslot; /* - * If the called has passed an invalid slot then create a new slot. + * If the caller has passed an invalid slot then create a new slot. * Otherwise, just clear the existing tuple from the slot. This slot * should be stored by the caller so that it can be reused for * decompressing the subsequent tuples. diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index 18e8ecfd90..d8483c36b3 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -1183,8 +1183,8 @@ typedef struct ModifyTableState TupleTableSlot *mt_root_tuple_slot; /* - * Slot for storing the modified tuple, incase the target attribute's - * compression method doesn't match with the source table. + * Slot for storing the modified tuple, in case the target attribute's + * compression method doesn't match that of the source table. */ TupleTableSlot *mt_decompress_tuple_slot; -- 2.17.0 --m51xatjYGsM+13rf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v24-0006-alter-table-set-compression.patch" ^ permalink raw reply [nested|flat] 46+ messages in thread
* [PATCH v24 5/7] fixups.patch @ 2021-02-10 21:56 Robert Haas <[email protected]> 0 siblings, 0 replies; 46+ messages in thread From: Robert Haas @ 2021-02-10 21:56 UTC (permalink / raw) --- doc/src/sgml/ddl.sgml | 3 --- doc/src/sgml/ref/create_table.sgml | 15 +++++++++++---- src/backend/access/common/detoast.c | 5 ++--- src/backend/access/compression/compress_lz4.c | 10 +++++----- src/backend/executor/nodeModifyTable.c | 2 +- src/include/nodes/execnodes.h | 4 ++-- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml index 4d7ed698b9..1e9a4625cc 100644 --- a/doc/src/sgml/ddl.sgml +++ b/doc/src/sgml/ddl.sgml @@ -3762,9 +3762,6 @@ CREATE TABLE measurement ( <productname>PostgreSQL</productname> tables (or, possibly, foreign tables). It is possible to specify a tablespace and storage parameters for each partition separately. - By default, each column in a partition inherits the compression method - from parent table's column, however a different compression method can be - set for each partition. </para> <para> diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index 51a7a977a5..a4b297340f 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -997,10 +997,17 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM <term><literal>COMPRESSION <replaceable class="parameter">compression_method</replaceable></literal></term> <listitem> <para> - This sets the compression method for a column. The supported compression - methods are <literal>pglz</literal> and <literal>lz4</literal>. - <literal>lz4</literal> is available only if <literal>--with-lz4</literal> - was used when building <productname>PostgreSQL</productname>. The default + The <literal>COMPRESSION</literal> clause sets the compression method + for a column. Compression is supported only for variable-width data + types, and is used only for columns whose storage type is main or + extended. (See <xref linkend="sql-altertable"/> for information on + column storage types.) Setting this property for a partitioned table + has no direct effect, because such tables have no storage of their own, + but the configured value is inherited by newly-created partitions. + The supported compression methods are <literal>pglz</literal> and + <literal>lz4</literal>. <literal>lz4</literal> is available only if + <literal>--with-lz4</literal> was used when building + <productname>PostgreSQL</productname>. The default is <literal>pglz</literal>. </para> </listitem> diff --git a/src/backend/access/common/detoast.c b/src/backend/access/common/detoast.c index b78d49167b..95d5b1c12a 100644 --- a/src/backend/access/common/detoast.c +++ b/src/backend/access/common/detoast.c @@ -477,8 +477,8 @@ toast_get_compression_oid(struct varlena *attr) return InvalidOid; /* - * Just fetch the toast compress header to know the compression method - * in the compressed data. + * Fetch just enough of the value to examine the compression header, + * so that we can find out the compression method. */ attr = toast_fetch_datum_slice(attr, 0, VARHDRSZ_COMPRESS); } @@ -503,7 +503,6 @@ toast_get_compression_handler(struct varlena *attr) cmid = TOAST_COMPRESS_METHOD(attr); - /* Get the handler routines for the compression method */ switch (cmid) { case PGLZ_COMPRESSION_ID: diff --git a/src/backend/access/compression/compress_lz4.c b/src/backend/access/compression/compress_lz4.c index 1856cf7df7..3079eff7eb 100644 --- a/src/backend/access/compression/compress_lz4.c +++ b/src/backend/access/compression/compress_lz4.c @@ -23,7 +23,7 @@ /* * lz4_cmcompress - compression routine for lz4 compression method * - * Compresses source into dest using the default strategy. Returns the + * Compresses source into dest using the LZ4 defaults. Returns the * compressed varlena, or NULL if compression fails. */ static struct varlena * @@ -42,8 +42,8 @@ lz4_cmcompress(const struct varlena *value) valsize = VARSIZE_ANY_EXHDR(value); /* - * Get maximum size of the compressed data that lz4 compression may output - * and allocate the memory for holding the compressed data and the header. + * Figure out the maximum possible size of the LZ4 output, add the bytes + * that will be needed for varlena overhead, and allocate that amount. */ max_size = LZ4_compressBound(valsize); tmp = (struct varlena *) palloc(max_size + VARHDRSZ_COMPRESS); @@ -83,10 +83,10 @@ lz4_cmdecompress(const struct varlena *value) int32 rawsize; struct varlena *result; - /* allocate memory for holding the uncompressed data */ + /* allocate memory for the uncompressed data */ result = (struct varlena *) palloc(VARRAWSIZE_4B_C(value) + VARHDRSZ); - /* decompress data using lz4 routine */ + /* decompress the data */ rawsize = LZ4_decompress_safe((char *) value + VARHDRSZ_COMPRESS, VARDATA(result), VARSIZE(value) - VARHDRSZ_COMPRESS, diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c index f77deee399..920d9dd0d5 100644 --- a/src/backend/executor/nodeModifyTable.c +++ b/src/backend/executor/nodeModifyTable.c @@ -2117,7 +2117,7 @@ CompareCompressionMethodAndDecompress(TupleTableSlot *slot, TupleTableSlot *newslot = *outslot; /* - * If the called has passed an invalid slot then create a new slot. + * If the caller has passed an invalid slot then create a new slot. * Otherwise, just clear the existing tuple from the slot. This slot * should be stored by the caller so that it can be reused for * decompressing the subsequent tuples. diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index 18e8ecfd90..d8483c36b3 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -1183,8 +1183,8 @@ typedef struct ModifyTableState TupleTableSlot *mt_root_tuple_slot; /* - * Slot for storing the modified tuple, incase the target attribute's - * compression method doesn't match with the source table. + * Slot for storing the modified tuple, in case the target attribute's + * compression method doesn't match that of the source table. */ TupleTableSlot *mt_decompress_tuple_slot; -- 2.17.0 --YZ5djTAD1cGYuMQK Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v24-0006-alter-table-set-compression.patch" ^ permalink raw reply [nested|flat] 46+ messages in thread
* [PATCH v24 5/7] fixups.patch @ 2021-02-10 21:56 Robert Haas <[email protected]> 0 siblings, 0 replies; 46+ messages in thread From: Robert Haas @ 2021-02-10 21:56 UTC (permalink / raw) --- doc/src/sgml/ddl.sgml | 3 --- doc/src/sgml/ref/create_table.sgml | 15 +++++++++++---- src/backend/access/common/detoast.c | 5 ++--- src/backend/access/compression/compress_lz4.c | 10 +++++----- src/backend/executor/nodeModifyTable.c | 2 +- src/include/nodes/execnodes.h | 4 ++-- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml index 4d7ed698b9..1e9a4625cc 100644 --- a/doc/src/sgml/ddl.sgml +++ b/doc/src/sgml/ddl.sgml @@ -3762,9 +3762,6 @@ CREATE TABLE measurement ( <productname>PostgreSQL</productname> tables (or, possibly, foreign tables). It is possible to specify a tablespace and storage parameters for each partition separately. - By default, each column in a partition inherits the compression method - from parent table's column, however a different compression method can be - set for each partition. </para> <para> diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index 51a7a977a5..a4b297340f 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -997,10 +997,17 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM <term><literal>COMPRESSION <replaceable class="parameter">compression_method</replaceable></literal></term> <listitem> <para> - This sets the compression method for a column. The supported compression - methods are <literal>pglz</literal> and <literal>lz4</literal>. - <literal>lz4</literal> is available only if <literal>--with-lz4</literal> - was used when building <productname>PostgreSQL</productname>. The default + The <literal>COMPRESSION</literal> clause sets the compression method + for a column. Compression is supported only for variable-width data + types, and is used only for columns whose storage type is main or + extended. (See <xref linkend="sql-altertable"/> for information on + column storage types.) Setting this property for a partitioned table + has no direct effect, because such tables have no storage of their own, + but the configured value is inherited by newly-created partitions. + The supported compression methods are <literal>pglz</literal> and + <literal>lz4</literal>. <literal>lz4</literal> is available only if + <literal>--with-lz4</literal> was used when building + <productname>PostgreSQL</productname>. The default is <literal>pglz</literal>. </para> </listitem> diff --git a/src/backend/access/common/detoast.c b/src/backend/access/common/detoast.c index b78d49167b..95d5b1c12a 100644 --- a/src/backend/access/common/detoast.c +++ b/src/backend/access/common/detoast.c @@ -477,8 +477,8 @@ toast_get_compression_oid(struct varlena *attr) return InvalidOid; /* - * Just fetch the toast compress header to know the compression method - * in the compressed data. + * Fetch just enough of the value to examine the compression header, + * so that we can find out the compression method. */ attr = toast_fetch_datum_slice(attr, 0, VARHDRSZ_COMPRESS); } @@ -503,7 +503,6 @@ toast_get_compression_handler(struct varlena *attr) cmid = TOAST_COMPRESS_METHOD(attr); - /* Get the handler routines for the compression method */ switch (cmid) { case PGLZ_COMPRESSION_ID: diff --git a/src/backend/access/compression/compress_lz4.c b/src/backend/access/compression/compress_lz4.c index 1856cf7df7..3079eff7eb 100644 --- a/src/backend/access/compression/compress_lz4.c +++ b/src/backend/access/compression/compress_lz4.c @@ -23,7 +23,7 @@ /* * lz4_cmcompress - compression routine for lz4 compression method * - * Compresses source into dest using the default strategy. Returns the + * Compresses source into dest using the LZ4 defaults. Returns the * compressed varlena, or NULL if compression fails. */ static struct varlena * @@ -42,8 +42,8 @@ lz4_cmcompress(const struct varlena *value) valsize = VARSIZE_ANY_EXHDR(value); /* - * Get maximum size of the compressed data that lz4 compression may output - * and allocate the memory for holding the compressed data and the header. + * Figure out the maximum possible size of the LZ4 output, add the bytes + * that will be needed for varlena overhead, and allocate that amount. */ max_size = LZ4_compressBound(valsize); tmp = (struct varlena *) palloc(max_size + VARHDRSZ_COMPRESS); @@ -83,10 +83,10 @@ lz4_cmdecompress(const struct varlena *value) int32 rawsize; struct varlena *result; - /* allocate memory for holding the uncompressed data */ + /* allocate memory for the uncompressed data */ result = (struct varlena *) palloc(VARRAWSIZE_4B_C(value) + VARHDRSZ); - /* decompress data using lz4 routine */ + /* decompress the data */ rawsize = LZ4_decompress_safe((char *) value + VARHDRSZ_COMPRESS, VARDATA(result), VARSIZE(value) - VARHDRSZ_COMPRESS, diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c index f77deee399..920d9dd0d5 100644 --- a/src/backend/executor/nodeModifyTable.c +++ b/src/backend/executor/nodeModifyTable.c @@ -2117,7 +2117,7 @@ CompareCompressionMethodAndDecompress(TupleTableSlot *slot, TupleTableSlot *newslot = *outslot; /* - * If the called has passed an invalid slot then create a new slot. + * If the caller has passed an invalid slot then create a new slot. * Otherwise, just clear the existing tuple from the slot. This slot * should be stored by the caller so that it can be reused for * decompressing the subsequent tuples. diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index 18e8ecfd90..d8483c36b3 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -1183,8 +1183,8 @@ typedef struct ModifyTableState TupleTableSlot *mt_root_tuple_slot; /* - * Slot for storing the modified tuple, incase the target attribute's - * compression method doesn't match with the source table. + * Slot for storing the modified tuple, in case the target attribute's + * compression method doesn't match that of the source table. */ TupleTableSlot *mt_decompress_tuple_slot; -- 2.17.0 --YZ5djTAD1cGYuMQK Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v24-0006-alter-table-set-compression.patch" ^ permalink raw reply [nested|flat] 46+ messages in thread
* [PATCH v24 5/7] fixups.patch @ 2021-02-10 21:56 Robert Haas <[email protected]> 0 siblings, 0 replies; 46+ messages in thread From: Robert Haas @ 2021-02-10 21:56 UTC (permalink / raw) --- doc/src/sgml/ddl.sgml | 3 --- doc/src/sgml/ref/create_table.sgml | 15 +++++++++++---- src/backend/access/common/detoast.c | 5 ++--- src/backend/access/compression/compress_lz4.c | 10 +++++----- src/backend/executor/nodeModifyTable.c | 2 +- src/include/nodes/execnodes.h | 4 ++-- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml index 4d7ed698b9..1e9a4625cc 100644 --- a/doc/src/sgml/ddl.sgml +++ b/doc/src/sgml/ddl.sgml @@ -3762,9 +3762,6 @@ CREATE TABLE measurement ( <productname>PostgreSQL</productname> tables (or, possibly, foreign tables). It is possible to specify a tablespace and storage parameters for each partition separately. - By default, each column in a partition inherits the compression method - from parent table's column, however a different compression method can be - set for each partition. </para> <para> diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index 51a7a977a5..a4b297340f 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -997,10 +997,17 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM <term><literal>COMPRESSION <replaceable class="parameter">compression_method</replaceable></literal></term> <listitem> <para> - This sets the compression method for a column. The supported compression - methods are <literal>pglz</literal> and <literal>lz4</literal>. - <literal>lz4</literal> is available only if <literal>--with-lz4</literal> - was used when building <productname>PostgreSQL</productname>. The default + The <literal>COMPRESSION</literal> clause sets the compression method + for a column. Compression is supported only for variable-width data + types, and is used only for columns whose storage type is main or + extended. (See <xref linkend="sql-altertable"/> for information on + column storage types.) Setting this property for a partitioned table + has no direct effect, because such tables have no storage of their own, + but the configured value is inherited by newly-created partitions. + The supported compression methods are <literal>pglz</literal> and + <literal>lz4</literal>. <literal>lz4</literal> is available only if + <literal>--with-lz4</literal> was used when building + <productname>PostgreSQL</productname>. The default is <literal>pglz</literal>. </para> </listitem> diff --git a/src/backend/access/common/detoast.c b/src/backend/access/common/detoast.c index b78d49167b..95d5b1c12a 100644 --- a/src/backend/access/common/detoast.c +++ b/src/backend/access/common/detoast.c @@ -477,8 +477,8 @@ toast_get_compression_oid(struct varlena *attr) return InvalidOid; /* - * Just fetch the toast compress header to know the compression method - * in the compressed data. + * Fetch just enough of the value to examine the compression header, + * so that we can find out the compression method. */ attr = toast_fetch_datum_slice(attr, 0, VARHDRSZ_COMPRESS); } @@ -503,7 +503,6 @@ toast_get_compression_handler(struct varlena *attr) cmid = TOAST_COMPRESS_METHOD(attr); - /* Get the handler routines for the compression method */ switch (cmid) { case PGLZ_COMPRESSION_ID: diff --git a/src/backend/access/compression/compress_lz4.c b/src/backend/access/compression/compress_lz4.c index 1856cf7df7..3079eff7eb 100644 --- a/src/backend/access/compression/compress_lz4.c +++ b/src/backend/access/compression/compress_lz4.c @@ -23,7 +23,7 @@ /* * lz4_cmcompress - compression routine for lz4 compression method * - * Compresses source into dest using the default strategy. Returns the + * Compresses source into dest using the LZ4 defaults. Returns the * compressed varlena, or NULL if compression fails. */ static struct varlena * @@ -42,8 +42,8 @@ lz4_cmcompress(const struct varlena *value) valsize = VARSIZE_ANY_EXHDR(value); /* - * Get maximum size of the compressed data that lz4 compression may output - * and allocate the memory for holding the compressed data and the header. + * Figure out the maximum possible size of the LZ4 output, add the bytes + * that will be needed for varlena overhead, and allocate that amount. */ max_size = LZ4_compressBound(valsize); tmp = (struct varlena *) palloc(max_size + VARHDRSZ_COMPRESS); @@ -83,10 +83,10 @@ lz4_cmdecompress(const struct varlena *value) int32 rawsize; struct varlena *result; - /* allocate memory for holding the uncompressed data */ + /* allocate memory for the uncompressed data */ result = (struct varlena *) palloc(VARRAWSIZE_4B_C(value) + VARHDRSZ); - /* decompress data using lz4 routine */ + /* decompress the data */ rawsize = LZ4_decompress_safe((char *) value + VARHDRSZ_COMPRESS, VARDATA(result), VARSIZE(value) - VARHDRSZ_COMPRESS, diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c index f77deee399..920d9dd0d5 100644 --- a/src/backend/executor/nodeModifyTable.c +++ b/src/backend/executor/nodeModifyTable.c @@ -2117,7 +2117,7 @@ CompareCompressionMethodAndDecompress(TupleTableSlot *slot, TupleTableSlot *newslot = *outslot; /* - * If the called has passed an invalid slot then create a new slot. + * If the caller has passed an invalid slot then create a new slot. * Otherwise, just clear the existing tuple from the slot. This slot * should be stored by the caller so that it can be reused for * decompressing the subsequent tuples. diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index 18e8ecfd90..d8483c36b3 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -1183,8 +1183,8 @@ typedef struct ModifyTableState TupleTableSlot *mt_root_tuple_slot; /* - * Slot for storing the modified tuple, incase the target attribute's - * compression method doesn't match with the source table. + * Slot for storing the modified tuple, in case the target attribute's + * compression method doesn't match that of the source table. */ TupleTableSlot *mt_decompress_tuple_slot; -- 2.17.0 --YZ5djTAD1cGYuMQK Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v24-0006-alter-table-set-compression.patch" ^ permalink raw reply [nested|flat] 46+ messages in thread
* [PATCH v24 05/10] fixups.patch @ 2021-02-10 21:56 Robert Haas <[email protected]> 0 siblings, 0 replies; 46+ messages in thread From: Robert Haas @ 2021-02-10 21:56 UTC (permalink / raw) --- doc/src/sgml/ddl.sgml | 3 --- doc/src/sgml/ref/create_table.sgml | 15 +++++++++++---- src/backend/access/common/detoast.c | 5 ++--- src/backend/access/compression/compress_lz4.c | 10 +++++----- src/backend/executor/nodeModifyTable.c | 2 +- src/include/nodes/execnodes.h | 4 ++-- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml index 4d7ed698b9..1e9a4625cc 100644 --- a/doc/src/sgml/ddl.sgml +++ b/doc/src/sgml/ddl.sgml @@ -3762,9 +3762,6 @@ CREATE TABLE measurement ( <productname>PostgreSQL</productname> tables (or, possibly, foreign tables). It is possible to specify a tablespace and storage parameters for each partition separately. - By default, each column in a partition inherits the compression method - from parent table's column, however a different compression method can be - set for each partition. </para> <para> diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index 51a7a977a5..a4b297340f 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -997,10 +997,17 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM <term><literal>COMPRESSION <replaceable class="parameter">compression_method</replaceable></literal></term> <listitem> <para> - This sets the compression method for a column. The supported compression - methods are <literal>pglz</literal> and <literal>lz4</literal>. - <literal>lz4</literal> is available only if <literal>--with-lz4</literal> - was used when building <productname>PostgreSQL</productname>. The default + The <literal>COMPRESSION</literal> clause sets the compression method + for a column. Compression is supported only for variable-width data + types, and is used only for columns whose storage type is main or + extended. (See <xref linkend="sql-altertable"/> for information on + column storage types.) Setting this property for a partitioned table + has no direct effect, because such tables have no storage of their own, + but the configured value is inherited by newly-created partitions. + The supported compression methods are <literal>pglz</literal> and + <literal>lz4</literal>. <literal>lz4</literal> is available only if + <literal>--with-lz4</literal> was used when building + <productname>PostgreSQL</productname>. The default is <literal>pglz</literal>. </para> </listitem> diff --git a/src/backend/access/common/detoast.c b/src/backend/access/common/detoast.c index b78d49167b..95d5b1c12a 100644 --- a/src/backend/access/common/detoast.c +++ b/src/backend/access/common/detoast.c @@ -477,8 +477,8 @@ toast_get_compression_oid(struct varlena *attr) return InvalidOid; /* - * Just fetch the toast compress header to know the compression method - * in the compressed data. + * Fetch just enough of the value to examine the compression header, + * so that we can find out the compression method. */ attr = toast_fetch_datum_slice(attr, 0, VARHDRSZ_COMPRESS); } @@ -503,7 +503,6 @@ toast_get_compression_handler(struct varlena *attr) cmid = TOAST_COMPRESS_METHOD(attr); - /* Get the handler routines for the compression method */ switch (cmid) { case PGLZ_COMPRESSION_ID: diff --git a/src/backend/access/compression/compress_lz4.c b/src/backend/access/compression/compress_lz4.c index 1856cf7df7..3079eff7eb 100644 --- a/src/backend/access/compression/compress_lz4.c +++ b/src/backend/access/compression/compress_lz4.c @@ -23,7 +23,7 @@ /* * lz4_cmcompress - compression routine for lz4 compression method * - * Compresses source into dest using the default strategy. Returns the + * Compresses source into dest using the LZ4 defaults. Returns the * compressed varlena, or NULL if compression fails. */ static struct varlena * @@ -42,8 +42,8 @@ lz4_cmcompress(const struct varlena *value) valsize = VARSIZE_ANY_EXHDR(value); /* - * Get maximum size of the compressed data that lz4 compression may output - * and allocate the memory for holding the compressed data and the header. + * Figure out the maximum possible size of the LZ4 output, add the bytes + * that will be needed for varlena overhead, and allocate that amount. */ max_size = LZ4_compressBound(valsize); tmp = (struct varlena *) palloc(max_size + VARHDRSZ_COMPRESS); @@ -83,10 +83,10 @@ lz4_cmdecompress(const struct varlena *value) int32 rawsize; struct varlena *result; - /* allocate memory for holding the uncompressed data */ + /* allocate memory for the uncompressed data */ result = (struct varlena *) palloc(VARRAWSIZE_4B_C(value) + VARHDRSZ); - /* decompress data using lz4 routine */ + /* decompress the data */ rawsize = LZ4_decompress_safe((char *) value + VARHDRSZ_COMPRESS, VARDATA(result), VARSIZE(value) - VARHDRSZ_COMPRESS, diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c index f77deee399..920d9dd0d5 100644 --- a/src/backend/executor/nodeModifyTable.c +++ b/src/backend/executor/nodeModifyTable.c @@ -2117,7 +2117,7 @@ CompareCompressionMethodAndDecompress(TupleTableSlot *slot, TupleTableSlot *newslot = *outslot; /* - * If the called has passed an invalid slot then create a new slot. + * If the caller has passed an invalid slot then create a new slot. * Otherwise, just clear the existing tuple from the slot. This slot * should be stored by the caller so that it can be reused for * decompressing the subsequent tuples. diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index 18e8ecfd90..d8483c36b3 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -1183,8 +1183,8 @@ typedef struct ModifyTableState TupleTableSlot *mt_root_tuple_slot; /* - * Slot for storing the modified tuple, incase the target attribute's - * compression method doesn't match with the source table. + * Slot for storing the modified tuple, in case the target attribute's + * compression method doesn't match that of the source table. */ TupleTableSlot *mt_decompress_tuple_slot; -- 2.17.0 --m51xatjYGsM+13rf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v24-0006-alter-table-set-compression.patch" ^ permalink raw reply [nested|flat] 46+ messages in thread
* [PATCH v24 5/7] fixups.patch @ 2021-02-10 21:56 Robert Haas <[email protected]> 0 siblings, 0 replies; 46+ messages in thread From: Robert Haas @ 2021-02-10 21:56 UTC (permalink / raw) --- doc/src/sgml/ddl.sgml | 3 --- doc/src/sgml/ref/create_table.sgml | 15 +++++++++++---- src/backend/access/common/detoast.c | 5 ++--- src/backend/access/compression/compress_lz4.c | 10 +++++----- src/backend/executor/nodeModifyTable.c | 2 +- src/include/nodes/execnodes.h | 4 ++-- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml index 4d7ed698b9..1e9a4625cc 100644 --- a/doc/src/sgml/ddl.sgml +++ b/doc/src/sgml/ddl.sgml @@ -3762,9 +3762,6 @@ CREATE TABLE measurement ( <productname>PostgreSQL</productname> tables (or, possibly, foreign tables). It is possible to specify a tablespace and storage parameters for each partition separately. - By default, each column in a partition inherits the compression method - from parent table's column, however a different compression method can be - set for each partition. </para> <para> diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index 51a7a977a5..a4b297340f 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -997,10 +997,17 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM <term><literal>COMPRESSION <replaceable class="parameter">compression_method</replaceable></literal></term> <listitem> <para> - This sets the compression method for a column. The supported compression - methods are <literal>pglz</literal> and <literal>lz4</literal>. - <literal>lz4</literal> is available only if <literal>--with-lz4</literal> - was used when building <productname>PostgreSQL</productname>. The default + The <literal>COMPRESSION</literal> clause sets the compression method + for a column. Compression is supported only for variable-width data + types, and is used only for columns whose storage type is main or + extended. (See <xref linkend="sql-altertable"/> for information on + column storage types.) Setting this property for a partitioned table + has no direct effect, because such tables have no storage of their own, + but the configured value is inherited by newly-created partitions. + The supported compression methods are <literal>pglz</literal> and + <literal>lz4</literal>. <literal>lz4</literal> is available only if + <literal>--with-lz4</literal> was used when building + <productname>PostgreSQL</productname>. The default is <literal>pglz</literal>. </para> </listitem> diff --git a/src/backend/access/common/detoast.c b/src/backend/access/common/detoast.c index b78d49167b..95d5b1c12a 100644 --- a/src/backend/access/common/detoast.c +++ b/src/backend/access/common/detoast.c @@ -477,8 +477,8 @@ toast_get_compression_oid(struct varlena *attr) return InvalidOid; /* - * Just fetch the toast compress header to know the compression method - * in the compressed data. + * Fetch just enough of the value to examine the compression header, + * so that we can find out the compression method. */ attr = toast_fetch_datum_slice(attr, 0, VARHDRSZ_COMPRESS); } @@ -503,7 +503,6 @@ toast_get_compression_handler(struct varlena *attr) cmid = TOAST_COMPRESS_METHOD(attr); - /* Get the handler routines for the compression method */ switch (cmid) { case PGLZ_COMPRESSION_ID: diff --git a/src/backend/access/compression/compress_lz4.c b/src/backend/access/compression/compress_lz4.c index 1856cf7df7..3079eff7eb 100644 --- a/src/backend/access/compression/compress_lz4.c +++ b/src/backend/access/compression/compress_lz4.c @@ -23,7 +23,7 @@ /* * lz4_cmcompress - compression routine for lz4 compression method * - * Compresses source into dest using the default strategy. Returns the + * Compresses source into dest using the LZ4 defaults. Returns the * compressed varlena, or NULL if compression fails. */ static struct varlena * @@ -42,8 +42,8 @@ lz4_cmcompress(const struct varlena *value) valsize = VARSIZE_ANY_EXHDR(value); /* - * Get maximum size of the compressed data that lz4 compression may output - * and allocate the memory for holding the compressed data and the header. + * Figure out the maximum possible size of the LZ4 output, add the bytes + * that will be needed for varlena overhead, and allocate that amount. */ max_size = LZ4_compressBound(valsize); tmp = (struct varlena *) palloc(max_size + VARHDRSZ_COMPRESS); @@ -83,10 +83,10 @@ lz4_cmdecompress(const struct varlena *value) int32 rawsize; struct varlena *result; - /* allocate memory for holding the uncompressed data */ + /* allocate memory for the uncompressed data */ result = (struct varlena *) palloc(VARRAWSIZE_4B_C(value) + VARHDRSZ); - /* decompress data using lz4 routine */ + /* decompress the data */ rawsize = LZ4_decompress_safe((char *) value + VARHDRSZ_COMPRESS, VARDATA(result), VARSIZE(value) - VARHDRSZ_COMPRESS, diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c index f77deee399..920d9dd0d5 100644 --- a/src/backend/executor/nodeModifyTable.c +++ b/src/backend/executor/nodeModifyTable.c @@ -2117,7 +2117,7 @@ CompareCompressionMethodAndDecompress(TupleTableSlot *slot, TupleTableSlot *newslot = *outslot; /* - * If the called has passed an invalid slot then create a new slot. + * If the caller has passed an invalid slot then create a new slot. * Otherwise, just clear the existing tuple from the slot. This slot * should be stored by the caller so that it can be reused for * decompressing the subsequent tuples. diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index 18e8ecfd90..d8483c36b3 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -1183,8 +1183,8 @@ typedef struct ModifyTableState TupleTableSlot *mt_root_tuple_slot; /* - * Slot for storing the modified tuple, incase the target attribute's - * compression method doesn't match with the source table. + * Slot for storing the modified tuple, in case the target attribute's + * compression method doesn't match that of the source table. */ TupleTableSlot *mt_decompress_tuple_slot; -- 2.17.0 --YZ5djTAD1cGYuMQK Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v24-0006-alter-table-set-compression.patch" ^ permalink raw reply [nested|flat] 46+ messages in thread
* [PATCH v24 05/10] fixups.patch @ 2021-02-10 21:56 Robert Haas <[email protected]> 0 siblings, 0 replies; 46+ messages in thread From: Robert Haas @ 2021-02-10 21:56 UTC (permalink / raw) --- doc/src/sgml/ddl.sgml | 3 --- doc/src/sgml/ref/create_table.sgml | 15 +++++++++++---- src/backend/access/common/detoast.c | 5 ++--- src/backend/access/compression/compress_lz4.c | 10 +++++----- src/backend/executor/nodeModifyTable.c | 2 +- src/include/nodes/execnodes.h | 4 ++-- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml index 4d7ed698b9..1e9a4625cc 100644 --- a/doc/src/sgml/ddl.sgml +++ b/doc/src/sgml/ddl.sgml @@ -3762,9 +3762,6 @@ CREATE TABLE measurement ( <productname>PostgreSQL</productname> tables (or, possibly, foreign tables). It is possible to specify a tablespace and storage parameters for each partition separately. - By default, each column in a partition inherits the compression method - from parent table's column, however a different compression method can be - set for each partition. </para> <para> diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index 51a7a977a5..a4b297340f 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -997,10 +997,17 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM <term><literal>COMPRESSION <replaceable class="parameter">compression_method</replaceable></literal></term> <listitem> <para> - This sets the compression method for a column. The supported compression - methods are <literal>pglz</literal> and <literal>lz4</literal>. - <literal>lz4</literal> is available only if <literal>--with-lz4</literal> - was used when building <productname>PostgreSQL</productname>. The default + The <literal>COMPRESSION</literal> clause sets the compression method + for a column. Compression is supported only for variable-width data + types, and is used only for columns whose storage type is main or + extended. (See <xref linkend="sql-altertable"/> for information on + column storage types.) Setting this property for a partitioned table + has no direct effect, because such tables have no storage of their own, + but the configured value is inherited by newly-created partitions. + The supported compression methods are <literal>pglz</literal> and + <literal>lz4</literal>. <literal>lz4</literal> is available only if + <literal>--with-lz4</literal> was used when building + <productname>PostgreSQL</productname>. The default is <literal>pglz</literal>. </para> </listitem> diff --git a/src/backend/access/common/detoast.c b/src/backend/access/common/detoast.c index b78d49167b..95d5b1c12a 100644 --- a/src/backend/access/common/detoast.c +++ b/src/backend/access/common/detoast.c @@ -477,8 +477,8 @@ toast_get_compression_oid(struct varlena *attr) return InvalidOid; /* - * Just fetch the toast compress header to know the compression method - * in the compressed data. + * Fetch just enough of the value to examine the compression header, + * so that we can find out the compression method. */ attr = toast_fetch_datum_slice(attr, 0, VARHDRSZ_COMPRESS); } @@ -503,7 +503,6 @@ toast_get_compression_handler(struct varlena *attr) cmid = TOAST_COMPRESS_METHOD(attr); - /* Get the handler routines for the compression method */ switch (cmid) { case PGLZ_COMPRESSION_ID: diff --git a/src/backend/access/compression/compress_lz4.c b/src/backend/access/compression/compress_lz4.c index 1856cf7df7..3079eff7eb 100644 --- a/src/backend/access/compression/compress_lz4.c +++ b/src/backend/access/compression/compress_lz4.c @@ -23,7 +23,7 @@ /* * lz4_cmcompress - compression routine for lz4 compression method * - * Compresses source into dest using the default strategy. Returns the + * Compresses source into dest using the LZ4 defaults. Returns the * compressed varlena, or NULL if compression fails. */ static struct varlena * @@ -42,8 +42,8 @@ lz4_cmcompress(const struct varlena *value) valsize = VARSIZE_ANY_EXHDR(value); /* - * Get maximum size of the compressed data that lz4 compression may output - * and allocate the memory for holding the compressed data and the header. + * Figure out the maximum possible size of the LZ4 output, add the bytes + * that will be needed for varlena overhead, and allocate that amount. */ max_size = LZ4_compressBound(valsize); tmp = (struct varlena *) palloc(max_size + VARHDRSZ_COMPRESS); @@ -83,10 +83,10 @@ lz4_cmdecompress(const struct varlena *value) int32 rawsize; struct varlena *result; - /* allocate memory for holding the uncompressed data */ + /* allocate memory for the uncompressed data */ result = (struct varlena *) palloc(VARRAWSIZE_4B_C(value) + VARHDRSZ); - /* decompress data using lz4 routine */ + /* decompress the data */ rawsize = LZ4_decompress_safe((char *) value + VARHDRSZ_COMPRESS, VARDATA(result), VARSIZE(value) - VARHDRSZ_COMPRESS, diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c index f77deee399..920d9dd0d5 100644 --- a/src/backend/executor/nodeModifyTable.c +++ b/src/backend/executor/nodeModifyTable.c @@ -2117,7 +2117,7 @@ CompareCompressionMethodAndDecompress(TupleTableSlot *slot, TupleTableSlot *newslot = *outslot; /* - * If the called has passed an invalid slot then create a new slot. + * If the caller has passed an invalid slot then create a new slot. * Otherwise, just clear the existing tuple from the slot. This slot * should be stored by the caller so that it can be reused for * decompressing the subsequent tuples. diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index 18e8ecfd90..d8483c36b3 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -1183,8 +1183,8 @@ typedef struct ModifyTableState TupleTableSlot *mt_root_tuple_slot; /* - * Slot for storing the modified tuple, incase the target attribute's - * compression method doesn't match with the source table. + * Slot for storing the modified tuple, in case the target attribute's + * compression method doesn't match that of the source table. */ TupleTableSlot *mt_decompress_tuple_slot; -- 2.17.0 --m51xatjYGsM+13rf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v24-0006-alter-table-set-compression.patch" ^ permalink raw reply [nested|flat] 46+ messages in thread
* [PATCH v24 05/10] fixups.patch @ 2021-02-10 21:56 Robert Haas <[email protected]> 0 siblings, 0 replies; 46+ messages in thread From: Robert Haas @ 2021-02-10 21:56 UTC (permalink / raw) --- doc/src/sgml/ddl.sgml | 3 --- doc/src/sgml/ref/create_table.sgml | 15 +++++++++++---- src/backend/access/common/detoast.c | 5 ++--- src/backend/access/compression/compress_lz4.c | 10 +++++----- src/backend/executor/nodeModifyTable.c | 2 +- src/include/nodes/execnodes.h | 4 ++-- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml index 4d7ed698b9..1e9a4625cc 100644 --- a/doc/src/sgml/ddl.sgml +++ b/doc/src/sgml/ddl.sgml @@ -3762,9 +3762,6 @@ CREATE TABLE measurement ( <productname>PostgreSQL</productname> tables (or, possibly, foreign tables). It is possible to specify a tablespace and storage parameters for each partition separately. - By default, each column in a partition inherits the compression method - from parent table's column, however a different compression method can be - set for each partition. </para> <para> diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index 51a7a977a5..a4b297340f 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -997,10 +997,17 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM <term><literal>COMPRESSION <replaceable class="parameter">compression_method</replaceable></literal></term> <listitem> <para> - This sets the compression method for a column. The supported compression - methods are <literal>pglz</literal> and <literal>lz4</literal>. - <literal>lz4</literal> is available only if <literal>--with-lz4</literal> - was used when building <productname>PostgreSQL</productname>. The default + The <literal>COMPRESSION</literal> clause sets the compression method + for a column. Compression is supported only for variable-width data + types, and is used only for columns whose storage type is main or + extended. (See <xref linkend="sql-altertable"/> for information on + column storage types.) Setting this property for a partitioned table + has no direct effect, because such tables have no storage of their own, + but the configured value is inherited by newly-created partitions. + The supported compression methods are <literal>pglz</literal> and + <literal>lz4</literal>. <literal>lz4</literal> is available only if + <literal>--with-lz4</literal> was used when building + <productname>PostgreSQL</productname>. The default is <literal>pglz</literal>. </para> </listitem> diff --git a/src/backend/access/common/detoast.c b/src/backend/access/common/detoast.c index b78d49167b..95d5b1c12a 100644 --- a/src/backend/access/common/detoast.c +++ b/src/backend/access/common/detoast.c @@ -477,8 +477,8 @@ toast_get_compression_oid(struct varlena *attr) return InvalidOid; /* - * Just fetch the toast compress header to know the compression method - * in the compressed data. + * Fetch just enough of the value to examine the compression header, + * so that we can find out the compression method. */ attr = toast_fetch_datum_slice(attr, 0, VARHDRSZ_COMPRESS); } @@ -503,7 +503,6 @@ toast_get_compression_handler(struct varlena *attr) cmid = TOAST_COMPRESS_METHOD(attr); - /* Get the handler routines for the compression method */ switch (cmid) { case PGLZ_COMPRESSION_ID: diff --git a/src/backend/access/compression/compress_lz4.c b/src/backend/access/compression/compress_lz4.c index 1856cf7df7..3079eff7eb 100644 --- a/src/backend/access/compression/compress_lz4.c +++ b/src/backend/access/compression/compress_lz4.c @@ -23,7 +23,7 @@ /* * lz4_cmcompress - compression routine for lz4 compression method * - * Compresses source into dest using the default strategy. Returns the + * Compresses source into dest using the LZ4 defaults. Returns the * compressed varlena, or NULL if compression fails. */ static struct varlena * @@ -42,8 +42,8 @@ lz4_cmcompress(const struct varlena *value) valsize = VARSIZE_ANY_EXHDR(value); /* - * Get maximum size of the compressed data that lz4 compression may output - * and allocate the memory for holding the compressed data and the header. + * Figure out the maximum possible size of the LZ4 output, add the bytes + * that will be needed for varlena overhead, and allocate that amount. */ max_size = LZ4_compressBound(valsize); tmp = (struct varlena *) palloc(max_size + VARHDRSZ_COMPRESS); @@ -83,10 +83,10 @@ lz4_cmdecompress(const struct varlena *value) int32 rawsize; struct varlena *result; - /* allocate memory for holding the uncompressed data */ + /* allocate memory for the uncompressed data */ result = (struct varlena *) palloc(VARRAWSIZE_4B_C(value) + VARHDRSZ); - /* decompress data using lz4 routine */ + /* decompress the data */ rawsize = LZ4_decompress_safe((char *) value + VARHDRSZ_COMPRESS, VARDATA(result), VARSIZE(value) - VARHDRSZ_COMPRESS, diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c index f77deee399..920d9dd0d5 100644 --- a/src/backend/executor/nodeModifyTable.c +++ b/src/backend/executor/nodeModifyTable.c @@ -2117,7 +2117,7 @@ CompareCompressionMethodAndDecompress(TupleTableSlot *slot, TupleTableSlot *newslot = *outslot; /* - * If the called has passed an invalid slot then create a new slot. + * If the caller has passed an invalid slot then create a new slot. * Otherwise, just clear the existing tuple from the slot. This slot * should be stored by the caller so that it can be reused for * decompressing the subsequent tuples. diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index 18e8ecfd90..d8483c36b3 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -1183,8 +1183,8 @@ typedef struct ModifyTableState TupleTableSlot *mt_root_tuple_slot; /* - * Slot for storing the modified tuple, incase the target attribute's - * compression method doesn't match with the source table. + * Slot for storing the modified tuple, in case the target attribute's + * compression method doesn't match that of the source table. */ TupleTableSlot *mt_decompress_tuple_slot; -- 2.17.0 --m51xatjYGsM+13rf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v24-0006-alter-table-set-compression.patch" ^ permalink raw reply [nested|flat] 46+ messages in thread
* [PATCH v24 05/10] fixups.patch @ 2021-02-10 21:56 Robert Haas <[email protected]> 0 siblings, 0 replies; 46+ messages in thread From: Robert Haas @ 2021-02-10 21:56 UTC (permalink / raw) --- doc/src/sgml/ddl.sgml | 3 --- doc/src/sgml/ref/create_table.sgml | 15 +++++++++++---- src/backend/access/common/detoast.c | 5 ++--- src/backend/access/compression/compress_lz4.c | 10 +++++----- src/backend/executor/nodeModifyTable.c | 2 +- src/include/nodes/execnodes.h | 4 ++-- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml index 4d7ed698b9..1e9a4625cc 100644 --- a/doc/src/sgml/ddl.sgml +++ b/doc/src/sgml/ddl.sgml @@ -3762,9 +3762,6 @@ CREATE TABLE measurement ( <productname>PostgreSQL</productname> tables (or, possibly, foreign tables). It is possible to specify a tablespace and storage parameters for each partition separately. - By default, each column in a partition inherits the compression method - from parent table's column, however a different compression method can be - set for each partition. </para> <para> diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index 51a7a977a5..a4b297340f 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -997,10 +997,17 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM <term><literal>COMPRESSION <replaceable class="parameter">compression_method</replaceable></literal></term> <listitem> <para> - This sets the compression method for a column. The supported compression - methods are <literal>pglz</literal> and <literal>lz4</literal>. - <literal>lz4</literal> is available only if <literal>--with-lz4</literal> - was used when building <productname>PostgreSQL</productname>. The default + The <literal>COMPRESSION</literal> clause sets the compression method + for a column. Compression is supported only for variable-width data + types, and is used only for columns whose storage type is main or + extended. (See <xref linkend="sql-altertable"/> for information on + column storage types.) Setting this property for a partitioned table + has no direct effect, because such tables have no storage of their own, + but the configured value is inherited by newly-created partitions. + The supported compression methods are <literal>pglz</literal> and + <literal>lz4</literal>. <literal>lz4</literal> is available only if + <literal>--with-lz4</literal> was used when building + <productname>PostgreSQL</productname>. The default is <literal>pglz</literal>. </para> </listitem> diff --git a/src/backend/access/common/detoast.c b/src/backend/access/common/detoast.c index b78d49167b..95d5b1c12a 100644 --- a/src/backend/access/common/detoast.c +++ b/src/backend/access/common/detoast.c @@ -477,8 +477,8 @@ toast_get_compression_oid(struct varlena *attr) return InvalidOid; /* - * Just fetch the toast compress header to know the compression method - * in the compressed data. + * Fetch just enough of the value to examine the compression header, + * so that we can find out the compression method. */ attr = toast_fetch_datum_slice(attr, 0, VARHDRSZ_COMPRESS); } @@ -503,7 +503,6 @@ toast_get_compression_handler(struct varlena *attr) cmid = TOAST_COMPRESS_METHOD(attr); - /* Get the handler routines for the compression method */ switch (cmid) { case PGLZ_COMPRESSION_ID: diff --git a/src/backend/access/compression/compress_lz4.c b/src/backend/access/compression/compress_lz4.c index 1856cf7df7..3079eff7eb 100644 --- a/src/backend/access/compression/compress_lz4.c +++ b/src/backend/access/compression/compress_lz4.c @@ -23,7 +23,7 @@ /* * lz4_cmcompress - compression routine for lz4 compression method * - * Compresses source into dest using the default strategy. Returns the + * Compresses source into dest using the LZ4 defaults. Returns the * compressed varlena, or NULL if compression fails. */ static struct varlena * @@ -42,8 +42,8 @@ lz4_cmcompress(const struct varlena *value) valsize = VARSIZE_ANY_EXHDR(value); /* - * Get maximum size of the compressed data that lz4 compression may output - * and allocate the memory for holding the compressed data and the header. + * Figure out the maximum possible size of the LZ4 output, add the bytes + * that will be needed for varlena overhead, and allocate that amount. */ max_size = LZ4_compressBound(valsize); tmp = (struct varlena *) palloc(max_size + VARHDRSZ_COMPRESS); @@ -83,10 +83,10 @@ lz4_cmdecompress(const struct varlena *value) int32 rawsize; struct varlena *result; - /* allocate memory for holding the uncompressed data */ + /* allocate memory for the uncompressed data */ result = (struct varlena *) palloc(VARRAWSIZE_4B_C(value) + VARHDRSZ); - /* decompress data using lz4 routine */ + /* decompress the data */ rawsize = LZ4_decompress_safe((char *) value + VARHDRSZ_COMPRESS, VARDATA(result), VARSIZE(value) - VARHDRSZ_COMPRESS, diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c index f77deee399..920d9dd0d5 100644 --- a/src/backend/executor/nodeModifyTable.c +++ b/src/backend/executor/nodeModifyTable.c @@ -2117,7 +2117,7 @@ CompareCompressionMethodAndDecompress(TupleTableSlot *slot, TupleTableSlot *newslot = *outslot; /* - * If the called has passed an invalid slot then create a new slot. + * If the caller has passed an invalid slot then create a new slot. * Otherwise, just clear the existing tuple from the slot. This slot * should be stored by the caller so that it can be reused for * decompressing the subsequent tuples. diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index 18e8ecfd90..d8483c36b3 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -1183,8 +1183,8 @@ typedef struct ModifyTableState TupleTableSlot *mt_root_tuple_slot; /* - * Slot for storing the modified tuple, incase the target attribute's - * compression method doesn't match with the source table. + * Slot for storing the modified tuple, in case the target attribute's + * compression method doesn't match that of the source table. */ TupleTableSlot *mt_decompress_tuple_slot; -- 2.17.0 --m51xatjYGsM+13rf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v24-0006-alter-table-set-compression.patch" ^ permalink raw reply [nested|flat] 46+ messages in thread
* [PATCH v24 5/7] fixups.patch @ 2021-02-10 21:56 Robert Haas <[email protected]> 0 siblings, 0 replies; 46+ messages in thread From: Robert Haas @ 2021-02-10 21:56 UTC (permalink / raw) --- doc/src/sgml/ddl.sgml | 3 --- doc/src/sgml/ref/create_table.sgml | 15 +++++++++++---- src/backend/access/common/detoast.c | 5 ++--- src/backend/access/compression/compress_lz4.c | 10 +++++----- src/backend/executor/nodeModifyTable.c | 2 +- src/include/nodes/execnodes.h | 4 ++-- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml index 4d7ed698b9..1e9a4625cc 100644 --- a/doc/src/sgml/ddl.sgml +++ b/doc/src/sgml/ddl.sgml @@ -3762,9 +3762,6 @@ CREATE TABLE measurement ( <productname>PostgreSQL</productname> tables (or, possibly, foreign tables). It is possible to specify a tablespace and storage parameters for each partition separately. - By default, each column in a partition inherits the compression method - from parent table's column, however a different compression method can be - set for each partition. </para> <para> diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index 51a7a977a5..a4b297340f 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -997,10 +997,17 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM <term><literal>COMPRESSION <replaceable class="parameter">compression_method</replaceable></literal></term> <listitem> <para> - This sets the compression method for a column. The supported compression - methods are <literal>pglz</literal> and <literal>lz4</literal>. - <literal>lz4</literal> is available only if <literal>--with-lz4</literal> - was used when building <productname>PostgreSQL</productname>. The default + The <literal>COMPRESSION</literal> clause sets the compression method + for a column. Compression is supported only for variable-width data + types, and is used only for columns whose storage type is main or + extended. (See <xref linkend="sql-altertable"/> for information on + column storage types.) Setting this property for a partitioned table + has no direct effect, because such tables have no storage of their own, + but the configured value is inherited by newly-created partitions. + The supported compression methods are <literal>pglz</literal> and + <literal>lz4</literal>. <literal>lz4</literal> is available only if + <literal>--with-lz4</literal> was used when building + <productname>PostgreSQL</productname>. The default is <literal>pglz</literal>. </para> </listitem> diff --git a/src/backend/access/common/detoast.c b/src/backend/access/common/detoast.c index b78d49167b..95d5b1c12a 100644 --- a/src/backend/access/common/detoast.c +++ b/src/backend/access/common/detoast.c @@ -477,8 +477,8 @@ toast_get_compression_oid(struct varlena *attr) return InvalidOid; /* - * Just fetch the toast compress header to know the compression method - * in the compressed data. + * Fetch just enough of the value to examine the compression header, + * so that we can find out the compression method. */ attr = toast_fetch_datum_slice(attr, 0, VARHDRSZ_COMPRESS); } @@ -503,7 +503,6 @@ toast_get_compression_handler(struct varlena *attr) cmid = TOAST_COMPRESS_METHOD(attr); - /* Get the handler routines for the compression method */ switch (cmid) { case PGLZ_COMPRESSION_ID: diff --git a/src/backend/access/compression/compress_lz4.c b/src/backend/access/compression/compress_lz4.c index 1856cf7df7..3079eff7eb 100644 --- a/src/backend/access/compression/compress_lz4.c +++ b/src/backend/access/compression/compress_lz4.c @@ -23,7 +23,7 @@ /* * lz4_cmcompress - compression routine for lz4 compression method * - * Compresses source into dest using the default strategy. Returns the + * Compresses source into dest using the LZ4 defaults. Returns the * compressed varlena, or NULL if compression fails. */ static struct varlena * @@ -42,8 +42,8 @@ lz4_cmcompress(const struct varlena *value) valsize = VARSIZE_ANY_EXHDR(value); /* - * Get maximum size of the compressed data that lz4 compression may output - * and allocate the memory for holding the compressed data and the header. + * Figure out the maximum possible size of the LZ4 output, add the bytes + * that will be needed for varlena overhead, and allocate that amount. */ max_size = LZ4_compressBound(valsize); tmp = (struct varlena *) palloc(max_size + VARHDRSZ_COMPRESS); @@ -83,10 +83,10 @@ lz4_cmdecompress(const struct varlena *value) int32 rawsize; struct varlena *result; - /* allocate memory for holding the uncompressed data */ + /* allocate memory for the uncompressed data */ result = (struct varlena *) palloc(VARRAWSIZE_4B_C(value) + VARHDRSZ); - /* decompress data using lz4 routine */ + /* decompress the data */ rawsize = LZ4_decompress_safe((char *) value + VARHDRSZ_COMPRESS, VARDATA(result), VARSIZE(value) - VARHDRSZ_COMPRESS, diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c index f77deee399..920d9dd0d5 100644 --- a/src/backend/executor/nodeModifyTable.c +++ b/src/backend/executor/nodeModifyTable.c @@ -2117,7 +2117,7 @@ CompareCompressionMethodAndDecompress(TupleTableSlot *slot, TupleTableSlot *newslot = *outslot; /* - * If the called has passed an invalid slot then create a new slot. + * If the caller has passed an invalid slot then create a new slot. * Otherwise, just clear the existing tuple from the slot. This slot * should be stored by the caller so that it can be reused for * decompressing the subsequent tuples. diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index 18e8ecfd90..d8483c36b3 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -1183,8 +1183,8 @@ typedef struct ModifyTableState TupleTableSlot *mt_root_tuple_slot; /* - * Slot for storing the modified tuple, incase the target attribute's - * compression method doesn't match with the source table. + * Slot for storing the modified tuple, in case the target attribute's + * compression method doesn't match that of the source table. */ TupleTableSlot *mt_decompress_tuple_slot; -- 2.17.0 --YZ5djTAD1cGYuMQK Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v24-0006-alter-table-set-compression.patch" ^ permalink raw reply [nested|flat] 46+ messages in thread
* [PATCH v24 05/10] fixups.patch @ 2021-02-10 21:56 Robert Haas <[email protected]> 0 siblings, 0 replies; 46+ messages in thread From: Robert Haas @ 2021-02-10 21:56 UTC (permalink / raw) --- doc/src/sgml/ddl.sgml | 3 --- doc/src/sgml/ref/create_table.sgml | 15 +++++++++++---- src/backend/access/common/detoast.c | 5 ++--- src/backend/access/compression/compress_lz4.c | 10 +++++----- src/backend/executor/nodeModifyTable.c | 2 +- src/include/nodes/execnodes.h | 4 ++-- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml index 4d7ed698b9..1e9a4625cc 100644 --- a/doc/src/sgml/ddl.sgml +++ b/doc/src/sgml/ddl.sgml @@ -3762,9 +3762,6 @@ CREATE TABLE measurement ( <productname>PostgreSQL</productname> tables (or, possibly, foreign tables). It is possible to specify a tablespace and storage parameters for each partition separately. - By default, each column in a partition inherits the compression method - from parent table's column, however a different compression method can be - set for each partition. </para> <para> diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index 51a7a977a5..a4b297340f 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -997,10 +997,17 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM <term><literal>COMPRESSION <replaceable class="parameter">compression_method</replaceable></literal></term> <listitem> <para> - This sets the compression method for a column. The supported compression - methods are <literal>pglz</literal> and <literal>lz4</literal>. - <literal>lz4</literal> is available only if <literal>--with-lz4</literal> - was used when building <productname>PostgreSQL</productname>. The default + The <literal>COMPRESSION</literal> clause sets the compression method + for a column. Compression is supported only for variable-width data + types, and is used only for columns whose storage type is main or + extended. (See <xref linkend="sql-altertable"/> for information on + column storage types.) Setting this property for a partitioned table + has no direct effect, because such tables have no storage of their own, + but the configured value is inherited by newly-created partitions. + The supported compression methods are <literal>pglz</literal> and + <literal>lz4</literal>. <literal>lz4</literal> is available only if + <literal>--with-lz4</literal> was used when building + <productname>PostgreSQL</productname>. The default is <literal>pglz</literal>. </para> </listitem> diff --git a/src/backend/access/common/detoast.c b/src/backend/access/common/detoast.c index b78d49167b..95d5b1c12a 100644 --- a/src/backend/access/common/detoast.c +++ b/src/backend/access/common/detoast.c @@ -477,8 +477,8 @@ toast_get_compression_oid(struct varlena *attr) return InvalidOid; /* - * Just fetch the toast compress header to know the compression method - * in the compressed data. + * Fetch just enough of the value to examine the compression header, + * so that we can find out the compression method. */ attr = toast_fetch_datum_slice(attr, 0, VARHDRSZ_COMPRESS); } @@ -503,7 +503,6 @@ toast_get_compression_handler(struct varlena *attr) cmid = TOAST_COMPRESS_METHOD(attr); - /* Get the handler routines for the compression method */ switch (cmid) { case PGLZ_COMPRESSION_ID: diff --git a/src/backend/access/compression/compress_lz4.c b/src/backend/access/compression/compress_lz4.c index 1856cf7df7..3079eff7eb 100644 --- a/src/backend/access/compression/compress_lz4.c +++ b/src/backend/access/compression/compress_lz4.c @@ -23,7 +23,7 @@ /* * lz4_cmcompress - compression routine for lz4 compression method * - * Compresses source into dest using the default strategy. Returns the + * Compresses source into dest using the LZ4 defaults. Returns the * compressed varlena, or NULL if compression fails. */ static struct varlena * @@ -42,8 +42,8 @@ lz4_cmcompress(const struct varlena *value) valsize = VARSIZE_ANY_EXHDR(value); /* - * Get maximum size of the compressed data that lz4 compression may output - * and allocate the memory for holding the compressed data and the header. + * Figure out the maximum possible size of the LZ4 output, add the bytes + * that will be needed for varlena overhead, and allocate that amount. */ max_size = LZ4_compressBound(valsize); tmp = (struct varlena *) palloc(max_size + VARHDRSZ_COMPRESS); @@ -83,10 +83,10 @@ lz4_cmdecompress(const struct varlena *value) int32 rawsize; struct varlena *result; - /* allocate memory for holding the uncompressed data */ + /* allocate memory for the uncompressed data */ result = (struct varlena *) palloc(VARRAWSIZE_4B_C(value) + VARHDRSZ); - /* decompress data using lz4 routine */ + /* decompress the data */ rawsize = LZ4_decompress_safe((char *) value + VARHDRSZ_COMPRESS, VARDATA(result), VARSIZE(value) - VARHDRSZ_COMPRESS, diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c index f77deee399..920d9dd0d5 100644 --- a/src/backend/executor/nodeModifyTable.c +++ b/src/backend/executor/nodeModifyTable.c @@ -2117,7 +2117,7 @@ CompareCompressionMethodAndDecompress(TupleTableSlot *slot, TupleTableSlot *newslot = *outslot; /* - * If the called has passed an invalid slot then create a new slot. + * If the caller has passed an invalid slot then create a new slot. * Otherwise, just clear the existing tuple from the slot. This slot * should be stored by the caller so that it can be reused for * decompressing the subsequent tuples. diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index 18e8ecfd90..d8483c36b3 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -1183,8 +1183,8 @@ typedef struct ModifyTableState TupleTableSlot *mt_root_tuple_slot; /* - * Slot for storing the modified tuple, incase the target attribute's - * compression method doesn't match with the source table. + * Slot for storing the modified tuple, in case the target attribute's + * compression method doesn't match that of the source table. */ TupleTableSlot *mt_decompress_tuple_slot; -- 2.17.0 --m51xatjYGsM+13rf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v24-0006-alter-table-set-compression.patch" ^ permalink raw reply [nested|flat] 46+ messages in thread
* [PATCH v24 05/10] fixups.patch @ 2021-02-10 21:56 Robert Haas <[email protected]> 0 siblings, 0 replies; 46+ messages in thread From: Robert Haas @ 2021-02-10 21:56 UTC (permalink / raw) --- doc/src/sgml/ddl.sgml | 3 --- doc/src/sgml/ref/create_table.sgml | 15 +++++++++++---- src/backend/access/common/detoast.c | 5 ++--- src/backend/access/compression/compress_lz4.c | 10 +++++----- src/backend/executor/nodeModifyTable.c | 2 +- src/include/nodes/execnodes.h | 4 ++-- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml index 4d7ed698b9..1e9a4625cc 100644 --- a/doc/src/sgml/ddl.sgml +++ b/doc/src/sgml/ddl.sgml @@ -3762,9 +3762,6 @@ CREATE TABLE measurement ( <productname>PostgreSQL</productname> tables (or, possibly, foreign tables). It is possible to specify a tablespace and storage parameters for each partition separately. - By default, each column in a partition inherits the compression method - from parent table's column, however a different compression method can be - set for each partition. </para> <para> diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index 51a7a977a5..a4b297340f 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -997,10 +997,17 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM <term><literal>COMPRESSION <replaceable class="parameter">compression_method</replaceable></literal></term> <listitem> <para> - This sets the compression method for a column. The supported compression - methods are <literal>pglz</literal> and <literal>lz4</literal>. - <literal>lz4</literal> is available only if <literal>--with-lz4</literal> - was used when building <productname>PostgreSQL</productname>. The default + The <literal>COMPRESSION</literal> clause sets the compression method + for a column. Compression is supported only for variable-width data + types, and is used only for columns whose storage type is main or + extended. (See <xref linkend="sql-altertable"/> for information on + column storage types.) Setting this property for a partitioned table + has no direct effect, because such tables have no storage of their own, + but the configured value is inherited by newly-created partitions. + The supported compression methods are <literal>pglz</literal> and + <literal>lz4</literal>. <literal>lz4</literal> is available only if + <literal>--with-lz4</literal> was used when building + <productname>PostgreSQL</productname>. The default is <literal>pglz</literal>. </para> </listitem> diff --git a/src/backend/access/common/detoast.c b/src/backend/access/common/detoast.c index b78d49167b..95d5b1c12a 100644 --- a/src/backend/access/common/detoast.c +++ b/src/backend/access/common/detoast.c @@ -477,8 +477,8 @@ toast_get_compression_oid(struct varlena *attr) return InvalidOid; /* - * Just fetch the toast compress header to know the compression method - * in the compressed data. + * Fetch just enough of the value to examine the compression header, + * so that we can find out the compression method. */ attr = toast_fetch_datum_slice(attr, 0, VARHDRSZ_COMPRESS); } @@ -503,7 +503,6 @@ toast_get_compression_handler(struct varlena *attr) cmid = TOAST_COMPRESS_METHOD(attr); - /* Get the handler routines for the compression method */ switch (cmid) { case PGLZ_COMPRESSION_ID: diff --git a/src/backend/access/compression/compress_lz4.c b/src/backend/access/compression/compress_lz4.c index 1856cf7df7..3079eff7eb 100644 --- a/src/backend/access/compression/compress_lz4.c +++ b/src/backend/access/compression/compress_lz4.c @@ -23,7 +23,7 @@ /* * lz4_cmcompress - compression routine for lz4 compression method * - * Compresses source into dest using the default strategy. Returns the + * Compresses source into dest using the LZ4 defaults. Returns the * compressed varlena, or NULL if compression fails. */ static struct varlena * @@ -42,8 +42,8 @@ lz4_cmcompress(const struct varlena *value) valsize = VARSIZE_ANY_EXHDR(value); /* - * Get maximum size of the compressed data that lz4 compression may output - * and allocate the memory for holding the compressed data and the header. + * Figure out the maximum possible size of the LZ4 output, add the bytes + * that will be needed for varlena overhead, and allocate that amount. */ max_size = LZ4_compressBound(valsize); tmp = (struct varlena *) palloc(max_size + VARHDRSZ_COMPRESS); @@ -83,10 +83,10 @@ lz4_cmdecompress(const struct varlena *value) int32 rawsize; struct varlena *result; - /* allocate memory for holding the uncompressed data */ + /* allocate memory for the uncompressed data */ result = (struct varlena *) palloc(VARRAWSIZE_4B_C(value) + VARHDRSZ); - /* decompress data using lz4 routine */ + /* decompress the data */ rawsize = LZ4_decompress_safe((char *) value + VARHDRSZ_COMPRESS, VARDATA(result), VARSIZE(value) - VARHDRSZ_COMPRESS, diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c index f77deee399..920d9dd0d5 100644 --- a/src/backend/executor/nodeModifyTable.c +++ b/src/backend/executor/nodeModifyTable.c @@ -2117,7 +2117,7 @@ CompareCompressionMethodAndDecompress(TupleTableSlot *slot, TupleTableSlot *newslot = *outslot; /* - * If the called has passed an invalid slot then create a new slot. + * If the caller has passed an invalid slot then create a new slot. * Otherwise, just clear the existing tuple from the slot. This slot * should be stored by the caller so that it can be reused for * decompressing the subsequent tuples. diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index 18e8ecfd90..d8483c36b3 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -1183,8 +1183,8 @@ typedef struct ModifyTableState TupleTableSlot *mt_root_tuple_slot; /* - * Slot for storing the modified tuple, incase the target attribute's - * compression method doesn't match with the source table. + * Slot for storing the modified tuple, in case the target attribute's + * compression method doesn't match that of the source table. */ TupleTableSlot *mt_decompress_tuple_slot; -- 2.17.0 --m51xatjYGsM+13rf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v24-0006-alter-table-set-compression.patch" ^ permalink raw reply [nested|flat] 46+ messages in thread
* [PATCH v24 05/10] fixups.patch @ 2021-02-10 21:56 Robert Haas <[email protected]> 0 siblings, 0 replies; 46+ messages in thread From: Robert Haas @ 2021-02-10 21:56 UTC (permalink / raw) --- doc/src/sgml/ddl.sgml | 3 --- doc/src/sgml/ref/create_table.sgml | 15 +++++++++++---- src/backend/access/common/detoast.c | 5 ++--- src/backend/access/compression/compress_lz4.c | 10 +++++----- src/backend/executor/nodeModifyTable.c | 2 +- src/include/nodes/execnodes.h | 4 ++-- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml index 4d7ed698b9..1e9a4625cc 100644 --- a/doc/src/sgml/ddl.sgml +++ b/doc/src/sgml/ddl.sgml @@ -3762,9 +3762,6 @@ CREATE TABLE measurement ( <productname>PostgreSQL</productname> tables (or, possibly, foreign tables). It is possible to specify a tablespace and storage parameters for each partition separately. - By default, each column in a partition inherits the compression method - from parent table's column, however a different compression method can be - set for each partition. </para> <para> diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index 51a7a977a5..a4b297340f 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -997,10 +997,17 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM <term><literal>COMPRESSION <replaceable class="parameter">compression_method</replaceable></literal></term> <listitem> <para> - This sets the compression method for a column. The supported compression - methods are <literal>pglz</literal> and <literal>lz4</literal>. - <literal>lz4</literal> is available only if <literal>--with-lz4</literal> - was used when building <productname>PostgreSQL</productname>. The default + The <literal>COMPRESSION</literal> clause sets the compression method + for a column. Compression is supported only for variable-width data + types, and is used only for columns whose storage type is main or + extended. (See <xref linkend="sql-altertable"/> for information on + column storage types.) Setting this property for a partitioned table + has no direct effect, because such tables have no storage of their own, + but the configured value is inherited by newly-created partitions. + The supported compression methods are <literal>pglz</literal> and + <literal>lz4</literal>. <literal>lz4</literal> is available only if + <literal>--with-lz4</literal> was used when building + <productname>PostgreSQL</productname>. The default is <literal>pglz</literal>. </para> </listitem> diff --git a/src/backend/access/common/detoast.c b/src/backend/access/common/detoast.c index b78d49167b..95d5b1c12a 100644 --- a/src/backend/access/common/detoast.c +++ b/src/backend/access/common/detoast.c @@ -477,8 +477,8 @@ toast_get_compression_oid(struct varlena *attr) return InvalidOid; /* - * Just fetch the toast compress header to know the compression method - * in the compressed data. + * Fetch just enough of the value to examine the compression header, + * so that we can find out the compression method. */ attr = toast_fetch_datum_slice(attr, 0, VARHDRSZ_COMPRESS); } @@ -503,7 +503,6 @@ toast_get_compression_handler(struct varlena *attr) cmid = TOAST_COMPRESS_METHOD(attr); - /* Get the handler routines for the compression method */ switch (cmid) { case PGLZ_COMPRESSION_ID: diff --git a/src/backend/access/compression/compress_lz4.c b/src/backend/access/compression/compress_lz4.c index 1856cf7df7..3079eff7eb 100644 --- a/src/backend/access/compression/compress_lz4.c +++ b/src/backend/access/compression/compress_lz4.c @@ -23,7 +23,7 @@ /* * lz4_cmcompress - compression routine for lz4 compression method * - * Compresses source into dest using the default strategy. Returns the + * Compresses source into dest using the LZ4 defaults. Returns the * compressed varlena, or NULL if compression fails. */ static struct varlena * @@ -42,8 +42,8 @@ lz4_cmcompress(const struct varlena *value) valsize = VARSIZE_ANY_EXHDR(value); /* - * Get maximum size of the compressed data that lz4 compression may output - * and allocate the memory for holding the compressed data and the header. + * Figure out the maximum possible size of the LZ4 output, add the bytes + * that will be needed for varlena overhead, and allocate that amount. */ max_size = LZ4_compressBound(valsize); tmp = (struct varlena *) palloc(max_size + VARHDRSZ_COMPRESS); @@ -83,10 +83,10 @@ lz4_cmdecompress(const struct varlena *value) int32 rawsize; struct varlena *result; - /* allocate memory for holding the uncompressed data */ + /* allocate memory for the uncompressed data */ result = (struct varlena *) palloc(VARRAWSIZE_4B_C(value) + VARHDRSZ); - /* decompress data using lz4 routine */ + /* decompress the data */ rawsize = LZ4_decompress_safe((char *) value + VARHDRSZ_COMPRESS, VARDATA(result), VARSIZE(value) - VARHDRSZ_COMPRESS, diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c index f77deee399..920d9dd0d5 100644 --- a/src/backend/executor/nodeModifyTable.c +++ b/src/backend/executor/nodeModifyTable.c @@ -2117,7 +2117,7 @@ CompareCompressionMethodAndDecompress(TupleTableSlot *slot, TupleTableSlot *newslot = *outslot; /* - * If the called has passed an invalid slot then create a new slot. + * If the caller has passed an invalid slot then create a new slot. * Otherwise, just clear the existing tuple from the slot. This slot * should be stored by the caller so that it can be reused for * decompressing the subsequent tuples. diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index 18e8ecfd90..d8483c36b3 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -1183,8 +1183,8 @@ typedef struct ModifyTableState TupleTableSlot *mt_root_tuple_slot; /* - * Slot for storing the modified tuple, incase the target attribute's - * compression method doesn't match with the source table. + * Slot for storing the modified tuple, in case the target attribute's + * compression method doesn't match that of the source table. */ TupleTableSlot *mt_decompress_tuple_slot; -- 2.17.0 --m51xatjYGsM+13rf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v24-0006-alter-table-set-compression.patch" ^ permalink raw reply [nested|flat] 46+ messages in thread
* [PATCH 06/12] fixups.patch @ 2021-02-10 21:56 Robert Haas <[email protected]> 0 siblings, 0 replies; 46+ messages in thread From: Robert Haas @ 2021-02-10 21:56 UTC (permalink / raw) --- doc/src/sgml/ddl.sgml | 3 --- doc/src/sgml/ref/create_table.sgml | 15 +++++++++++---- src/backend/access/common/detoast.c | 5 ++--- src/backend/access/compression/compress_lz4.c | 10 +++++----- src/backend/executor/nodeModifyTable.c | 2 +- src/include/nodes/execnodes.h | 4 ++-- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml index 4d7ed698b9..1e9a4625cc 100644 --- a/doc/src/sgml/ddl.sgml +++ b/doc/src/sgml/ddl.sgml @@ -3762,9 +3762,6 @@ CREATE TABLE measurement ( <productname>PostgreSQL</productname> tables (or, possibly, foreign tables). It is possible to specify a tablespace and storage parameters for each partition separately. - By default, each column in a partition inherits the compression method - from parent table's column, however a different compression method can be - set for each partition. </para> <para> diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index 3374012940..807597e648 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -997,10 +997,17 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM <term><literal>COMPRESSION <replaceable class="parameter">compression_method</replaceable></literal></term> <listitem> <para> - This sets the compression method for a column. The supported compression - methods are <literal>pglz</literal> and <literal>lz4</literal>. - <literal>lz4</literal> is available only if <literal>--with-lz4</literal> - was used when building <productname>PostgreSQL</productname>. The default + The <literal>COMPRESSION</literal> clause sets the compression method + for a column. Compression is supported only for variable-width data + types, and is used only for columns whose storage type is main or + extended. (See <xref linkend="sql-altertable"/> for information on + column storage types.) Setting this property for a partitioned table + has no direct effect, because such tables have no storage of their own, + but the configured value is inherited by newly-created partitions. + The supported compression methods are <literal>pglz</literal> and + <literal>lz4</literal>. <literal>lz4</literal> is available only if + <literal>--with-lz4</literal> was used when building + <productname>PostgreSQL</productname>. The default is <literal>pglz</literal>. </para> </listitem> diff --git a/src/backend/access/common/detoast.c b/src/backend/access/common/detoast.c index b78d49167b..95d5b1c12a 100644 --- a/src/backend/access/common/detoast.c +++ b/src/backend/access/common/detoast.c @@ -477,8 +477,8 @@ toast_get_compression_oid(struct varlena *attr) return InvalidOid; /* - * Just fetch the toast compress header to know the compression method - * in the compressed data. + * Fetch just enough of the value to examine the compression header, + * so that we can find out the compression method. */ attr = toast_fetch_datum_slice(attr, 0, VARHDRSZ_COMPRESS); } @@ -503,7 +503,6 @@ toast_get_compression_handler(struct varlena *attr) cmid = TOAST_COMPRESS_METHOD(attr); - /* Get the handler routines for the compression method */ switch (cmid) { case PGLZ_COMPRESSION_ID: diff --git a/src/backend/access/compression/compress_lz4.c b/src/backend/access/compression/compress_lz4.c index 1856cf7df7..3079eff7eb 100644 --- a/src/backend/access/compression/compress_lz4.c +++ b/src/backend/access/compression/compress_lz4.c @@ -23,7 +23,7 @@ /* * lz4_cmcompress - compression routine for lz4 compression method * - * Compresses source into dest using the default strategy. Returns the + * Compresses source into dest using the LZ4 defaults. Returns the * compressed varlena, or NULL if compression fails. */ static struct varlena * @@ -42,8 +42,8 @@ lz4_cmcompress(const struct varlena *value) valsize = VARSIZE_ANY_EXHDR(value); /* - * Get maximum size of the compressed data that lz4 compression may output - * and allocate the memory for holding the compressed data and the header. + * Figure out the maximum possible size of the LZ4 output, add the bytes + * that will be needed for varlena overhead, and allocate that amount. */ max_size = LZ4_compressBound(valsize); tmp = (struct varlena *) palloc(max_size + VARHDRSZ_COMPRESS); @@ -83,10 +83,10 @@ lz4_cmdecompress(const struct varlena *value) int32 rawsize; struct varlena *result; - /* allocate memory for holding the uncompressed data */ + /* allocate memory for the uncompressed data */ result = (struct varlena *) palloc(VARRAWSIZE_4B_C(value) + VARHDRSZ); - /* decompress data using lz4 routine */ + /* decompress the data */ rawsize = LZ4_decompress_safe((char *) value + VARHDRSZ_COMPRESS, VARDATA(result), VARSIZE(value) - VARHDRSZ_COMPRESS, diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c index f77deee399..920d9dd0d5 100644 --- a/src/backend/executor/nodeModifyTable.c +++ b/src/backend/executor/nodeModifyTable.c @@ -2117,7 +2117,7 @@ CompareCompressionMethodAndDecompress(TupleTableSlot *slot, TupleTableSlot *newslot = *outslot; /* - * If the called has passed an invalid slot then create a new slot. + * If the caller has passed an invalid slot then create a new slot. * Otherwise, just clear the existing tuple from the slot. This slot * should be stored by the caller so that it can be reused for * decompressing the subsequent tuples. diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index ac3884b3a8..182b77a0ff 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -1186,8 +1186,8 @@ typedef struct ModifyTableState TupleTableSlot *mt_root_tuple_slot; /* - * Slot for storing the modified tuple, incase the target attribute's - * compression method doesn't match with the source table. + * Slot for storing the modified tuple, in case the target attribute's + * compression method doesn't match that of the source table. */ TupleTableSlot *mt_decompress_tuple_slot; -- 2.17.0 --9Ek0hoCL9XbhcSqy Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0007-alter-table-set-compression.patch" ^ permalink raw reply [nested|flat] 46+ messages in thread
* [PATCH v24 05/10] fixups.patch @ 2021-02-10 21:56 Robert Haas <[email protected]> 0 siblings, 0 replies; 46+ messages in thread From: Robert Haas @ 2021-02-10 21:56 UTC (permalink / raw) --- doc/src/sgml/ddl.sgml | 3 --- doc/src/sgml/ref/create_table.sgml | 15 +++++++++++---- src/backend/access/common/detoast.c | 5 ++--- src/backend/access/compression/compress_lz4.c | 10 +++++----- src/backend/executor/nodeModifyTable.c | 2 +- src/include/nodes/execnodes.h | 4 ++-- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml index 4d7ed698b9..1e9a4625cc 100644 --- a/doc/src/sgml/ddl.sgml +++ b/doc/src/sgml/ddl.sgml @@ -3762,9 +3762,6 @@ CREATE TABLE measurement ( <productname>PostgreSQL</productname> tables (or, possibly, foreign tables). It is possible to specify a tablespace and storage parameters for each partition separately. - By default, each column in a partition inherits the compression method - from parent table's column, however a different compression method can be - set for each partition. </para> <para> diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index 51a7a977a5..a4b297340f 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -997,10 +997,17 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM <term><literal>COMPRESSION <replaceable class="parameter">compression_method</replaceable></literal></term> <listitem> <para> - This sets the compression method for a column. The supported compression - methods are <literal>pglz</literal> and <literal>lz4</literal>. - <literal>lz4</literal> is available only if <literal>--with-lz4</literal> - was used when building <productname>PostgreSQL</productname>. The default + The <literal>COMPRESSION</literal> clause sets the compression method + for a column. Compression is supported only for variable-width data + types, and is used only for columns whose storage type is main or + extended. (See <xref linkend="sql-altertable"/> for information on + column storage types.) Setting this property for a partitioned table + has no direct effect, because such tables have no storage of their own, + but the configured value is inherited by newly-created partitions. + The supported compression methods are <literal>pglz</literal> and + <literal>lz4</literal>. <literal>lz4</literal> is available only if + <literal>--with-lz4</literal> was used when building + <productname>PostgreSQL</productname>. The default is <literal>pglz</literal>. </para> </listitem> diff --git a/src/backend/access/common/detoast.c b/src/backend/access/common/detoast.c index b78d49167b..95d5b1c12a 100644 --- a/src/backend/access/common/detoast.c +++ b/src/backend/access/common/detoast.c @@ -477,8 +477,8 @@ toast_get_compression_oid(struct varlena *attr) return InvalidOid; /* - * Just fetch the toast compress header to know the compression method - * in the compressed data. + * Fetch just enough of the value to examine the compression header, + * so that we can find out the compression method. */ attr = toast_fetch_datum_slice(attr, 0, VARHDRSZ_COMPRESS); } @@ -503,7 +503,6 @@ toast_get_compression_handler(struct varlena *attr) cmid = TOAST_COMPRESS_METHOD(attr); - /* Get the handler routines for the compression method */ switch (cmid) { case PGLZ_COMPRESSION_ID: diff --git a/src/backend/access/compression/compress_lz4.c b/src/backend/access/compression/compress_lz4.c index 1856cf7df7..3079eff7eb 100644 --- a/src/backend/access/compression/compress_lz4.c +++ b/src/backend/access/compression/compress_lz4.c @@ -23,7 +23,7 @@ /* * lz4_cmcompress - compression routine for lz4 compression method * - * Compresses source into dest using the default strategy. Returns the + * Compresses source into dest using the LZ4 defaults. Returns the * compressed varlena, or NULL if compression fails. */ static struct varlena * @@ -42,8 +42,8 @@ lz4_cmcompress(const struct varlena *value) valsize = VARSIZE_ANY_EXHDR(value); /* - * Get maximum size of the compressed data that lz4 compression may output - * and allocate the memory for holding the compressed data and the header. + * Figure out the maximum possible size of the LZ4 output, add the bytes + * that will be needed for varlena overhead, and allocate that amount. */ max_size = LZ4_compressBound(valsize); tmp = (struct varlena *) palloc(max_size + VARHDRSZ_COMPRESS); @@ -83,10 +83,10 @@ lz4_cmdecompress(const struct varlena *value) int32 rawsize; struct varlena *result; - /* allocate memory for holding the uncompressed data */ + /* allocate memory for the uncompressed data */ result = (struct varlena *) palloc(VARRAWSIZE_4B_C(value) + VARHDRSZ); - /* decompress data using lz4 routine */ + /* decompress the data */ rawsize = LZ4_decompress_safe((char *) value + VARHDRSZ_COMPRESS, VARDATA(result), VARSIZE(value) - VARHDRSZ_COMPRESS, diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c index f77deee399..920d9dd0d5 100644 --- a/src/backend/executor/nodeModifyTable.c +++ b/src/backend/executor/nodeModifyTable.c @@ -2117,7 +2117,7 @@ CompareCompressionMethodAndDecompress(TupleTableSlot *slot, TupleTableSlot *newslot = *outslot; /* - * If the called has passed an invalid slot then create a new slot. + * If the caller has passed an invalid slot then create a new slot. * Otherwise, just clear the existing tuple from the slot. This slot * should be stored by the caller so that it can be reused for * decompressing the subsequent tuples. diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index 18e8ecfd90..d8483c36b3 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -1183,8 +1183,8 @@ typedef struct ModifyTableState TupleTableSlot *mt_root_tuple_slot; /* - * Slot for storing the modified tuple, incase the target attribute's - * compression method doesn't match with the source table. + * Slot for storing the modified tuple, in case the target attribute's + * compression method doesn't match that of the source table. */ TupleTableSlot *mt_decompress_tuple_slot; -- 2.17.0 --m51xatjYGsM+13rf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v24-0006-alter-table-set-compression.patch" ^ permalink raw reply [nested|flat] 46+ messages in thread
* [PATCH v24 05/10] fixups.patch @ 2021-02-10 21:56 Robert Haas <[email protected]> 0 siblings, 0 replies; 46+ messages in thread From: Robert Haas @ 2021-02-10 21:56 UTC (permalink / raw) --- doc/src/sgml/ddl.sgml | 3 --- doc/src/sgml/ref/create_table.sgml | 15 +++++++++++---- src/backend/access/common/detoast.c | 5 ++--- src/backend/access/compression/compress_lz4.c | 10 +++++----- src/backend/executor/nodeModifyTable.c | 2 +- src/include/nodes/execnodes.h | 4 ++-- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml index 4d7ed698b9..1e9a4625cc 100644 --- a/doc/src/sgml/ddl.sgml +++ b/doc/src/sgml/ddl.sgml @@ -3762,9 +3762,6 @@ CREATE TABLE measurement ( <productname>PostgreSQL</productname> tables (or, possibly, foreign tables). It is possible to specify a tablespace and storage parameters for each partition separately. - By default, each column in a partition inherits the compression method - from parent table's column, however a different compression method can be - set for each partition. </para> <para> diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index 51a7a977a5..a4b297340f 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -997,10 +997,17 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM <term><literal>COMPRESSION <replaceable class="parameter">compression_method</replaceable></literal></term> <listitem> <para> - This sets the compression method for a column. The supported compression - methods are <literal>pglz</literal> and <literal>lz4</literal>. - <literal>lz4</literal> is available only if <literal>--with-lz4</literal> - was used when building <productname>PostgreSQL</productname>. The default + The <literal>COMPRESSION</literal> clause sets the compression method + for a column. Compression is supported only for variable-width data + types, and is used only for columns whose storage type is main or + extended. (See <xref linkend="sql-altertable"/> for information on + column storage types.) Setting this property for a partitioned table + has no direct effect, because such tables have no storage of their own, + but the configured value is inherited by newly-created partitions. + The supported compression methods are <literal>pglz</literal> and + <literal>lz4</literal>. <literal>lz4</literal> is available only if + <literal>--with-lz4</literal> was used when building + <productname>PostgreSQL</productname>. The default is <literal>pglz</literal>. </para> </listitem> diff --git a/src/backend/access/common/detoast.c b/src/backend/access/common/detoast.c index b78d49167b..95d5b1c12a 100644 --- a/src/backend/access/common/detoast.c +++ b/src/backend/access/common/detoast.c @@ -477,8 +477,8 @@ toast_get_compression_oid(struct varlena *attr) return InvalidOid; /* - * Just fetch the toast compress header to know the compression method - * in the compressed data. + * Fetch just enough of the value to examine the compression header, + * so that we can find out the compression method. */ attr = toast_fetch_datum_slice(attr, 0, VARHDRSZ_COMPRESS); } @@ -503,7 +503,6 @@ toast_get_compression_handler(struct varlena *attr) cmid = TOAST_COMPRESS_METHOD(attr); - /* Get the handler routines for the compression method */ switch (cmid) { case PGLZ_COMPRESSION_ID: diff --git a/src/backend/access/compression/compress_lz4.c b/src/backend/access/compression/compress_lz4.c index 1856cf7df7..3079eff7eb 100644 --- a/src/backend/access/compression/compress_lz4.c +++ b/src/backend/access/compression/compress_lz4.c @@ -23,7 +23,7 @@ /* * lz4_cmcompress - compression routine for lz4 compression method * - * Compresses source into dest using the default strategy. Returns the + * Compresses source into dest using the LZ4 defaults. Returns the * compressed varlena, or NULL if compression fails. */ static struct varlena * @@ -42,8 +42,8 @@ lz4_cmcompress(const struct varlena *value) valsize = VARSIZE_ANY_EXHDR(value); /* - * Get maximum size of the compressed data that lz4 compression may output - * and allocate the memory for holding the compressed data and the header. + * Figure out the maximum possible size of the LZ4 output, add the bytes + * that will be needed for varlena overhead, and allocate that amount. */ max_size = LZ4_compressBound(valsize); tmp = (struct varlena *) palloc(max_size + VARHDRSZ_COMPRESS); @@ -83,10 +83,10 @@ lz4_cmdecompress(const struct varlena *value) int32 rawsize; struct varlena *result; - /* allocate memory for holding the uncompressed data */ + /* allocate memory for the uncompressed data */ result = (struct varlena *) palloc(VARRAWSIZE_4B_C(value) + VARHDRSZ); - /* decompress data using lz4 routine */ + /* decompress the data */ rawsize = LZ4_decompress_safe((char *) value + VARHDRSZ_COMPRESS, VARDATA(result), VARSIZE(value) - VARHDRSZ_COMPRESS, diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c index f77deee399..920d9dd0d5 100644 --- a/src/backend/executor/nodeModifyTable.c +++ b/src/backend/executor/nodeModifyTable.c @@ -2117,7 +2117,7 @@ CompareCompressionMethodAndDecompress(TupleTableSlot *slot, TupleTableSlot *newslot = *outslot; /* - * If the called has passed an invalid slot then create a new slot. + * If the caller has passed an invalid slot then create a new slot. * Otherwise, just clear the existing tuple from the slot. This slot * should be stored by the caller so that it can be reused for * decompressing the subsequent tuples. diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index 18e8ecfd90..d8483c36b3 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -1183,8 +1183,8 @@ typedef struct ModifyTableState TupleTableSlot *mt_root_tuple_slot; /* - * Slot for storing the modified tuple, incase the target attribute's - * compression method doesn't match with the source table. + * Slot for storing the modified tuple, in case the target attribute's + * compression method doesn't match that of the source table. */ TupleTableSlot *mt_decompress_tuple_slot; -- 2.17.0 --m51xatjYGsM+13rf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v24-0006-alter-table-set-compression.patch" ^ permalink raw reply [nested|flat] 46+ messages in thread
* [PATCH v24 05/10] fixups.patch @ 2021-02-10 21:56 Robert Haas <[email protected]> 0 siblings, 0 replies; 46+ messages in thread From: Robert Haas @ 2021-02-10 21:56 UTC (permalink / raw) --- doc/src/sgml/ddl.sgml | 3 --- doc/src/sgml/ref/create_table.sgml | 15 +++++++++++---- src/backend/access/common/detoast.c | 5 ++--- src/backend/access/compression/compress_lz4.c | 10 +++++----- src/backend/executor/nodeModifyTable.c | 2 +- src/include/nodes/execnodes.h | 4 ++-- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml index 4d7ed698b9..1e9a4625cc 100644 --- a/doc/src/sgml/ddl.sgml +++ b/doc/src/sgml/ddl.sgml @@ -3762,9 +3762,6 @@ CREATE TABLE measurement ( <productname>PostgreSQL</productname> tables (or, possibly, foreign tables). It is possible to specify a tablespace and storage parameters for each partition separately. - By default, each column in a partition inherits the compression method - from parent table's column, however a different compression method can be - set for each partition. </para> <para> diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index 51a7a977a5..a4b297340f 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -997,10 +997,17 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM <term><literal>COMPRESSION <replaceable class="parameter">compression_method</replaceable></literal></term> <listitem> <para> - This sets the compression method for a column. The supported compression - methods are <literal>pglz</literal> and <literal>lz4</literal>. - <literal>lz4</literal> is available only if <literal>--with-lz4</literal> - was used when building <productname>PostgreSQL</productname>. The default + The <literal>COMPRESSION</literal> clause sets the compression method + for a column. Compression is supported only for variable-width data + types, and is used only for columns whose storage type is main or + extended. (See <xref linkend="sql-altertable"/> for information on + column storage types.) Setting this property for a partitioned table + has no direct effect, because such tables have no storage of their own, + but the configured value is inherited by newly-created partitions. + The supported compression methods are <literal>pglz</literal> and + <literal>lz4</literal>. <literal>lz4</literal> is available only if + <literal>--with-lz4</literal> was used when building + <productname>PostgreSQL</productname>. The default is <literal>pglz</literal>. </para> </listitem> diff --git a/src/backend/access/common/detoast.c b/src/backend/access/common/detoast.c index b78d49167b..95d5b1c12a 100644 --- a/src/backend/access/common/detoast.c +++ b/src/backend/access/common/detoast.c @@ -477,8 +477,8 @@ toast_get_compression_oid(struct varlena *attr) return InvalidOid; /* - * Just fetch the toast compress header to know the compression method - * in the compressed data. + * Fetch just enough of the value to examine the compression header, + * so that we can find out the compression method. */ attr = toast_fetch_datum_slice(attr, 0, VARHDRSZ_COMPRESS); } @@ -503,7 +503,6 @@ toast_get_compression_handler(struct varlena *attr) cmid = TOAST_COMPRESS_METHOD(attr); - /* Get the handler routines for the compression method */ switch (cmid) { case PGLZ_COMPRESSION_ID: diff --git a/src/backend/access/compression/compress_lz4.c b/src/backend/access/compression/compress_lz4.c index 1856cf7df7..3079eff7eb 100644 --- a/src/backend/access/compression/compress_lz4.c +++ b/src/backend/access/compression/compress_lz4.c @@ -23,7 +23,7 @@ /* * lz4_cmcompress - compression routine for lz4 compression method * - * Compresses source into dest using the default strategy. Returns the + * Compresses source into dest using the LZ4 defaults. Returns the * compressed varlena, or NULL if compression fails. */ static struct varlena * @@ -42,8 +42,8 @@ lz4_cmcompress(const struct varlena *value) valsize = VARSIZE_ANY_EXHDR(value); /* - * Get maximum size of the compressed data that lz4 compression may output - * and allocate the memory for holding the compressed data and the header. + * Figure out the maximum possible size of the LZ4 output, add the bytes + * that will be needed for varlena overhead, and allocate that amount. */ max_size = LZ4_compressBound(valsize); tmp = (struct varlena *) palloc(max_size + VARHDRSZ_COMPRESS); @@ -83,10 +83,10 @@ lz4_cmdecompress(const struct varlena *value) int32 rawsize; struct varlena *result; - /* allocate memory for holding the uncompressed data */ + /* allocate memory for the uncompressed data */ result = (struct varlena *) palloc(VARRAWSIZE_4B_C(value) + VARHDRSZ); - /* decompress data using lz4 routine */ + /* decompress the data */ rawsize = LZ4_decompress_safe((char *) value + VARHDRSZ_COMPRESS, VARDATA(result), VARSIZE(value) - VARHDRSZ_COMPRESS, diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c index f77deee399..920d9dd0d5 100644 --- a/src/backend/executor/nodeModifyTable.c +++ b/src/backend/executor/nodeModifyTable.c @@ -2117,7 +2117,7 @@ CompareCompressionMethodAndDecompress(TupleTableSlot *slot, TupleTableSlot *newslot = *outslot; /* - * If the called has passed an invalid slot then create a new slot. + * If the caller has passed an invalid slot then create a new slot. * Otherwise, just clear the existing tuple from the slot. This slot * should be stored by the caller so that it can be reused for * decompressing the subsequent tuples. diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index 18e8ecfd90..d8483c36b3 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -1183,8 +1183,8 @@ typedef struct ModifyTableState TupleTableSlot *mt_root_tuple_slot; /* - * Slot for storing the modified tuple, incase the target attribute's - * compression method doesn't match with the source table. + * Slot for storing the modified tuple, in case the target attribute's + * compression method doesn't match that of the source table. */ TupleTableSlot *mt_decompress_tuple_slot; -- 2.17.0 --m51xatjYGsM+13rf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v24-0006-alter-table-set-compression.patch" ^ permalink raw reply [nested|flat] 46+ messages in thread
* [PATCH v24 05/10] fixups.patch @ 2021-02-10 21:56 Robert Haas <[email protected]> 0 siblings, 0 replies; 46+ messages in thread From: Robert Haas @ 2021-02-10 21:56 UTC (permalink / raw) --- doc/src/sgml/ddl.sgml | 3 --- doc/src/sgml/ref/create_table.sgml | 15 +++++++++++---- src/backend/access/common/detoast.c | 5 ++--- src/backend/access/compression/compress_lz4.c | 10 +++++----- src/backend/executor/nodeModifyTable.c | 2 +- src/include/nodes/execnodes.h | 4 ++-- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml index 4d7ed698b9..1e9a4625cc 100644 --- a/doc/src/sgml/ddl.sgml +++ b/doc/src/sgml/ddl.sgml @@ -3762,9 +3762,6 @@ CREATE TABLE measurement ( <productname>PostgreSQL</productname> tables (or, possibly, foreign tables). It is possible to specify a tablespace and storage parameters for each partition separately. - By default, each column in a partition inherits the compression method - from parent table's column, however a different compression method can be - set for each partition. </para> <para> diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index 51a7a977a5..a4b297340f 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -997,10 +997,17 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM <term><literal>COMPRESSION <replaceable class="parameter">compression_method</replaceable></literal></term> <listitem> <para> - This sets the compression method for a column. The supported compression - methods are <literal>pglz</literal> and <literal>lz4</literal>. - <literal>lz4</literal> is available only if <literal>--with-lz4</literal> - was used when building <productname>PostgreSQL</productname>. The default + The <literal>COMPRESSION</literal> clause sets the compression method + for a column. Compression is supported only for variable-width data + types, and is used only for columns whose storage type is main or + extended. (See <xref linkend="sql-altertable"/> for information on + column storage types.) Setting this property for a partitioned table + has no direct effect, because such tables have no storage of their own, + but the configured value is inherited by newly-created partitions. + The supported compression methods are <literal>pglz</literal> and + <literal>lz4</literal>. <literal>lz4</literal> is available only if + <literal>--with-lz4</literal> was used when building + <productname>PostgreSQL</productname>. The default is <literal>pglz</literal>. </para> </listitem> diff --git a/src/backend/access/common/detoast.c b/src/backend/access/common/detoast.c index b78d49167b..95d5b1c12a 100644 --- a/src/backend/access/common/detoast.c +++ b/src/backend/access/common/detoast.c @@ -477,8 +477,8 @@ toast_get_compression_oid(struct varlena *attr) return InvalidOid; /* - * Just fetch the toast compress header to know the compression method - * in the compressed data. + * Fetch just enough of the value to examine the compression header, + * so that we can find out the compression method. */ attr = toast_fetch_datum_slice(attr, 0, VARHDRSZ_COMPRESS); } @@ -503,7 +503,6 @@ toast_get_compression_handler(struct varlena *attr) cmid = TOAST_COMPRESS_METHOD(attr); - /* Get the handler routines for the compression method */ switch (cmid) { case PGLZ_COMPRESSION_ID: diff --git a/src/backend/access/compression/compress_lz4.c b/src/backend/access/compression/compress_lz4.c index 1856cf7df7..3079eff7eb 100644 --- a/src/backend/access/compression/compress_lz4.c +++ b/src/backend/access/compression/compress_lz4.c @@ -23,7 +23,7 @@ /* * lz4_cmcompress - compression routine for lz4 compression method * - * Compresses source into dest using the default strategy. Returns the + * Compresses source into dest using the LZ4 defaults. Returns the * compressed varlena, or NULL if compression fails. */ static struct varlena * @@ -42,8 +42,8 @@ lz4_cmcompress(const struct varlena *value) valsize = VARSIZE_ANY_EXHDR(value); /* - * Get maximum size of the compressed data that lz4 compression may output - * and allocate the memory for holding the compressed data and the header. + * Figure out the maximum possible size of the LZ4 output, add the bytes + * that will be needed for varlena overhead, and allocate that amount. */ max_size = LZ4_compressBound(valsize); tmp = (struct varlena *) palloc(max_size + VARHDRSZ_COMPRESS); @@ -83,10 +83,10 @@ lz4_cmdecompress(const struct varlena *value) int32 rawsize; struct varlena *result; - /* allocate memory for holding the uncompressed data */ + /* allocate memory for the uncompressed data */ result = (struct varlena *) palloc(VARRAWSIZE_4B_C(value) + VARHDRSZ); - /* decompress data using lz4 routine */ + /* decompress the data */ rawsize = LZ4_decompress_safe((char *) value + VARHDRSZ_COMPRESS, VARDATA(result), VARSIZE(value) - VARHDRSZ_COMPRESS, diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c index f77deee399..920d9dd0d5 100644 --- a/src/backend/executor/nodeModifyTable.c +++ b/src/backend/executor/nodeModifyTable.c @@ -2117,7 +2117,7 @@ CompareCompressionMethodAndDecompress(TupleTableSlot *slot, TupleTableSlot *newslot = *outslot; /* - * If the called has passed an invalid slot then create a new slot. + * If the caller has passed an invalid slot then create a new slot. * Otherwise, just clear the existing tuple from the slot. This slot * should be stored by the caller so that it can be reused for * decompressing the subsequent tuples. diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index 18e8ecfd90..d8483c36b3 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -1183,8 +1183,8 @@ typedef struct ModifyTableState TupleTableSlot *mt_root_tuple_slot; /* - * Slot for storing the modified tuple, incase the target attribute's - * compression method doesn't match with the source table. + * Slot for storing the modified tuple, in case the target attribute's + * compression method doesn't match that of the source table. */ TupleTableSlot *mt_decompress_tuple_slot; -- 2.17.0 --m51xatjYGsM+13rf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v24-0006-alter-table-set-compression.patch" ^ permalink raw reply [nested|flat] 46+ messages in thread
* [PATCH v24 5/7] fixups.patch @ 2021-02-10 21:56 Robert Haas <[email protected]> 0 siblings, 0 replies; 46+ messages in thread From: Robert Haas @ 2021-02-10 21:56 UTC (permalink / raw) --- doc/src/sgml/ddl.sgml | 3 --- doc/src/sgml/ref/create_table.sgml | 15 +++++++++++---- src/backend/access/common/detoast.c | 5 ++--- src/backend/access/compression/compress_lz4.c | 10 +++++----- src/backend/executor/nodeModifyTable.c | 2 +- src/include/nodes/execnodes.h | 4 ++-- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml index 4d7ed698b9..1e9a4625cc 100644 --- a/doc/src/sgml/ddl.sgml +++ b/doc/src/sgml/ddl.sgml @@ -3762,9 +3762,6 @@ CREATE TABLE measurement ( <productname>PostgreSQL</productname> tables (or, possibly, foreign tables). It is possible to specify a tablespace and storage parameters for each partition separately. - By default, each column in a partition inherits the compression method - from parent table's column, however a different compression method can be - set for each partition. </para> <para> diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index 51a7a977a5..a4b297340f 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -997,10 +997,17 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM <term><literal>COMPRESSION <replaceable class="parameter">compression_method</replaceable></literal></term> <listitem> <para> - This sets the compression method for a column. The supported compression - methods are <literal>pglz</literal> and <literal>lz4</literal>. - <literal>lz4</literal> is available only if <literal>--with-lz4</literal> - was used when building <productname>PostgreSQL</productname>. The default + The <literal>COMPRESSION</literal> clause sets the compression method + for a column. Compression is supported only for variable-width data + types, and is used only for columns whose storage type is main or + extended. (See <xref linkend="sql-altertable"/> for information on + column storage types.) Setting this property for a partitioned table + has no direct effect, because such tables have no storage of their own, + but the configured value is inherited by newly-created partitions. + The supported compression methods are <literal>pglz</literal> and + <literal>lz4</literal>. <literal>lz4</literal> is available only if + <literal>--with-lz4</literal> was used when building + <productname>PostgreSQL</productname>. The default is <literal>pglz</literal>. </para> </listitem> diff --git a/src/backend/access/common/detoast.c b/src/backend/access/common/detoast.c index b78d49167b..95d5b1c12a 100644 --- a/src/backend/access/common/detoast.c +++ b/src/backend/access/common/detoast.c @@ -477,8 +477,8 @@ toast_get_compression_oid(struct varlena *attr) return InvalidOid; /* - * Just fetch the toast compress header to know the compression method - * in the compressed data. + * Fetch just enough of the value to examine the compression header, + * so that we can find out the compression method. */ attr = toast_fetch_datum_slice(attr, 0, VARHDRSZ_COMPRESS); } @@ -503,7 +503,6 @@ toast_get_compression_handler(struct varlena *attr) cmid = TOAST_COMPRESS_METHOD(attr); - /* Get the handler routines for the compression method */ switch (cmid) { case PGLZ_COMPRESSION_ID: diff --git a/src/backend/access/compression/compress_lz4.c b/src/backend/access/compression/compress_lz4.c index 1856cf7df7..3079eff7eb 100644 --- a/src/backend/access/compression/compress_lz4.c +++ b/src/backend/access/compression/compress_lz4.c @@ -23,7 +23,7 @@ /* * lz4_cmcompress - compression routine for lz4 compression method * - * Compresses source into dest using the default strategy. Returns the + * Compresses source into dest using the LZ4 defaults. Returns the * compressed varlena, or NULL if compression fails. */ static struct varlena * @@ -42,8 +42,8 @@ lz4_cmcompress(const struct varlena *value) valsize = VARSIZE_ANY_EXHDR(value); /* - * Get maximum size of the compressed data that lz4 compression may output - * and allocate the memory for holding the compressed data and the header. + * Figure out the maximum possible size of the LZ4 output, add the bytes + * that will be needed for varlena overhead, and allocate that amount. */ max_size = LZ4_compressBound(valsize); tmp = (struct varlena *) palloc(max_size + VARHDRSZ_COMPRESS); @@ -83,10 +83,10 @@ lz4_cmdecompress(const struct varlena *value) int32 rawsize; struct varlena *result; - /* allocate memory for holding the uncompressed data */ + /* allocate memory for the uncompressed data */ result = (struct varlena *) palloc(VARRAWSIZE_4B_C(value) + VARHDRSZ); - /* decompress data using lz4 routine */ + /* decompress the data */ rawsize = LZ4_decompress_safe((char *) value + VARHDRSZ_COMPRESS, VARDATA(result), VARSIZE(value) - VARHDRSZ_COMPRESS, diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c index f77deee399..920d9dd0d5 100644 --- a/src/backend/executor/nodeModifyTable.c +++ b/src/backend/executor/nodeModifyTable.c @@ -2117,7 +2117,7 @@ CompareCompressionMethodAndDecompress(TupleTableSlot *slot, TupleTableSlot *newslot = *outslot; /* - * If the called has passed an invalid slot then create a new slot. + * If the caller has passed an invalid slot then create a new slot. * Otherwise, just clear the existing tuple from the slot. This slot * should be stored by the caller so that it can be reused for * decompressing the subsequent tuples. diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index 18e8ecfd90..d8483c36b3 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -1183,8 +1183,8 @@ typedef struct ModifyTableState TupleTableSlot *mt_root_tuple_slot; /* - * Slot for storing the modified tuple, incase the target attribute's - * compression method doesn't match with the source table. + * Slot for storing the modified tuple, in case the target attribute's + * compression method doesn't match that of the source table. */ TupleTableSlot *mt_decompress_tuple_slot; -- 2.17.0 --YZ5djTAD1cGYuMQK Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v24-0006-alter-table-set-compression.patch" ^ permalink raw reply [nested|flat] 46+ messages in thread
* [PATCH v24 5/7] fixups.patch @ 2021-02-10 21:56 Robert Haas <[email protected]> 0 siblings, 0 replies; 46+ messages in thread From: Robert Haas @ 2021-02-10 21:56 UTC (permalink / raw) --- doc/src/sgml/ddl.sgml | 3 --- doc/src/sgml/ref/create_table.sgml | 15 +++++++++++---- src/backend/access/common/detoast.c | 5 ++--- src/backend/access/compression/compress_lz4.c | 10 +++++----- src/backend/executor/nodeModifyTable.c | 2 +- src/include/nodes/execnodes.h | 4 ++-- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml index 4d7ed698b9..1e9a4625cc 100644 --- a/doc/src/sgml/ddl.sgml +++ b/doc/src/sgml/ddl.sgml @@ -3762,9 +3762,6 @@ CREATE TABLE measurement ( <productname>PostgreSQL</productname> tables (or, possibly, foreign tables). It is possible to specify a tablespace and storage parameters for each partition separately. - By default, each column in a partition inherits the compression method - from parent table's column, however a different compression method can be - set for each partition. </para> <para> diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index 51a7a977a5..a4b297340f 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -997,10 +997,17 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM <term><literal>COMPRESSION <replaceable class="parameter">compression_method</replaceable></literal></term> <listitem> <para> - This sets the compression method for a column. The supported compression - methods are <literal>pglz</literal> and <literal>lz4</literal>. - <literal>lz4</literal> is available only if <literal>--with-lz4</literal> - was used when building <productname>PostgreSQL</productname>. The default + The <literal>COMPRESSION</literal> clause sets the compression method + for a column. Compression is supported only for variable-width data + types, and is used only for columns whose storage type is main or + extended. (See <xref linkend="sql-altertable"/> for information on + column storage types.) Setting this property for a partitioned table + has no direct effect, because such tables have no storage of their own, + but the configured value is inherited by newly-created partitions. + The supported compression methods are <literal>pglz</literal> and + <literal>lz4</literal>. <literal>lz4</literal> is available only if + <literal>--with-lz4</literal> was used when building + <productname>PostgreSQL</productname>. The default is <literal>pglz</literal>. </para> </listitem> diff --git a/src/backend/access/common/detoast.c b/src/backend/access/common/detoast.c index b78d49167b..95d5b1c12a 100644 --- a/src/backend/access/common/detoast.c +++ b/src/backend/access/common/detoast.c @@ -477,8 +477,8 @@ toast_get_compression_oid(struct varlena *attr) return InvalidOid; /* - * Just fetch the toast compress header to know the compression method - * in the compressed data. + * Fetch just enough of the value to examine the compression header, + * so that we can find out the compression method. */ attr = toast_fetch_datum_slice(attr, 0, VARHDRSZ_COMPRESS); } @@ -503,7 +503,6 @@ toast_get_compression_handler(struct varlena *attr) cmid = TOAST_COMPRESS_METHOD(attr); - /* Get the handler routines for the compression method */ switch (cmid) { case PGLZ_COMPRESSION_ID: diff --git a/src/backend/access/compression/compress_lz4.c b/src/backend/access/compression/compress_lz4.c index 1856cf7df7..3079eff7eb 100644 --- a/src/backend/access/compression/compress_lz4.c +++ b/src/backend/access/compression/compress_lz4.c @@ -23,7 +23,7 @@ /* * lz4_cmcompress - compression routine for lz4 compression method * - * Compresses source into dest using the default strategy. Returns the + * Compresses source into dest using the LZ4 defaults. Returns the * compressed varlena, or NULL if compression fails. */ static struct varlena * @@ -42,8 +42,8 @@ lz4_cmcompress(const struct varlena *value) valsize = VARSIZE_ANY_EXHDR(value); /* - * Get maximum size of the compressed data that lz4 compression may output - * and allocate the memory for holding the compressed data and the header. + * Figure out the maximum possible size of the LZ4 output, add the bytes + * that will be needed for varlena overhead, and allocate that amount. */ max_size = LZ4_compressBound(valsize); tmp = (struct varlena *) palloc(max_size + VARHDRSZ_COMPRESS); @@ -83,10 +83,10 @@ lz4_cmdecompress(const struct varlena *value) int32 rawsize; struct varlena *result; - /* allocate memory for holding the uncompressed data */ + /* allocate memory for the uncompressed data */ result = (struct varlena *) palloc(VARRAWSIZE_4B_C(value) + VARHDRSZ); - /* decompress data using lz4 routine */ + /* decompress the data */ rawsize = LZ4_decompress_safe((char *) value + VARHDRSZ_COMPRESS, VARDATA(result), VARSIZE(value) - VARHDRSZ_COMPRESS, diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c index f77deee399..920d9dd0d5 100644 --- a/src/backend/executor/nodeModifyTable.c +++ b/src/backend/executor/nodeModifyTable.c @@ -2117,7 +2117,7 @@ CompareCompressionMethodAndDecompress(TupleTableSlot *slot, TupleTableSlot *newslot = *outslot; /* - * If the called has passed an invalid slot then create a new slot. + * If the caller has passed an invalid slot then create a new slot. * Otherwise, just clear the existing tuple from the slot. This slot * should be stored by the caller so that it can be reused for * decompressing the subsequent tuples. diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index 18e8ecfd90..d8483c36b3 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -1183,8 +1183,8 @@ typedef struct ModifyTableState TupleTableSlot *mt_root_tuple_slot; /* - * Slot for storing the modified tuple, incase the target attribute's - * compression method doesn't match with the source table. + * Slot for storing the modified tuple, in case the target attribute's + * compression method doesn't match that of the source table. */ TupleTableSlot *mt_decompress_tuple_slot; -- 2.17.0 --YZ5djTAD1cGYuMQK Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v24-0006-alter-table-set-compression.patch" ^ permalink raw reply [nested|flat] 46+ messages in thread
* [PATCH v24 05/10] fixups.patch @ 2021-02-10 21:56 Robert Haas <[email protected]> 0 siblings, 0 replies; 46+ messages in thread From: Robert Haas @ 2021-02-10 21:56 UTC (permalink / raw) --- doc/src/sgml/ddl.sgml | 3 --- doc/src/sgml/ref/create_table.sgml | 15 +++++++++++---- src/backend/access/common/detoast.c | 5 ++--- src/backend/access/compression/compress_lz4.c | 10 +++++----- src/backend/executor/nodeModifyTable.c | 2 +- src/include/nodes/execnodes.h | 4 ++-- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml index 4d7ed698b9..1e9a4625cc 100644 --- a/doc/src/sgml/ddl.sgml +++ b/doc/src/sgml/ddl.sgml @@ -3762,9 +3762,6 @@ CREATE TABLE measurement ( <productname>PostgreSQL</productname> tables (or, possibly, foreign tables). It is possible to specify a tablespace and storage parameters for each partition separately. - By default, each column in a partition inherits the compression method - from parent table's column, however a different compression method can be - set for each partition. </para> <para> diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index 51a7a977a5..a4b297340f 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -997,10 +997,17 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM <term><literal>COMPRESSION <replaceable class="parameter">compression_method</replaceable></literal></term> <listitem> <para> - This sets the compression method for a column. The supported compression - methods are <literal>pglz</literal> and <literal>lz4</literal>. - <literal>lz4</literal> is available only if <literal>--with-lz4</literal> - was used when building <productname>PostgreSQL</productname>. The default + The <literal>COMPRESSION</literal> clause sets the compression method + for a column. Compression is supported only for variable-width data + types, and is used only for columns whose storage type is main or + extended. (See <xref linkend="sql-altertable"/> for information on + column storage types.) Setting this property for a partitioned table + has no direct effect, because such tables have no storage of their own, + but the configured value is inherited by newly-created partitions. + The supported compression methods are <literal>pglz</literal> and + <literal>lz4</literal>. <literal>lz4</literal> is available only if + <literal>--with-lz4</literal> was used when building + <productname>PostgreSQL</productname>. The default is <literal>pglz</literal>. </para> </listitem> diff --git a/src/backend/access/common/detoast.c b/src/backend/access/common/detoast.c index b78d49167b..95d5b1c12a 100644 --- a/src/backend/access/common/detoast.c +++ b/src/backend/access/common/detoast.c @@ -477,8 +477,8 @@ toast_get_compression_oid(struct varlena *attr) return InvalidOid; /* - * Just fetch the toast compress header to know the compression method - * in the compressed data. + * Fetch just enough of the value to examine the compression header, + * so that we can find out the compression method. */ attr = toast_fetch_datum_slice(attr, 0, VARHDRSZ_COMPRESS); } @@ -503,7 +503,6 @@ toast_get_compression_handler(struct varlena *attr) cmid = TOAST_COMPRESS_METHOD(attr); - /* Get the handler routines for the compression method */ switch (cmid) { case PGLZ_COMPRESSION_ID: diff --git a/src/backend/access/compression/compress_lz4.c b/src/backend/access/compression/compress_lz4.c index 1856cf7df7..3079eff7eb 100644 --- a/src/backend/access/compression/compress_lz4.c +++ b/src/backend/access/compression/compress_lz4.c @@ -23,7 +23,7 @@ /* * lz4_cmcompress - compression routine for lz4 compression method * - * Compresses source into dest using the default strategy. Returns the + * Compresses source into dest using the LZ4 defaults. Returns the * compressed varlena, or NULL if compression fails. */ static struct varlena * @@ -42,8 +42,8 @@ lz4_cmcompress(const struct varlena *value) valsize = VARSIZE_ANY_EXHDR(value); /* - * Get maximum size of the compressed data that lz4 compression may output - * and allocate the memory for holding the compressed data and the header. + * Figure out the maximum possible size of the LZ4 output, add the bytes + * that will be needed for varlena overhead, and allocate that amount. */ max_size = LZ4_compressBound(valsize); tmp = (struct varlena *) palloc(max_size + VARHDRSZ_COMPRESS); @@ -83,10 +83,10 @@ lz4_cmdecompress(const struct varlena *value) int32 rawsize; struct varlena *result; - /* allocate memory for holding the uncompressed data */ + /* allocate memory for the uncompressed data */ result = (struct varlena *) palloc(VARRAWSIZE_4B_C(value) + VARHDRSZ); - /* decompress data using lz4 routine */ + /* decompress the data */ rawsize = LZ4_decompress_safe((char *) value + VARHDRSZ_COMPRESS, VARDATA(result), VARSIZE(value) - VARHDRSZ_COMPRESS, diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c index f77deee399..920d9dd0d5 100644 --- a/src/backend/executor/nodeModifyTable.c +++ b/src/backend/executor/nodeModifyTable.c @@ -2117,7 +2117,7 @@ CompareCompressionMethodAndDecompress(TupleTableSlot *slot, TupleTableSlot *newslot = *outslot; /* - * If the called has passed an invalid slot then create a new slot. + * If the caller has passed an invalid slot then create a new slot. * Otherwise, just clear the existing tuple from the slot. This slot * should be stored by the caller so that it can be reused for * decompressing the subsequent tuples. diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index 18e8ecfd90..d8483c36b3 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -1183,8 +1183,8 @@ typedef struct ModifyTableState TupleTableSlot *mt_root_tuple_slot; /* - * Slot for storing the modified tuple, incase the target attribute's - * compression method doesn't match with the source table. + * Slot for storing the modified tuple, in case the target attribute's + * compression method doesn't match that of the source table. */ TupleTableSlot *mt_decompress_tuple_slot; -- 2.17.0 --m51xatjYGsM+13rf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v24-0006-alter-table-set-compression.patch" ^ permalink raw reply [nested|flat] 46+ messages in thread
* [PATCH v24 5/7] fixups.patch @ 2021-02-10 21:56 Robert Haas <[email protected]> 0 siblings, 0 replies; 46+ messages in thread From: Robert Haas @ 2021-02-10 21:56 UTC (permalink / raw) --- doc/src/sgml/ddl.sgml | 3 --- doc/src/sgml/ref/create_table.sgml | 15 +++++++++++---- src/backend/access/common/detoast.c | 5 ++--- src/backend/access/compression/compress_lz4.c | 10 +++++----- src/backend/executor/nodeModifyTable.c | 2 +- src/include/nodes/execnodes.h | 4 ++-- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml index 4d7ed698b9..1e9a4625cc 100644 --- a/doc/src/sgml/ddl.sgml +++ b/doc/src/sgml/ddl.sgml @@ -3762,9 +3762,6 @@ CREATE TABLE measurement ( <productname>PostgreSQL</productname> tables (or, possibly, foreign tables). It is possible to specify a tablespace and storage parameters for each partition separately. - By default, each column in a partition inherits the compression method - from parent table's column, however a different compression method can be - set for each partition. </para> <para> diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index 51a7a977a5..a4b297340f 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -997,10 +997,17 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM <term><literal>COMPRESSION <replaceable class="parameter">compression_method</replaceable></literal></term> <listitem> <para> - This sets the compression method for a column. The supported compression - methods are <literal>pglz</literal> and <literal>lz4</literal>. - <literal>lz4</literal> is available only if <literal>--with-lz4</literal> - was used when building <productname>PostgreSQL</productname>. The default + The <literal>COMPRESSION</literal> clause sets the compression method + for a column. Compression is supported only for variable-width data + types, and is used only for columns whose storage type is main or + extended. (See <xref linkend="sql-altertable"/> for information on + column storage types.) Setting this property for a partitioned table + has no direct effect, because such tables have no storage of their own, + but the configured value is inherited by newly-created partitions. + The supported compression methods are <literal>pglz</literal> and + <literal>lz4</literal>. <literal>lz4</literal> is available only if + <literal>--with-lz4</literal> was used when building + <productname>PostgreSQL</productname>. The default is <literal>pglz</literal>. </para> </listitem> diff --git a/src/backend/access/common/detoast.c b/src/backend/access/common/detoast.c index b78d49167b..95d5b1c12a 100644 --- a/src/backend/access/common/detoast.c +++ b/src/backend/access/common/detoast.c @@ -477,8 +477,8 @@ toast_get_compression_oid(struct varlena *attr) return InvalidOid; /* - * Just fetch the toast compress header to know the compression method - * in the compressed data. + * Fetch just enough of the value to examine the compression header, + * so that we can find out the compression method. */ attr = toast_fetch_datum_slice(attr, 0, VARHDRSZ_COMPRESS); } @@ -503,7 +503,6 @@ toast_get_compression_handler(struct varlena *attr) cmid = TOAST_COMPRESS_METHOD(attr); - /* Get the handler routines for the compression method */ switch (cmid) { case PGLZ_COMPRESSION_ID: diff --git a/src/backend/access/compression/compress_lz4.c b/src/backend/access/compression/compress_lz4.c index 1856cf7df7..3079eff7eb 100644 --- a/src/backend/access/compression/compress_lz4.c +++ b/src/backend/access/compression/compress_lz4.c @@ -23,7 +23,7 @@ /* * lz4_cmcompress - compression routine for lz4 compression method * - * Compresses source into dest using the default strategy. Returns the + * Compresses source into dest using the LZ4 defaults. Returns the * compressed varlena, or NULL if compression fails. */ static struct varlena * @@ -42,8 +42,8 @@ lz4_cmcompress(const struct varlena *value) valsize = VARSIZE_ANY_EXHDR(value); /* - * Get maximum size of the compressed data that lz4 compression may output - * and allocate the memory for holding the compressed data and the header. + * Figure out the maximum possible size of the LZ4 output, add the bytes + * that will be needed for varlena overhead, and allocate that amount. */ max_size = LZ4_compressBound(valsize); tmp = (struct varlena *) palloc(max_size + VARHDRSZ_COMPRESS); @@ -83,10 +83,10 @@ lz4_cmdecompress(const struct varlena *value) int32 rawsize; struct varlena *result; - /* allocate memory for holding the uncompressed data */ + /* allocate memory for the uncompressed data */ result = (struct varlena *) palloc(VARRAWSIZE_4B_C(value) + VARHDRSZ); - /* decompress data using lz4 routine */ + /* decompress the data */ rawsize = LZ4_decompress_safe((char *) value + VARHDRSZ_COMPRESS, VARDATA(result), VARSIZE(value) - VARHDRSZ_COMPRESS, diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c index f77deee399..920d9dd0d5 100644 --- a/src/backend/executor/nodeModifyTable.c +++ b/src/backend/executor/nodeModifyTable.c @@ -2117,7 +2117,7 @@ CompareCompressionMethodAndDecompress(TupleTableSlot *slot, TupleTableSlot *newslot = *outslot; /* - * If the called has passed an invalid slot then create a new slot. + * If the caller has passed an invalid slot then create a new slot. * Otherwise, just clear the existing tuple from the slot. This slot * should be stored by the caller so that it can be reused for * decompressing the subsequent tuples. diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index 18e8ecfd90..d8483c36b3 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -1183,8 +1183,8 @@ typedef struct ModifyTableState TupleTableSlot *mt_root_tuple_slot; /* - * Slot for storing the modified tuple, incase the target attribute's - * compression method doesn't match with the source table. + * Slot for storing the modified tuple, in case the target attribute's + * compression method doesn't match that of the source table. */ TupleTableSlot *mt_decompress_tuple_slot; -- 2.17.0 --YZ5djTAD1cGYuMQK Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v24-0006-alter-table-set-compression.patch" ^ permalink raw reply [nested|flat] 46+ messages in thread
* [PATCH v24 5/7] fixups.patch @ 2021-02-10 21:56 Robert Haas <[email protected]> 0 siblings, 0 replies; 46+ messages in thread From: Robert Haas @ 2021-02-10 21:56 UTC (permalink / raw) --- doc/src/sgml/ddl.sgml | 3 --- doc/src/sgml/ref/create_table.sgml | 15 +++++++++++---- src/backend/access/common/detoast.c | 5 ++--- src/backend/access/compression/compress_lz4.c | 10 +++++----- src/backend/executor/nodeModifyTable.c | 2 +- src/include/nodes/execnodes.h | 4 ++-- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml index 4d7ed698b9..1e9a4625cc 100644 --- a/doc/src/sgml/ddl.sgml +++ b/doc/src/sgml/ddl.sgml @@ -3762,9 +3762,6 @@ CREATE TABLE measurement ( <productname>PostgreSQL</productname> tables (or, possibly, foreign tables). It is possible to specify a tablespace and storage parameters for each partition separately. - By default, each column in a partition inherits the compression method - from parent table's column, however a different compression method can be - set for each partition. </para> <para> diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index 51a7a977a5..a4b297340f 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -997,10 +997,17 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM <term><literal>COMPRESSION <replaceable class="parameter">compression_method</replaceable></literal></term> <listitem> <para> - This sets the compression method for a column. The supported compression - methods are <literal>pglz</literal> and <literal>lz4</literal>. - <literal>lz4</literal> is available only if <literal>--with-lz4</literal> - was used when building <productname>PostgreSQL</productname>. The default + The <literal>COMPRESSION</literal> clause sets the compression method + for a column. Compression is supported only for variable-width data + types, and is used only for columns whose storage type is main or + extended. (See <xref linkend="sql-altertable"/> for information on + column storage types.) Setting this property for a partitioned table + has no direct effect, because such tables have no storage of their own, + but the configured value is inherited by newly-created partitions. + The supported compression methods are <literal>pglz</literal> and + <literal>lz4</literal>. <literal>lz4</literal> is available only if + <literal>--with-lz4</literal> was used when building + <productname>PostgreSQL</productname>. The default is <literal>pglz</literal>. </para> </listitem> diff --git a/src/backend/access/common/detoast.c b/src/backend/access/common/detoast.c index b78d49167b..95d5b1c12a 100644 --- a/src/backend/access/common/detoast.c +++ b/src/backend/access/common/detoast.c @@ -477,8 +477,8 @@ toast_get_compression_oid(struct varlena *attr) return InvalidOid; /* - * Just fetch the toast compress header to know the compression method - * in the compressed data. + * Fetch just enough of the value to examine the compression header, + * so that we can find out the compression method. */ attr = toast_fetch_datum_slice(attr, 0, VARHDRSZ_COMPRESS); } @@ -503,7 +503,6 @@ toast_get_compression_handler(struct varlena *attr) cmid = TOAST_COMPRESS_METHOD(attr); - /* Get the handler routines for the compression method */ switch (cmid) { case PGLZ_COMPRESSION_ID: diff --git a/src/backend/access/compression/compress_lz4.c b/src/backend/access/compression/compress_lz4.c index 1856cf7df7..3079eff7eb 100644 --- a/src/backend/access/compression/compress_lz4.c +++ b/src/backend/access/compression/compress_lz4.c @@ -23,7 +23,7 @@ /* * lz4_cmcompress - compression routine for lz4 compression method * - * Compresses source into dest using the default strategy. Returns the + * Compresses source into dest using the LZ4 defaults. Returns the * compressed varlena, or NULL if compression fails. */ static struct varlena * @@ -42,8 +42,8 @@ lz4_cmcompress(const struct varlena *value) valsize = VARSIZE_ANY_EXHDR(value); /* - * Get maximum size of the compressed data that lz4 compression may output - * and allocate the memory for holding the compressed data and the header. + * Figure out the maximum possible size of the LZ4 output, add the bytes + * that will be needed for varlena overhead, and allocate that amount. */ max_size = LZ4_compressBound(valsize); tmp = (struct varlena *) palloc(max_size + VARHDRSZ_COMPRESS); @@ -83,10 +83,10 @@ lz4_cmdecompress(const struct varlena *value) int32 rawsize; struct varlena *result; - /* allocate memory for holding the uncompressed data */ + /* allocate memory for the uncompressed data */ result = (struct varlena *) palloc(VARRAWSIZE_4B_C(value) + VARHDRSZ); - /* decompress data using lz4 routine */ + /* decompress the data */ rawsize = LZ4_decompress_safe((char *) value + VARHDRSZ_COMPRESS, VARDATA(result), VARSIZE(value) - VARHDRSZ_COMPRESS, diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c index f77deee399..920d9dd0d5 100644 --- a/src/backend/executor/nodeModifyTable.c +++ b/src/backend/executor/nodeModifyTable.c @@ -2117,7 +2117,7 @@ CompareCompressionMethodAndDecompress(TupleTableSlot *slot, TupleTableSlot *newslot = *outslot; /* - * If the called has passed an invalid slot then create a new slot. + * If the caller has passed an invalid slot then create a new slot. * Otherwise, just clear the existing tuple from the slot. This slot * should be stored by the caller so that it can be reused for * decompressing the subsequent tuples. diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index 18e8ecfd90..d8483c36b3 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -1183,8 +1183,8 @@ typedef struct ModifyTableState TupleTableSlot *mt_root_tuple_slot; /* - * Slot for storing the modified tuple, incase the target attribute's - * compression method doesn't match with the source table. + * Slot for storing the modified tuple, in case the target attribute's + * compression method doesn't match that of the source table. */ TupleTableSlot *mt_decompress_tuple_slot; -- 2.17.0 --YZ5djTAD1cGYuMQK Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v24-0006-alter-table-set-compression.patch" ^ permalink raw reply [nested|flat] 46+ messages in thread
* [PATCH v24 05/10] fixups.patch @ 2021-02-10 21:56 Robert Haas <[email protected]> 0 siblings, 0 replies; 46+ messages in thread From: Robert Haas @ 2021-02-10 21:56 UTC (permalink / raw) --- doc/src/sgml/ddl.sgml | 3 --- doc/src/sgml/ref/create_table.sgml | 15 +++++++++++---- src/backend/access/common/detoast.c | 5 ++--- src/backend/access/compression/compress_lz4.c | 10 +++++----- src/backend/executor/nodeModifyTable.c | 2 +- src/include/nodes/execnodes.h | 4 ++-- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml index 4d7ed698b9..1e9a4625cc 100644 --- a/doc/src/sgml/ddl.sgml +++ b/doc/src/sgml/ddl.sgml @@ -3762,9 +3762,6 @@ CREATE TABLE measurement ( <productname>PostgreSQL</productname> tables (or, possibly, foreign tables). It is possible to specify a tablespace and storage parameters for each partition separately. - By default, each column in a partition inherits the compression method - from parent table's column, however a different compression method can be - set for each partition. </para> <para> diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index 51a7a977a5..a4b297340f 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -997,10 +997,17 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM <term><literal>COMPRESSION <replaceable class="parameter">compression_method</replaceable></literal></term> <listitem> <para> - This sets the compression method for a column. The supported compression - methods are <literal>pglz</literal> and <literal>lz4</literal>. - <literal>lz4</literal> is available only if <literal>--with-lz4</literal> - was used when building <productname>PostgreSQL</productname>. The default + The <literal>COMPRESSION</literal> clause sets the compression method + for a column. Compression is supported only for variable-width data + types, and is used only for columns whose storage type is main or + extended. (See <xref linkend="sql-altertable"/> for information on + column storage types.) Setting this property for a partitioned table + has no direct effect, because such tables have no storage of their own, + but the configured value is inherited by newly-created partitions. + The supported compression methods are <literal>pglz</literal> and + <literal>lz4</literal>. <literal>lz4</literal> is available only if + <literal>--with-lz4</literal> was used when building + <productname>PostgreSQL</productname>. The default is <literal>pglz</literal>. </para> </listitem> diff --git a/src/backend/access/common/detoast.c b/src/backend/access/common/detoast.c index b78d49167b..95d5b1c12a 100644 --- a/src/backend/access/common/detoast.c +++ b/src/backend/access/common/detoast.c @@ -477,8 +477,8 @@ toast_get_compression_oid(struct varlena *attr) return InvalidOid; /* - * Just fetch the toast compress header to know the compression method - * in the compressed data. + * Fetch just enough of the value to examine the compression header, + * so that we can find out the compression method. */ attr = toast_fetch_datum_slice(attr, 0, VARHDRSZ_COMPRESS); } @@ -503,7 +503,6 @@ toast_get_compression_handler(struct varlena *attr) cmid = TOAST_COMPRESS_METHOD(attr); - /* Get the handler routines for the compression method */ switch (cmid) { case PGLZ_COMPRESSION_ID: diff --git a/src/backend/access/compression/compress_lz4.c b/src/backend/access/compression/compress_lz4.c index 1856cf7df7..3079eff7eb 100644 --- a/src/backend/access/compression/compress_lz4.c +++ b/src/backend/access/compression/compress_lz4.c @@ -23,7 +23,7 @@ /* * lz4_cmcompress - compression routine for lz4 compression method * - * Compresses source into dest using the default strategy. Returns the + * Compresses source into dest using the LZ4 defaults. Returns the * compressed varlena, or NULL if compression fails. */ static struct varlena * @@ -42,8 +42,8 @@ lz4_cmcompress(const struct varlena *value) valsize = VARSIZE_ANY_EXHDR(value); /* - * Get maximum size of the compressed data that lz4 compression may output - * and allocate the memory for holding the compressed data and the header. + * Figure out the maximum possible size of the LZ4 output, add the bytes + * that will be needed for varlena overhead, and allocate that amount. */ max_size = LZ4_compressBound(valsize); tmp = (struct varlena *) palloc(max_size + VARHDRSZ_COMPRESS); @@ -83,10 +83,10 @@ lz4_cmdecompress(const struct varlena *value) int32 rawsize; struct varlena *result; - /* allocate memory for holding the uncompressed data */ + /* allocate memory for the uncompressed data */ result = (struct varlena *) palloc(VARRAWSIZE_4B_C(value) + VARHDRSZ); - /* decompress data using lz4 routine */ + /* decompress the data */ rawsize = LZ4_decompress_safe((char *) value + VARHDRSZ_COMPRESS, VARDATA(result), VARSIZE(value) - VARHDRSZ_COMPRESS, diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c index f77deee399..920d9dd0d5 100644 --- a/src/backend/executor/nodeModifyTable.c +++ b/src/backend/executor/nodeModifyTable.c @@ -2117,7 +2117,7 @@ CompareCompressionMethodAndDecompress(TupleTableSlot *slot, TupleTableSlot *newslot = *outslot; /* - * If the called has passed an invalid slot then create a new slot. + * If the caller has passed an invalid slot then create a new slot. * Otherwise, just clear the existing tuple from the slot. This slot * should be stored by the caller so that it can be reused for * decompressing the subsequent tuples. diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index 18e8ecfd90..d8483c36b3 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -1183,8 +1183,8 @@ typedef struct ModifyTableState TupleTableSlot *mt_root_tuple_slot; /* - * Slot for storing the modified tuple, incase the target attribute's - * compression method doesn't match with the source table. + * Slot for storing the modified tuple, in case the target attribute's + * compression method doesn't match that of the source table. */ TupleTableSlot *mt_decompress_tuple_slot; -- 2.17.0 --m51xatjYGsM+13rf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v24-0006-alter-table-set-compression.patch" ^ permalink raw reply [nested|flat] 46+ messages in thread
* [PATCH v24 5/7] fixups.patch @ 2021-02-10 21:56 Robert Haas <[email protected]> 0 siblings, 0 replies; 46+ messages in thread From: Robert Haas @ 2021-02-10 21:56 UTC (permalink / raw) --- doc/src/sgml/ddl.sgml | 3 --- doc/src/sgml/ref/create_table.sgml | 15 +++++++++++---- src/backend/access/common/detoast.c | 5 ++--- src/backend/access/compression/compress_lz4.c | 10 +++++----- src/backend/executor/nodeModifyTable.c | 2 +- src/include/nodes/execnodes.h | 4 ++-- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml index 4d7ed698b9..1e9a4625cc 100644 --- a/doc/src/sgml/ddl.sgml +++ b/doc/src/sgml/ddl.sgml @@ -3762,9 +3762,6 @@ CREATE TABLE measurement ( <productname>PostgreSQL</productname> tables (or, possibly, foreign tables). It is possible to specify a tablespace and storage parameters for each partition separately. - By default, each column in a partition inherits the compression method - from parent table's column, however a different compression method can be - set for each partition. </para> <para> diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index 51a7a977a5..a4b297340f 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -997,10 +997,17 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM <term><literal>COMPRESSION <replaceable class="parameter">compression_method</replaceable></literal></term> <listitem> <para> - This sets the compression method for a column. The supported compression - methods are <literal>pglz</literal> and <literal>lz4</literal>. - <literal>lz4</literal> is available only if <literal>--with-lz4</literal> - was used when building <productname>PostgreSQL</productname>. The default + The <literal>COMPRESSION</literal> clause sets the compression method + for a column. Compression is supported only for variable-width data + types, and is used only for columns whose storage type is main or + extended. (See <xref linkend="sql-altertable"/> for information on + column storage types.) Setting this property for a partitioned table + has no direct effect, because such tables have no storage of their own, + but the configured value is inherited by newly-created partitions. + The supported compression methods are <literal>pglz</literal> and + <literal>lz4</literal>. <literal>lz4</literal> is available only if + <literal>--with-lz4</literal> was used when building + <productname>PostgreSQL</productname>. The default is <literal>pglz</literal>. </para> </listitem> diff --git a/src/backend/access/common/detoast.c b/src/backend/access/common/detoast.c index b78d49167b..95d5b1c12a 100644 --- a/src/backend/access/common/detoast.c +++ b/src/backend/access/common/detoast.c @@ -477,8 +477,8 @@ toast_get_compression_oid(struct varlena *attr) return InvalidOid; /* - * Just fetch the toast compress header to know the compression method - * in the compressed data. + * Fetch just enough of the value to examine the compression header, + * so that we can find out the compression method. */ attr = toast_fetch_datum_slice(attr, 0, VARHDRSZ_COMPRESS); } @@ -503,7 +503,6 @@ toast_get_compression_handler(struct varlena *attr) cmid = TOAST_COMPRESS_METHOD(attr); - /* Get the handler routines for the compression method */ switch (cmid) { case PGLZ_COMPRESSION_ID: diff --git a/src/backend/access/compression/compress_lz4.c b/src/backend/access/compression/compress_lz4.c index 1856cf7df7..3079eff7eb 100644 --- a/src/backend/access/compression/compress_lz4.c +++ b/src/backend/access/compression/compress_lz4.c @@ -23,7 +23,7 @@ /* * lz4_cmcompress - compression routine for lz4 compression method * - * Compresses source into dest using the default strategy. Returns the + * Compresses source into dest using the LZ4 defaults. Returns the * compressed varlena, or NULL if compression fails. */ static struct varlena * @@ -42,8 +42,8 @@ lz4_cmcompress(const struct varlena *value) valsize = VARSIZE_ANY_EXHDR(value); /* - * Get maximum size of the compressed data that lz4 compression may output - * and allocate the memory for holding the compressed data and the header. + * Figure out the maximum possible size of the LZ4 output, add the bytes + * that will be needed for varlena overhead, and allocate that amount. */ max_size = LZ4_compressBound(valsize); tmp = (struct varlena *) palloc(max_size + VARHDRSZ_COMPRESS); @@ -83,10 +83,10 @@ lz4_cmdecompress(const struct varlena *value) int32 rawsize; struct varlena *result; - /* allocate memory for holding the uncompressed data */ + /* allocate memory for the uncompressed data */ result = (struct varlena *) palloc(VARRAWSIZE_4B_C(value) + VARHDRSZ); - /* decompress data using lz4 routine */ + /* decompress the data */ rawsize = LZ4_decompress_safe((char *) value + VARHDRSZ_COMPRESS, VARDATA(result), VARSIZE(value) - VARHDRSZ_COMPRESS, diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c index f77deee399..920d9dd0d5 100644 --- a/src/backend/executor/nodeModifyTable.c +++ b/src/backend/executor/nodeModifyTable.c @@ -2117,7 +2117,7 @@ CompareCompressionMethodAndDecompress(TupleTableSlot *slot, TupleTableSlot *newslot = *outslot; /* - * If the called has passed an invalid slot then create a new slot. + * If the caller has passed an invalid slot then create a new slot. * Otherwise, just clear the existing tuple from the slot. This slot * should be stored by the caller so that it can be reused for * decompressing the subsequent tuples. diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index 18e8ecfd90..d8483c36b3 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -1183,8 +1183,8 @@ typedef struct ModifyTableState TupleTableSlot *mt_root_tuple_slot; /* - * Slot for storing the modified tuple, incase the target attribute's - * compression method doesn't match with the source table. + * Slot for storing the modified tuple, in case the target attribute's + * compression method doesn't match that of the source table. */ TupleTableSlot *mt_decompress_tuple_slot; -- 2.17.0 --YZ5djTAD1cGYuMQK Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v24-0006-alter-table-set-compression.patch" ^ permalink raw reply [nested|flat] 46+ messages in thread
* [PATCH v24 05/10] fixups.patch @ 2021-02-10 21:56 Robert Haas <[email protected]> 0 siblings, 0 replies; 46+ messages in thread From: Robert Haas @ 2021-02-10 21:56 UTC (permalink / raw) --- doc/src/sgml/ddl.sgml | 3 --- doc/src/sgml/ref/create_table.sgml | 15 +++++++++++---- src/backend/access/common/detoast.c | 5 ++--- src/backend/access/compression/compress_lz4.c | 10 +++++----- src/backend/executor/nodeModifyTable.c | 2 +- src/include/nodes/execnodes.h | 4 ++-- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml index 4d7ed698b9..1e9a4625cc 100644 --- a/doc/src/sgml/ddl.sgml +++ b/doc/src/sgml/ddl.sgml @@ -3762,9 +3762,6 @@ CREATE TABLE measurement ( <productname>PostgreSQL</productname> tables (or, possibly, foreign tables). It is possible to specify a tablespace and storage parameters for each partition separately. - By default, each column in a partition inherits the compression method - from parent table's column, however a different compression method can be - set for each partition. </para> <para> diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index 51a7a977a5..a4b297340f 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -997,10 +997,17 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM <term><literal>COMPRESSION <replaceable class="parameter">compression_method</replaceable></literal></term> <listitem> <para> - This sets the compression method for a column. The supported compression - methods are <literal>pglz</literal> and <literal>lz4</literal>. - <literal>lz4</literal> is available only if <literal>--with-lz4</literal> - was used when building <productname>PostgreSQL</productname>. The default + The <literal>COMPRESSION</literal> clause sets the compression method + for a column. Compression is supported only for variable-width data + types, and is used only for columns whose storage type is main or + extended. (See <xref linkend="sql-altertable"/> for information on + column storage types.) Setting this property for a partitioned table + has no direct effect, because such tables have no storage of their own, + but the configured value is inherited by newly-created partitions. + The supported compression methods are <literal>pglz</literal> and + <literal>lz4</literal>. <literal>lz4</literal> is available only if + <literal>--with-lz4</literal> was used when building + <productname>PostgreSQL</productname>. The default is <literal>pglz</literal>. </para> </listitem> diff --git a/src/backend/access/common/detoast.c b/src/backend/access/common/detoast.c index b78d49167b..95d5b1c12a 100644 --- a/src/backend/access/common/detoast.c +++ b/src/backend/access/common/detoast.c @@ -477,8 +477,8 @@ toast_get_compression_oid(struct varlena *attr) return InvalidOid; /* - * Just fetch the toast compress header to know the compression method - * in the compressed data. + * Fetch just enough of the value to examine the compression header, + * so that we can find out the compression method. */ attr = toast_fetch_datum_slice(attr, 0, VARHDRSZ_COMPRESS); } @@ -503,7 +503,6 @@ toast_get_compression_handler(struct varlena *attr) cmid = TOAST_COMPRESS_METHOD(attr); - /* Get the handler routines for the compression method */ switch (cmid) { case PGLZ_COMPRESSION_ID: diff --git a/src/backend/access/compression/compress_lz4.c b/src/backend/access/compression/compress_lz4.c index 1856cf7df7..3079eff7eb 100644 --- a/src/backend/access/compression/compress_lz4.c +++ b/src/backend/access/compression/compress_lz4.c @@ -23,7 +23,7 @@ /* * lz4_cmcompress - compression routine for lz4 compression method * - * Compresses source into dest using the default strategy. Returns the + * Compresses source into dest using the LZ4 defaults. Returns the * compressed varlena, or NULL if compression fails. */ static struct varlena * @@ -42,8 +42,8 @@ lz4_cmcompress(const struct varlena *value) valsize = VARSIZE_ANY_EXHDR(value); /* - * Get maximum size of the compressed data that lz4 compression may output - * and allocate the memory for holding the compressed data and the header. + * Figure out the maximum possible size of the LZ4 output, add the bytes + * that will be needed for varlena overhead, and allocate that amount. */ max_size = LZ4_compressBound(valsize); tmp = (struct varlena *) palloc(max_size + VARHDRSZ_COMPRESS); @@ -83,10 +83,10 @@ lz4_cmdecompress(const struct varlena *value) int32 rawsize; struct varlena *result; - /* allocate memory for holding the uncompressed data */ + /* allocate memory for the uncompressed data */ result = (struct varlena *) palloc(VARRAWSIZE_4B_C(value) + VARHDRSZ); - /* decompress data using lz4 routine */ + /* decompress the data */ rawsize = LZ4_decompress_safe((char *) value + VARHDRSZ_COMPRESS, VARDATA(result), VARSIZE(value) - VARHDRSZ_COMPRESS, diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c index f77deee399..920d9dd0d5 100644 --- a/src/backend/executor/nodeModifyTable.c +++ b/src/backend/executor/nodeModifyTable.c @@ -2117,7 +2117,7 @@ CompareCompressionMethodAndDecompress(TupleTableSlot *slot, TupleTableSlot *newslot = *outslot; /* - * If the called has passed an invalid slot then create a new slot. + * If the caller has passed an invalid slot then create a new slot. * Otherwise, just clear the existing tuple from the slot. This slot * should be stored by the caller so that it can be reused for * decompressing the subsequent tuples. diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index 18e8ecfd90..d8483c36b3 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -1183,8 +1183,8 @@ typedef struct ModifyTableState TupleTableSlot *mt_root_tuple_slot; /* - * Slot for storing the modified tuple, incase the target attribute's - * compression method doesn't match with the source table. + * Slot for storing the modified tuple, in case the target attribute's + * compression method doesn't match that of the source table. */ TupleTableSlot *mt_decompress_tuple_slot; -- 2.17.0 --m51xatjYGsM+13rf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v24-0006-alter-table-set-compression.patch" ^ permalink raw reply [nested|flat] 46+ messages in thread
* [PATCH v24 5/7] fixups.patch @ 2021-02-10 21:56 Robert Haas <[email protected]> 0 siblings, 0 replies; 46+ messages in thread From: Robert Haas @ 2021-02-10 21:56 UTC (permalink / raw) --- doc/src/sgml/ddl.sgml | 3 --- doc/src/sgml/ref/create_table.sgml | 15 +++++++++++---- src/backend/access/common/detoast.c | 5 ++--- src/backend/access/compression/compress_lz4.c | 10 +++++----- src/backend/executor/nodeModifyTable.c | 2 +- src/include/nodes/execnodes.h | 4 ++-- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml index 4d7ed698b9..1e9a4625cc 100644 --- a/doc/src/sgml/ddl.sgml +++ b/doc/src/sgml/ddl.sgml @@ -3762,9 +3762,6 @@ CREATE TABLE measurement ( <productname>PostgreSQL</productname> tables (or, possibly, foreign tables). It is possible to specify a tablespace and storage parameters for each partition separately. - By default, each column in a partition inherits the compression method - from parent table's column, however a different compression method can be - set for each partition. </para> <para> diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index 51a7a977a5..a4b297340f 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -997,10 +997,17 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM <term><literal>COMPRESSION <replaceable class="parameter">compression_method</replaceable></literal></term> <listitem> <para> - This sets the compression method for a column. The supported compression - methods are <literal>pglz</literal> and <literal>lz4</literal>. - <literal>lz4</literal> is available only if <literal>--with-lz4</literal> - was used when building <productname>PostgreSQL</productname>. The default + The <literal>COMPRESSION</literal> clause sets the compression method + for a column. Compression is supported only for variable-width data + types, and is used only for columns whose storage type is main or + extended. (See <xref linkend="sql-altertable"/> for information on + column storage types.) Setting this property for a partitioned table + has no direct effect, because such tables have no storage of their own, + but the configured value is inherited by newly-created partitions. + The supported compression methods are <literal>pglz</literal> and + <literal>lz4</literal>. <literal>lz4</literal> is available only if + <literal>--with-lz4</literal> was used when building + <productname>PostgreSQL</productname>. The default is <literal>pglz</literal>. </para> </listitem> diff --git a/src/backend/access/common/detoast.c b/src/backend/access/common/detoast.c index b78d49167b..95d5b1c12a 100644 --- a/src/backend/access/common/detoast.c +++ b/src/backend/access/common/detoast.c @@ -477,8 +477,8 @@ toast_get_compression_oid(struct varlena *attr) return InvalidOid; /* - * Just fetch the toast compress header to know the compression method - * in the compressed data. + * Fetch just enough of the value to examine the compression header, + * so that we can find out the compression method. */ attr = toast_fetch_datum_slice(attr, 0, VARHDRSZ_COMPRESS); } @@ -503,7 +503,6 @@ toast_get_compression_handler(struct varlena *attr) cmid = TOAST_COMPRESS_METHOD(attr); - /* Get the handler routines for the compression method */ switch (cmid) { case PGLZ_COMPRESSION_ID: diff --git a/src/backend/access/compression/compress_lz4.c b/src/backend/access/compression/compress_lz4.c index 1856cf7df7..3079eff7eb 100644 --- a/src/backend/access/compression/compress_lz4.c +++ b/src/backend/access/compression/compress_lz4.c @@ -23,7 +23,7 @@ /* * lz4_cmcompress - compression routine for lz4 compression method * - * Compresses source into dest using the default strategy. Returns the + * Compresses source into dest using the LZ4 defaults. Returns the * compressed varlena, or NULL if compression fails. */ static struct varlena * @@ -42,8 +42,8 @@ lz4_cmcompress(const struct varlena *value) valsize = VARSIZE_ANY_EXHDR(value); /* - * Get maximum size of the compressed data that lz4 compression may output - * and allocate the memory for holding the compressed data and the header. + * Figure out the maximum possible size of the LZ4 output, add the bytes + * that will be needed for varlena overhead, and allocate that amount. */ max_size = LZ4_compressBound(valsize); tmp = (struct varlena *) palloc(max_size + VARHDRSZ_COMPRESS); @@ -83,10 +83,10 @@ lz4_cmdecompress(const struct varlena *value) int32 rawsize; struct varlena *result; - /* allocate memory for holding the uncompressed data */ + /* allocate memory for the uncompressed data */ result = (struct varlena *) palloc(VARRAWSIZE_4B_C(value) + VARHDRSZ); - /* decompress data using lz4 routine */ + /* decompress the data */ rawsize = LZ4_decompress_safe((char *) value + VARHDRSZ_COMPRESS, VARDATA(result), VARSIZE(value) - VARHDRSZ_COMPRESS, diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c index f77deee399..920d9dd0d5 100644 --- a/src/backend/executor/nodeModifyTable.c +++ b/src/backend/executor/nodeModifyTable.c @@ -2117,7 +2117,7 @@ CompareCompressionMethodAndDecompress(TupleTableSlot *slot, TupleTableSlot *newslot = *outslot; /* - * If the called has passed an invalid slot then create a new slot. + * If the caller has passed an invalid slot then create a new slot. * Otherwise, just clear the existing tuple from the slot. This slot * should be stored by the caller so that it can be reused for * decompressing the subsequent tuples. diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index 18e8ecfd90..d8483c36b3 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -1183,8 +1183,8 @@ typedef struct ModifyTableState TupleTableSlot *mt_root_tuple_slot; /* - * Slot for storing the modified tuple, incase the target attribute's - * compression method doesn't match with the source table. + * Slot for storing the modified tuple, in case the target attribute's + * compression method doesn't match that of the source table. */ TupleTableSlot *mt_decompress_tuple_slot; -- 2.17.0 --YZ5djTAD1cGYuMQK Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v24-0006-alter-table-set-compression.patch" ^ permalink raw reply [nested|flat] 46+ messages in thread
* [PATCH v24 05/10] fixups.patch @ 2021-02-10 21:56 Robert Haas <[email protected]> 0 siblings, 0 replies; 46+ messages in thread From: Robert Haas @ 2021-02-10 21:56 UTC (permalink / raw) --- doc/src/sgml/ddl.sgml | 3 --- doc/src/sgml/ref/create_table.sgml | 15 +++++++++++---- src/backend/access/common/detoast.c | 5 ++--- src/backend/access/compression/compress_lz4.c | 10 +++++----- src/backend/executor/nodeModifyTable.c | 2 +- src/include/nodes/execnodes.h | 4 ++-- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml index 4d7ed698b9..1e9a4625cc 100644 --- a/doc/src/sgml/ddl.sgml +++ b/doc/src/sgml/ddl.sgml @@ -3762,9 +3762,6 @@ CREATE TABLE measurement ( <productname>PostgreSQL</productname> tables (or, possibly, foreign tables). It is possible to specify a tablespace and storage parameters for each partition separately. - By default, each column in a partition inherits the compression method - from parent table's column, however a different compression method can be - set for each partition. </para> <para> diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index 51a7a977a5..a4b297340f 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -997,10 +997,17 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM <term><literal>COMPRESSION <replaceable class="parameter">compression_method</replaceable></literal></term> <listitem> <para> - This sets the compression method for a column. The supported compression - methods are <literal>pglz</literal> and <literal>lz4</literal>. - <literal>lz4</literal> is available only if <literal>--with-lz4</literal> - was used when building <productname>PostgreSQL</productname>. The default + The <literal>COMPRESSION</literal> clause sets the compression method + for a column. Compression is supported only for variable-width data + types, and is used only for columns whose storage type is main or + extended. (See <xref linkend="sql-altertable"/> for information on + column storage types.) Setting this property for a partitioned table + has no direct effect, because such tables have no storage of their own, + but the configured value is inherited by newly-created partitions. + The supported compression methods are <literal>pglz</literal> and + <literal>lz4</literal>. <literal>lz4</literal> is available only if + <literal>--with-lz4</literal> was used when building + <productname>PostgreSQL</productname>. The default is <literal>pglz</literal>. </para> </listitem> diff --git a/src/backend/access/common/detoast.c b/src/backend/access/common/detoast.c index b78d49167b..95d5b1c12a 100644 --- a/src/backend/access/common/detoast.c +++ b/src/backend/access/common/detoast.c @@ -477,8 +477,8 @@ toast_get_compression_oid(struct varlena *attr) return InvalidOid; /* - * Just fetch the toast compress header to know the compression method - * in the compressed data. + * Fetch just enough of the value to examine the compression header, + * so that we can find out the compression method. */ attr = toast_fetch_datum_slice(attr, 0, VARHDRSZ_COMPRESS); } @@ -503,7 +503,6 @@ toast_get_compression_handler(struct varlena *attr) cmid = TOAST_COMPRESS_METHOD(attr); - /* Get the handler routines for the compression method */ switch (cmid) { case PGLZ_COMPRESSION_ID: diff --git a/src/backend/access/compression/compress_lz4.c b/src/backend/access/compression/compress_lz4.c index 1856cf7df7..3079eff7eb 100644 --- a/src/backend/access/compression/compress_lz4.c +++ b/src/backend/access/compression/compress_lz4.c @@ -23,7 +23,7 @@ /* * lz4_cmcompress - compression routine for lz4 compression method * - * Compresses source into dest using the default strategy. Returns the + * Compresses source into dest using the LZ4 defaults. Returns the * compressed varlena, or NULL if compression fails. */ static struct varlena * @@ -42,8 +42,8 @@ lz4_cmcompress(const struct varlena *value) valsize = VARSIZE_ANY_EXHDR(value); /* - * Get maximum size of the compressed data that lz4 compression may output - * and allocate the memory for holding the compressed data and the header. + * Figure out the maximum possible size of the LZ4 output, add the bytes + * that will be needed for varlena overhead, and allocate that amount. */ max_size = LZ4_compressBound(valsize); tmp = (struct varlena *) palloc(max_size + VARHDRSZ_COMPRESS); @@ -83,10 +83,10 @@ lz4_cmdecompress(const struct varlena *value) int32 rawsize; struct varlena *result; - /* allocate memory for holding the uncompressed data */ + /* allocate memory for the uncompressed data */ result = (struct varlena *) palloc(VARRAWSIZE_4B_C(value) + VARHDRSZ); - /* decompress data using lz4 routine */ + /* decompress the data */ rawsize = LZ4_decompress_safe((char *) value + VARHDRSZ_COMPRESS, VARDATA(result), VARSIZE(value) - VARHDRSZ_COMPRESS, diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c index f77deee399..920d9dd0d5 100644 --- a/src/backend/executor/nodeModifyTable.c +++ b/src/backend/executor/nodeModifyTable.c @@ -2117,7 +2117,7 @@ CompareCompressionMethodAndDecompress(TupleTableSlot *slot, TupleTableSlot *newslot = *outslot; /* - * If the called has passed an invalid slot then create a new slot. + * If the caller has passed an invalid slot then create a new slot. * Otherwise, just clear the existing tuple from the slot. This slot * should be stored by the caller so that it can be reused for * decompressing the subsequent tuples. diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index 18e8ecfd90..d8483c36b3 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -1183,8 +1183,8 @@ typedef struct ModifyTableState TupleTableSlot *mt_root_tuple_slot; /* - * Slot for storing the modified tuple, incase the target attribute's - * compression method doesn't match with the source table. + * Slot for storing the modified tuple, in case the target attribute's + * compression method doesn't match that of the source table. */ TupleTableSlot *mt_decompress_tuple_slot; -- 2.17.0 --m51xatjYGsM+13rf Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v24-0006-alter-table-set-compression.patch" ^ permalink raw reply [nested|flat] 46+ messages in thread
* [PATCH v24 5/7] fixups.patch @ 2021-02-10 21:56 Robert Haas <[email protected]> 0 siblings, 0 replies; 46+ messages in thread From: Robert Haas @ 2021-02-10 21:56 UTC (permalink / raw) --- doc/src/sgml/ddl.sgml | 3 --- doc/src/sgml/ref/create_table.sgml | 15 +++++++++++---- src/backend/access/common/detoast.c | 5 ++--- src/backend/access/compression/compress_lz4.c | 10 +++++----- src/backend/executor/nodeModifyTable.c | 2 +- src/include/nodes/execnodes.h | 4 ++-- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml index 4d7ed698b9..1e9a4625cc 100644 --- a/doc/src/sgml/ddl.sgml +++ b/doc/src/sgml/ddl.sgml @@ -3762,9 +3762,6 @@ CREATE TABLE measurement ( <productname>PostgreSQL</productname> tables (or, possibly, foreign tables). It is possible to specify a tablespace and storage parameters for each partition separately. - By default, each column in a partition inherits the compression method - from parent table's column, however a different compression method can be - set for each partition. </para> <para> diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index 51a7a977a5..a4b297340f 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -997,10 +997,17 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM <term><literal>COMPRESSION <replaceable class="parameter">compression_method</replaceable></literal></term> <listitem> <para> - This sets the compression method for a column. The supported compression - methods are <literal>pglz</literal> and <literal>lz4</literal>. - <literal>lz4</literal> is available only if <literal>--with-lz4</literal> - was used when building <productname>PostgreSQL</productname>. The default + The <literal>COMPRESSION</literal> clause sets the compression method + for a column. Compression is supported only for variable-width data + types, and is used only for columns whose storage type is main or + extended. (See <xref linkend="sql-altertable"/> for information on + column storage types.) Setting this property for a partitioned table + has no direct effect, because such tables have no storage of their own, + but the configured value is inherited by newly-created partitions. + The supported compression methods are <literal>pglz</literal> and + <literal>lz4</literal>. <literal>lz4</literal> is available only if + <literal>--with-lz4</literal> was used when building + <productname>PostgreSQL</productname>. The default is <literal>pglz</literal>. </para> </listitem> diff --git a/src/backend/access/common/detoast.c b/src/backend/access/common/detoast.c index b78d49167b..95d5b1c12a 100644 --- a/src/backend/access/common/detoast.c +++ b/src/backend/access/common/detoast.c @@ -477,8 +477,8 @@ toast_get_compression_oid(struct varlena *attr) return InvalidOid; /* - * Just fetch the toast compress header to know the compression method - * in the compressed data. + * Fetch just enough of the value to examine the compression header, + * so that we can find out the compression method. */ attr = toast_fetch_datum_slice(attr, 0, VARHDRSZ_COMPRESS); } @@ -503,7 +503,6 @@ toast_get_compression_handler(struct varlena *attr) cmid = TOAST_COMPRESS_METHOD(attr); - /* Get the handler routines for the compression method */ switch (cmid) { case PGLZ_COMPRESSION_ID: diff --git a/src/backend/access/compression/compress_lz4.c b/src/backend/access/compression/compress_lz4.c index 1856cf7df7..3079eff7eb 100644 --- a/src/backend/access/compression/compress_lz4.c +++ b/src/backend/access/compression/compress_lz4.c @@ -23,7 +23,7 @@ /* * lz4_cmcompress - compression routine for lz4 compression method * - * Compresses source into dest using the default strategy. Returns the + * Compresses source into dest using the LZ4 defaults. Returns the * compressed varlena, or NULL if compression fails. */ static struct varlena * @@ -42,8 +42,8 @@ lz4_cmcompress(const struct varlena *value) valsize = VARSIZE_ANY_EXHDR(value); /* - * Get maximum size of the compressed data that lz4 compression may output - * and allocate the memory for holding the compressed data and the header. + * Figure out the maximum possible size of the LZ4 output, add the bytes + * that will be needed for varlena overhead, and allocate that amount. */ max_size = LZ4_compressBound(valsize); tmp = (struct varlena *) palloc(max_size + VARHDRSZ_COMPRESS); @@ -83,10 +83,10 @@ lz4_cmdecompress(const struct varlena *value) int32 rawsize; struct varlena *result; - /* allocate memory for holding the uncompressed data */ + /* allocate memory for the uncompressed data */ result = (struct varlena *) palloc(VARRAWSIZE_4B_C(value) + VARHDRSZ); - /* decompress data using lz4 routine */ + /* decompress the data */ rawsize = LZ4_decompress_safe((char *) value + VARHDRSZ_COMPRESS, VARDATA(result), VARSIZE(value) - VARHDRSZ_COMPRESS, diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c index f77deee399..920d9dd0d5 100644 --- a/src/backend/executor/nodeModifyTable.c +++ b/src/backend/executor/nodeModifyTable.c @@ -2117,7 +2117,7 @@ CompareCompressionMethodAndDecompress(TupleTableSlot *slot, TupleTableSlot *newslot = *outslot; /* - * If the called has passed an invalid slot then create a new slot. + * If the caller has passed an invalid slot then create a new slot. * Otherwise, just clear the existing tuple from the slot. This slot * should be stored by the caller so that it can be reused for * decompressing the subsequent tuples. diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index 18e8ecfd90..d8483c36b3 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -1183,8 +1183,8 @@ typedef struct ModifyTableState TupleTableSlot *mt_root_tuple_slot; /* - * Slot for storing the modified tuple, incase the target attribute's - * compression method doesn't match with the source table. + * Slot for storing the modified tuple, in case the target attribute's + * compression method doesn't match that of the source table. */ TupleTableSlot *mt_decompress_tuple_slot; -- 2.17.0 --YZ5djTAD1cGYuMQK Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v24-0006-alter-table-set-compression.patch" ^ permalink raw reply [nested|flat] 46+ messages in thread
* [PATCH v24 5/7] fixups.patch @ 2021-02-10 21:56 Robert Haas <[email protected]> 0 siblings, 0 replies; 46+ messages in thread From: Robert Haas @ 2021-02-10 21:56 UTC (permalink / raw) --- doc/src/sgml/ddl.sgml | 3 --- doc/src/sgml/ref/create_table.sgml | 15 +++++++++++---- src/backend/access/common/detoast.c | 5 ++--- src/backend/access/compression/compress_lz4.c | 10 +++++----- src/backend/executor/nodeModifyTable.c | 2 +- src/include/nodes/execnodes.h | 4 ++-- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml index 4d7ed698b9..1e9a4625cc 100644 --- a/doc/src/sgml/ddl.sgml +++ b/doc/src/sgml/ddl.sgml @@ -3762,9 +3762,6 @@ CREATE TABLE measurement ( <productname>PostgreSQL</productname> tables (or, possibly, foreign tables). It is possible to specify a tablespace and storage parameters for each partition separately. - By default, each column in a partition inherits the compression method - from parent table's column, however a different compression method can be - set for each partition. </para> <para> diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index 51a7a977a5..a4b297340f 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -997,10 +997,17 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM <term><literal>COMPRESSION <replaceable class="parameter">compression_method</replaceable></literal></term> <listitem> <para> - This sets the compression method for a column. The supported compression - methods are <literal>pglz</literal> and <literal>lz4</literal>. - <literal>lz4</literal> is available only if <literal>--with-lz4</literal> - was used when building <productname>PostgreSQL</productname>. The default + The <literal>COMPRESSION</literal> clause sets the compression method + for a column. Compression is supported only for variable-width data + types, and is used only for columns whose storage type is main or + extended. (See <xref linkend="sql-altertable"/> for information on + column storage types.) Setting this property for a partitioned table + has no direct effect, because such tables have no storage of their own, + but the configured value is inherited by newly-created partitions. + The supported compression methods are <literal>pglz</literal> and + <literal>lz4</literal>. <literal>lz4</literal> is available only if + <literal>--with-lz4</literal> was used when building + <productname>PostgreSQL</productname>. The default is <literal>pglz</literal>. </para> </listitem> diff --git a/src/backend/access/common/detoast.c b/src/backend/access/common/detoast.c index b78d49167b..95d5b1c12a 100644 --- a/src/backend/access/common/detoast.c +++ b/src/backend/access/common/detoast.c @@ -477,8 +477,8 @@ toast_get_compression_oid(struct varlena *attr) return InvalidOid; /* - * Just fetch the toast compress header to know the compression method - * in the compressed data. + * Fetch just enough of the value to examine the compression header, + * so that we can find out the compression method. */ attr = toast_fetch_datum_slice(attr, 0, VARHDRSZ_COMPRESS); } @@ -503,7 +503,6 @@ toast_get_compression_handler(struct varlena *attr) cmid = TOAST_COMPRESS_METHOD(attr); - /* Get the handler routines for the compression method */ switch (cmid) { case PGLZ_COMPRESSION_ID: diff --git a/src/backend/access/compression/compress_lz4.c b/src/backend/access/compression/compress_lz4.c index 1856cf7df7..3079eff7eb 100644 --- a/src/backend/access/compression/compress_lz4.c +++ b/src/backend/access/compression/compress_lz4.c @@ -23,7 +23,7 @@ /* * lz4_cmcompress - compression routine for lz4 compression method * - * Compresses source into dest using the default strategy. Returns the + * Compresses source into dest using the LZ4 defaults. Returns the * compressed varlena, or NULL if compression fails. */ static struct varlena * @@ -42,8 +42,8 @@ lz4_cmcompress(const struct varlena *value) valsize = VARSIZE_ANY_EXHDR(value); /* - * Get maximum size of the compressed data that lz4 compression may output - * and allocate the memory for holding the compressed data and the header. + * Figure out the maximum possible size of the LZ4 output, add the bytes + * that will be needed for varlena overhead, and allocate that amount. */ max_size = LZ4_compressBound(valsize); tmp = (struct varlena *) palloc(max_size + VARHDRSZ_COMPRESS); @@ -83,10 +83,10 @@ lz4_cmdecompress(const struct varlena *value) int32 rawsize; struct varlena *result; - /* allocate memory for holding the uncompressed data */ + /* allocate memory for the uncompressed data */ result = (struct varlena *) palloc(VARRAWSIZE_4B_C(value) + VARHDRSZ); - /* decompress data using lz4 routine */ + /* decompress the data */ rawsize = LZ4_decompress_safe((char *) value + VARHDRSZ_COMPRESS, VARDATA(result), VARSIZE(value) - VARHDRSZ_COMPRESS, diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c index f77deee399..920d9dd0d5 100644 --- a/src/backend/executor/nodeModifyTable.c +++ b/src/backend/executor/nodeModifyTable.c @@ -2117,7 +2117,7 @@ CompareCompressionMethodAndDecompress(TupleTableSlot *slot, TupleTableSlot *newslot = *outslot; /* - * If the called has passed an invalid slot then create a new slot. + * If the caller has passed an invalid slot then create a new slot. * Otherwise, just clear the existing tuple from the slot. This slot * should be stored by the caller so that it can be reused for * decompressing the subsequent tuples. diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index 18e8ecfd90..d8483c36b3 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -1183,8 +1183,8 @@ typedef struct ModifyTableState TupleTableSlot *mt_root_tuple_slot; /* - * Slot for storing the modified tuple, incase the target attribute's - * compression method doesn't match with the source table. + * Slot for storing the modified tuple, in case the target attribute's + * compression method doesn't match that of the source table. */ TupleTableSlot *mt_decompress_tuple_slot; -- 2.17.0 --YZ5djTAD1cGYuMQK Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v24-0006-alter-table-set-compression.patch" ^ permalink raw reply [nested|flat] 46+ messages in thread
* Re: incremental backup breakage in BlockRefTableEntryGetBlocks @ 2024-04-05 06:59 Jakub Wartak <[email protected]> 0 siblings, 0 replies; 46+ messages in thread From: Jakub Wartak @ 2024-04-05 06:59 UTC (permalink / raw) To: Tomas Vondra <[email protected]>; +Cc: Robert Haas <[email protected]>; pgsql-hackers On Thu, Apr 4, 2024 at 9:11 PM Tomas Vondra <[email protected]> wrote: > > On 4/4/24 19:38, Robert Haas wrote: > > Hi, > > > > Yesterday, Tomas Vondra reported to me off-list that he was seeing > > what appeared to be data corruption after taking and restoring an > > incremental backup. Overnight, Jakub Wartak further experimented with > > Tomas's test case, did some initial analysis, and made it very easy to > > reproduce. I spent this morning tracking down the problem, for which I > > attach a patch. > > > > Thanks, I can confirm this fixes the issue I've observed/reported. On > master 10 out of 10 runs failed, with the patch no failures. Same here, patch fixes it on recent master. I've also run pgbench for ~30mins and compared master and incremental and got 0 differences, should be good. > The test is very simple: > > 1) init pgbench Tomas had magic fingers here - he used pgbench -i -s 100 which causes bigger relations (it wouldn't trigger for smaller -s values as Robert explained - now it makes full sense; in earlier tests I was using much smaller -s , then transitioned to other workloads (mostly append only), and final 100GB+/24h+ tests used mostly INSERTs rather than UPDATEs AFAIR). The other interesting thing is that one of the animals runs with configure --with-relsegsize=<somesmallvalue> (so new relations are full much earlier) and it was not catched there either - Wouldn't it be good idea to to test in src/test/recover/ like that? And of course i'm attaching reproducer with some braindump notes in case in future one hits similiar issue and wonders where to even start looking (it's very primitive though but might help). -J. #!/bin/bash rm -rf tmp mkdir /tmp/wals pg_ctl -D tmp/data init echo "summarize_wal = on" >> tmp/data/postgresql.conf #optional echo "autovacuum = off" >> tmp/data/postgresql.conf #optional (gather WAL for analysis) echo "archive_mode = on" >> tmp/data/postgresql.conf echo "archive_command = 'cp %p /tmp/wals/%f'" >> tmp/data/postgresql.conf #optional (no FPW in pg_waldump) #echo "full_page_writes = off" >> tmp/data/postgresql.conf #below steps by Tomas: pg_ctl -D tmp/data -l tmp/pg.log start createdb test pgbench -i -s 100 test pg_basebackup -D tmp/full -c fast pgbench -t 1000 test pg_basebackup -D tmp/increment-1 --increment=tmp/full/backup_manifest -c fast pg_dumpall > tmp/dumpall-source.log pg_ctl -D tmp/data -l tmp/pg.log stop pg_verifybackup tmp/full pg_verifybackup tmp/increment-1/ pg_combinebackup -d -o tmp/restored tmp/full tmp/increment-1/ > tmp/combinebackup 2>&1 pg_ctl -D tmp/restored/ -l tmp/pg.log start pg_dumpall > tmp/dumpall-restored.log #pg_ctl -D tmp/restored/ -l pg.tmp/log stop diff -u tmp/dumpall-source.log tmp/dumpall-restored.log | wc -l exit 0 -----------------8<-----------------8<-----------------8<-----------------8<-----------------8<----------------- it gives: postgres@test:5432 : 54750 # select ctid,aid,bid,abalance from pgbench_accounts where aid in (select aid from pgbench_accounts group by aid, bid having count(*) > 1 order by aid, bid limit 1); ctid | aid | bid | abalance ------------+---------+-----+---------- (65690,55) | 4007145 | 41 | 0 (1 row) postgres@test:5432 : 54750 # set enable_bitmapscan to off; SET postgres@test:5432 : 54750 # set enable_indexscan to off; SET postgres@test:5432 : 54750 # select ctid,aid,bid,abalance from pgbench_accounts where aid in (select aid from pgbench_accounts group by aid, bid having count(*) > 1 order by aid, bid limit 1); ctid | aid | bid | abalance -------------+---------+-----+---------- (65690,55) | 4007145 | 41 | 0 (163943,49) | 4007145 | 41 | 638 (2 rows) postgres@test:5432 : 54750 # select relfilenode from pg_class where relname ='pgbench_accounts'; relfilenode ------------- 16400 (1 row) postgres@test:5432 : 54750 # $ for f in tmp/data/pg_wal/summaries/* ; do >&2 echo "$f"; pg_walsummary -i $f ; done | grep -e 65690 -e 163943 tmp/data/pg_wal/summaries/00000001000000000100002800000000010B1AA0.summary tmp/data/pg_wal/summaries/0000000100000000010B1AA000000000014E6538.summary tmp/data/pg_wal/summaries/0000000100000000014E653800000000014E6638.summary tmp/data/pg_wal/summaries/0000000100000000014E663800000000014ED020.summary tmp/data/pg_wal/summaries/0000000100000000014ED02000000000014ED120.summary tmp/data/pg_wal/summaries/0000000100000000014ED12000000000014ED458.summary tmp/data/pg_wal/summaries/0000000100000000014ED4580000000022403570.summary TS 1663, DB 16384, REL 16400, FORK main: block 65690 tmp/data/pg_wal/summaries/0000000100000000224035700000000043431F50.summary tmp/data/pg_wal/summaries/000000010000000043431F50000000004F0000D8.summary tmp/data/pg_wal/summaries/00000001000000004F0000D80000000051000028.summary TS 1663, DB 16384, REL 16400, FORK main: block 65690 TS 1663, DB 16384, REL 16400, FORK main: block 163943 on tmp/data/pg_wal/summaries/00000001000000004F0000D80000000051000028.summary without -i: TS 1663, DB 16384, REL 16400, FORK main: block 163069 TS 1663, DB 16384, REL 16400, FORK main: block 163213 TS 1663, DB 16384, REL 16400, FORK main: block 163253 TS 1663, DB 16384, REL 16400, FORK main: block 163392 TS 1663, DB 16384, REL 16400, FORK main: block 163492 TS 1663, DB 16384, REL 16400, FORK main: block 163542 TS 1663, DB 16384, REL 16400, FORK main: block 163811 TS 1663, DB 16384, REL 16400, FORK main: block 163819 TS 1663, DB 16384, REL 16400, FORK main: blocks 163934..163950 << dupe here TS 1663, DB 16384, REL 16401, FORK main: block 0 TS 1663, DB 16384, REL 16402, FORK main: limit 0 TS 1663, DB 16384, REL 16402, FORK vm: limit 0 TS 1663, DB 16384, REL 16402, FORK init: limit 0 # being lazy! full wal archive_command scan since the beginning $ for f in /tmp/wals/0* ; do >&2 echo "$f"; pg_waldump $f ; done | grep 1663/16384/16400 | grep --color -e 'blk 65690' -e 'blk 163943' [..] /tmp/wals/000000010000000000000019 /tmp/wals/00000001000000000000001A /tmp/wals/00000001000000000000001B <-- normal load from pgbench -i? rmgr: Heap2 len (rec/tot): 6515/ 6515, tx: 743, lsn: 0/1B748238, prev 0/1B7481F8, desc: MULTI_INSERT+INIT ntuples: 61, flags: 0x20, blkref #0: rel 1663/16384/16400 blk 65690 rmgr: Heap2 len (rec/tot): 59/ 59, tx: 743, lsn: 0/1B749BB0, prev 0/1B748238, desc: VISIBLE snapshotConflictHorizon: 0, flags: 0x03, blkref #0: rel 1663/16384/16400 fork vm blk 2, blkref #1: rel 1663/16384/16400 blk 65690 /tmp/wals/00000001000000000000001C /tmp/wals/00000001000000000000001D /tmp/wals/00000001000000000000001E /tmp/wals/00000001000000000000004E /tmp/wals/00000001000000000000004F /tmp/wals/00000001000000000000004F.000000D8.backup // ignore pg_waldump: error: could not read file "00000001000000000000004F.000000D8.backup": read 343 of 8192 /tmp/wals/000000010000000000000050 // our bug trigger? rmgr: Heap len (rec/tot): 171/ 171, tx: 1275, lsn: 0/5081F350, prev 0/5081D370, desc: UPDATE+INIT old_xmax: 1275, old_off: 37, old_infobits: [], flags: 0x01, new_xmax: 0, new_off: 1, blkref #0: rel 1663/16384/16400 blk 163943, blkref #1: rel 1663/16384/16400 blk 13119 rmgr: Heap len (rec/tot): 171/ 171, tx: 1276, lsn: 0/50823260, prev 0/50821280, desc: UPDATE old_xmax: 1276, old_off: 31, old_infobits: [], flags: 0x01, new_xmax: 0, new_off: 2, blkref #0: rel 1663/16384/16400 blk 163943, blkref #1: rel 1663/16384/16400 blk 158621 rmgr: Heap len (rec/tot): 171/ 171, tx: 1277, lsn: 0/508271F8, prev 0/50825218, desc: UPDATE old_xmax: 1277, old_off: 24, old_infobits: [], flags: 0x01, new_xmax: 0, new_off: 3, blkref #0: rel 1663/16384/16400 blk 163943, blkref #1: rel 1663/16384/16400 blk 39933 rmgr: Heap len (rec/tot): 171/ 171, tx: 1278, lsn: 0/5082B0C8, prev 0/508290E8, desc: UPDATE old_xmax: 1278, old_off: 33, old_infobits: [], flags: 0x01, new_xmax: 0, new_off: 4, blkref #0: rel 1663/16384/16400 blk 163943, blkref #1: rel 1663/16384/16400 blk 157948 rmgr: Heap len (rec/tot): 171/ 171, tx: 1279, lsn: 0/5082EFD8, prev 0/5082CFF8, desc: UPDATE old_xmax: 1279, old_off: 40, old_infobits: [], flags: 0x01, new_xmax: 0, new_off: 5, blkref #0: rel 1663/16384/16400 blk 163943, blkref #1: rel 1663/16384/16400 blk 134187 [..] rmgr: Heap len (rec/tot): 171/ 171, tx: 1321, lsn: 0/508D47E8, prev 0/508D2808, desc: UPDATE old_xmax: 1321, old_off: 13, old_infobits: [], flags: 0x01, new_xmax: 0, new_off: 47, blkref #0: rel 1663/16384/16400 blk 163943, blkref #1: rel 1663/16384/16400 blk 30385 rmgr: Heap len (rec/tot): 171/ 171, tx: 1322, lsn: 0/508D86F8, prev 0/508D6718, desc: UPDATE old_xmax: 1322, old_off: 27, old_infobits: [], flags: 0x01, new_xmax: 0, new_off: 48, blkref #0: rel 1663/16384/16400 blk 163943, blkref #1: rel 1663/16384/16400 blk 27497 rmgr: Heap len (rec/tot): 59/ 8135, tx: 1323, lsn: 0/508DA628, prev 0/508DA600, desc: LOCK xmax: 1323, off: 55, infobits: [LOCK_ONLY, EXCL_LOCK], flags: 0x01, blkref #0: rel 1663/16384/16400 blk 65690 FPW rmgr: Heap len (rec/tot): 171/ 171, tx: 1323, lsn: 0/508DC608, prev 0/508DA628, desc: UPDATE old_xmax: 1323, old_off: 55, old_infobits: [], flags: 0x01, new_xmax: 0, new_off: 49, blkref #0: rel 1663/16384/16400 blk 163943, blkref #1: rel 1663/16384/16400 blk 65690 /tmp/wals/000000010000000000000051 /tmp/wals/000000010000000000000051.00000028.backup pg_waldump: error: could not read file "000000010000000000000051.00000028.backup": read 400 of 8192 /tmp/wals/000000010000000000000052 rmgr: Heap2 len (rec/tot): 60/ 8008, tx: 0, lsn: 0/522DD5B0, prev 0/522DB650, desc: PRUNE snapshotConflictHorizon: 1323, nredirected: 0, ndead: 1, isCatalogRel: F, blkref #0: rel 1663/16384/16400 blk 65690 FPW WAL in /tmp/wals/000000010000000000000050, compare against tmp/combinebackup outputs Attachments: [text/plain] reproduce_incremental_bug_04_04_2024_v1.txt (8.2K, ../../CAKZiRmzZWayaa3Uaxds7-tWqpbtrGDFqrxOTa8Zd-SsxrfrgFA@mail.gmail.com/2-reproduce_incremental_bug_04_04_2024_v1.txt) download | inline: #!/bin/bash rm -rf tmp mkdir /tmp/wals pg_ctl -D tmp/data init echo "summarize_wal = on" >> tmp/data/postgresql.conf #optional echo "autovacuum = off" >> tmp/data/postgresql.conf #optional (gather WAL for analysis) echo "archive_mode = on" >> tmp/data/postgresql.conf echo "archive_command = 'cp %p /tmp/wals/%f'" >> tmp/data/postgresql.conf #optional (no FPW in pg_waldump) #echo "full_page_writes = off" >> tmp/data/postgresql.conf #below steps by Tomas: pg_ctl -D tmp/data -l tmp/pg.log start createdb test pgbench -i -s 100 test pg_basebackup -D tmp/full -c fast pgbench -t 1000 test pg_basebackup -D tmp/increment-1 --increment=tmp/full/backup_manifest -c fast pg_dumpall > tmp/dumpall-source.log pg_ctl -D tmp/data -l tmp/pg.log stop pg_verifybackup tmp/full pg_verifybackup tmp/increment-1/ pg_combinebackup -d -o tmp/restored tmp/full tmp/increment-1/ > tmp/combinebackup 2>&1 pg_ctl -D tmp/restored/ -l tmp/pg.log start pg_dumpall > tmp/dumpall-restored.log #pg_ctl -D tmp/restored/ -l pg.tmp/log stop diff -u tmp/dumpall-source.log tmp/dumpall-restored.log | wc -l exit 0 -----------------8<-----------------8<-----------------8<-----------------8<-----------------8<----------------- it gives: postgres@test:5432 : 54750 # select ctid,aid,bid,abalance from pgbench_accounts where aid in (select aid from pgbench_accounts group by aid, bid having count(*) > 1 order by aid, bid limit 1); ctid | aid | bid | abalance ------------+---------+-----+---------- (65690,55) | 4007145 | 41 | 0 (1 row) postgres@test:5432 : 54750 # set enable_bitmapscan to off; SET postgres@test:5432 : 54750 # set enable_indexscan to off; SET postgres@test:5432 : 54750 # select ctid,aid,bid,abalance from pgbench_accounts where aid in (select aid from pgbench_accounts group by aid, bid having count(*) > 1 order by aid, bid limit 1); ctid | aid | bid | abalance -------------+---------+-----+---------- (65690,55) | 4007145 | 41 | 0 (163943,49) | 4007145 | 41 | 638 (2 rows) postgres@test:5432 : 54750 # select relfilenode from pg_class where relname ='pgbench_accounts'; relfilenode ------------- 16400 (1 row) postgres@test:5432 : 54750 # $ for f in tmp/data/pg_wal/summaries/* ; do >&2 echo "$f"; pg_walsummary -i $f ; done | grep -e 65690 -e 163943 tmp/data/pg_wal/summaries/00000001000000000100002800000000010B1AA0.summary tmp/data/pg_wal/summaries/0000000100000000010B1AA000000000014E6538.summary tmp/data/pg_wal/summaries/0000000100000000014E653800000000014E6638.summary tmp/data/pg_wal/summaries/0000000100000000014E663800000000014ED020.summary tmp/data/pg_wal/summaries/0000000100000000014ED02000000000014ED120.summary tmp/data/pg_wal/summaries/0000000100000000014ED12000000000014ED458.summary tmp/data/pg_wal/summaries/0000000100000000014ED4580000000022403570.summary TS 1663, DB 16384, REL 16400, FORK main: block 65690 tmp/data/pg_wal/summaries/0000000100000000224035700000000043431F50.summary tmp/data/pg_wal/summaries/000000010000000043431F50000000004F0000D8.summary tmp/data/pg_wal/summaries/00000001000000004F0000D80000000051000028.summary TS 1663, DB 16384, REL 16400, FORK main: block 65690 TS 1663, DB 16384, REL 16400, FORK main: block 163943 on tmp/data/pg_wal/summaries/00000001000000004F0000D80000000051000028.summary without -i: TS 1663, DB 16384, REL 16400, FORK main: block 163069 TS 1663, DB 16384, REL 16400, FORK main: block 163213 TS 1663, DB 16384, REL 16400, FORK main: block 163253 TS 1663, DB 16384, REL 16400, FORK main: block 163392 TS 1663, DB 16384, REL 16400, FORK main: block 163492 TS 1663, DB 16384, REL 16400, FORK main: block 163542 TS 1663, DB 16384, REL 16400, FORK main: block 163811 TS 1663, DB 16384, REL 16400, FORK main: block 163819 TS 1663, DB 16384, REL 16400, FORK main: blocks 163934..163950 << dupe here TS 1663, DB 16384, REL 16401, FORK main: block 0 TS 1663, DB 16384, REL 16402, FORK main: limit 0 TS 1663, DB 16384, REL 16402, FORK vm: limit 0 TS 1663, DB 16384, REL 16402, FORK init: limit 0 # being lazy! full wal archive_command scan since the beginning $ for f in /tmp/wals/0* ; do >&2 echo "$f"; pg_waldump $f ; done | grep 1663/16384/16400 | grep --color -e 'blk 65690' -e 'blk 163943' [..] /tmp/wals/000000010000000000000019 /tmp/wals/00000001000000000000001A /tmp/wals/00000001000000000000001B <-- normal load from pgbench -i? rmgr: Heap2 len (rec/tot): 6515/ 6515, tx: 743, lsn: 0/1B748238, prev 0/1B7481F8, desc: MULTI_INSERT+INIT ntuples: 61, flags: 0x20, blkref #0: rel 1663/16384/16400 blk 65690 rmgr: Heap2 len (rec/tot): 59/ 59, tx: 743, lsn: 0/1B749BB0, prev 0/1B748238, desc: VISIBLE snapshotConflictHorizon: 0, flags: 0x03, blkref #0: rel 1663/16384/16400 fork vm blk 2, blkref #1: rel 1663/16384/16400 blk 65690 /tmp/wals/00000001000000000000001C /tmp/wals/00000001000000000000001D /tmp/wals/00000001000000000000001E /tmp/wals/00000001000000000000004E /tmp/wals/00000001000000000000004F /tmp/wals/00000001000000000000004F.000000D8.backup // ignore pg_waldump: error: could not read file "00000001000000000000004F.000000D8.backup": read 343 of 8192 /tmp/wals/000000010000000000000050 // our bug trigger? rmgr: Heap len (rec/tot): 171/ 171, tx: 1275, lsn: 0/5081F350, prev 0/5081D370, desc: UPDATE+INIT old_xmax: 1275, old_off: 37, old_infobits: [], flags: 0x01, new_xmax: 0, new_off: 1, blkref #0: rel 1663/16384/16400 blk 163943, blkref #1: rel 1663/16384/16400 blk 13119 rmgr: Heap len (rec/tot): 171/ 171, tx: 1276, lsn: 0/50823260, prev 0/50821280, desc: UPDATE old_xmax: 1276, old_off: 31, old_infobits: [], flags: 0x01, new_xmax: 0, new_off: 2, blkref #0: rel 1663/16384/16400 blk 163943, blkref #1: rel 1663/16384/16400 blk 158621 rmgr: Heap len (rec/tot): 171/ 171, tx: 1277, lsn: 0/508271F8, prev 0/50825218, desc: UPDATE old_xmax: 1277, old_off: 24, old_infobits: [], flags: 0x01, new_xmax: 0, new_off: 3, blkref #0: rel 1663/16384/16400 blk 163943, blkref #1: rel 1663/16384/16400 blk 39933 rmgr: Heap len (rec/tot): 171/ 171, tx: 1278, lsn: 0/5082B0C8, prev 0/508290E8, desc: UPDATE old_xmax: 1278, old_off: 33, old_infobits: [], flags: 0x01, new_xmax: 0, new_off: 4, blkref #0: rel 1663/16384/16400 blk 163943, blkref #1: rel 1663/16384/16400 blk 157948 rmgr: Heap len (rec/tot): 171/ 171, tx: 1279, lsn: 0/5082EFD8, prev 0/5082CFF8, desc: UPDATE old_xmax: 1279, old_off: 40, old_infobits: [], flags: 0x01, new_xmax: 0, new_off: 5, blkref #0: rel 1663/16384/16400 blk 163943, blkref #1: rel 1663/16384/16400 blk 134187 [..] rmgr: Heap len (rec/tot): 171/ 171, tx: 1321, lsn: 0/508D47E8, prev 0/508D2808, desc: UPDATE old_xmax: 1321, old_off: 13, old_infobits: [], flags: 0x01, new_xmax: 0, new_off: 47, blkref #0: rel 1663/16384/16400 blk 163943, blkref #1: rel 1663/16384/16400 blk 30385 rmgr: Heap len (rec/tot): 171/ 171, tx: 1322, lsn: 0/508D86F8, prev 0/508D6718, desc: UPDATE old_xmax: 1322, old_off: 27, old_infobits: [], flags: 0x01, new_xmax: 0, new_off: 48, blkref #0: rel 1663/16384/16400 blk 163943, blkref #1: rel 1663/16384/16400 blk 27497 rmgr: Heap len (rec/tot): 59/ 8135, tx: 1323, lsn: 0/508DA628, prev 0/508DA600, desc: LOCK xmax: 1323, off: 55, infobits: [LOCK_ONLY, EXCL_LOCK], flags: 0x01, blkref #0: rel 1663/16384/16400 blk 65690 FPW rmgr: Heap len (rec/tot): 171/ 171, tx: 1323, lsn: 0/508DC608, prev 0/508DA628, desc: UPDATE old_xmax: 1323, old_off: 55, old_infobits: [], flags: 0x01, new_xmax: 0, new_off: 49, blkref #0: rel 1663/16384/16400 blk 163943, blkref #1: rel 1663/16384/16400 blk 65690 /tmp/wals/000000010000000000000051 /tmp/wals/000000010000000000000051.00000028.backup pg_waldump: error: could not read file "000000010000000000000051.00000028.backup": read 400 of 8192 /tmp/wals/000000010000000000000052 rmgr: Heap2 len (rec/tot): 60/ 8008, tx: 0, lsn: 0/522DD5B0, prev 0/522DB650, desc: PRUNE snapshotConflictHorizon: 1323, nredirected: 0, ndead: 1, isCatalogRel: F, blkref #0: rel 1663/16384/16400 blk 65690 FPW WAL in /tmp/wals/000000010000000000000050, compare against tmp/combinebackup outputs ^ permalink raw reply [nested|flat] 46+ messages in thread
end of thread, other threads:[~2024-04-05 06:59 UTC | newest] Thread overview: 46+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2021-02-10 21:56 [PATCH v24 05/10] fixups.patch Robert Haas <[email protected]> 2021-02-10 21:56 [PATCH v24 05/10] fixups.patch Robert Haas <[email protected]> 2021-02-10 21:56 [PATCH v24 05/10] fixups.patch Robert Haas <[email protected]> 2021-02-10 21:56 [PATCH v24 5/7] fixups.patch Robert Haas <[email protected]> 2021-02-10 21:56 [PATCH v24 05/10] fixups.patch Robert Haas <[email protected]> 2021-02-10 21:56 [PATCH v24 05/10] fixups.patch Robert Haas <[email protected]> 2021-02-10 21:56 [PATCH v24 5/7] fixups.patch Robert Haas <[email protected]> 2021-02-10 21:56 [PATCH v24 05/10] fixups.patch Robert Haas <[email protected]> 2021-02-10 21:56 [PATCH v24 5/7] fixups.patch Robert Haas <[email protected]> 2021-02-10 21:56 [PATCH v24 5/7] fixups.patch Robert Haas <[email protected]> 2021-02-10 21:56 [PATCH v24 5/7] fixups.patch Robert Haas <[email protected]> 2021-02-10 21:56 [PATCH v24 5/7] fixups.patch Robert Haas <[email protected]> 2021-02-10 21:56 [PATCH v24 5/7] fixups.patch Robert Haas <[email protected]> 2021-02-10 21:56 [PATCH v24 5/7] fixups.patch Robert Haas <[email protected]> 2021-02-10 21:56 [PATCH v24 5/7] fixups.patch Robert Haas <[email protected]> 2021-02-10 21:56 [PATCH v24 05/10] fixups.patch Robert Haas <[email protected]> 2021-02-10 21:56 [PATCH v24 5/7] fixups.patch Robert Haas <[email protected]> 2021-02-10 21:56 [PATCH v24 5/7] fixups.patch Robert Haas <[email protected]> 2021-02-10 21:56 [PATCH v24 5/7] fixups.patch Robert Haas <[email protected]> 2021-02-10 21:56 [PATCH v24 05/10] fixups.patch Robert Haas <[email protected]> 2021-02-10 21:56 [PATCH v24 5/7] fixups.patch Robert Haas <[email protected]> 2021-02-10 21:56 [PATCH v24 05/10] fixups.patch Robert Haas <[email protected]> 2021-02-10 21:56 [PATCH v24 05/10] fixups.patch Robert Haas <[email protected]> 2021-02-10 21:56 [PATCH v24 05/10] fixups.patch Robert Haas <[email protected]> 2021-02-10 21:56 [PATCH v24 5/7] fixups.patch Robert Haas <[email protected]> 2021-02-10 21:56 [PATCH v24 05/10] fixups.patch Robert Haas <[email protected]> 2021-02-10 21:56 [PATCH v24 05/10] fixups.patch Robert Haas <[email protected]> 2021-02-10 21:56 [PATCH v24 05/10] fixups.patch Robert Haas <[email protected]> 2021-02-10 21:56 [PATCH 06/12] fixups.patch Robert Haas <[email protected]> 2021-02-10 21:56 [PATCH v24 05/10] fixups.patch Robert Haas <[email protected]> 2021-02-10 21:56 [PATCH v24 05/10] fixups.patch Robert Haas <[email protected]> 2021-02-10 21:56 [PATCH v24 05/10] fixups.patch Robert Haas <[email protected]> 2021-02-10 21:56 [PATCH v24 05/10] fixups.patch Robert Haas <[email protected]> 2021-02-10 21:56 [PATCH v24 5/7] fixups.patch Robert Haas <[email protected]> 2021-02-10 21:56 [PATCH v24 5/7] fixups.patch Robert Haas <[email protected]> 2021-02-10 21:56 [PATCH v24 05/10] fixups.patch Robert Haas <[email protected]> 2021-02-10 21:56 [PATCH v24 5/7] fixups.patch Robert Haas <[email protected]> 2021-02-10 21:56 [PATCH v24 5/7] fixups.patch Robert Haas <[email protected]> 2021-02-10 21:56 [PATCH v24 05/10] fixups.patch Robert Haas <[email protected]> 2021-02-10 21:56 [PATCH v24 5/7] fixups.patch Robert Haas <[email protected]> 2021-02-10 21:56 [PATCH v24 05/10] fixups.patch Robert Haas <[email protected]> 2021-02-10 21:56 [PATCH v24 5/7] fixups.patch Robert Haas <[email protected]> 2021-02-10 21:56 [PATCH v24 05/10] fixups.patch Robert Haas <[email protected]> 2021-02-10 21:56 [PATCH v24 5/7] fixups.patch Robert Haas <[email protected]> 2021-02-10 21:56 [PATCH v24 5/7] fixups.patch Robert Haas <[email protected]> 2024-04-05 06:59 Re: incremental backup breakage in BlockRefTableEntryGetBlocks Jakub Wartak <[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