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
30928692
Commit
30928692
authored
Apr 05, 2001
by
Vadim B. Mikheev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
StartupXLOG(): initialize XLogCtl->Insert to new page if there is
no room for a record on last log page.
parent
495fe121
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
14 deletions
+44
-14
src/backend/access/transam/xlog.c
src/backend/access/transam/xlog.c
+44
-14
No files found.
src/backend/access/transam/xlog.c
View file @
30928692
...
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Header: /cvsroot/pgsql/src/backend/access/transam/xlog.c,v 1.6
3 2001/03/22 03:59:18 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/access/transam/xlog.c,v 1.6
4 2001/04/05 09:34:32 vadim
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -2440,23 +2440,53 @@ StartupXLOG(void)
openLogOff
=
0
;
ControlFile
->
logId
=
openLogId
;
ControlFile
->
logSeg
=
openLogSeg
+
1
;
XLogCtl
->
xlblocks
[
0
].
xlogid
=
openLogId
;
XLogCtl
->
xlblocks
[
0
].
xrecoff
=
((
EndOfLog
.
xrecoff
-
1
)
/
BLCKSZ
+
1
)
*
BLCKSZ
;
Insert
=
&
XLogCtl
->
Insert
;
Insert
->
PrevRecord
=
LastRec
;
/*
* Tricky point here: readBuf contains the *last* block that the
* LastRec record spans, not the one it starts in, which is what we
* want.
* If the next record will go to the new page
* then initialize for that one.
*/
Assert
(
readOff
==
(
XLogCtl
->
xlblocks
[
0
].
xrecoff
-
BLCKSZ
)
%
XLogSegSize
);
memcpy
((
char
*
)
Insert
->
currpage
,
readBuf
,
BLCKSZ
);
Insert
->
currpos
=
(
char
*
)
Insert
->
currpage
+
(
EndOfLog
.
xrecoff
+
BLCKSZ
-
XLogCtl
->
xlblocks
[
0
].
xrecoff
);
/* Make sure rest of page is zero */
memset
(
Insert
->
currpos
,
0
,
INSERT_FREESPACE
(
Insert
));
Insert
->
PrevRecord
=
LastRec
;
if
((
BLCKSZ
-
EndOfLog
.
xrecoff
%
BLCKSZ
)
<
SizeOfXLogRecord
)
EndOfLog
.
xrecoff
+=
(
BLCKSZ
-
EndOfLog
.
xrecoff
%
BLCKSZ
);
if
(
EndOfLog
.
xrecoff
%
BLCKSZ
==
0
)
{
if
(
EndOfLog
.
xrecoff
>=
XLogFileSize
)
{
XLogCtl
->
xlblocks
[
0
].
xlogid
=
EndOfLog
.
xlogid
+
1
;
XLogCtl
->
xlblocks
[
0
].
xrecoff
=
BLCKSZ
;
}
else
{
XLogCtl
->
xlblocks
[
0
].
xlogid
=
EndOfLog
.
xlogid
;
XLogCtl
->
xlblocks
[
0
].
xrecoff
=
EndOfLog
.
xrecoff
+
BLCKSZ
;
}
Insert
->
currpos
=
(
char
*
)
Insert
->
currpage
+
SizeOfXLogPHD
;
Insert
->
currpage
->
xlp_magic
=
XLOG_PAGE_MAGIC
;
if
(
InRecovery
)
Insert
->
currpage
->
xlp_sui
=
ThisStartUpID
;
else
Insert
->
currpage
->
xlp_sui
=
ThisStartUpID
+
1
;
}
else
{
XLogCtl
->
xlblocks
[
0
].
xlogid
=
openLogId
;
XLogCtl
->
xlblocks
[
0
].
xrecoff
=
((
EndOfLog
.
xrecoff
-
1
)
/
BLCKSZ
+
1
)
*
BLCKSZ
;
/*
* Tricky point here: readBuf contains the *last* block that the
* LastRec record spans, not the one it starts in, which is what we
* want.
*
* XXX - why would we want block LastRec starts in?
*/
Assert
(
readOff
==
(
XLogCtl
->
xlblocks
[
0
].
xrecoff
-
BLCKSZ
)
%
XLogSegSize
);
memcpy
((
char
*
)
Insert
->
currpage
,
readBuf
,
BLCKSZ
);
Insert
->
currpos
=
(
char
*
)
Insert
->
currpage
+
(
EndOfLog
.
xrecoff
+
BLCKSZ
-
XLogCtl
->
xlblocks
[
0
].
xrecoff
);
/* Make sure rest of page is zero */
memset
(
Insert
->
currpos
,
0
,
INSERT_FREESPACE
(
Insert
));
}
LogwrtResult
.
Write
=
LogwrtResult
.
Flush
=
EndOfLog
;
...
...
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