diff options
author | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2019-12-16 14:23:56 -0300 |
---|---|---|
committer | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2019-12-16 14:23:56 -0300 |
commit | 91fca4bb60e8c00e8b0e2755555b39f4b1c1659c (patch) | |
tree | 8c4f4ae9ee0af9fa42dd39090b76c092494e1d1f /src/backend/access/transam/xlog.c | |
parent | 741b884353e4803abc15d4392ad287b0d5953fc4 (diff) | |
download | postgresql-91fca4bb60e8c00e8b0e2755555b39f4b1c1659c.tar.gz postgresql-91fca4bb60e8c00e8b0e2755555b39f4b1c1659c.zip |
Demote variable from global to local
recoveryDelayUntilTime was introduced by commit 36da3cfb457b as a global
because its method of operation was devilishly intrincate. Commit
c945af80cfda removed all that complexity and could have turned it into a
local variable, but didn't. Do so now.
Discussion: https://postgr.es/m/20191213200751.GA10731@alvherre.pgsql
Reviewed-by: Michaƫl Paquier, Daniel Gustafsson
Diffstat (limited to 'src/backend/access/transam/xlog.c')
-rw-r--r-- | src/backend/access/transam/xlog.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 6bc1a6b46d6..3baf1b009aa 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -277,7 +277,6 @@ static TimestampTz recoveryTargetTime; const char *recoveryTargetName; XLogRecPtr recoveryTargetLSN; int recovery_min_apply_delay = 0; -TimestampTz recoveryDelayUntilTime; /* options formerly taken from recovery.conf for XLOG streaming */ bool StandbyModeRequested = false; @@ -5970,6 +5969,7 @@ recoveryApplyDelay(XLogReaderState *record) { uint8 xact_info; TimestampTz xtime; + TimestampTz delayUntil; long secs; int microsecs; @@ -6005,15 +6005,13 @@ recoveryApplyDelay(XLogReaderState *record) if (!getRecordTimestamp(record, &xtime)) return false; - recoveryDelayUntilTime = - TimestampTzPlusMilliseconds(xtime, recovery_min_apply_delay); + delayUntil = TimestampTzPlusMilliseconds(xtime, recovery_min_apply_delay); /* * Exit without arming the latch if it's already past time to apply this * record */ - TimestampDifference(GetCurrentTimestamp(), recoveryDelayUntilTime, - &secs, µsecs); + TimestampDifference(GetCurrentTimestamp(), delayUntil, &secs, µsecs); if (secs <= 0 && microsecs <= 0) return false; @@ -6028,10 +6026,9 @@ recoveryApplyDelay(XLogReaderState *record) break; /* - * Wait for difference between GetCurrentTimestamp() and - * recoveryDelayUntilTime + * Wait for difference between GetCurrentTimestamp() and delayUntil */ - TimestampDifference(GetCurrentTimestamp(), recoveryDelayUntilTime, + TimestampDifference(GetCurrentTimestamp(), delayUntil, &secs, µsecs); /* |