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
a7fcadd1
Commit
a7fcadd1
authored
Oct 21, 2000
by
Vadim B. Mikheev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WAL
parent
7c177a49
Changes
21
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
942 additions
and
457 deletions
+942
-457
src/backend/access/gist/gist.c
src/backend/access/gist/gist.c
+26
-1
src/backend/access/hash/hash.c
src/backend/access/hash/hash.c
+28
-2
src/backend/access/heap/heapam.c
src/backend/access/heap/heapam.c
+53
-2
src/backend/access/nbtree/nbtinsert.c
src/backend/access/nbtree/nbtinsert.c
+26
-18
src/backend/access/nbtree/nbtpage.c
src/backend/access/nbtree/nbtpage.c
+9
-6
src/backend/access/nbtree/nbtree.c
src/backend/access/nbtree/nbtree.c
+428
-361
src/backend/access/rtree/rtree.c
src/backend/access/rtree/rtree.c
+26
-1
src/backend/access/transam/rmgr.c
src/backend/access/transam/rmgr.c
+57
-2
src/backend/access/transam/xact.c
src/backend/access/transam/xact.c
+36
-2
src/backend/access/transam/xlog.c
src/backend/access/transam/xlog.c
+149
-32
src/backend/access/transam/xlogutils.c
src/backend/access/transam/xlogutils.c
+4
-0
src/backend/bootstrap/bootstrap.c
src/backend/bootstrap/bootstrap.c
+3
-1
src/backend/postmaster/postmaster.c
src/backend/postmaster/postmaster.c
+15
-1
src/backend/storage/buffer/bufmgr.c
src/backend/storage/buffer/bufmgr.c
+4
-3
src/backend/storage/page/bufpage.c
src/backend/storage/page/bufpage.c
+33
-2
src/backend/storage/smgr/smgr.c
src/backend/storage/smgr/smgr.c
+24
-1
src/include/access/nbtree.h
src/include/access/nbtree.h
+6
-6
src/include/access/rmgr.h
src/include/access/rmgr.h
+1
-10
src/include/access/xlog.h
src/include/access/xlog.h
+11
-0
src/include/storage/bufpage.h
src/include/storage/bufpage.h
+2
-1
src/include/storage/itemid.h
src/include/storage/itemid.h
+1
-5
No files found.
src/backend/access/gist/gist.c
View file @
a7fcadd1
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/gist/gist.c,v 1.6
2 2000/07/14 22:17:28 tgl
Exp $
* $Header: /cvsroot/pgsql/src/backend/access/gist/gist.c,v 1.6
3 2000/10/21 15:43:09 vadim
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -23,6 +23,12 @@
...
@@ -23,6 +23,12 @@
#include "miscadmin.h"
#include "miscadmin.h"
#include "utils/syscache.h"
#include "utils/syscache.h"
#ifdef XLOG
#include "access/xlogutils.h"
void
gist_redo
(
XLogRecPtr
lsn
,
XLogRecord
*
record
);
void
gist_undo
(
XLogRecPtr
lsn
,
XLogRecord
*
record
);
void
gist_desc
(
char
*
buf
,
uint8
xl_info
,
char
*
rec
);
#endif
/* non-export function prototypes */
/* non-export function prototypes */
static
InsertIndexResult
gistdoinsert
(
Relation
r
,
IndexTuple
itup
,
static
InsertIndexResult
gistdoinsert
(
Relation
r
,
IndexTuple
itup
,
...
@@ -1344,3 +1350,22 @@ int_range_out(INTRANGE *r)
...
@@ -1344,3 +1350,22 @@ int_range_out(INTRANGE *r)
}
}
#endif
/* defined GISTDEBUG */
#endif
/* defined GISTDEBUG */
#ifdef XLOG
void
gist_redo
(
XLogRecPtr
lsn
,
XLogRecord
*
record
)
{
elog
(
STOP
,
"gist_redo: unimplemented"
);
}
void
gist_undo
(
XLogRecPtr
lsn
,
XLogRecord
*
record
)
{
elog
(
STOP
,
"gist_undo: unimplemented"
);
}
void
gist_desc
(
char
*
buf
,
uint8
xl_info
,
char
*
rec
)
{
}
#endif
src/backend/access/hash/hash.c
View file @
a7fcadd1
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/hash/hash.c,v 1.4
2 2000/07/14 22:17:28 tgl
Exp $
* $Header: /cvsroot/pgsql/src/backend/access/hash/hash.c,v 1.4
3 2000/10/21 15:43:11 vadim
Exp $
*
*
* NOTES
* NOTES
* This file contains only the public interface routines.
* This file contains only the public interface routines.
...
@@ -25,9 +25,16 @@
...
@@ -25,9 +25,16 @@
#include "executor/executor.h"
#include "executor/executor.h"
#include "miscadmin.h"
#include "miscadmin.h"
bool
BuildingHash
=
false
;
bool
BuildingHash
=
false
;
#ifdef XLOG
#include "access/xlogutils.h"
void
hash_redo
(
XLogRecPtr
lsn
,
XLogRecord
*
record
);
void
hash_undo
(
XLogRecPtr
lsn
,
XLogRecord
*
record
);
void
hash_desc
(
char
*
buf
,
uint8
xl_info
,
char
*
rec
);
#endif
/*
/*
* hashbuild() -- build a new hash index.
* hashbuild() -- build a new hash index.
*
*
...
@@ -478,3 +485,22 @@ hashdelete(PG_FUNCTION_ARGS)
...
@@ -478,3 +485,22 @@ hashdelete(PG_FUNCTION_ARGS)
PG_RETURN_VOID
();
PG_RETURN_VOID
();
}
}
#ifdef XLOG
void
hash_redo
(
XLogRecPtr
lsn
,
XLogRecord
*
record
)
{
elog
(
STOP
,
"hash_redo: unimplemented"
);
}
void
hash_undo
(
XLogRecPtr
lsn
,
XLogRecord
*
record
)
{
elog
(
STOP
,
"hash_undo: unimplemented"
);
}
void
hash_desc
(
char
*
buf
,
uint8
xl_info
,
char
*
rec
)
{
}
#endif
src/backend/access/heap/heapam.c
View file @
a7fcadd1
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.
89 2000/10/20 11:01:02
vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.
90 2000/10/21 15:43:14
vadim Exp $
*
*
*
*
* INTERFACE ROUTINES
* INTERFACE ROUTINES
...
@@ -86,12 +86,14 @@
...
@@ -86,12 +86,14 @@
#include "utils/inval.h"
#include "utils/inval.h"
#include "utils/relcache.h"
#include "utils/relcache.h"
#ifdef XLOG
/* comments are in heap_update */
#ifdef XLOG
#include "access/xlogutils.h"
#include "access/xlogutils.h"
void
heap_redo
(
XLogRecPtr
lsn
,
XLogRecord
*
record
);
void
heap_redo
(
XLogRecPtr
lsn
,
XLogRecord
*
record
);
void
heap_undo
(
XLogRecPtr
lsn
,
XLogRecord
*
record
);
void
heap_undo
(
XLogRecPtr
lsn
,
XLogRecord
*
record
);
void
heap_desc
(
char
*
buf
,
uint8
xl_info
,
char
*
rec
);
/* comments are in heap_update */
static
xl_heaptid
_locked_tuple_
;
static
xl_heaptid
_locked_tuple_
;
static
void
_heap_unlock_tuple
(
void
*
data
);
static
void
_heap_unlock_tuple
(
void
*
data
);
...
@@ -2480,4 +2482,53 @@ HeapPageCleanup(Buffer buffer)
...
@@ -2480,4 +2482,53 @@ HeapPageCleanup(Buffer buffer)
PageRepairFragmentation
(
page
);
PageRepairFragmentation
(
page
);
}
}
static
void
out_target
(
char
*
buf
,
xl_heaptid
*
target
)
{
sprintf
(
buf
+
strlen
(
buf
),
"node %u/%u; cid %u; tid %u/%u"
,
target
->
node
.
tblNode
,
target
->
node
.
relNode
,
target
->
cid
,
ItemPointerGetBlockNumber
(
&
(
target
->
tid
)),
ItemPointerGetOffsetNumber
(
&
(
target
->
tid
)));
}
void
heap_desc
(
char
*
buf
,
uint8
xl_info
,
char
*
rec
)
{
uint8
info
=
xl_info
&
~
XLR_INFO_MASK
;
if
(
info
==
XLOG_HEAP_INSERT
)
{
xl_heap_insert
*
xlrec
=
(
xl_heap_insert
*
)
rec
;
strcat
(
buf
,
"insert: "
);
out_target
(
buf
,
&
(
xlrec
->
target
));
}
else
if
(
info
==
XLOG_HEAP_DELETE
)
{
xl_heap_delete
*
xlrec
=
(
xl_heap_delete
*
)
rec
;
strcat
(
buf
,
"delete: "
);
out_target
(
buf
,
&
(
xlrec
->
target
));
}
else
if
(
info
==
XLOG_HEAP_UPDATE
)
{
xl_heap_update
*
xlrec
=
(
xl_heap_update
*
)
rec
;
strcat
(
buf
,
"update: "
);
out_target
(
buf
,
&
(
xlrec
->
target
));
sprintf
(
buf
+
strlen
(
buf
),
"; new %u/%u"
,
ItemPointerGetBlockNumber
(
&
(
xlrec
->
newtid
)),
ItemPointerGetOffsetNumber
(
&
(
xlrec
->
newtid
)));
}
else
if
(
info
==
XLOG_HEAP_MOVE
)
{
xl_heap_move
*
xlrec
=
(
xl_heap_move
*
)
rec
;
strcat
(
buf
,
"move: "
);
out_target
(
buf
,
&
(
xlrec
->
target
));
sprintf
(
buf
+
strlen
(
buf
),
"; new %u/%u"
,
ItemPointerGetBlockNumber
(
&
(
xlrec
->
newtid
)),
ItemPointerGetOffsetNumber
(
&
(
xlrec
->
newtid
)));
}
else
strcat
(
buf
,
"UNKNOWN"
);
}
#endif
/* XLOG */
#endif
/* XLOG */
src/backend/access/nbtree/nbtinsert.c
View file @
a7fcadd1
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.6
6 2000/10/13 12:05:20
vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.6
7 2000/10/21 15:43:18
vadim Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -527,12 +527,13 @@ _bt_insertonpg(Relation rel,
...
@@ -527,12 +527,13 @@ _bt_insertonpg(Relation rel,
{
{
char
xlbuf
[
sizeof
(
xl_btree_insert
)
+
char
xlbuf
[
sizeof
(
xl_btree_insert
)
+
sizeof
(
CommandId
)
+
sizeof
(
RelFileNode
)];
sizeof
(
CommandId
)
+
sizeof
(
RelFileNode
)];
xl_btree_insert
*
xlrec
=
xlbuf
;
xl_btree_insert
*
xlrec
=
(
xl_btree_insert
*
)
xlbuf
;
int
hsize
=
SizeOfBtreeInsert
;
int
hsize
=
SizeOfBtreeInsert
;
BTItemData
truncitem
;
BTItemData
truncitem
;
BTItem
xlitem
=
btitem
;
BTItem
xlitem
=
btitem
;
Size
xlsize
=
IndexTupleDSize
(
btitem
->
bti_itup
)
+
Size
xlsize
=
IndexTupleDSize
(
btitem
->
bti_itup
)
+
(
sizeof
(
BTItemData
)
-
sizeof
(
IndexTupleData
));
(
sizeof
(
BTItemData
)
-
sizeof
(
IndexTupleData
));
XLogRecPtr
recptr
;
xlrec
->
target
.
node
=
rel
->
rd_node
;
xlrec
->
target
.
node
=
rel
->
rd_node
;
ItemPointerSet
(
&
(
xlrec
->
target
.
tid
),
BufferGetBlockNumber
(
buf
),
newitemoff
);
ItemPointerSet
(
&
(
xlrec
->
target
.
tid
),
BufferGetBlockNumber
(
buf
),
newitemoff
);
...
@@ -555,7 +556,7 @@ _bt_insertonpg(Relation rel,
...
@@ -555,7 +556,7 @@ _bt_insertonpg(Relation rel,
xlsize
=
sizeof
(
BTItemData
);
xlsize
=
sizeof
(
BTItemData
);
}
}
XLogRecPtr
recptr
=
XLogInsert
(
RM_BTREE_ID
,
XLOG_BTREE_INSERT
,
recptr
=
XLogInsert
(
RM_BTREE_ID
,
XLOG_BTREE_INSERT
,
xlbuf
,
hsize
,
(
char
*
)
xlitem
,
xlsize
);
xlbuf
,
hsize
,
(
char
*
)
xlitem
,
xlsize
);
PageSetLSN
(
page
,
recptr
);
PageSetLSN
(
page
,
recptr
);
...
@@ -785,17 +786,19 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright,
...
@@ -785,17 +786,19 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright,
{
{
char
xlbuf
[
sizeof
(
xl_btree_split
)
+
char
xlbuf
[
sizeof
(
xl_btree_split
)
+
sizeof
(
CommandId
)
+
sizeof
(
RelFileNode
)
+
BLCKSZ
];
sizeof
(
CommandId
)
+
sizeof
(
RelFileNode
)
+
BLCKSZ
];
xl_btree_split
*
xlrec
=
xlbuf
;
xl_btree_split
*
xlrec
=
(
xl_btree_split
*
)
xlbuf
;
int
hsize
=
SizeOfBtreeSplit
;
int
hsize
=
SizeOfBtreeSplit
;
int
flag
=
(
newitemonleft
)
?
int
flag
=
(
newitemonleft
)
?
XLOG_BTREE_SPLEFT
:
XLOG_BTREE_SPLIT
;
XLOG_BTREE_SPLEFT
:
XLOG_BTREE_SPLIT
;
BlockNumber
blkno
;
XLogRecPtr
recptr
;
xlrec
->
target
.
node
=
rel
->
rd_node
;
xlrec
->
target
.
node
=
rel
->
rd_node
;
ItemPointerSet
(
&
(
xlrec
->
target
.
tid
),
itup_blkno
,
itup_off
);
ItemPointerSet
(
&
(
xlrec
->
target
.
tid
),
*
itup_blkno
,
*
itup_off
);
if
(
P_ISLEAF
(
lopaque
))
if
(
P_ISLEAF
(
lopaque
))
{
{
CommandId
cid
=
GetCurrentCommandId
();
CommandId
cid
=
GetCurrentCommandId
();
memcpy
(
xlbuf
+
hsize
,
&
(
char
*
)
cid
,
sizeof
(
CommandId
));
memcpy
(
xlbuf
+
hsize
,
&
cid
,
sizeof
(
CommandId
));
hsize
+=
sizeof
(
CommandId
);
hsize
+=
sizeof
(
CommandId
);
memcpy
(
xlbuf
+
hsize
,
&
(
_xlheapRel
->
rd_node
),
sizeof
(
RelFileNode
));
memcpy
(
xlbuf
+
hsize
,
&
(
_xlheapRel
->
rd_node
),
sizeof
(
RelFileNode
));
hsize
+=
sizeof
(
RelFileNode
);
hsize
+=
sizeof
(
RelFileNode
);
...
@@ -814,7 +817,7 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright,
...
@@ -814,7 +817,7 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright,
* Actually, seems that in non-leaf splits newitem shouldn't
* Actually, seems that in non-leaf splits newitem shouldn't
* go to first data key position on left page.
* go to first data key position on left page.
*/
*/
if
(
!
P_ISLEAF
(
lopaque
)
&&
itup_off
==
P_FIRSTDATAKEY
(
lopaque
))
if
(
!
P_ISLEAF
(
lopaque
)
&&
*
itup_off
==
P_FIRSTDATAKEY
(
lopaque
))
{
{
BTItemData
truncitem
=
*
newitem
;
BTItemData
truncitem
=
*
newitem
;
truncitem
.
bti_itup
.
t_info
=
sizeof
(
BTItemData
);
truncitem
.
bti_itup
.
t_info
=
sizeof
(
BTItemData
);
...
@@ -828,20 +831,24 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright,
...
@@ -828,20 +831,24 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright,
memcpy
(
xlbuf
+
hsize
,
(
char
*
)
newitem
,
itemsz
);
memcpy
(
xlbuf
+
hsize
,
(
char
*
)
newitem
,
itemsz
);
hsize
+=
itemsz
;
hsize
+=
itemsz
;
}
}
xlrec
->
otherblk
=
BufferGetBlockNumber
(
rbuf
);
blkno
=
BufferGetBlockNumber
(
rbuf
);
BlockIdSet
(
&
(
xlrec
->
otherblk
),
blkno
);
}
}
else
else
xlrec
->
otherblk
=
BufferGetBlockNumber
(
buf
);
{
blkno
=
BufferGetBlockNumber
(
buf
);
BlockIdSet
(
&
(
xlrec
->
otherblk
),
blkno
);
}
xlrec
->
rightblk
=
ropaque
->
btpo_next
;
BlockIdSet
(
&
(
xlrec
->
rightblk
),
ropaque
->
btpo_next
)
;
/*
/*
* Dirrect access to page is not good but faster - we should
* Dirrect access to page is not good but faster - we should
* implement some new func in page API.
* implement some new func in page API.
*/
*/
XLogRecPtr
recptr
=
XLogInsert
(
RM_BTREE_ID
,
flag
,
xlbuf
,
recptr
=
XLogInsert
(
RM_BTREE_ID
,
flag
,
xlbuf
,
hsize
,
(
char
*
)
rightpage
+
(
PageHeader
)
rightpage
)
->
pd_upper
,
hsize
,
(
char
*
)
rightpage
+
(
(
PageHeader
)
rightpage
)
->
pd_upper
,
((
PageHeader
)
rightpage
)
->
pd_special
-
((
PageHeader
)
rightpage
)
->
upper
);
((
PageHeader
)
rightpage
)
->
pd_special
-
((
PageHeader
)
rightpage
)
->
pd_
upper
);
PageSetLSN
(
leftpage
,
recptr
);
PageSetLSN
(
leftpage
,
recptr
);
PageSetSUI
(
leftpage
,
ThisStartUpID
);
PageSetSUI
(
leftpage
,
ThisStartUpID
);
...
@@ -1070,7 +1077,7 @@ static Buffer
...
@@ -1070,7 +1077,7 @@ static Buffer
_bt_getstackbuf
(
Relation
rel
,
BTStack
stack
)
_bt_getstackbuf
(
Relation
rel
,
BTStack
stack
)
{
{
BlockNumber
blkno
;
BlockNumber
blkno
;
Buffer
buf
,
newbuf
;
Buffer
buf
;
OffsetNumber
start
,
OffsetNumber
start
,
offnum
,
offnum
,
maxoff
;
maxoff
;
...
@@ -1236,6 +1243,7 @@ _bt_newroot(Relation rel, Buffer lbuf, Buffer rbuf)
...
@@ -1236,6 +1243,7 @@ _bt_newroot(Relation rel, Buffer lbuf, Buffer rbuf)
xl_btree_newroot
xlrec
;
xl_btree_newroot
xlrec
;
Page
metapg
=
BufferGetPage
(
metabuf
);
Page
metapg
=
BufferGetPage
(
metabuf
);
BTMetaPageData
*
metad
=
BTPageGetMeta
(
metapg
);
BTMetaPageData
*
metad
=
BTPageGetMeta
(
metapg
);
XLogRecPtr
recptr
;
xlrec
.
node
=
rel
->
rd_node
;
xlrec
.
node
=
rel
->
rd_node
;
BlockIdSet
(
&
(
xlrec
.
rootblk
),
rootblknum
);
BlockIdSet
(
&
(
xlrec
.
rootblk
),
rootblknum
);
...
@@ -1244,10 +1252,10 @@ _bt_newroot(Relation rel, Buffer lbuf, Buffer rbuf)
...
@@ -1244,10 +1252,10 @@ _bt_newroot(Relation rel, Buffer lbuf, Buffer rbuf)
* Dirrect access to page is not good but faster - we should
* Dirrect access to page is not good but faster - we should
* implement some new func in page API.
* implement some new func in page API.
*/
*/
XLogRecPtr
recptr
=
XLogInsert
(
RM_BTREE_ID
,
XLOG_BTREE_NEWROOT
,
recptr
=
XLogInsert
(
RM_BTREE_ID
,
XLOG_BTREE_NEWROOT
,
&
xlrec
,
SizeOfBtreeNewroot
,
(
char
*
)
&
xlrec
,
SizeOfBtreeNewroot
,
(
char
*
)
rootpage
+
(
PageHeader
)
rootpage
)
->
pd_upper
,
(
char
*
)
rootpage
+
(
(
PageHeader
)
rootpage
)
->
pd_upper
,
((
PageHeader
)
rootpage
)
->
pd_special
-
((
PageHeader
)
rootpage
)
->
upper
);
((
PageHeader
)
rootpage
)
->
pd_special
-
((
PageHeader
)
rootpage
)
->
pd_
upper
);
metad
->
btm_root
=
rootblknum
;
metad
->
btm_root
=
rootblknum
;
(
metad
->
btm_level
)
++
;
(
metad
->
btm_level
)
++
;
...
...
src/backend/access/nbtree/nbtpage.c
View file @
a7fcadd1
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtpage.c,v 1.
39 2000/10/13 02:03:00
vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtpage.c,v 1.
40 2000/10/21 15:43:18
vadim Exp $
*
*
* NOTES
* NOTES
* Postgres btree pages look like ordinary relation pages. The opaque
* Postgres btree pages look like ordinary relation pages. The opaque
...
@@ -171,13 +171,14 @@ _bt_getroot(Relation rel, int access)
...
@@ -171,13 +171,14 @@ _bt_getroot(Relation rel, int access)
#ifdef XLOG
#ifdef XLOG
/* XLOG stuff */
/* XLOG stuff */
{
{
xl_btree_newroot
xlrec
;
xl_btree_newroot
xlrec
;
XLogRecPtr
recptr
;
xlrec
.
node
=
rel
->
rd_node
;
xlrec
.
node
=
rel
->
rd_node
;
BlockIdSet
(
&
(
xlrec
.
rootblk
),
rootblkno
);
BlockIdSet
(
&
(
xlrec
.
rootblk
),
rootblkno
);
XLogRecPtr
recptr
=
XLogInsert
(
RM_BTREE_ID
,
XLOG_BTREE_NEWROOT
,
recptr
=
XLogInsert
(
RM_BTREE_ID
,
XLOG_BTREE_NEWROOT
,
&
xlrec
,
SizeOfBtreeNewroot
,
NULL
,
0
);
(
char
*
)
&
xlrec
,
SizeOfBtreeNewroot
,
NULL
,
0
);
PageSetLSN
(
rootpage
,
recptr
);
PageSetLSN
(
rootpage
,
recptr
);
PageSetSUI
(
rootpage
,
ThisStartUpID
);
PageSetSUI
(
rootpage
,
ThisStartUpID
);
...
@@ -404,10 +405,12 @@ _bt_pagedel(Relation rel, ItemPointer tid)
...
@@ -404,10 +405,12 @@ _bt_pagedel(Relation rel, ItemPointer tid)
/* XLOG stuff */
/* XLOG stuff */
{
{
xl_btree_delete
xlrec
;
xl_btree_delete
xlrec
;
XLogRecPtr
recptr
;
xlrec
.
target
.
node
=
rel
->
rd_node
;
xlrec
.
target
.
node
=
rel
->
rd_node
;
xlrec
.
target
.
tid
=
*
tid
;
xlrec
.
target
.
tid
=
*
tid
;
XLogRecPtr
recptr
=
XLogInsert
(
RM_BTREE_ID
,
XLOG_BTREE_DELETE
,
recptr
=
XLogInsert
(
RM_BTREE_ID
,
XLOG_BTREE_DELETE
,
(
char
*
)
xlrec
,
SizeOfBtreeDelete
,
NULL
,
0
);
(
char
*
)
&
xlrec
,
SizeOfBtreeDelete
,
NULL
,
0
);
PageSetLSN
(
page
,
recptr
);
PageSetLSN
(
page
,
recptr
);
PageSetSUI
(
page
,
ThisStartUpID
);
PageSetSUI
(
page
,
ThisStartUpID
);
...
...
src/backend/access/nbtree/nbtree.c
View file @
a7fcadd1
This diff is collapsed.
Click to expand it.
src/backend/access/rtree/rtree.c
View file @
a7fcadd1
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtree.c,v 1.5
3 2000/07/30 20:43:40 tgl
Exp $
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtree.c,v 1.5
4 2000/10/21 15:43:20 vadim
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -22,6 +22,12 @@
...
@@ -22,6 +22,12 @@
#include "executor/executor.h"
#include "executor/executor.h"
#include "miscadmin.h"
#include "miscadmin.h"
#ifdef XLOG
#include "access/xlogutils.h"
void
rtree_redo
(
XLogRecPtr
lsn
,
XLogRecord
*
record
);
void
rtree_undo
(
XLogRecPtr
lsn
,
XLogRecord
*
record
);
void
rtree_desc
(
char
*
buf
,
uint8
xl_info
,
char
*
rec
);
#endif
typedef
struct
SPLITVEC
typedef
struct
SPLITVEC
{
{
...
@@ -1066,3 +1072,22 @@ _rtdump(Relation r)
...
@@ -1066,3 +1072,22 @@ _rtdump(Relation r)
}
}
#endif
/* defined RTDEBUG */
#endif
/* defined RTDEBUG */
#ifdef XLOG
void
rtree_redo
(
XLogRecPtr
lsn
,
XLogRecord
*
record
)
{
elog
(
STOP
,
"rtree_redo: unimplemented"
);
}
void
rtree_undo
(
XLogRecPtr
lsn
,
XLogRecord
*
record
)
{
elog
(
STOP
,
"rtree_undo: unimplemented"
);
}
void
rtree_desc
(
char
*
buf
,
uint8
xl_info
,
char
*
rec
)
{
}
#endif
src/backend/access/transam/rmgr.c
View file @
a7fcadd1
#include "postgres.h"
#include "postgres.h"
#include "access/
rmgr
.h"
#include "access/
xlog
.h"
RmgrData
*
RmgrTable
=
NULL
;
#ifdef XLOG
extern
void
xlog_redo
(
XLogRecPtr
lsn
,
XLogRecord
*
rptr
);
extern
void
xlog_undo
(
XLogRecPtr
lsn
,
XLogRecord
*
rptr
);
extern
void
xlog_desc
(
char
*
buf
,
uint8
xl_info
,
char
*
rec
);
extern
void
xact_redo
(
XLogRecPtr
lsn
,
XLogRecord
*
rptr
);
extern
void
xact_undo
(
XLogRecPtr
lsn
,
XLogRecord
*
rptr
);
extern
void
xact_desc
(
char
*
buf
,
uint8
xl_info
,
char
*
rec
);
extern
void
smgr_redo
(
XLogRecPtr
lsn
,
XLogRecord
*
rptr
);
extern
void
smgr_undo
(
XLogRecPtr
lsn
,
XLogRecord
*
rptr
);
extern
void
smgr_desc
(
char
*
buf
,
uint8
xl_info
,
char
*
rec
);
extern
void
heap_redo
(
XLogRecPtr
lsn
,
XLogRecord
*
rptr
);
extern
void
heap_undo
(
XLogRecPtr
lsn
,
XLogRecord
*
rptr
);
extern
void
heap_desc
(
char
*
buf
,
uint8
xl_info
,
char
*
rec
);
extern
void
btree_redo
(
XLogRecPtr
lsn
,
XLogRecord
*
rptr
);
extern
void
btree_undo
(
XLogRecPtr
lsn
,
XLogRecord
*
rptr
);
extern
void
btree_desc
(
char
*
buf
,
uint8
xl_info
,
char
*
rec
);
extern
void
hash_redo
(
XLogRecPtr
lsn
,
XLogRecord
*
rptr
);
extern
void
hash_undo
(
XLogRecPtr
lsn
,
XLogRecord
*
rptr
);
extern
void
hash_desc
(
char
*
buf
,
uint8
xl_info
,
char
*
rec
);
extern
void
rtree_redo
(
XLogRecPtr
lsn
,
XLogRecord
*
rptr
);
extern
void
rtree_undo
(
XLogRecPtr
lsn
,
XLogRecord
*
rptr
);
extern
void
rtree_desc
(
char
*
buf
,
uint8
xl_info
,
char
*
rec
);
extern
void
gist_redo
(
XLogRecPtr
lsn
,
XLogRecord
*
rptr
);
extern
void
gist_undo
(
XLogRecPtr
lsn
,
XLogRecord
*
rptr
);
extern
void
gist_desc
(
char
*
buf
,
uint8
xl_info
,
char
*
rec
);
RmgrData
RmgrTable
[]
=
{
{
"XLOG"
,
xlog_redo
,
xlog_undo
,
xlog_desc
},
{
"Transaction"
,
xact_redo
,
xact_undo
,
xact_desc
},
{
"Storage"
,
smgr_redo
,
smgr_undo
,
smgr_desc
},
{
"Reserved 3"
,
NULL
,
NULL
,
NULL
},
{
"Reserved 4"
,
NULL
,
NULL
,
NULL
},
{
"Reserved 5"
,
NULL
,
NULL
,
NULL
},
{
"Reserved 6"
,
NULL
,
NULL
,
NULL
},
{
"Reserved 7"
,
NULL
,
NULL
,
NULL
},
{
"Reserved 8"
,
NULL
,
NULL
,
NULL
},
{
"Reserved 9"
,
NULL
,
NULL
,
NULL
},
{
"Heap"
,
heap_redo
,
heap_undo
,
heap_desc
},
{
"Btree"
,
btree_redo
,
btree_undo
,
btree_desc
},
{
"Hash"
,
hash_redo
,
hash_undo
,
hash_desc
},
{
"Rtree"
,
rtree_redo
,
rtree_undo
,
rtree_desc
},
{
"Gist"
,
gist_redo
,
gist_undo
,
gist_desc
}
};
#else
RmgrData
RmgrTable
[]
=
{};
#endif
src/backend/access/transam/xact.c
View file @
a7fcadd1
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.7
3 2000/10/20 11:01:04
vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.7
4 2000/10/21 15:43:22
vadim Exp $
*
*
* NOTES
* NOTES
* Transaction aborts can now occur two ways:
* Transaction aborts can now occur two ways:
...
@@ -224,6 +224,7 @@ int CommitDelay;
...
@@ -224,6 +224,7 @@ int CommitDelay;
void
xact_redo
(
XLogRecPtr
lsn
,
XLogRecord
*
record
);
void
xact_redo
(
XLogRecPtr
lsn
,
XLogRecord
*
record
);
void
xact_undo
(
XLogRecPtr
lsn
,
XLogRecord
*
record
);
void
xact_undo
(
XLogRecPtr
lsn
,
XLogRecord
*
record
);
void
xact_desc
(
char
*
buf
,
uint8
xl_info
,
char
*
rec
);
static
void
(
*
_RollbackFunc
)(
void
*
)
=
NULL
;
static
void
(
*
_RollbackFunc
)(
void
*
)
=
NULL
;
static
void
*
_RollbackData
=
NULL
;
static
void
*
_RollbackData
=
NULL
;
...
@@ -692,6 +693,7 @@ RecordTransactionCommit()
...
@@ -692,6 +693,7 @@ RecordTransactionCommit()
TransactionIdCommit
(
xid
);
TransactionIdCommit
(
xid
);
#ifdef XLOG
#ifdef XLOG
if
(
MyLastRecPtr
.
xlogid
!=
0
||
MyLastRecPtr
.
xrecoff
!=
0
)
{
{
xl_xact_commit
xlrec
;
xl_xact_commit
xlrec
;
struct
timeval
delay
;
struct
timeval
delay
;
...
@@ -711,6 +713,9 @@ RecordTransactionCommit()
...
@@ -711,6 +713,9 @@ RecordTransactionCommit()
delay
.
tv_sec
=
0
;
delay
.
tv_sec
=
0
;
delay
.
tv_usec
=
CommitDelay
;
delay
.
tv_usec
=
CommitDelay
;
(
void
)
select
(
0
,
NULL
,
NULL
,
NULL
,
&
delay
);
(
void
)
select
(
0
,
NULL
,
NULL
,
NULL
,
&
delay
);
XLogFlush
(
recptr
);
MyLastRecPtr
.
xlogid
=
0
;
MyLastRecPtr
.
xrecoff
=
0
;
}
}
#endif
#endif
/*
/*
...
@@ -823,7 +828,7 @@ RecordTransactionAbort()
...
@@ -823,7 +828,7 @@ RecordTransactionAbort()
TransactionIdAbort
(
xid
);
TransactionIdAbort
(
xid
);
#ifdef XLOG
#ifdef XLOG
if
(
SharedBufferChanged
)
if
(
MyLastRecPtr
.
xlogid
!=
0
||
MyLastRecPtr
.
xrecoff
!=
0
)
{
{
xl_xact_abort
xlrec
;
xl_xact_abort
xlrec
;
XLogRecPtr
recptr
;
XLogRecPtr
recptr
;
...
@@ -1176,6 +1181,8 @@ AbortTransaction()
...
@@ -1176,6 +1181,8 @@ AbortTransaction()
AtEOXact_Files
();
AtEOXact_Files
();
/* Here we'll rollback xaction changes */
/* Here we'll rollback xaction changes */
MyLastRecPtr
.
xlogid
=
0
;
MyLastRecPtr
.
xrecoff
=
0
;
AtAbort_Locks
();
AtAbort_Locks
();
...
@@ -1748,6 +1755,33 @@ xact_undo(XLogRecPtr lsn, XLogRecord *record)
...
@@ -1748,6 +1755,33 @@ xact_undo(XLogRecPtr lsn, XLogRecord *record)
else
if
(
info
!=
XLOG_XACT_ABORT
)
else
if
(
info
!=
XLOG_XACT_ABORT
)
elog
(
STOP
,
"xact_redo: unknown op code %u"
,
info
);
elog
(
STOP
,
"xact_redo: unknown op code %u"
,
info
);
}
}
void
xact_desc
(
char
*
buf
,
uint8
xl_info
,
char
*
rec
)
{
uint8
info
=
xl_info
&
~
XLR_INFO_MASK
;
if
(
info
==
XLOG_XACT_COMMIT
)
{
xl_xact_commit
*
xlrec
=
(
xl_xact_commit
*
)
rec
;
struct
tm
*
tm
=
localtime
(
&
xlrec
->
xtime
);
sprintf
(
buf
+
strlen
(
buf
),
"commit: %04u-%02u-%02u %02u:%02u:%02u"
,
tm
->
tm_year
+
1900
,
tm
->
tm_mon
+
1
,
tm
->
tm_mday
,
tm
->
tm_hour
,
tm
->
tm_min
,
tm
->
tm_sec
);
}
else
if
(
info
==
XLOG_XACT_ABORT
)
{
xl_xact_abort
*
xlrec
=
(
xl_xact_abort
*
)
rec
;
struct
tm
*
tm
=
localtime
(
&
xlrec
->
xtime
);
sprintf
(
buf
+
strlen
(
buf
),
"abort: %04u-%02u-%02u %02u:%02u:%02u"
,
tm
->
tm_year
+
1900
,
tm
->
tm_mon
+
1
,
tm
->
tm_mday
,
tm
->
tm_hour
,
tm
->
tm_min
,
tm
->
tm_sec
);
}
else
strcat
(
buf
,
"UNKNOWN"
);
}
void
void
XactPushRollback
(
void
(
*
func
)
(
void
*
),
void
*
data
)
XactPushRollback
(
void
(
*
func
)
(
void
*
),
void
*
data
)
...
...
src/backend/access/transam/xlog.c
View file @
a7fcadd1
This diff is collapsed.
Click to expand it.
src/backend/access/transam/xlogutils.c
View file @
a7fcadd1
...
@@ -276,6 +276,9 @@ _xl_init_rel_cache(void)
...
@@ -276,6 +276,9 @@ _xl_init_rel_cache(void)
_xlpgcarr
=
(
Form_pg_class
)
malloc
(
sizeof
(
FormData_pg_class
)
*
_xlcnt
);
_xlpgcarr
=
(
Form_pg_class
)
malloc
(
sizeof
(
FormData_pg_class
)
*
_xlcnt
);
memset
(
_xlpgcarr
,
0
,
sizeof
(
XLogRelDesc
)
*
_xlcnt
);
memset
(
_xlpgcarr
,
0
,
sizeof
(
XLogRelDesc
)
*
_xlcnt
);
_xlrelarr
[
0
].
moreRecently
=
&
(
_xlrelarr
[
0
]);
_xlrelarr
[
0
].
lessRecently
=
&
(
_xlrelarr
[
0
]);
memset
(
&
ctl
,
0
,
(
int
)
sizeof
(
ctl
));
memset
(
&
ctl
,
0
,
(
int
)
sizeof
(
ctl
));
ctl
.
keysize
=
sizeof
(
RelFileNode
);
ctl
.
keysize
=
sizeof
(
RelFileNode
);
ctl
.
datasize
=
sizeof
(
XLogRelDesc
*
);
ctl
.
datasize
=
sizeof
(
XLogRelDesc
*
);
...
@@ -383,6 +386,7 @@ XLogOpenRelation(bool redo, RmgrId rmid, RelFileNode rnode)
...
@@ -383,6 +386,7 @@ XLogOpenRelation(bool redo, RmgrId rmid, RelFileNode rnode)
hentry
->
rdesc
=
res
;
hentry
->
rdesc
=
res
;
res
->
reldata
.
rd_unlinked
=
true
;
/* look smgropen */
res
->
reldata
.
rd_unlinked
=
true
;
/* look smgropen */
res
->
reldata
.
rd_fd
=
-
1
;
res
->
reldata
.
rd_fd
=
smgropen
(
DEFAULT_SMGR
,
&
(
res
->
reldata
));
res
->
reldata
.
rd_fd
=
smgropen
(
DEFAULT_SMGR
,
&
(
res
->
reldata
));
}
}
...
...
src/backend/bootstrap/bootstrap.c
View file @
a7fcadd1
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.9
3 2000/09/06 14:15:14 petere
Exp $
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.9
4 2000/10/21 15:43:24 vadim
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -345,6 +345,7 @@ BootstrapMain(int argc, char *argv[])
...
@@ -345,6 +345,7 @@ BootstrapMain(int argc, char *argv[])
if
(
IsUnderPostmaster
&&
xloginit
)
if
(
IsUnderPostmaster
&&
xloginit
)
{
{
SetProcessingMode
(
NormalProcessing
);
StartupXLOG
();
StartupXLOG
();
proc_exit
(
0
);
proc_exit
(
0
);
}
}
...
@@ -360,6 +361,7 @@ BootstrapMain(int argc, char *argv[])
...
@@ -360,6 +361,7 @@ BootstrapMain(int argc, char *argv[])
if
(
IsUnderPostmaster
&&
!
xloginit
)
if
(
IsUnderPostmaster
&&
!
xloginit
)
{
{
SetProcessingMode
(
NormalProcessing
);
ShutdownXLOG
();
ShutdownXLOG
();
proc_exit
(
0
);
proc_exit
(
0
);
}
}
...
...
src/backend/postmaster/postmaster.c
View file @
a7fcadd1
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.17
2 2000/10/16 14:52:08
vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.17
3 2000/10/21 15:43:26
vadim Exp $
*
*
* NOTES
* NOTES
*
*
...
@@ -220,6 +220,10 @@ extern char *optarg;
...
@@ -220,6 +220,10 @@ extern char *optarg;
extern
int
optind
,
extern
int
optind
,
opterr
;
opterr
;
extern
char
XLogDir
[];
extern
char
ControlFilePath
[];
extern
void
SetThisStartUpID
(
void
);
/*
/*
* postmaster.c - function prototypes
* postmaster.c - function prototypes
*/
*/
...
@@ -600,6 +604,10 @@ PostmasterMain(int argc, char *argv[])
...
@@ -600,6 +604,10 @@ PostmasterMain(int argc, char *argv[])
/* set up shared memory and semaphores */
/* set up shared memory and semaphores */
reset_shared
(
PostPortName
);
reset_shared
(
PostPortName
);
/* Init XLOG pathes */
snprintf
(
XLogDir
,
MAXPGPATH
,
"%s/pg_xlog"
,
DataDir
);
snprintf
(
ControlFilePath
,
MAXPGPATH
,
"%s/global/pg_control"
,
DataDir
);
/*
/*
* Initialize the list of active backends. This list is only used for
* Initialize the list of active backends. This list is only used for
* garbage collecting the backend processes.
* garbage collecting the backend processes.
...
@@ -1449,6 +1457,12 @@ reaper(SIGNAL_ARGS)
...
@@ -1449,6 +1457,12 @@ reaper(SIGNAL_ARGS)
abort
();
abort
();
ShutdownPID
=
ShutdownDataBase
();
ShutdownPID
=
ShutdownDataBase
();
}
}
/*
* Startup succeeded - remember its ID
*/
SetThisStartUpID
();
pqsignal
(
SIGCHLD
,
reaper
);
pqsignal
(
SIGCHLD
,
reaper
);
return
;
return
;
}
}
...
...
src/backend/storage/buffer/bufmgr.c
View file @
a7fcadd1
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.8
8 2000/10/20 11:01:0
7 vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.8
9 2000/10/21 15:43:2
7 vadim Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -609,7 +609,7 @@ BufferAlloc(Relation reln,
...
@@ -609,7 +609,7 @@ BufferAlloc(Relation reln,
}
}
/* record the database name and relation name for this buffer */
/* record the database name and relation name for this buffer */
strcpy
(
buf
->
blind
.
dbname
,
DatabaseName
);
strcpy
(
buf
->
blind
.
dbname
,
(
DatabaseName
)
?
DatabaseName
:
"Recovery"
);
strcpy
(
buf
->
blind
.
relname
,
RelationGetPhysicalRelationName
(
reln
));
strcpy
(
buf
->
blind
.
relname
,
RelationGetPhysicalRelationName
(
reln
));
buf
->
relId
=
reln
->
rd_lockInfo
.
lockRelId
;
buf
->
relId
=
reln
->
rd_lockInfo
.
lockRelId
;
...
@@ -1168,8 +1168,9 @@ BufferSync()
...
@@ -1168,8 +1168,9 @@ BufferSync()
SpinRelease
(
BufMgrLock
);
SpinRelease
(
BufMgrLock
);
}
}
#ifndef XLOG
LocalBufferSync
();
LocalBufferSync
();
#endif
}
}
...
...
src/backend/storage/page/bufpage.c
View file @
a7fcadd1
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/page/bufpage.c,v 1.3
2 2000/10/20 11:28:3
9 vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/page/bufpage.c,v 1.3
3 2000/10/21 15:43:2
9 vadim Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -245,7 +245,11 @@ itemidcompare(const void *itemidp1, const void *itemidp2)
...
@@ -245,7 +245,11 @@ itemidcompare(const void *itemidp1, const void *itemidp2)
/*
/*
* PageRepairFragmentation
* PageRepairFragmentation
* Frees fragmented space on a page.
*
* Frees fragmented space on a page.
* It doesn't remove unused line pointers! Please don't change this.
* This routine is usable for heap pages only.
*
*/
*/
void
void
PageRepairFragmentation
(
Page
page
)
PageRepairFragmentation
(
Page
page
)
...
@@ -264,6 +268,8 @@ PageRepairFragmentation(Page page)
...
@@ -264,6 +268,8 @@ PageRepairFragmentation(Page page)
for
(
i
=
0
;
i
<
nline
;
i
++
)
for
(
i
=
0
;
i
<
nline
;
i
++
)
{
{
lp
=
((
PageHeader
)
page
)
->
pd_linp
+
i
;
lp
=
((
PageHeader
)
page
)
->
pd_linp
+
i
;
if
((
*
lp
).
lp_flags
&
LP_DELETE
)
/* marked for deletion */
(
*
lp
).
lp_flags
&=
~
(
LP_USED
|
LP_DELETE
);
if
((
*
lp
).
lp_flags
&
LP_USED
)
if
((
*
lp
).
lp_flags
&
LP_USED
)
nused
++
;
nused
++
;
}
}
...
@@ -343,6 +349,31 @@ PageGetFreeSpace(Page page)
...
@@ -343,6 +349,31 @@ PageGetFreeSpace(Page page)
return
space
;
return
space
;
}
}
/*
* PageRepairFragmentation un-useful for index page cleanup because
* of it doesn't remove line pointers. This routine could be more
* effective but ... no time -:)
*/
void
IndexPageCleanup
(
Buffer
buffer
)
{
Page
page
=
(
Page
)
BufferGetPage
(
buffer
);
ItemId
lp
;
OffsetNumber
maxoff
;
OffsetNumber
i
;
maxoff
=
PageGetMaxOffsetNumber
(
page
);
for
(
i
=
0
;
i
<
maxoff
;
i
++
)
{
lp
=
((
PageHeader
)
page
)
->
pd_linp
+
i
;
if
((
*
lp
).
lp_flags
&
LP_DELETE
)
/* marked for deletion */
{
PageIndexTupleDelete
(
page
,
i
+
1
);
maxoff
--
;
}
}
}
/*
/*
*----------------------------------------------------------------
*----------------------------------------------------------------
* PageIndexTupleDelete
* PageIndexTupleDelete
...
...
src/backend/storage/smgr/smgr.c
View file @
a7fcadd1
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/smgr/smgr.c,v 1.4
0 2000/10/16 14:52:12
vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/smgr/smgr.c,v 1.4
1 2000/10/21 15:43:31
vadim Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -539,3 +539,26 @@ smgriswo(int16 smgrno)
...
@@ -539,3 +539,26 @@ smgriswo(int16 smgrno)
}
}
#endif
#endif
#ifdef XLOG
#include "access/xlog.h"
void
smgr_redo
(
XLogRecPtr
lsn
,
XLogRecord
*
record
);
void
smgr_undo
(
XLogRecPtr
lsn
,
XLogRecord
*
record
);
void
smgr_desc
(
char
*
buf
,
uint8
xl_info
,
char
*
rec
);
void
smgr_redo
(
XLogRecPtr
lsn
,
XLogRecord
*
record
)
{
}
void
smgr_undo
(
XLogRecPtr
lsn
,
XLogRecord
*
record
)
{
}
void
smgr_desc
(
char
*
buf
,
uint8
xl_info
,
char
*
rec
)
{
}
#endif
src/include/access/nbtree.h
View file @
a7fcadd1
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* $Id: nbtree.h,v 1.4
5 2000/10/13 12:05:22
vadim Exp $
* $Id: nbtree.h,v 1.4
6 2000/10/21 15:43:33
vadim Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -266,9 +266,9 @@ typedef struct xl_btree_insert
...
@@ -266,9 +266,9 @@ typedef struct xl_btree_insert
typedef
struct
xl_btree_split
typedef
struct
xl_btree_split
{
{
xl_btreetid
target
;
/* inserted tuple id */
xl_btreetid
target
;
/* inserted tuple id */
BlockId
otherblk
;
/* second block participated in split: */
BlockId
Data
otherblk
;
/* second block participated in split: */
/* first one is stored in target' tid */
/* first one is stored in target' tid */
BlockId
rightblk
;
/* next right block */
BlockId
Data
rightblk
;
/* next right block */
/*
/*
* We log all btitems from the right sibling. If new btitem goes on
* We log all btitems from the right sibling. If new btitem goes on
* the left sibling then we log it too and it will be the first
* the left sibling then we log it too and it will be the first
...
@@ -277,7 +277,7 @@ typedef struct xl_btree_split
...
@@ -277,7 +277,7 @@ typedef struct xl_btree_split
*/
*/
}
xl_btree_split
;
}
xl_btree_split
;
#define SizeOfBtreeSplit (offsetof(xl_btree_
insert, rightblk) + sizeof(BlockId
))
#define SizeOfBtreeSplit (offsetof(xl_btree_
split, rightblk) + sizeof(BlockIdData
))
/*
/*
* New root log record.
* New root log record.
...
@@ -285,11 +285,11 @@ typedef struct xl_btree_split
...
@@ -285,11 +285,11 @@ typedef struct xl_btree_split
typedef
struct
xl_btree_newroot
typedef
struct
xl_btree_newroot
{
{
RelFileNode
node
;
RelFileNode
node
;
BlockId
rootblk
;
BlockId
Data
rootblk
;
/* 0 or 2 BTITEMS FOLLOW AT END OF STRUCT */
/* 0 or 2 BTITEMS FOLLOW AT END OF STRUCT */
}
xl_btree_newroot
;
}
xl_btree_newroot
;
#define SizeOfBtreeNewroot (offsetof(xl_btree_newroot, rootblk) + sizeof(BlockId))
#define SizeOfBtreeNewroot (offsetof(xl_btree_newroot, rootblk) + sizeof(BlockId
Data
))
/* end of XLOG stuff */
/* end of XLOG stuff */
...
...
src/include/access/rmgr.h
View file @
a7fcadd1
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
*
*
* rmgr.h
* rmgr.h
*
*
* Resource managers de
scription table
* Resource managers de
finition
*
*
*/
*/
#ifndef RMGR_H
#ifndef RMGR_H
...
@@ -10,15 +10,6 @@
...
@@ -10,15 +10,6 @@
typedef
uint8
RmgrId
;
typedef
uint8
RmgrId
;
typedef
struct
RmgrData
{
char
*
rm_name
;
void
(
*
rm_redo
)();
/* REDO(XLogRecPtr lsn, XLogRecord rptr) */
void
(
*
rm_undo
)();
/* UNDO(XLogRecPtr lsn, XLogRecord rptr) */
}
RmgrData
;
extern
RmgrData
*
RmgrTable
;
/*
/*
* Built-in resource managers
* Built-in resource managers
*/
*/
...
...
src/include/access/xlog.h
View file @
a7fcadd1
...
@@ -90,6 +90,17 @@ typedef XLogPageHeaderData *XLogPageHeader;
...
@@ -90,6 +90,17 @@ typedef XLogPageHeaderData *XLogPageHeader;
typedef
uint32
StartUpID
;
typedef
uint32
StartUpID
;
extern
StartUpID
ThisStartUpID
;
extern
StartUpID
ThisStartUpID
;
extern
bool
InRecovery
;
extern
bool
InRecovery
;
extern
XLogRecPtr
MyLastRecPtr
;
typedef
struct
RmgrData
{
char
*
rm_name
;
void
(
*
rm_redo
)(
XLogRecPtr
lsn
,
XLogRecord
*
rptr
);
void
(
*
rm_undo
)(
XLogRecPtr
lsn
,
XLogRecord
*
rptr
);
void
(
*
rm_desc
)(
char
*
buf
,
uint8
xl_info
,
char
*
rec
);
}
RmgrData
;
extern
RmgrData
RmgrTable
[];
extern
XLogRecPtr
XLogInsert
(
RmgrId
rmid
,
uint8
info
,
extern
XLogRecPtr
XLogInsert
(
RmgrId
rmid
,
uint8
info
,
char
*
hdr
,
uint32
hdrlen
,
char
*
hdr
,
uint32
hdrlen
,
...
...
src/include/storage/bufpage.h
View file @
a7fcadd1
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* $Id: bufpage.h,v 1.3
3 2000/10/20 11:01:21
vadim Exp $
* $Id: bufpage.h,v 1.3
4 2000/10/21 15:43:36
vadim Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -324,6 +324,7 @@ extern void PageRestoreTempPage(Page tempPage, Page oldPage);
...
@@ -324,6 +324,7 @@ extern void PageRestoreTempPage(Page tempPage, Page oldPage);
extern
void
PageRepairFragmentation
(
Page
page
);
extern
void
PageRepairFragmentation
(
Page
page
);
extern
Size
PageGetFreeSpace
(
Page
page
);
extern
Size
PageGetFreeSpace
(
Page
page
);
extern
void
PageIndexTupleDelete
(
Page
page
,
OffsetNumber
offset
);
extern
void
PageIndexTupleDelete
(
Page
page
,
OffsetNumber
offset
);
extern
void
IndexPageCleanup
(
Buffer
buffer
);
#endif
/* BUFPAGE_H */
#endif
/* BUFPAGE_H */
src/include/storage/itemid.h
View file @
a7fcadd1
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* $Id: itemid.h,v 1.1
3 2000/10/20 11:01:21
vadim Exp $
* $Id: itemid.h,v 1.1
4 2000/10/21 15:43:36
vadim Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -31,15 +31,11 @@ typedef ItemIdData *ItemId;
...
@@ -31,15 +31,11 @@ typedef ItemIdData *ItemId;
*/
*/
#define LP_USED 0x01
/* this line pointer is being used */
#define LP_USED 0x01
/* this line pointer is being used */
#ifdef XLOG
#define LP_DELETE 0x02
/* item is to be deleted */
#define LP_DELETE 0x02
/* item is to be deleted */
#define ItemIdDeleted(itemId) \
#define ItemIdDeleted(itemId) \
(((itemId)->lp_flags & LP_DELETE) != 0)
(((itemId)->lp_flags & LP_DELETE) != 0)
#endif
/*
/*
* This bit may be passed to PageAddItem together with
* This bit may be passed to PageAddItem together with
* LP_USED & LP_DELETED bits to specify overwrite mode
* LP_USED & LP_DELETED bits to specify overwrite mode
...
...
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