From: | Andres Freund <andres(at)anarazel(dot)de> |
---|---|
To: | Pavan Deolasee <pavan(dot)deolasee(at)gmail(dot)com> |
Cc: | Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, Simon Riggs <simon(at)2ndquadrant(dot)com> |
Subject: | Re: COPY FREEZE and setting PD_ALL_VISIBLE/visibility map bits |
Date: | 2019-04-04 17:24:17 |
Message-ID: | 20190404172417.gua2xmn754uoxzto@alap3.anarazel.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
On 2019-04-03 10:19:17 +0530, Pavan Deolasee wrote:
> diff --git a/src/backend/commands/copy.c b/src/backend/commands/copy.c
> index c1fd7b78ce..09df70a3ac 100644
> --- a/src/backend/commands/copy.c
> +++ b/src/backend/commands/copy.c
> @@ -2833,6 +2833,15 @@ CopyFrom(CopyState cstate)
> !has_instead_insert_row_trig &&
> resultRelInfo->ri_FdwRoutine == NULL;
>
> + /*
> + * Note: As of PG12, COPY FREEZE is not supported on
> + * partitioned table. Nevertheless have this check in place so
> + * that we do the right thing if it ever gets supported.
> + */
> + if (ti_options & TABLE_INSERT_FROZEN)
> + CheckAndSetAllVisibleBulkInsertState(resultRelInfo->ri_RelationDesc,
> + bistate);
> +
> /*
> * We'd better make the bulk insert mechanism gets a new
> * buffer when the partition being inserted into changes.
> @@ -3062,6 +3071,15 @@ CopyFrom(CopyState cstate)
> firstBufferedLineNo);
> }
>
> + /*
> + * If we are inserting frozen tuples, check if the last page used can also
> + * be marked as all-visible and all-frozen. This ensures that a table can
> + * be fully frozen when the data is loaded.
> + */
> + if (ti_options & TABLE_INSERT_FROZEN)
> + CheckAndSetAllVisibleBulkInsertState(resultRelInfo->ri_RelationDesc,
> + bistate);
> +
> /* Done, clean up */
> error_context_stack = errcallback.previous;
I'm totally not OK with this from a layering
POV. CheckAndSetAllVisibleBulkInsertState is entirely heap specific
(without being named such), whereas all the heap specific bits are
getting moved below tableam.
Greetings,
Andres Freund
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2019-04-04 18:07:04 | Re: query logging of prepared statements |
Previous Message | Robbie Harwood | 2019-04-04 17:15:48 | Re: [PATCH v20] GSSAPI encryption support |