diff options
author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2014-04-03 15:09:37 +0300 |
---|---|---|
committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2014-04-03 15:44:42 +0300 |
commit | 767fc1c520a19f353006a5926cfea63bc4a4a57b (patch) | |
tree | 5f2b0f87c3612a66b335eaa8bea399083c66360c /src/backend/access/gist/README | |
parent | 65183fb78f1a31b6f333fde3293e047898bd6931 (diff) |
Avoid palloc in critical section in GiST WAL-logging.
Memory allocation can fail if you run out of memory, and inside a critical
section that will lead to a PANIC. Use conservatively-sized arrays in stack
instead.
There was previously no explicit limit on the number of pages a GiST split
can produce, it was only limited by the number of LWLocks that can be held
simultaneously (100 at the moment). This patch adds an explicit limit of 75
pages. That should be plenty, a typical split shouldn't produce more than
2-3 page halves.
The bug has been there forever, but only backpatch down to 9.1. The code
was changed significantly in 9.1, and it doesn't seem worth the risk or
trouble to adapt this for 9.0 and 8.4.
Diffstat (limited to 'src/backend/access/gist/README')
-rw-r--r-- | src/backend/access/gist/README | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/backend/access/gist/README b/src/backend/access/gist/README index 4bcac1f2c79..dd4c9fa70a0 100644 --- a/src/backend/access/gist/README +++ b/src/backend/access/gist/README @@ -135,7 +135,7 @@ that didn't need to be split. This differs from the insertion algorithm in the original paper. In the original paper, you first walk down the tree until you reach a leaf page, and -then you adjust the downlink in the parent, and propagating the adjustment up, +then you adjust the downlink in the parent, and propagate the adjustment up, all the way up to the root in the worst case. But we adjust the downlinks to cover the new key already when we walk down, so that when we reach the leaf page, we don't need to update the parents anymore, except to insert the |