Re: fixing old_snapshot_threshold's time->xid mapping
Robert Haas <robertmhaas@gmail.com>
From: Robert Haas <robertmhaas@gmail.com>
To: Dilip Kumar <dilipbalaut@gmail.com>
Cc: Kevin Grittner <kgrittn@gmail.com>, Andres Freund <andres@anarazel.de>, "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2020-04-20T18:01:07Z
Lists: pgsql-hackers
On Mon, Apr 20, 2020 at 12:10 AM Dilip Kumar <dilipbalaut@gmail.com> wrote: > I have started reviewing these patches. I think, the fixes looks right to me. > > + LWLockAcquire(OldSnapshotTimeMapLock, LW_SHARED); > + mapping->head_offset = oldSnapshotControl->head_offset; > + mapping->head_timestamp = oldSnapshotControl->head_timestamp; > + mapping->count_used = oldSnapshotControl->count_used; > + for (int i = 0; i < OLD_SNAPSHOT_TIME_MAP_ENTRIES; ++i) > + mapping->xid_by_minute[i] = oldSnapshotControl->xid_by_minute[i]; > + LWLockRelease(OldSnapshotTimeMapLock); > > I think memcpy would be a better choice instead of looping it for all > the entries, since we are doing this under a lock? When I did it that way, it complained about "const" and I couldn't immediately figure out how to fix it. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company
Commits
-
Remove the "snapshot too old" feature.
- f691f5b80a85 17.0 landed
-
Fix two bugs in MaintainOldSnapshotTimeMapping.
- 55b7e2f4d78d 14.0 landed
-
Add new 'old_snapshot' contrib module.
- aecf5ee2bb36 14.0 landed
-
Expose oldSnapshotControl definition via new header.
- f5ea92e8d620 14.0 landed