| From: | Peter Geoghegan <pg(at)bowt(dot)ie> |
|---|---|
| To: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | nbtree: Refactor "fastpath" and _bt_search() code |
| Date: | 2020-03-16 21:04:22 |
| Message-ID: | CAH2-Wzk59cxKJRd=rfbyub6-V4yWRjsOYRkUNHBLT1P1GdtCQQ@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
I have another refactoring patch for nbtinsert.c that is a little
bigger than the commits I've pushed recently. I thought I should run
it by -hackers before proceeding with commit, even though it seems
like a very clear improvement to me.
Attached patch creates a _bt_search() wrapper that is local to
nbtinsert.c -- _bt_search_insert(). This contains all the logic needed
to handle the "fastpath" rightmost leaf page caching optimization
added by commit 2b272734, avoiding any direct knowledge of the
optimization within the high level _bt_doinsert() function. This is
more or less how things were before 2b272734. This is certainly a
readability win.
It's also useful to have our leaf page buffer acquired within a
dedicated function that knows about the BTInsertState struct. That
makes the "ownership" of the buffer less ambiguous, and provides a
single reference point for other code that sets up the fastpath
optimization that will now actually be used in _bt_search_insert().
--
Peter Geoghegan
| Attachment | Content-Type | Size |
|---|---|---|
| v1-0001-Refactor-_bt_doinsert-fastpath-optimization.patch | application/octet-stream | 9.9 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Justin Pryzby | 2020-03-16 21:07:57 | Re: Berserk Autovacuum (let's save next Mandrill) |
| Previous Message | Daniel Gustafsson | 2020-03-16 21:04:05 | Re: [PATCH] Use PKG_CHECK_MODULES to detect the libxml2 library |