Re: [HACKERS] Better error message on pg_upgrade checksum mismatches

2015-02-11 Thread Bruce Momjian
On Tue, Feb 10, 2015 at 10:55:07AM -0500, Greg Sabino Mullane wrote:
 Just a little thing that's been bugging me. If one side of the 
 pg_upgrade has checksums and the other does not, give a less 
 cryptic error message.

Thanks.  Slightly adjusted patch attached and applied to head.

-- 
  Bruce Momjian  br...@momjian.ushttp://momjian.us
  EnterpriseDB http://enterprisedb.com

  + Everyone has their own god. +
diff --git a/contrib/pg_upgrade/controldata.c b/contrib/pg_upgrade/controldata.c
new file mode 100644
index a02a8ec..0e70b6f
*** a/contrib/pg_upgrade/controldata.c
--- b/contrib/pg_upgrade/controldata.c
*** check_control_data(ControlData *oldctrl,
*** 572,581 
  	 * We might eventually allow upgrades from checksum to no-checksum
  	 * clusters.
  	 */
! 	if (oldctrl-data_checksum_version != newctrl-data_checksum_version)
! 	{
! 		pg_fatal(old and new pg_controldata checksum versions are invalid or do not match\n);
! 	}
  }
  
  
--- 572,585 
  	 * We might eventually allow upgrades from checksum to no-checksum
  	 * clusters.
  	 */
! 	if (oldctrl-data_checksum_version == 0 
! 		newctrl-data_checksum_version != 0)
! 		pg_fatal(old cluster does not use data checksums but the new one does\n);
! 	else if (oldctrl-data_checksum_version != 0 
! 			 newctrl-data_checksum_version == 0)
! 		pg_fatal(old cluster uses data checksums but the new one does not\n);
! 	else if (oldctrl-data_checksum_version != newctrl-data_checksum_version)
! 		pg_fatal(old and new cluster pg_controldata checksum versions do not match\n);
  }
  
  

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


[HACKERS] Better error message on pg_upgrade checksum mismatches

2015-02-10 Thread Greg Sabino Mullane
Just a little thing that's been bugging me. If one side of the 
pg_upgrade has checksums and the other does not, give a less 
cryptic error message.


-- 
Greg Sabino Mullane g...@endpoint.com
End Point Corporation
PGP Key: 0x14964AC8
diff --git a/contrib/pg_upgrade/controldata.c b/contrib/pg_upgrade/controldata.c
index a02a8ec..8a7b976 100644
--- a/contrib/pg_upgrade/controldata.c
+++ b/contrib/pg_upgrade/controldata.c
@@ -572,9 +572,17 @@ check_control_data(ControlData *oldctrl,
 	 * We might eventually allow upgrades from checksum to no-checksum
 	 * clusters.
 	 */
+	if (! oldctrl-data_checksum_version  newctrl-data_checksum_version)
+	{
+		pg_fatal(old version does not use data checksums but new one does\n);
+	}
+	if (oldctrl-data_checksum_version  ! newctrl-data_checksum_version)
+	{
+		pg_fatal(old version uses data checksums but new one does not\n);
+	}
 	if (oldctrl-data_checksum_version != newctrl-data_checksum_version)
 	{
-		pg_fatal(old and new pg_controldata checksum versions are invalid or do not match\n);
+		pg_fatal(old and new pg_controldata checksum versions do not match\n);
 	}
 }
 


signature.asc
Description: Digital signature


Re: [HACKERS] Better error message on pg_upgrade checksum mismatches

2015-02-10 Thread Bruce Momjian
On Tue, Feb 10, 2015 at 10:55:07AM -0500, Greg Sabino Mullane wrote:
 Just a little thing that's been bugging me. If one side of the 
 pg_upgrade has checksums and the other does not, give a less 
 cryptic error message.

OK, sure.  Good fix, will apply.  This seems to be the day for pg_upgrade
fixes/improvements.  :-)

-- 
  Bruce Momjian  br...@momjian.ushttp://momjian.us
  EnterpriseDB http://enterprisedb.com

  + Everyone has their own god. +


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers