Re: POC PATCH: copy from ... exceptions to: (was Re: VLDB Features)

2022-11-02 Thread Damir Belyalov
Updated the patch: - Optimized and simplified logic of IGNORE_ERRORS - Changed variable names to more understandable ones - Added an analogue of MAX_BUFFERED_BYTES for safe buffer Regards, Damir Belyalov Postgres Professional > diff --git a/doc/src/sgml/ref/copy.sgml

Re: POC PATCH: copy from ... exceptions to: (was Re: VLDB Features)

2022-10-17 Thread Damir Belyalov
Updated the patch due to conflicts when applying to master. > diff --git a/doc/src/sgml/ref/copy.sgml b/doc/src/sgml/ref/copy.sgml index c25b52d0cb..22c992e6f6 100644 --- a/doc/src/sgml/ref/copy.sgml +++ b/doc/src/sgml/ref/copy.sgml @@ -34,6 +34,7 @@ COPY { table_name [ ( format_name FREEZE

Re: POC PATCH: copy from ... exceptions to: (was Re: VLDB Features)

2022-09-29 Thread Damir Belyalov
> > Do you mean you stop dealing with errors concerned with constraints and > triggers and we should review 0006-COPY_IGNORE_ERRORS? > Yes, this patch is simpler and I think it's worth adding it first. > Hmm, I applied v6 patch and when canceled COPY by sending SIGINT(ctrl + > C), I faced the

Re: POC PATCH: copy from ... exceptions to: (was Re: VLDB Features)

2022-09-26 Thread torikoshia
On 2022-09-21 21:11, Damir Belyalov wrote: Thanks for updating patch. In the previous patch there was an error when processing constraints. The patch was fixed, but the code grew up and became more complicated (0005-COPY_IGNORE_ERRORS). I also simplified the logic of safeNextCopyFrom(). You

Re: POC PATCH: copy from ... exceptions to: (was Re: VLDB Features)

2022-09-21 Thread Damir Belyalov
Thank you for reviewing. In the previous patch there was an error when processing constraints. The patch was fixed, but the code grew up and became more complicated (0005-COPY_IGNORE_ERRORS). I also simplified the logic of safeNextCopyFrom(). You asked why we need subtransactions, so the answer is

Re: POC PATCH: copy from ... exceptions to: (was Re: VLDB Features)

2022-08-29 Thread torikoshia
On 2022-08-25 01:54, Damir Belyalov wrote: + /* Buffer was filled, commit subtransaction and prepare to replay */ + ReleaseCurrentSubTransaction(); What is actually being committed by this ReleaseCurrentSubTransaction()? It seems to me that just

Re: POC PATCH: copy from ... exceptions to: (was Re: VLDB Features)

2022-08-24 Thread Zhihong Yu
Hi, I was looking at 0004-COPY_IGNORE_ERRORS.patch + * Ignore constraints if IGNORE_ERRORS is enabled + */ +static void +safeExecConstraints(CopyFromState cstate, ResultRelInfo *resultRelInfo, TupleTableSlot *myslot, EState *estate) I think the existing ExecConstraints() can be expanded by

Re: POC PATCH: copy from ... exceptions to: (was Re: VLDB Features)

2022-08-24 Thread Damir Belyalov
> From 09befdad45a6b1ae70d6c5abc90d1c2296e56ee1 Mon Sep 17 00:00:00 2001 From: Damir Belyalov Date: Fri, 15 Oct 2021 11:55:18 +0300 Subject: [PATCH] COPY_IGNORE_ERRORS with GUC for replay_buffer size --- doc/src/sgml/config.sgml | 17 ++ doc/src/sgml/ref/copy.sgml

Re: POC PATCH: copy from ... exceptions to: (was Re: VLDB Features)

2022-08-24 Thread Damir Belyalov
> > > + /* Buffer was filled, commit subtransaction and prepare > to replay */ > > + ReleaseCurrentSubTransaction(); > What is actually being committed by this ReleaseCurrentSubTransaction()? > It seems to me that just safecstate->replay_buffer is fulfilled before >

Re: POC PATCH: copy from ... exceptions to: (was Re: VLDB Features)

2022-08-22 Thread torikoshia
On 2022-08-15 22:23, Damir Belyalov wrote: I expected I could see rows after COPY, but just saw 999 rows. Also I implemented your case and it worked correctly. Thanks for the new patch! Here are some comments on it. + if (safecstate->saved_tuples < REPLAY_BUFFER_SIZE) +

Re: POC PATCH: copy from ... exceptions to: (was Re: VLDB Features)

2022-08-15 Thread Damir Belyalov
> > > Thank you for feedback. I improved my patch recently and tested it on different sizes of MAX_BUFFERED_TUPLES and REPLAY_BUFFER_SIZE. > I loaded 1 rows which contained 1 wrong row. > I expected I could see rows after COPY, but just saw 999 rows. Also I implemented your case and it

Re: POC PATCH: copy from ... exceptions to: (was Re: VLDB Features)

2022-08-15 Thread torikoshia
On 2022-07-19 21:40, Damir Belyalov wrote: Hi! Improved my patch by adding block subtransactions. The block size is determined by the REPLAY_BUFFER_SIZE parameter. I used the idea of a buffer for accumulating tuples in it. If we read REPLAY_BUFFER_SIZE rows without errors, the subtransaction

Re: POC PATCH: copy from ... exceptions to: (was Re: VLDB Features)

2022-07-19 Thread Damir Belyalov
Hi! Improved my patch by adding block subtransactions. The block size is determined by the REPLAY_BUFFER_SIZE parameter. I used the idea of a buffer for accumulating tuples in it. If we read REPLAY_BUFFER_SIZE rows without errors, the subtransaction will be committed. If we find an error, the

Re: POC PATCH: copy from ... exceptions to: (was Re: VLDB Features)

2021-12-18 Thread Pavel Stehule
Hi so 18. 12. 2021 v 9:55 odesílatel Damir Belyalov napsal: > Hello. > > Wrote a patch implementing COPY with ignoring errors in rows using block > subtransactions. > It is great so you are working on this patch. Unfortunately, I am afraid this simple design is not optimal. Using

Re: POC PATCH: copy from ... exceptions to: (was Re: VLDB Features)

2021-12-18 Thread Damir Belyalov
Hello. Wrote a patch implementing COPY with ignoring errors in rows using block subtransactions. Syntax: COPY [table] FROM [file/stdin] WITH IGNORE_ERROS; Examples: CREATE TABLE check_ign_err (n int, m int, k int); COPY check_ign_err FROM STDIN WITH IGNORE_ERRORS; 1 1 1 2 2 2 2 3 3 3 \.

<    1   2