Re: [HACKERS] pg_filedump patch for 9.5

2016-03-19 Thread Christoph Berg
Re: Pavel Raiskup 2016-02-26 <8883822.6jzmttx...@nb.usersys.redhat.com>
> On Saturday 08 of August 2015 20:38:38 Satoshi Nagayasu wrote:
> > I have created a patch for pg_filedump to work with 9.5.
> > Here is a list of changes.
> > 
> >  * Fix to rename CRC32 macros to work with 9.5.
> >  * Fix to add missing DBState: DB_SHUTDOWNED_IN_RECOVERY.
> >  * Fix to add missing page flags for Btree and GIN.
> >  * Update copyright date.
> > 
> > Please take a look. Any comments are welcome.
> 
> Thanks for the patch;  it helps with building against 9.5.
> 
> Hints I can give ATM:
> 
>   * copyright is outdated now 
>   * to allow the build with 'make
> PGSQL_INCLUDE_DIR=/usr/include/pgsql/server' the following patch is
> needed:
> 
> --- a/Makefile
> +++ b/Makefile
> @@ -18,7 +18,7 @@ DISTFILES= README.pg_filedump Makefile Makefile.contrib 
> \
>  all: pg_filedump
>  
>  pg_filedump: pg_filedump.o
> -   ${CC} ${CFLAGS} -o pg_filedump pg_filedump.o
> +   ${CC} ${CFLAGS} -o pg_filedump pg_filedump.o -lpgport
> 
> Pavel

Hi,

thanks for the patches, I've pushed them to the git repo.

http://git.postgresql.org/gitweb/?p=pg_filedump.git

Christoph


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


Re: [HACKERS] pg_filedump patch for 9.5

2016-02-26 Thread Pavel Raiskup
On Saturday 08 of August 2015 20:38:38 Satoshi Nagayasu wrote:
> I have created a patch for pg_filedump to work with 9.5.
> Here is a list of changes.
> 
>  * Fix to rename CRC32 macros to work with 9.5.
>  * Fix to add missing DBState: DB_SHUTDOWNED_IN_RECOVERY.
>  * Fix to add missing page flags for Btree and GIN.
>  * Update copyright date.
> 
> Please take a look. Any comments are welcome.

Thanks for the patch;  it helps with building against 9.5.

Hints I can give ATM:

  * copyright is outdated now 
  * to allow the build with 'make
PGSQL_INCLUDE_DIR=/usr/include/pgsql/server' the following patch is
needed:

--- a/Makefile
+++ b/Makefile
@@ -18,7 +18,7 @@ DISTFILES= README.pg_filedump Makefile Makefile.contrib \
 all: pg_filedump
 
 pg_filedump: pg_filedump.o
-   ${CC} ${CFLAGS} -o pg_filedump pg_filedump.o
+   ${CC} ${CFLAGS} -o pg_filedump pg_filedump.o -lpgport

Pavel



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


[HACKERS] pg_filedump patch for 9.5

2015-08-08 Thread Satoshi Nagayasu
Hi,

I have created a patch for pg_filedump to work with 9.5.
Here is a list of changes.

 * Fix to rename CRC32 macros to work with 9.5.
 * Fix to add missing DBState: DB_SHUTDOWNED_IN_RECOVERY.
 * Fix to add missing page flags for Btree and GIN.
 * Update copyright date.

Please take a look. Any comments are welcome.

Regards,

-- 
NAGAYASU Satoshi sn...@uptime.jp
diff --git a/Makefile b/Makefile
index c64dfbf..d80a3a3 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 # View README.pg_filedump first
 
 # note this must match version macros in pg_filedump.h
-FD_VERSION=9.3.0
+FD_VERSION=9.5.0
 
 CC=gcc
 CFLAGS=-g -O -Wall -Wmissing-prototypes -Wmissing-declarations
