- Notifications
You must be signed in to change notification settings - Fork5
Commit6d46f47
committed
Improve hash index bucket split behavior.
Previously, the right to split a bucket was represented by aheavyweight lock on the page number of the primary bucket page.Unfortunately, this meant that every scan needed to take a heavyweightlock on that bucket also, which was bad for concurrency. Instead, usea cleanup lock on the primary bucket page to indicate the right tobegin a split, so that scans only need to retain a pin on that page,which is they would have to acquire anyway, and which is also muchcheaper.In addition to reducing the locking cost, this also avoids locking outscans and inserts for the entire lifetime of the split: while the newbucket is being populated with copies of the appropriate tuples fromthe old bucket, scans and inserts can happen in parallel. There areminor concurrency improvements for vacuum operations as well, thoughthe situation there is still far from ideal.This patch also removes the unworldly assumption that a split willnever be interrupted. With the new code, a split is done in a seriesof small steps and the system can pick up where it left off if it isinterrupted prior to completion. While this patch does not itself addwrite-ahead logging for hash indexes, it is clearly a necessary firststep, since one of the things that could interrupt a split is theremoval of electrical power from the machine performing it.Amit Kapila. I wrote the original design on which this patch isbased, and did a good bit of work on the comments and README throughmultiple rounds of review, but all of the code is Amit's. Alsoreviewed by Jesper Pedersen, Jeff Janes, and others.Discussion:http://postgr.es/m/CAA4eK1LfzcZYxLoXS874Ad0+S-ZM60U9bwcyiUZx9mHZ-KCWhw@mail.gmail.com1 parent213c0f2 commit6d46f47
File tree
12 files changed
+1365
-626
lines changed- src
- backend
- access/hash
- utils/resowner
- include/access
12 files changed
+1365
-626
lines changedLines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
15 |
| - | |
16 |
| - | |
| 15 | + | |
| 16 | + | |
17 | 17 |
| |
18 | 18 |
|
Lines changed: 168 additions & 143 deletions
Large diffs are not rendered by default.
0 commit comments
Comments
(0)