postgresql/src/backend
Robert Haas 55b7e2f4d7 Fix two bugs in MaintainOldSnapshotTimeMapping.
The previous coding was confused about whether head_timestamp was
intended to represent the timestamp for the newest bucket in the
mapping or the oldest timestamp for the oldest bucket in the mapping.
Decide that it's intended to be the oldest one, and repair
accordingly.

To do that, we need to do two things. First, when advancing to a
new bucket, don't categorically set head_timestamp to the new
timestamp. Do this only if we're blowing out the map completely
because a lot of time has passed since we last maintained it. If
we're replacing entries one by one, advance head_timestamp by
1 minute for each; if we're filling in unused entries, don't
advance head_timestamp at all.

Second, fix the computation of how many buckets we need to advance.
The previous formula would be correct if head_timestamp were the
timestamp for the new bucket, but we're now making all the code
agree that it's the timestamp for the oldest bucket, so adjust the
formula accordingly.

This is certainly a bug fix, but I don't feel good about
back-patching it without the introspection tools added by commit
aecf5ee2bb, and perhaps also some
actual tests. Since back-patching the introspection tools might
not attract sufficient support and since there are no automated
tests of these fixes yet, I'm just committing this to master for
now.

Patch by me, reviewed by Thomas Munro, Dilip Kumar, Hamid Akhtar.

Discussion: http://postgr.es/m/CA+TgmoY=aqf0zjTD+3dUWYkgMiNDegDLFjo+6ze=Wtpik+3XqA@mail.gmail.com
2020-09-24 15:27:19 -04:00
..
access Standardize the printf format for st_size 2020-09-24 21:04:21 +02:00
bootstrap Improve some ancient, crufty code in bootstrap + initdb. 2020-09-05 16:20:04 -04:00
catalog Remove support for postfix (right-unary) operators. 2020-09-17 19:38:05 -04:00
commands Improve error cursor positions for problems with partition bounds. 2020-09-23 18:04:53 -04:00
executor Don't fetch partition check expression during InitResultRelInfo. 2020-09-16 14:28:18 -04:00
foreign Update copyrights for 2020 2020-01-01 12:21:45 -05:00
jit Fix a few typos in JIT comments and README 2020-08-21 09:33:56 +12:00
lib Use pg_bitutils for HyperLogLog. 2020-07-30 09:14:23 -07:00
libpq Message fixes and style improvements 2020-09-14 06:42:30 +02:00
main Clean up includes of s_lock.h. 2020-06-18 19:41:05 -07:00
nodes Remove support for postfix (right-unary) operators. 2020-09-17 19:38:05 -04:00
optimizer Allow incremental sorts for windowing functions 2020-09-15 23:44:45 +12:00
parser Improve error cursor positions for problems with partition bounds. 2020-09-23 18:04:53 -04:00
partitioning Improve error cursor positions for problems with partition bounds. 2020-09-23 18:04:53 -04:00
po Translation updates 2020-05-18 12:49:30 +02:00
port Add huge_page_size setting for use on Linux. 2020-07-17 14:33:00 +12:00
postmaster Centralize setup of SIGQUIT handling for postmaster child processes. 2020-09-16 16:04:36 -04:00
regex Dial back -Wimplicit-fallthrough to level 3 2020-05-13 15:31:14 -04:00
replication Update file header comments for logical/relation.c. 2020-09-18 10:14:30 +05:30
rewrite Redefine pg_class.reltuples to be -1 before the first VACUUM or ANALYZE. 2020-08-30 12:21:51 -04:00
snowball code: replace most remaining uses of 'master'. 2020-07-08 13:24:35 -07:00
statistics Remove some more useless assignments. 2020-09-04 14:32:19 -04:00
storage Allow WaitLatch() to be used without a latch. 2020-09-23 15:17:30 +12:00
tcop Fix bogus completion tag usage in walsender 2020-09-16 21:16:25 -03:00
tsearch Improve behavior of tsearch_readline(), and remove t_readline(). 2020-09-23 20:26:58 -04:00
utils Fix two bugs in MaintainOldSnapshotTimeMapping. 2020-09-24 15:27:19 -04:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
Makefile Update copyrights for 2020 2020-01-01 12:21:45 -05:00
common.mk Remove PARTIAL_LINKING build mode. 2018-03-30 17:33:04 -07:00
nls.mk Add missing gettext triggers 2020-04-28 13:35:40 +02:00