diff --git a/README.pg_filedump b/README.pg_filedump
index 3a04d59..13d51ff 100644
--- a/README.pg_filedump
+++ b/README.pg_filedump
@@ -2,7 +2,7 @@ pg_filedump - Display formatted contents of a PostgreSQL heap, 
index,
   or control file.
 
 Copyright (c) 2002-2010 Red Hat, Inc.
-Copyright (c) 2011-2014, PostgreSQL Global Development Group
+Copyright (c) 2011-2015, PostgreSQL Global Development Group
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
diff --git a/pg_filedump.c b/pg_filedump.c
index 6cd02a9..1dfc524 100644
--- a/pg_filedump.c
+++ b/pg_filedump.c
@@ -3,7 +3,7 @@
  *formatting heap (data), index and control 
files.
  *
  * Copyright (c) 2002-2010 Red Hat, Inc.
- * Copyright (c) 2011-2014, PostgreSQL Global Development Group
+ * Copyright (c) 2011-2015, PostgreSQL Global Development Group
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -24,7 +24,7 @@
 
 #include pg_filedump.h
 
-#include utils/pg_crc_tables.h
+#include utils/pg_crc.h
 
 /* checksum_impl.h uses Assert, which doesn't work outside the server */
 #undef Assert
@@ -91,7 +91,7 @@ DisplayOptions(unsigned int validOptions)
printf
(\nVersion %s (for %s)
 \nCopyright (c) 2002-2010 Red Hat, Inc.
- \nCopyright (c) 2011-2014, PostgreSQL Global Development 
Group\n,
+ \nCopyright (c) 2011-2015, PostgreSQL Global Development 
Group\n,
 FD_VERSION, FD_PG_VERSION);
 
printf
@@ -1132,6 +1132,8 @@ FormatSpecial()
strcat(flagString, SPLITEND|);
if (btreeSection-btpo_flags  BTP_HAS_GARBAGE)
strcat(flagString, HASGARBAGE|);
+   if (btreeSection-btpo_flags  
BTP_INCOMPLETE_SPLIT)
+   strcat(flagString, INCOMPLETESPLIT|);
if (strlen(flagString))
flagString[strlen(flagString) - 1] = 
'\0';
 
@@ -1216,6 +1218,10 @@ FormatSpecial()
strcat(flagString, LIST|);
if (ginSection-flags  GIN_LIST_FULLROW)
strcat(flagString, FULLROW|);
+   if (ginSection-flags  GIN_INCOMPLETE_SPLIT)
+   strcat(flagString, INCOMPLETESPLIT|);
+   if (ginSection-flags  GIN_COMPRESSED)
+   strcat(flagString, COMPRESSED|);
if (strlen(flagString))
flagString[strlen(flagString) - 1] = 
'\0';
printf( GIN Index Section:\n
@@ -1340,9 +1346,9 @@ FormatControl()
char   *dbState;
 
/* Compute a local copy of the CRC to verify the one on disk */
-   INIT_CRC32(crcLocal);
-   COMP_CRC32(crcLocal, buffer, offsetof(ControlFileData, crc));
-   FIN_CRC32(crcLocal);
+   INIT_CRC32C(crcLocal);
+   COMP_CRC32C(crcLocal, buffer, offsetof(ControlFileData, crc));
+   FIN_CRC32C(crcLocal);
 
/* Grab a readable version of the database state */
switch (controlData-state)
@@ -1353,6 +1359,9 @@ FormatControl()
case DB_SHUTDOWNED:
dbState = SHUTDOWNED;
break;
+   case DB_SHUTDOWNED_IN_RECOVERY:
+   dbState = SHUTDOWNED_IN_RECOVERY;
+   break;
case DB_SHUTDOWNING:
dbState = SHUTDOWNING;
break;
@@ -1400,7 +1409,7 @@ FormatControl()
  Maximum Index Keys: %u\n
TOAST Chunk Size: %u\n
  Date and Time Type Storage: