Support 9.5 and recognize more flags
This follows the CRC32 macro renames in 9.5 (we do not attempt to maintain support for the older versions), adds support for the DB_SHUTDOWNED_IN_RECOVERY dbState, and adds support for missing BTree and GIN page flags. Satoshi Nagayasu
This commit is contained in:
		
							
								
								
									
										4
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								Makefile
									
									
									
									
									
								
							| @ -1,7 +1,7 @@ | |||||||
| # View README.pg_filedump first | # View README.pg_filedump first | ||||||
|  |  | ||||||
| # note this must match version macros in pg_filedump.h | # note this must match version macros in pg_filedump.h | ||||||
| FD_VERSION=9.3.0 | FD_VERSION=9.5.0 | ||||||
|  |  | ||||||
| CC=gcc | CC=gcc | ||||||
| CFLAGS=-g -O -Wall -Wmissing-prototypes -Wmissing-declarations | CFLAGS=-g -O -Wall -Wmissing-prototypes -Wmissing-declarations | ||||||
| @ -19,7 +19,7 @@ DISTFILES= README.pg_filedump Makefile Makefile.contrib \ | |||||||
| all: pg_filedump | all: pg_filedump | ||||||
|  |  | ||||||
| pg_filedump: pg_filedump.o | pg_filedump: pg_filedump.o | ||||||
| 	${CC} ${CFLAGS} -o pg_filedump pg_filedump.o | 	${CC} ${CFLAGS} -o pg_filedump pg_filedump.o -lpgport | ||||||
|  |  | ||||||
| pg_filedump.o: pg_filedump.c | pg_filedump.o: pg_filedump.c | ||||||
| 	${CC} ${CFLAGS} -I${PGSQL_INCLUDE_DIR} pg_filedump.c -c | 	${CC} ${CFLAGS} -I${PGSQL_INCLUDE_DIR} pg_filedump.c -c | ||||||
|  | |||||||
| @ -24,7 +24,7 @@ | |||||||
|  |  | ||||||
| #include "pg_filedump.h" | #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 */ | /*	checksum_impl.h uses Assert, which doesn't work outside the server */ | ||||||
| #undef Assert | #undef Assert | ||||||
| @ -1132,6 +1132,8 @@ FormatSpecial() | |||||||
| 					strcat(flagString, "SPLITEND|"); | 					strcat(flagString, "SPLITEND|"); | ||||||
| 				if (btreeSection->btpo_flags & BTP_HAS_GARBAGE) | 				if (btreeSection->btpo_flags & BTP_HAS_GARBAGE) | ||||||
| 					strcat(flagString, "HASGARBAGE|"); | 					strcat(flagString, "HASGARBAGE|"); | ||||||
|  | 				if (btreeSection->btpo_flags & BTP_INCOMPLETE_SPLIT) | ||||||
|  | 					strcat(flagString, "INCOMPLETESPLIT|"); | ||||||
| 				if (strlen(flagString)) | 				if (strlen(flagString)) | ||||||
| 					flagString[strlen(flagString) - 1] = '\0'; | 					flagString[strlen(flagString) - 1] = '\0'; | ||||||
|  |  | ||||||
| @ -1216,6 +1218,10 @@ FormatSpecial() | |||||||
| 					strcat(flagString, "LIST|"); | 					strcat(flagString, "LIST|"); | ||||||
| 				if (ginSection->flags & GIN_LIST_FULLROW) | 				if (ginSection->flags & GIN_LIST_FULLROW) | ||||||
| 					strcat(flagString, "FULLROW|"); | 					strcat(flagString, "FULLROW|"); | ||||||
|  | 				if (ginSection->flags & GIN_INCOMPLETE_SPLIT) | ||||||
|  | 					strcat(flagString, "INCOMPLETESPLIT|"); | ||||||
|  | 				if (ginSection->flags & GIN_COMPRESSED) | ||||||
|  | 					strcat(flagString, "COMPRESSED|"); | ||||||
| 				if (strlen(flagString)) | 				if (strlen(flagString)) | ||||||
| 					flagString[strlen(flagString) - 1] = '\0'; | 					flagString[strlen(flagString) - 1] = '\0'; | ||||||
| 				printf(" GIN Index Section:\n" | 				printf(" GIN Index Section:\n" | ||||||
| @ -1340,9 +1346,9 @@ FormatControl() | |||||||
| 		char	   *dbState; | 		char	   *dbState; | ||||||
|  |  | ||||||
| 		/* Compute a local copy of the CRC to verify the one on disk */ | 		/* Compute a local copy of the CRC to verify the one on disk */ | ||||||
| 		INIT_CRC32(crcLocal); | 		INIT_CRC32C(crcLocal); | ||||||
| 		COMP_CRC32(crcLocal, buffer, offsetof(ControlFileData, crc)); | 		COMP_CRC32C(crcLocal, buffer, offsetof(ControlFileData, crc)); | ||||||
| 		FIN_CRC32(crcLocal); | 		FIN_CRC32C(crcLocal); | ||||||
|  |  | ||||||
| 		/* Grab a readable version of the database state */ | 		/* Grab a readable version of the database state */ | ||||||
| 		switch (controlData->state) | 		switch (controlData->state) | ||||||
| @ -1353,6 +1359,9 @@ FormatControl() | |||||||
| 			case DB_SHUTDOWNED: | 			case DB_SHUTDOWNED: | ||||||
| 				dbState = "SHUTDOWNED"; | 				dbState = "SHUTDOWNED"; | ||||||
| 				break; | 				break; | ||||||
|  | 			case DB_SHUTDOWNED_IN_RECOVERY: | ||||||
|  | 				dbState = "SHUTDOWNED_IN_RECOVERY"; | ||||||
|  | 				break; | ||||||
| 			case DB_SHUTDOWNING: | 			case DB_SHUTDOWNING: | ||||||
| 				dbState = "SHUTDOWNING"; | 				dbState = "SHUTDOWNING"; | ||||||
| 				break; | 				break; | ||||||
| @ -1400,7 +1409,7 @@ FormatControl() | |||||||
| 			   "           Maximum Index Keys: %u\n" | 			   "           Maximum Index Keys: %u\n" | ||||||
| 			   "             TOAST Chunk Size: %u\n" | 			   "             TOAST Chunk Size: %u\n" | ||||||
| 			   "   Date and Time Type Storage: %s\n\n", | 			   "   Date and Time Type Storage: %s\n\n", | ||||||
| 			   EQ_CRC32(crcLocal, | 			   EQ_CRC32C(crcLocal, | ||||||
| 						controlData->crc) ? "Correct" : "Not Correct", | 						controlData->crc) ? "Correct" : "Not Correct", | ||||||
| 			   controlData->pg_control_version, | 			   controlData->pg_control_version, | ||||||
| 			   (controlData->pg_control_version == PG_CONTROL_VERSION ? | 			   (controlData->pg_control_version == PG_CONTROL_VERSION ? | ||||||
|  | |||||||
| @ -22,8 +22,8 @@ | |||||||
|  * Original Author: Patrick Macdonald <patrickm@redhat.com> |  * Original Author: Patrick Macdonald <patrickm@redhat.com> | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #define FD_VERSION	"9.4.0"		/* version ID of pg_filedump */ | #define FD_VERSION	"9.5.0"		/* version ID of pg_filedump */ | ||||||
| #define FD_PG_VERSION	"PostgreSQL 9.4.x"		/* PG version it works with */ | #define FD_PG_VERSION	"PostgreSQL 9.5.x"		/* PG version it works with */ | ||||||
|  |  | ||||||
| #include "postgres.h" | #include "postgres.h" | ||||||
|  |  | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user