From c29aff959dc64f7321062e7f33d8c6ec23db53d3 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Thu, 23 Feb 2017 15:57:08 -0500 Subject: 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 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 --- src/backend/replication/basebackup.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/backend/replication/basebackup.c') diff --git a/src/backend/replication/basebackup.c b/src/backend/replication/basebackup.c index 09ecc153656..643a17943af 100644 --- a/src/backend/replication/basebackup.c +++ b/src/backend/replication/basebackup.c @@ -92,10 +92,10 @@ static uint64 throttling_sample; static int64 throttling_counter; /* The minimum time required to transfer throttling_sample bytes. */ -static int64 elapsed_min_unit; +static TimeOffset elapsed_min_unit; /* The last check of the transfer rate. */ -static int64 throttled_last; +static TimestampTz throttled_last; /* * The contents of these directories are removed or recreated during server @@ -254,7 +254,7 @@ perform_base_backup(basebackup_options *opt, DIR *tblspcdir) throttling_counter = 0; /* The 'real data' starts now (header was ignored). */ - throttled_last = GetCurrentIntegerTimestamp(); + throttled_last = GetCurrentTimestamp(); } else { @@ -1333,7 +1333,7 @@ _tarWriteDir(const char *pathbuf, int basepathlen, struct stat *statbuf, static void throttle(size_t increment) { - int64 elapsed, + TimeOffset elapsed, elapsed_min, sleep; int wait_result; @@ -1346,7 +1346,7 @@ throttle(size_t increment) return; /* Time elapsed since the last measurement (and possible wake up). */ - elapsed = GetCurrentIntegerTimestamp() - throttled_last; + elapsed = GetCurrentTimestamp() - throttled_last; /* How much should have elapsed at minimum? */ elapsed_min = elapsed_min_unit * (throttling_counter / throttling_sample); sleep = elapsed_min - elapsed; @@ -1381,5 +1381,5 @@ throttle(size_t increment) * Time interval for the remaining amount and possible next increments * starts now. */ - throttled_last = GetCurrentIntegerTimestamp(); + throttled_last = GetCurrentTimestamp(); } -- cgit v1.2.3