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
1d9819d6
Commit
1d9819d6
authored
Apr 03, 2001
by
Vadim B. Mikheev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Log sequence creation (to initialize magic number on recovery).
parent
5f5db804
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
3 deletions
+35
-3
src/backend/commands/sequence.c
src/backend/commands/sequence.c
+35
-3
No files found.
src/backend/commands/sequence.c
View file @
1d9819d6
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/sequence.c,v 1.5
2 2001/03/22 03:59:23 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/sequence.c,v 1.5
3 2001/04/03 21:58:00 vadim
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -181,9 +181,41 @@ DefineSequence(CreateSeqStmt *seq)
/* Now - form & insert sequence tuple */
tuple
=
heap_formtuple
(
tupDesc
,
value
,
null
);
heap_insert
(
rel
,
tuple
);
ReleaseBuffer
(
buf
);
if
(
WriteBuffer
(
buf
)
==
STATUS_ERROR
)
elog
(
ERROR
,
"DefineSequence: WriteBuffer failed"
);
/*
* After crash REDO of heap_insert above would re-init page and
* our magic number would be lost. We have to log sequence creation.
* This means two log records instead of one -:(
*/
START_CRIT_SECTION
();
{
xl_seq_rec
xlrec
;
XLogRecPtr
recptr
;
XLogRecData
rdata
[
2
];
Form_pg_sequence
newseq
=
(
Form_pg_sequence
)
GETSTRUCT
(
tuple
);
/* We do not log first nextval call, so "advance" sequence here */
newseq
->
is_called
=
't'
;
newseq
->
log_cnt
=
0
;
xlrec
.
node
=
rel
->
rd_node
;
rdata
[
0
].
buffer
=
InvalidBuffer
;
rdata
[
0
].
data
=
(
char
*
)
&
xlrec
;
rdata
[
0
].
len
=
sizeof
(
xl_seq_rec
);
rdata
[
0
].
next
=
&
(
rdata
[
1
]);
rdata
[
1
].
buffer
=
InvalidBuffer
;
rdata
[
1
].
data
=
(
char
*
)
tuple
->
t_data
;
rdata
[
1
].
len
=
tuple
->
t_len
;
rdata
[
1
].
next
=
NULL
;
recptr
=
XLogInsert
(
RM_SEQ_ID
,
XLOG_SEQ_LOG
|
XLOG_NO_TRAN
,
rdata
);
PageSetLSN
(
page
,
recptr
);
PageSetSUI
(
page
,
ThisStartUpID
);
}
END_CRIT_SECTION
();
heap_close
(
rel
,
AccessExclusiveLock
);
}
...
...
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