Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
9789c99d
Commit
9789c99d
authored
Feb 21, 2012
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cosmetic cleanup for commit
a760893d
.
Mostly, fixing overlooked comments.
parent
c2a2f751
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
15 deletions
+31
-15
src/backend/access/nbtree/nbtpage.c
src/backend/access/nbtree/nbtpage.c
+21
-7
src/backend/access/nbtree/nbtree.c
src/backend/access/nbtree/nbtree.c
+6
-5
src/backend/access/nbtree/nbtxlog.c
src/backend/access/nbtree/nbtxlog.c
+2
-2
src/include/access/nbtree.h
src/include/access/nbtree.h
+2
-1
No files found.
src/backend/access/nbtree/nbtpage.c
View file @
9789c99d
...
...
@@ -715,7 +715,7 @@ _bt_page_recyclable(Page page)
}
/*
* Delete item(s) from a btree page.
* Delete item(s) from a btree page
during VACUUM
.
*
* This must only be used for deleting leaf items. Deleting an item on a
* non-leaf page has to be done as part of an atomic action that includes
...
...
@@ -736,7 +736,8 @@ _bt_page_recyclable(Page page)
*/
void
_bt_delitems_vacuum
(
Relation
rel
,
Buffer
buf
,
OffsetNumber
*
itemnos
,
int
nitems
,
BlockNumber
lastBlockVacuumed
)
OffsetNumber
*
itemnos
,
int
nitems
,
BlockNumber
lastBlockVacuumed
)
{
Page
page
=
BufferGetPage
(
buf
);
BTPageOpaque
opaque
;
...
...
@@ -771,7 +772,6 @@ _bt_delitems_vacuum(Relation rel, Buffer buf,
{
XLogRecPtr
recptr
;
XLogRecData
rdata
[
2
];
xl_btree_vacuum
xlrec_vacuum
;
xlrec_vacuum
.
node
=
rel
->
rd_node
;
...
...
@@ -811,13 +811,27 @@ _bt_delitems_vacuum(Relation rel, Buffer buf,
END_CRIT_SECTION
();
}
/*
* Delete item(s) from a btree page during single-page cleanup.
*
* As above, must only be used on leaf pages.
*
* This routine assumes that the caller has pinned and locked the buffer.
* Also, the given itemnos *must* appear in increasing order in the array.
*
* This is nearly the same as _bt_delitems_vacuum as far as what it does to
* the page, but the WAL logging considerations are quite different. See
* comments for _bt_delitems_vacuum.
*/
void
_bt_delitems_delete
(
Relation
rel
,
Buffer
buf
,
OffsetNumber
*
itemnos
,
int
nitems
,
Relation
heapRel
)
OffsetNumber
*
itemnos
,
int
nitems
,
Relation
heapRel
)
{
Page
page
=
BufferGetPage
(
buf
);
BTPageOpaque
opaque
;
/* Shouldn't be called unless there's something to do */
Assert
(
nitems
>
0
);
/* No ereport(ERROR) until changes are logged */
...
...
@@ -849,7 +863,6 @@ _bt_delitems_delete(Relation rel, Buffer buf,
{
XLogRecPtr
recptr
;
XLogRecData
rdata
[
3
];
xl_btree_delete
xlrec_delete
;
xlrec_delete
.
node
=
rel
->
rd_node
;
...
...
@@ -863,8 +876,9 @@ _bt_delitems_delete(Relation rel, Buffer buf,
rdata
[
0
].
next
=
&
(
rdata
[
1
]);
/*
* We need the target-offsets array whether or not we store the to
* allow us to find the latestRemovedXid on a standby server.
* We need the target-offsets array whether or not we store the whole
* buffer, to allow us to find the latestRemovedXid on a standby
* server.
*/
rdata
[
1
].
data
=
(
char
*
)
itemnos
;
rdata
[
1
].
len
=
nitems
*
sizeof
(
OffsetNumber
);
...
...
src/backend/access/nbtree/nbtree.c
View file @
9789c99d
...
...
@@ -1004,14 +1004,15 @@ restart:
}
/*
* Apply any needed deletes. We issue just one _bt_delitems
() call
* per page, so as to minimize WAL traffic.
* Apply any needed deletes. We issue just one _bt_delitems
_vacuum()
*
call
per page, so as to minimize WAL traffic.
*/
if
(
ndeletable
>
0
)
{
BlockNumber
lastBlockVacuumed
=
BufferGetBlockNumber
(
buf
);
_bt_delitems_vacuum
(
rel
,
buf
,
deletable
,
ndeletable
,
vstate
->
lastBlockVacuumed
);
_bt_delitems_vacuum
(
rel
,
buf
,
deletable
,
ndeletable
,
vstate
->
lastBlockVacuumed
);
/*
* Keep track of the block number of the lastBlockVacuumed, so we
...
...
@@ -1031,8 +1032,8 @@ restart:
/*
* If the page has been split during this vacuum cycle, it seems
* worth expending a write to clear btpo_cycleid even if we don't
* have any deletions to do. (If we do, _bt_delitems
takes care
* of this.) This ensures we won't process the page again.
* have any deletions to do. (If we do, _bt_delitems
_vacuum takes
*
care
of this.) This ensures we won't process the page again.
*
* We treat this like a hint-bit update because there's no need to
* WAL-log it.
...
...
src/backend/access/nbtree/nbtxlog.c
View file @
9789c99d
...
...
@@ -539,7 +539,7 @@ btree_xlog_vacuum(XLogRecPtr lsn, XLogRecord *record)
/*
* Mark the page as not containing any LP_DEAD items --- see comments in
* _bt_delitems().
* _bt_delitems
_vacuum
().
*/
opaque
=
(
BTPageOpaque
)
PageGetSpecialPointer
(
page
);
opaque
->
btpo_flags
&=
~
BTP_HAS_GARBAGE
;
...
...
@@ -720,7 +720,7 @@ btree_xlog_delete(XLogRecPtr lsn, XLogRecord *record)
/*
* Mark the page as not containing any LP_DEAD items --- see comments in
* _bt_delitems().
* _bt_delitems
_delete
().
*/
opaque
=
(
BTPageOpaque
)
PageGetSpecialPointer
(
page
);
opaque
->
btpo_flags
&=
~
BTP_HAS_GARBAGE
;
...
...
src/include/access/nbtree.h
View file @
9789c99d
...
...
@@ -635,7 +635,8 @@ extern bool _bt_page_recyclable(Page page);
extern
void
_bt_delitems_delete
(
Relation
rel
,
Buffer
buf
,
OffsetNumber
*
itemnos
,
int
nitems
,
Relation
heapRel
);
extern
void
_bt_delitems_vacuum
(
Relation
rel
,
Buffer
buf
,
OffsetNumber
*
itemnos
,
int
nitems
,
BlockNumber
lastBlockVacuumed
);
OffsetNumber
*
itemnos
,
int
nitems
,
BlockNumber
lastBlockVacuumed
);
extern
int
_bt_pagedel
(
Relation
rel
,
Buffer
buf
,
BTStack
stack
);
/*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment