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
03659a26
Commit
03659a26
authored
Nov 29, 1996
by
Vadim B. Mikheev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added: dynamic re-moving page from list of pages usable for shrinking
if its free-space < min_tuple_len.
parent
7b4426ea
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
3 deletions
+60
-3
src/backend/commands/vacuum.c
src/backend/commands/vacuum.c
+60
-3
No files found.
src/backend/commands/vacuum.c
View file @
03659a26
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.1
0 1996/11/28 04:37:38
vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.1
1 1996/11/29 10:27:59
vadim Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -462,6 +462,7 @@ _vc_scanheap (VRelList curvrl, Relation onerel,
...
@@ -462,6 +462,7 @@ _vc_scanheap (VRelList curvrl, Relation onerel,
{
{
int
nblocks
,
blkno
;
int
nblocks
,
blkno
;
ItemId
itemid
;
ItemId
itemid
;
ItemPointer
itemptr
;
HeapTuple
htup
;
HeapTuple
htup
;
Buffer
buf
;
Buffer
buf
;
Page
page
,
tempPage
=
NULL
;
Page
page
,
tempPage
=
NULL
;
...
@@ -611,6 +612,33 @@ DELETE_TRANSACTION_ID_VALID %d, TUPGONE %d.",
...
@@ -611,6 +612,33 @@ DELETE_TRANSACTION_ID_VALID %d, TUPGONE %d.",
tupgone
);
tupgone
);
}
}
/*
* It's possibly! But from where it comes ?
* And should we fix it ? - vadim 11/28/96
*/
itemptr
=
&
(
htup
->
t_ctid
);
if
(
!
ItemPointerIsValid
(
itemptr
)
||
BlockIdGetBlockNumber
(
&
(
itemptr
->
ip_blkid
))
!=
blkno
)
{
elog
(
NOTICE
,
"ITEM POINTER IS INVALID: %u/%u FOR %u/%u. TUPGONE %d."
,
BlockIdGetBlockNumber
(
&
(
itemptr
->
ip_blkid
)),
itemptr
->
ip_posid
,
blkno
,
offnum
,
tupgone
);
}
/*
* Other checks...
*/
if
(
htup
->
t_len
!=
itemid
->
lp_len
)
{
elog
(
NOTICE
,
"PAGEHEADER' LEN %u IS NOT THE SAME AS HTUP' %u FOR %u/%u.TUPGONE %d."
,
itemid
->
lp_len
,
htup
->
t_len
,
blkno
,
offnum
,
tupgone
);
}
if
(
!
OidIsValid
(
htup
->
t_oid
)
)
{
elog
(
NOTICE
,
"OID IS INVALID FOR %u/%u.TUPGONE %d."
,
blkno
,
offnum
,
tupgone
);
}
if
(
tupgone
)
{
if
(
tupgone
)
{
ItemId
lpp
;
ItemId
lpp
;
...
@@ -676,6 +704,10 @@ DELETE_TRANSACTION_ID_VALID %d, TUPGONE %d.",
...
@@ -676,6 +704,10 @@ DELETE_TRANSACTION_ID_VALID %d, TUPGONE %d.",
/* save stats in the rel list for use later */
/* save stats in the rel list for use later */
curvrl
->
vrl_ntups
=
ntups
;
curvrl
->
vrl_ntups
=
ntups
;
curvrl
->
vrl_npages
=
nblocks
;
curvrl
->
vrl_npages
=
nblocks
;
if
(
ntups
==
0
)
min_tlen
=
max_tlen
=
0
;
curvrl
->
vrl_min_tlen
=
min_tlen
;
curvrl
->
vrl_max_tlen
=
max_tlen
;
Vvpl
->
vpl_nemend
=
nemend
;
Vvpl
->
vpl_nemend
=
nemend
;
Fvpl
->
vpl_nemend
=
nemend
;
Fvpl
->
vpl_nemend
=
nemend
;
...
@@ -746,6 +778,7 @@ _vc_rpfheap (VRelList curvrl, Relation onerel,
...
@@ -746,6 +778,7 @@ _vc_rpfheap (VRelList curvrl, Relation onerel,
InsertIndexResult
iresult
;
InsertIndexResult
iresult
;
VPageListData
Nvpl
;
VPageListData
Nvpl
;
VPageDescr
ToVpd
=
NULL
,
Fvplast
,
Vvplast
,
vpc
,
*
vpp
;
VPageDescr
ToVpd
=
NULL
,
Fvplast
,
Vvplast
,
vpc
,
*
vpp
;
int
ToVpI
=
0
;
IndDesc
*
Idesc
,
*
idcur
;
IndDesc
*
Idesc
,
*
idcur
;
int
Fblklast
,
Vblklast
,
i
;
int
Fblklast
,
Vblklast
,
i
;
Size
tlen
;
Size
tlen
;
...
@@ -872,8 +905,31 @@ _vc_rpfheap (VRelList curvrl, Relation onerel,
...
@@ -872,8 +905,31 @@ _vc_rpfheap (VRelList curvrl, Relation onerel,
!
_vc_enough_space
(
ToVpd
,
tlen
)
)
!
_vc_enough_space
(
ToVpd
,
tlen
)
)
{
{
if
(
ToBuf
!=
InvalidBuffer
)
if
(
ToBuf
!=
InvalidBuffer
)
{
WriteBuffer
(
ToBuf
);
WriteBuffer
(
ToBuf
);
ToBuf
=
InvalidBuffer
;
ToBuf
=
InvalidBuffer
;
/*
* If no one tuple can't be added to this page -
* remove page from Fvpl. - vadim 11/27/96
*/
if
(
!
_vc_enough_space
(
ToVpd
,
curvrl
->
vrl_min_tlen
)
)
{
if
(
ToVpd
!=
Fvplast
)
{
Assert
(
Fnpages
>
ToVpI
+
1
);
memmove
(
Fvpl
->
vpl_pgdesc
+
ToVpI
,
Fvpl
->
vpl_pgdesc
+
ToVpI
+
1
,
sizeof
(
VPageDescr
*
)
*
(
Fnpages
-
ToVpI
-
1
));
}
Assert
(
Fnpages
>=
1
);
Fnpages
--
;
if
(
Fnpages
==
0
)
break
;
/* get prev reapped page from Fvpl */
Fvplast
=
Fvpl
->
vpl_pgdesc
[
Fnpages
-
1
];
Fblklast
=
Fvplast
->
vpd_blkno
;
}
}
for
(
i
=
0
;
i
<
Fnpages
;
i
++
)
for
(
i
=
0
;
i
<
Fnpages
;
i
++
)
{
{
if
(
_vc_enough_space
(
Fvpl
->
vpl_pgdesc
[
i
],
tlen
)
)
if
(
_vc_enough_space
(
Fvpl
->
vpl_pgdesc
[
i
],
tlen
)
)
...
@@ -881,7 +937,8 @@ _vc_rpfheap (VRelList curvrl, Relation onerel,
...
@@ -881,7 +937,8 @@ _vc_rpfheap (VRelList curvrl, Relation onerel,
}
}
if
(
i
==
Fnpages
)
if
(
i
==
Fnpages
)
break
;
/* can't move item anywhere */
break
;
/* can't move item anywhere */
ToVpd
=
Fvpl
->
vpl_pgdesc
[
i
];
ToVpI
=
i
;
ToVpd
=
Fvpl
->
vpl_pgdesc
[
ToVpI
];
ToBuf
=
ReadBuffer
(
onerel
,
ToVpd
->
vpd_blkno
);
ToBuf
=
ReadBuffer
(
onerel
,
ToVpd
->
vpd_blkno
);
ToPage
=
BufferGetPage
(
ToBuf
);
ToPage
=
BufferGetPage
(
ToBuf
);
/* if this page was not used before - clean it */
/* if this page was not used before - clean it */
...
...
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