From: | Kazutaka Onishi <onishi(at)heterodb(dot)com> |
---|---|
To: | Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> |
Cc: | Kohei KaiGai <kaigai(at)heterodb(dot)com>, Zhihong Yu <zyu(at)yugabyte(dot)com>, Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>, Amit Langote <amitlangote09(at)gmail(dot)com>, Ibrar Ahmed <ibrar(dot)ahmad(at)gmail(dot)com>, PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com> |
Subject: | Re: TRUNCATE on foreign table |
Date: | 2021-04-05 15:17:22 |
Message-ID: | CAJuF6cPpG+gZWxbmYXsUZOrvJTaC3FryGasEunj+GLVTKwjR0A@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
> Did you check that hash_destroy is not reachable when an error occurs
> on the remote server while executing truncate command?
I've checked it and hash_destroy doesn't work on error.
I just adding elog() to check this:
+ elog(NOTICE,"destroyed");
+ hash_destroy(ft_htab);
Then I've checked by the test.
+ -- 'truncatable' option
+ ALTER SERVER loopback OPTIONS (ADD truncatable 'false');
+ TRUNCATE tru_ftable; -- error
+ ERROR: truncate on "tru_ftable" is prohibited
<- hash_destroy doesn't work.
+ ALTER FOREIGN TABLE tru_ftable OPTIONS (ADD truncatable 'true');
+ TRUNCATE tru_ftable; -- accepted
+ NOTICE: destroyed <- hash_destroy works.
Of course, the elog() is not included in v13 patch.
2021年4月5日(月) 23:35 Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>:
>
> On Mon, Apr 5, 2021 at 7:38 PM Kazutaka Onishi <onishi(at)heterodb(dot)com> wrote:
> > > 3) I think we need truncatable behaviour that is consistent with updatable.
> >
> > It's not correct. "truncatable" option works the same as "updatable".
> > I've confirmed that the table can be truncated with the combination:
> > truncatable on the server setting is false & truncatable on the table
> > setting is true.
> > I've also added to the test.
>
> Yeah you are right! I was wrong in understanding.
>
> > > 7) Did you try checking whether we reach hash_destroy code when a
> > > failure happens on executing truncate on a remote table? Otherwise we
> > > might want to do routine->ExecForeignTruncate inside PG_TRY block?
> >
> > I've added PG_TRY block.
>
> Did you check that hash_destroy is not reachable when an error occurs
> on the remote server while executing truncate command? If yes, then
> only we will have PG_TRY block, otherwise not.
>
> > > 9) It will be good if you can divide up your patch into 3 separate
> > > patches - 0001 code, 0002 tests, 0003 documentation
> >
> > I'll do it when I send a patch in the future, please forgive me on this patch.
>
> That's okay.
>
> With Regards,
> Bharath Rupireddy.
> EnterpriseDB: http://www.enterprisedb.com
From | Date | Subject | |
---|---|---|---|
Next Message | vignesh C | 2021-04-05 15:21:19 | Re: Replication slot stats misgivings |
Previous Message | Fujii Masao | 2021-04-05 15:08:46 | Re: Get memory contexts of an arbitrary backend process |