Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5c588be

Browse files
PITR can stop at a named restore point when recovery target = time
though must not update the last transaction timestamp.Plus comment and message cleanup for recent named restore point.Fujii Masao, minor changes by me
1 parent01ff8dd commit5c588be

File tree

1 file changed

+20
-10
lines changed
  • src/backend/access/transam

1 file changed

+20
-10
lines changed

‎src/backend/access/transam/xlog.c

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5228,7 +5228,7 @@ readRecoveryCommandFile(void)
52285228
if (strlen(recoveryTargetName) >=MAXFNAMELEN)
52295229
ereport(FATAL,
52305230
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
5231-
errmsg("recovery_target_name is too long")));
5231+
errmsg("recovery_target_name is too long (maximum %d characters)",MAXFNAMELEN-1)));
52325232

52335233
ereport(DEBUG2,
52345234
(errmsg("recovery_target_name = '%s'",
@@ -5448,7 +5448,7 @@ exitArchiveRecovery(TimeLineID endTLI, uint32 endLogId, uint32 endLogSeg)
54485448
* Returns TRUE if we are stopping, FALSE otherwise. On TRUE return,
54495449
* *includeThis is set TRUE if we should apply this record before stopping.
54505450
*
5451-
* We also track the timestamp of the latest applied COMMIT/ABORT/RESTORE POINT
5451+
* We also track the timestamp of the latest applied COMMIT/ABORT
54525452
* record in XLogCtl->recoveryLastXTime, for logging purposes.
54535453
* Also, some information is saved in recoveryStopXid et al for use in
54545454
* annotating the new timeline's history file.
@@ -5493,14 +5493,19 @@ recoveryStopsHere(XLogRecord *record, bool *includeThis)
54935493
/* Do we have a PITR target at all? */
54945494
if (recoveryTarget==RECOVERY_TARGET_UNSET)
54955495
{
5496-
SetLatestXTime(recordXtime);
5496+
/*
5497+
* Save timestamp of latest transaction commit/abort if this is
5498+
* a transaction record
5499+
*/
5500+
if (record->xl_rmid==RM_XACT_ID)
5501+
SetLatestXTime(recordXtime);
54975502
return false;
54985503
}
54995504

55005505
if (recoveryTarget==RECOVERY_TARGET_XID)
55015506
{
55025507
/*
5503-
*there can be only one transaction end record with this exact
5508+
*There can be only one transaction end record with this exact
55045509
* transactionid
55055510
*
55065511
* when testing for an xid, we MUST test for equality only, since
@@ -5515,21 +5520,21 @@ recoveryStopsHere(XLogRecord *record, bool *includeThis)
55155520
elseif (recoveryTarget==RECOVERY_TARGET_NAME)
55165521
{
55175522
/*
5518-
*there can be many restore points that share the same name, so we stop
5523+
*There can be many restore points that share the same name, so we stop
55195524
* at the first one
55205525
*/
55215526
stopsHere= (strcmp(recordRPName,recoveryTargetName)==0);
55225527

55235528
/*
5524-
*ignore recoveryTargetInclusive because this is not a transaction
5529+
*Ignore recoveryTargetInclusive because this is not a transaction
55255530
* record
55265531
*/
55275532
*includeThis= false;
55285533
}
55295534
else
55305535
{
55315536
/*
5532-
*there can be many transactions that share the same commit time, so
5537+
*There can be many transactions that share the same commit time, so
55335538
* we stop after the last one, if we are inclusive, or stop at the
55345539
* first one if we are exclusive
55355540
*/
@@ -5583,10 +5588,15 @@ recoveryStopsHere(XLogRecord *record, bool *includeThis)
55835588
timestamptz_to_str(recoveryStopTime))));
55845589
}
55855590

5586-
if (recoveryStopAfter)
5591+
/*
5592+
* Note that if we use a RECOVERY_TARGET_TIME then we can stop
5593+
* at a restore point since they are timestamped, though the latest
5594+
* transaction time is not updated.
5595+
*/
5596+
if (record->xl_rmid==RM_XACT_ID&&recoveryStopAfter)
55875597
SetLatestXTime(recordXtime);
55885598
}
5589-
else
5599+
elseif (record->xl_rmid==RM_XACT_ID)
55905600
SetLatestXTime(recordXtime);
55915601

55925602
returnstopsHere;
@@ -9220,7 +9230,7 @@ pg_create_restore_point(PG_FUNCTION_ARGS)
92209230
if (strlen(restore_name_str) >=MAXFNAMELEN)
92219231
ereport(ERROR,
92229232
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
9223-
errmsg("value too long for restore point")));
9233+
errmsg("value too long for restore point (maximum %d characters)",MAXFNAMELEN-1)));
92249234

92259235
restorepoint=XLogRestorePoint(restore_name_str);
92269236

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp