From cdcae2b6a7d263b2771b6386af626b47ce17da19 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter_e@gmx.net>
Date: Thu, 1 Oct 2015 21:42:00 -0400
Subject: [PATCH] pg_rewind: Improve some messages

The output of a typical pg_rewind run contained a mix of capitalized and
not-capitalized and punctuated and not-punctuated phrases for no
apparent reason.  Make that consistent.  Also fix some problems in other
messages.
---
 src/bin/pg_rewind/file_ops.c    | 2 +-
 src/bin/pg_rewind/libpq_fetch.c | 6 +++---
 src/bin/pg_rewind/pg_rewind.c   | 6 +++---
 src/bin/pg_rewind/timeline.c    | 2 +-
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/bin/pg_rewind/file_ops.c b/src/bin/pg_rewind/file_ops.c
index c2d8aa19396..193b72e9a2a 100644
--- a/src/bin/pg_rewind/file_ops.c
+++ b/src/bin/pg_rewind/file_ops.c
@@ -198,7 +198,7 @@ truncate_target_file(const char *path, off_t newsize)
 				 dstpath, strerror(errno));
 
 	if (ftruncate(fd, newsize) != 0)
-		pg_fatal("could not truncate file \"%s\" to %u bytes: %s\n",
+		pg_fatal("could not truncate file \"%s\" to %u: %s\n",
 				 dstpath, (unsigned int) newsize, strerror(errno));
 
 	close(fd);
diff --git a/src/bin/pg_rewind/libpq_fetch.c b/src/bin/pg_rewind/libpq_fetch.c
index 0e186f2c36f..41d687ba403 100644
--- a/src/bin/pg_rewind/libpq_fetch.c
+++ b/src/bin/pg_rewind/libpq_fetch.c
@@ -120,7 +120,7 @@ libpqGetCurrentXlogInsertLocation(void)
 	val = run_simple_query("SELECT pg_current_xlog_insert_location()");
 
 	if (sscanf(val, "%X/%X", &hi, &lo) != 2)
-		pg_fatal("unrecognized result \"%s\" for current XLOG insert location\n", val);
+		pg_fatal("unrecognized result \"%s\" for current WAL insert location\n", val);
 
 	result = ((uint64) hi) << 32 | lo;
 
@@ -248,7 +248,7 @@ receiveFileChunks(const char *sql)
 				continue;		/* final zero-row result */
 
 			default:
-				pg_fatal("unexpected result while fetching remote files: %s\n",
+				pg_fatal("unexpected result while fetching remote files: %s",
 						 PQresultErrorMessage(res));
 		}
 
@@ -300,7 +300,7 @@ receiveFileChunks(const char *sql)
 		if (PQgetisnull(res, 0, 2))
 		{
 			pg_log(PG_DEBUG,
-			  "received NULL chunk for file \"%s\", file has been deleted\n",
+			  "received null value for chunk for file \"%s\", file has been deleted\n",
 				   filename);
 			pg_free(filename);
 			PQclear(res);
diff --git a/src/bin/pg_rewind/pg_rewind.c b/src/bin/pg_rewind/pg_rewind.c
index 4b7e26aac18..a2d9ca36aa1 100644
--- a/src/bin/pg_rewind/pg_rewind.c
+++ b/src/bin/pg_rewind/pg_rewind.c
@@ -215,7 +215,7 @@ main(int argc, char **argv)
 		pg_fatal("source and target cluster are on the same timeline\n");
 
 	findCommonAncestorTimeline(&divergerec, &lastcommontli);
-	printf(_("The servers diverged at WAL position %X/%X on timeline %u.\n"),
+	printf(_("servers diverged at WAL position %X/%X on timeline %u\n"),
 		   (uint32) (divergerec >> 32), (uint32) divergerec, lastcommontli);
 
 	/*
@@ -250,13 +250,13 @@ main(int argc, char **argv)
 
 	if (!rewind_needed)
 	{
-		printf(_("No rewind required.\n"));
+		printf(_("no rewind required\n"));
 		exit(0);
 	}
 
 	findLastCheckpoint(datadir_target, divergerec, lastcommontli,
 					   &chkptrec, &chkpttli, &chkptredo);
-	printf(_("Rewinding from last common checkpoint at %X/%X on timeline %u\n"),
+	printf(_("rewinding from last common checkpoint at %X/%X on timeline %u\n"),
 		   (uint32) (chkptrec >> 32), (uint32) chkptrec,
 		   chkpttli);
 
diff --git a/src/bin/pg_rewind/timeline.c b/src/bin/pg_rewind/timeline.c
index 752623058ec..e734310505e 100644
--- a/src/bin/pg_rewind/timeline.c
+++ b/src/bin/pg_rewind/timeline.c
@@ -80,7 +80,7 @@ rewind_parseTimeLineHistory(char *buffer, TimeLineID targetTLI, int *nentries)
 		if (nfields != 3)
 		{
 			fprintf(stderr, _("syntax error in history file: %s\n"), fline);
-			fprintf(stderr, _("Expected an XLOG switchpoint location.\n"));
+			fprintf(stderr, _("Expected a transaction log switchpoint location.\n"));
 			exit(1);
 		}
 		if (entries && tli <= lasttli)
-- 
GitLab