if (state->system_identifier &&
longhdr->xlp_sysid != state->system_identifier)
{
- char fhdrident_str[32];
- char sysident_str[32];
-
- /*
- * Format sysids separately to keep platform-dependent format code
- * out of the translatable message string.
- */
- snprintf(fhdrident_str, sizeof(fhdrident_str), UINT64_FORMAT,
- longhdr->xlp_sysid);
- snprintf(sysident_str, sizeof(sysident_str), UINT64_FORMAT,
- state->system_identifier);
report_invalid_record(state,
- "WAL file is from different database system: WAL file database system identifier is %s, pg_control database system identifier is %s",
- fhdrident_str, sysident_str);
+ "WAL file is from different database system: WAL file database system identifier is %llu, pg_control database system identifier is %llu",
+ (unsigned long long) longhdr->xlp_sysid,
+ (unsigned long long) state->system_identifier);
return false;
}
else if (longhdr->xlp_seg_size != state->wal_segment_size)
static XLogRecPtr startptr;
/* Total number of checksum failures during base backup. */
-static int64 total_checksum_failures;
+static long long int total_checksum_failures;
/* Do not verify checksums. */
static bool noverify_checksums = false;
if (total_checksum_failures)
{
if (total_checksum_failures > 1)
- {
- char buf[64];
-
- snprintf(buf, sizeof(buf), INT64_FORMAT, total_checksum_failures);
-
ereport(WARNING,
- (errmsg("%s total checksum verification failures", buf)));
- }
+ (errmsg("%lld total checksum verification failures", total_checksum_failures)));
+
ereport(ERROR,
(errcode(ERRCODE_DATA_CORRUPTED),
errmsg("checksum verification failure during base backup")));
time_t time_tmp;
char pgctime_str[128];
char ckpttime_str[128];
- char sysident_str[32];
char mock_auth_nonce_str[MOCK_AUTH_NONCE_LEN * 2 + 1];
const char *strftime_fmt = "%c";
const char *progname;
else
strcpy(xlogfilename, _("???"));
- /*
- * Format system_identifier and mock_authentication_nonce separately to
- * keep platform-dependent format code out of the translatable message
- * string.
- */
- snprintf(sysident_str, sizeof(sysident_str), UINT64_FORMAT,
- ControlFile->system_identifier);
for (i = 0; i < MOCK_AUTH_NONCE_LEN; i++)
snprintf(&mock_auth_nonce_str[i * 2], 3, "%02x",
(unsigned char) ControlFile->mock_authentication_nonce[i]);
ControlFile->pg_control_version);
printf(_("Catalog version number: %u\n"),
ControlFile->catalog_version_no);
- printf(_("Database system identifier: %s\n"),
- sysident_str);
+ printf(_("Database system identifier: %llu\n"),
+ (unsigned long long) ControlFile->system_identifier);
printf(_("Database cluster state: %s\n"),
dbState(ControlFile->state));
printf(_("pg_control last modified: %s\n"),
static void
PrintControlValues(bool guessed)
{
- char sysident_str[32];
-
if (guessed)
printf(_("Guessed pg_control values:\n\n"));
else
printf(_("Current pg_control values:\n\n"));
- /*
- * Format system_identifier separately to keep platform-dependent format
- * code out of the translatable message string.
- */
- snprintf(sysident_str, sizeof(sysident_str), UINT64_FORMAT,
- ControlFile.system_identifier);
-
printf(_("pg_control version number: %u\n"),
ControlFile.pg_control_version);
printf(_("Catalog version number: %u\n"),
ControlFile.catalog_version_no);
- printf(_("Database system identifier: %s\n"),
- sysident_str);
+ printf(_("Database system identifier: %llu\n"),
+ (unsigned long long) ControlFile.system_identifier);
printf(_("Latest checkpoint's TimeLineID: %u\n"),
ControlFile.checkPointCopy.ThisTimeLineID);
printf(_("Latest checkpoint's full_page_writes: %s\n"),
char *filename;
int filenamelen;
int64 chunkoff;
- char chunkoff_str[32];
int chunksize;
char *chunk;
continue;
}
- /*
- * Separate step to keep platform-dependent format code out of
- * translatable strings.
- */
- snprintf(chunkoff_str, sizeof(chunkoff_str), INT64_FORMAT, chunkoff);
- pg_log_debug("received chunk for file \"%s\", offset %s, size %d",
- filename, chunkoff_str, chunksize);
+ pg_log_debug("received chunk for file \"%s\", offset %lld, size %d",
+ filename, (long long int) chunkoff, chunksize);
open_target_file(filename, false);
static void output(uint64 loop_count);
/* record duration in powers of 2 microseconds */
-int64 histogram[32];
+long long int histogram[32];
int
main(int argc, char *argv[])
Max(10, len3), header3);
for (i = 0; i <= max_bit; i++)
- {
- char buf[100];
-
- /* lame hack to work around INT64_FORMAT deficiencies */
- snprintf(buf, sizeof(buf), INT64_FORMAT, histogram[i]);
- printf("%*ld %*.5f %*s\n",
+ printf("%*ld %*.5f %*lld\n",
Max(6, len1), 1l << i,
Max(10, len2) - 1, (double) histogram[i] * 100 / loop_count,
- Max(10, len3), buf);
- }
+ Max(10, len3), histogram[i]);
}