From da823d7ca809f1c511ab3a84d3eb489d60870325 Mon Sep 17 00:00:00 2001 From: oushu1wangziming1 Date: Tue, 21 Aug 2018 16:14:31 +0800 Subject: [PATCH] HAWQ-1651. Fix some bugs in bulid and unittest. --- contrib/exthdfs/common.h | 1 - src/backend/cdb/cdbvars.c | 2 +- src/backend/commands/tablecmds.c | 20 ++++++++++---------- src/backend/parser/analyze.c | 10 +++++----- src/backend/utils/mmgr/mcxt.c | 2 -- src/include/nodes/memnodes.h | 2 -- 6 files changed, 16 insertions(+), 21 deletions(-) diff --git a/contrib/exthdfs/common.h b/contrib/exthdfs/common.h index 4111909772..0908649c70 100644 --- a/contrib/exthdfs/common.h +++ b/contrib/exthdfs/common.h @@ -24,7 +24,6 @@ #include "fmgr.h" #include "funcapi.h" #include "access/extprotocol.h" -#include "access/fileam.h" #include "catalog/pg_proc.h" #include "catalog/pg_exttable.h" #include "utils/array.h" diff --git a/src/backend/cdb/cdbvars.c b/src/backend/cdb/cdbvars.c index 3fe13be474..2144bacf3b 100644 --- a/src/backend/cdb/cdbvars.c +++ b/src/backend/cdb/cdbvars.c @@ -169,12 +169,12 @@ bool gp_interconnect_cache_future_packets=true; int Gp_udp_bufsize_k; /* UPD recv buf size, in KB */ -#ifdef USE_ASSERT_CHECKING /* * UDP-IC Test hooks (for fault injection). * * Dropseg: specifies which segment to apply the drop_percent to. */ +#ifdef USE_ASSERT_CHECKING int gp_udpic_dropseg = UNDEF_SEGMENT; int gp_udpic_dropxmit_percent = 0; int gp_udpic_dropacks_percent = 0; diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 156e04ce87..88fdcbc0e8 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -18380,7 +18380,7 @@ static Datum transformFormatOpts(char formattype, char *formatname, char *format { DefElem *defel = (DefElem *)lfirst(option); - if (strcmp(defel->defname, "delimiter") == 0) + if (strcmp(defel->defname, "delimiter") == 0 || strcmp(defel->defname, "delimiter_as") == 0 ) { if (delim) ereport(ERROR, @@ -18389,7 +18389,7 @@ static Datum transformFormatOpts(char formattype, char *formatname, char *format errOmitLocation(true))); delim = strVal(defel->arg); } - else if (strcmp(defel->defname, "null") == 0) + else if (strcmp(defel->defname, "null") == 0 || strcmp(defel->defname, "null_as") == 0) { if (null_print) ereport(ERROR, @@ -18398,7 +18398,7 @@ static Datum transformFormatOpts(char formattype, char *formatname, char *format errOmitLocation(true))); null_print = strVal(defel->arg); } - else if (strcmp(defel->defname, "header") == 0) + else if (strcmp(defel->defname, "header") == 0 || strcmp(defel->defname, "header_as") == 0) { if (header_line) ereport(ERROR, @@ -18407,7 +18407,7 @@ static Datum transformFormatOpts(char formattype, char *formatname, char *format errOmitLocation(true))); header_line = intVal(defel->arg); } - else if (strcmp(defel->defname, "quote") == 0) + else if (strcmp(defel->defname, "quote") == 0 || strcmp(defel->defname, "quote_as") == 0) { if (quote) ereport(ERROR, @@ -18416,7 +18416,7 @@ static Datum transformFormatOpts(char formattype, char *formatname, char *format errOmitLocation(true))); quote = strVal(defel->arg); } - else if (strcmp(defel->defname, "escape") == 0) + else if (strcmp(defel->defname, "escape") == 0 || strcmp(defel->defname, "escape_as") == 0) { if (escape) ereport(ERROR, @@ -18425,7 +18425,7 @@ static Datum transformFormatOpts(char formattype, char *formatname, char *format errOmitLocation(true))); escape = strVal(defel->arg); } - else if (strcmp(defel->defname, "force_notnull") == 0) + else if (strcmp(defel->defname, "force_notnull") == 0 || strcmp(defel->defname, "force_notnull_as") == 0) { if (force_notnull) ereport(ERROR, @@ -18435,7 +18435,7 @@ static Datum transformFormatOpts(char formattype, char *formatname, char *format force_notnull = (List *) defel->arg; } - else if (strcmp(defel->defname, "force_quote") == 0) + else if (strcmp(defel->defname, "force_quote") == 0 || strcmp(defel->defname, "force_quote_as") == 0) { if (force_quote) ereport(ERROR, @@ -18445,7 +18445,7 @@ static Datum transformFormatOpts(char formattype, char *formatname, char *format force_quote = (List *) defel->arg; } - else if (strcmp(defel->defname, "fill_missing_fields") == 0) + else if (strcmp(defel->defname, "fill_missing_fields") == 0 || strcmp(defel->defname, "fill_missing_fields_as") == 0) { if (fill_missing) ereport(ERROR, @@ -18454,7 +18454,7 @@ static Datum transformFormatOpts(char formattype, char *formatname, char *format errOmitLocation(true))); fill_missing = intVal(defel->arg); } - else if (strcmp(defel->defname, "newline") == 0) + else if (strcmp(defel->defname, "newline") == 0 || strcmp(defel->defname, "newline_as") == 0) { if (eol_str) ereport(ERROR, @@ -18463,7 +18463,7 @@ static Datum transformFormatOpts(char formattype, char *formatname, char *format errOmitLocation(true))); eol_str = strVal(defel->arg); } - else if (strcmp(defel->defname, "formatter") == 0) + else if (strcmp(defel->defname, "formatter") == 0 || strcmp(defel->defname, "formatter_as") == 0) { ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), diff --git a/src/backend/parser/analyze.c b/src/backend/parser/analyze.c index 02efb2e121..4b4da4e3af 100644 --- a/src/backend/parser/analyze.c +++ b/src/backend/parser/analyze.c @@ -2195,7 +2195,7 @@ enum PreDefinedFormatterOptionVALTYPE { PREDEF_FMTOPT_VAL_COLNAMELIST }; -enum PreDefinedFormatterOptionID { +typedef enum PreDefinedFormatterOptionID { PREDEF_FMT_OPT_ID_DELIMITER, PREDEF_FMT_OPT_ID_NULL, PREDEF_FMT_OPT_ID_HEADER, @@ -2207,7 +2207,7 @@ enum PreDefinedFormatterOptionID { PREDEF_FMT_OPT_ID_NEWLINE, PREDEF_FMT_OPT_ID_UNPREDEFINED, PREDEF_FMT_OPT_ID_ILLEGAL -}; +}PreDefinedFormatterOptionID; typedef struct PreDefinedFormatterOption { char keyword[3][32]; @@ -2253,7 +2253,7 @@ enum PreDefinedFormatterOptionID MatchExternalRelationFormatterOption( (options[i].valueType == PREDEF_FMTOPT_VAL_COLNAMELIST))) { return options[i].optID; /* Got option having one value */ } else { - return PREDEF_FMT_OPT_ID_ILLEGAL; /* no expected value type */ + return PREDEF_FMT_OPT_ID_UNPREDEFINED; /* no expected value type */ } } else if (pdOpt->nKeyword == 2 && de2 != NULL && strcasecmp(pdOpt->keyword[0], ((Value *)(de1->arg))->val.str) == @@ -2274,7 +2274,7 @@ enum PreDefinedFormatterOptionID MatchExternalRelationFormatterOption( (options[i].valueType == PREDEF_FMTOPT_VAL_COLNAMELIST))) { return options[i].optID; /* Got option having one value */ } else { - return PREDEF_FMT_OPT_ID_ILLEGAL; /* no expected value type */ + return PREDEF_FMT_OPT_ID_UNPREDEFINED; /* no expected value type */ } } else if (pdOpt->nKeyword == 3 && de2 != NULL && de3 != NULL && strcasecmp(pdOpt->keyword[0], ((Value *)(de1->arg))->val.str) == @@ -2297,7 +2297,7 @@ enum PreDefinedFormatterOptionID MatchExternalRelationFormatterOption( (options[i].valueType == PREDEF_FMTOPT_VAL_COLNAMELIST))) { return options[i].optID; /* Got option having one value */ } else { - return PREDEF_FMT_OPT_ID_ILLEGAL; /* no expected value type */ + return PREDEF_FMT_OPT_ID_UNPREDEFINED; /* no expected value type */ } } } diff --git a/src/backend/utils/mmgr/mcxt.c b/src/backend/utils/mmgr/mcxt.c index 607d3c9f48..86bdde89ef 100644 --- a/src/backend/utils/mmgr/mcxt.c +++ b/src/backend/utils/mmgr/mcxt.c @@ -828,7 +828,6 @@ MemoryContextStats(MemoryContext context) * * This is just a debugging utility, so it's not fancy. */ -#ifdef MEMORY_CONTEXT_CHECKING void MemoryContextCheck(MemoryContext context) { @@ -840,7 +839,6 @@ MemoryContextCheck(MemoryContext context) for (child = context->firstchild; child != NULL; child = child->nextchild) MemoryContextCheck(child); } -#endif /* * MemoryContextContains diff --git a/src/include/nodes/memnodes.h b/src/include/nodes/memnodes.h index 131610c6b2..95f3aeb75a 100644 --- a/src/include/nodes/memnodes.h +++ b/src/include/nodes/memnodes.h @@ -66,9 +66,7 @@ typedef struct MemoryContextMethods void (*stats) (MemoryContext context, uint64 *nBlocks, uint64 *nChunks, uint64 *currentAvailable, uint64 *allAllocated, uint64 *allFreed, uint64 *maxHeld); void (*release_accounting)(MemoryContext context); void (*update_generation)(MemoryContext context); -#ifdef MEMORY_CONTEXT_CHECKING void (*check) (MemoryContext context); -#endif } MemoryContextMethods;