1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-15 03:41:20 +03:00

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
This commit is contained in:
Tom Lane
2017-02-23 15:57:08 -05:00
parent b9d092c962
commit c29aff959d
22 changed files with 100 additions and 94 deletions

View File

@@ -57,7 +57,7 @@ static int outfd = -1;
static volatile sig_atomic_t time_to_abort = false;
static volatile sig_atomic_t output_reopen = false;
static bool output_isfile;
static int64 output_last_fsync = -1;
static TimestampTz output_last_fsync = -1;
static bool output_needs_fsync = false;
static XLogRecPtr output_written_lsn = InvalidXLogRecPtr;
static XLogRecPtr output_fsync_lsn = InvalidXLogRecPtr;
@@ -112,7 +112,7 @@ usage(void)
* Send a Standby Status Update message to server.
*/
static bool
sendFeedback(PGconn *conn, int64 now, bool force, bool replyRequested)
sendFeedback(PGconn *conn, TimestampTz now, bool force, bool replyRequested)
{
static XLogRecPtr last_written_lsn = InvalidXLogRecPtr;
static XLogRecPtr last_fsync_lsn = InvalidXLogRecPtr;
@@ -175,7 +175,7 @@ disconnect_and_exit(int code)
}
static bool
OutputFsync(int64 now)
OutputFsync(TimestampTz now)
{
output_last_fsync = now;
@@ -212,7 +212,7 @@ StreamLogicalLog(void)
{
PGresult *res;
char *copybuf = NULL;
int64 last_status = -1;
TimestampTz last_status = -1;
int i;
PQExpBuffer query;
@@ -285,7 +285,7 @@ StreamLogicalLog(void)
int r;
int bytes_left;
int bytes_written;
int64 now;
TimestampTz now;
int hdr_len;
XLogRecPtr cur_record_lsn = InvalidXLogRecPtr;
@@ -365,8 +365,8 @@ StreamLogicalLog(void)
* response back to the client.
*/
fd_set input_mask;
int64 message_target = 0;
int64 fsync_target = 0;
TimestampTz message_target = 0;
TimestampTz fsync_target = 0;
struct timeval timeout;
struct timeval *timeoutptr = NULL;
@@ -394,7 +394,7 @@ StreamLogicalLog(void)
/* Now compute when to wakeup. */
if (message_target > 0 || fsync_target > 0)
{
int64 targettime;
TimestampTz targettime;
long secs;
int usecs;
@@ -622,7 +622,7 @@ StreamLogicalLog(void)
if (outfd != -1 && strcmp(outfile, "-") != 0)
{
int64 t = feGetCurrentTimestamp();
TimestampTz t = feGetCurrentTimestamp();
/* no need to jump to error on failure here, we're finishing anyway */
OutputFsync(t);