diff options
author | Tom Lane | 2017-02-23 20:57:08 +0000 |
---|---|---|
committer | Tom Lane | 2017-02-23 20:57:08 +0000 |
commit | c29aff959dc64f7321062e7f33d8c6ec23db53d3 (patch) | |
tree | 4c3efa167e01805b2e4fcd6eead2e1a320a2c420 /src/include/utils | |
parent | b9d092c962ea3262930e3c31a8c3d79b66ce9d43 (diff) |
Consistently declare timestamp variables as TimestampTz.
Twiddle the replication-related code so that its timestamp variables
are declared TimestampTz, rather than the uninformative "int64" that
was previously used for meant-to-be-always-integer timestamps.
This resolves the int64-vs-TimestampTz declaration inconsistencies
introduced by commit 7c030783a, though in the opposite direction to
what was originally suggested.
This required including datatype/timestamp.h in a couple more places
than before. I decided it would be a good idea to slim down that
header by not having it pull in <float.h> etc, as those headers are
no longer at all relevant to its purpose. Unsurprisingly, a small number
of .c files turn out to have been depending on those inclusions, so add
them back in the .c files as needed.
Discussion: https://postgr.es/m/26788.1487455319@sss.pgh.pa.us
Discussion: https://postgr.es/m/27694.1487456324@sss.pgh.pa.us
Diffstat (limited to 'src/include/utils')
-rw-r--r-- | src/include/utils/snapmgr.h | 7 | ||||
-rw-r--r-- | src/include/utils/snapshot.h | 3 | ||||
-rw-r--r-- | src/include/utils/timestamp.h | 7 |
3 files changed, 6 insertions, 11 deletions
diff --git a/src/include/utils/snapmgr.h b/src/include/utils/snapmgr.h index 2618cc4546e..ab953669bf2 100644 --- a/src/include/utils/snapmgr.h +++ b/src/include/utils/snapmgr.h @@ -51,8 +51,8 @@ extern PGDLLIMPORT int old_snapshot_threshold; extern Size SnapMgrShmemSize(void); extern void SnapMgrInit(void); -extern int64 GetSnapshotCurrentTimestamp(void); -extern int64 GetOldSnapshotThresholdTimestamp(void); +extern TimestampTz GetSnapshotCurrentTimestamp(void); +extern TimestampTz GetOldSnapshotThresholdTimestamp(void); extern bool FirstSnapshotSet; @@ -93,7 +93,8 @@ extern void DeleteAllExportedSnapshotFiles(void); extern bool ThereAreNoPriorRegisteredSnapshots(void); extern TransactionId TransactionIdLimitedForOldSnapshots(TransactionId recentXmin, Relation relation); -extern void MaintainOldSnapshotTimeMapping(int64 whenTaken, TransactionId xmin); +extern void MaintainOldSnapshotTimeMapping(TimestampTz whenTaken, + TransactionId xmin); extern char *ExportSnapshot(Snapshot snapshot); diff --git a/src/include/utils/snapshot.h b/src/include/utils/snapshot.h index ebd5d5a85cb..2bcaa42277e 100644 --- a/src/include/utils/snapshot.h +++ b/src/include/utils/snapshot.h @@ -15,6 +15,7 @@ #include "access/htup.h" #include "access/xlogdefs.h" +#include "datatype/timestamp.h" #include "lib/pairingheap.h" #include "storage/buf.h" @@ -107,7 +108,7 @@ typedef struct SnapshotData uint32 regd_count; /* refcount on RegisteredSnapshots */ pairingheap_node ph_node; /* link in the RegisteredSnapshots heap */ - int64 whenTaken; /* timestamp when snapshot was taken */ + TimestampTz whenTaken; /* timestamp when snapshot was taken */ XLogRecPtr lsn; /* position in the WAL stream when taken */ } SnapshotData; diff --git a/src/include/utils/timestamp.h b/src/include/utils/timestamp.h index d9098354a85..7fd1c7692ff 100644 --- a/src/include/utils/timestamp.h +++ b/src/include/utils/timestamp.h @@ -76,13 +76,6 @@ extern bool TimestampDifferenceExceeds(TimestampTz start_time, TimestampTz stop_time, int msec); -/* - * Prototypes for functions to deal with integer timestamps, when the native - * format is float timestamps. - */ -#define GetCurrentIntegerTimestamp() GetCurrentTimestamp() -#define IntegerTimestampToTimestampTz(timestamp) (timestamp) - extern TimestampTz time_t_to_timestamptz(pg_time_t tm); extern pg_time_t timestamptz_to_time_t(TimestampTz t); |