From: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
---|---|
To: | 赵锐 <875941708(at)qq(dot)com> |
Cc: | Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, Amit Langote <amitlangote09(at)gmail(dot)com>, Petr Jelinek <petr(at)2ndquadrant(dot)com>, Rafia Sabih <rafia(dot)pghackers(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: adding partitioned tables to publications |
Date: | 2021-01-11 11:42:45 |
Message-ID: | CAA4eK1KC+4DNq=Q-B5V0VyVV+6jbtjbg4aE0Kwx5vUyVPKNbWw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, Dec 30, 2020 at 8:03 PM 赵锐 <875941708(at)qq(dot)com> wrote:
>
> The first file of Amit's patch can not only re-range the code, but also fix a hidden bug.
> To make it easy to see, I attach another patch.
> "RelationIdGetRelation" will increase ref on owner->relrefarr, without "RelationClose", the owner->relrefarr will enlarge and re-hash.
> When the capacity of owner->relrefarr is over than 10 million, enlarge and re-hash takes serial hours. And what's worse, increase ref will also take minutes, as the hash collision resolution is based on looking up an array in order.
> When we want to publish 10 billion data under one partition table, it takes serial days up to increase ref, enlarge and re-hash, and CPU is always 99%.
> After applying my patch, 10 billion will be published in 10 minutes.
>
It is a clear relation descriptor leak. The proposed fix seems correct
to me. The patch wasn't getting applied to HEAD. So, I have prepared
the separate patches for HEAD and 13. There are minor modifications in
the patch like I have used RelationIsValid before closing the
relation. I have not added any test because I see that there is
already a test in src/test/subscription/t/013_partition.
Kindly let me know your English name so that I can give you credit as
a co-author?
--
With Regards,
Amit Kapila.
Attachment | Content-Type | Size |
---|---|---|
v1-0001-Fix-relation-descriptor-leak.HEAD.patch | application/octet-stream | 2.8 KB |
v1-0001-Fix-relation-descriptor-leak.13.patch | application/octet-stream | 2.8 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Amit Kapila | 2021-01-11 11:57:22 | Re: Added schema level support for publication. |
Previous Message | 曾文旌 | 2021-01-11 11:40:18 | Re: Proposal: Global Index |