From 9608533d92e68fef234c89218ea9df4b84f5606c Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Mon, 24 May 2021 14:21:38 +0400 Subject: [PATCH] MCOL-4734 Compilation failure: MariaDB-10.6 + ColumnStore-develop mcsconfig.h and my_config.h have the following pre-processor definitions: 1. Conflicting definitions coming from the standard cmake definitions: - PACKAGE - PACKAGE_BUGREPORT - PACKAGE_NAME - PACKAGE_STRING - PACKAGE_TARNAME - PACKAGE_VERSION - VERSION 2. Conflicting definitions of other kinds: - HAVE_STRTOLL - this is a dirt in MariaDB headers. Should be fixed in the server code. my_config.h erroneously performs "#define HAVE_STRTOLL" instead of "#define HAVE_STRTOLL 1". in some cases. The former is not CMake compatible style. The latter is. 3. Non-conflicting definitions: Otherwise, mcsconfig.h and my_config.h should be mutually compatible, because both are generated by cmake on the same host machine. So they should have exactly equal definitions like "HAVE_XXX", "SIZEOF_XXX", etc. Observations: - It's OK to include both mcsconfig.h and my_config.h providing that we suppress duplicate definition of the above conflicting types #1 and #2. - There is no a need to suppress duplicate definitions mentioned in #3, as they are compatible! - my_sys.h and m_ctype.h must always follow a CMake configuation header, either my_config.h or mcsconfig.h (or both). They must never be included without any preceeding configuration header. This change make sure that we resolve conflicts by: - either disallowing inclusion of mcsconfig.h and my_config.h at the same time - or by hiding conflicting definitions #1 and #2 (with their later restoring). - also, by making sure that my_sys.h and m_ctype.h always follow a CMake configuration file. Details: - idb_mysql.h can now only be included only after my_config.h An attempt to use idb_mysql.h with mcsconfig.h instead of my_config.h is caught by the "#error" preprocessor directive. - mariadb_my_sys.h can now be only included after mcsconfig.h. An attempt to use mariadb_my_sys.h without mcscofig.h (e.g. with my_config.h) is also caught by "#error". - collation.h now can now be included in two ways. It now has the following effective structure: #if defined(PREFER_MY_CONFIG_H) && defined(MY_CONFIG_H) // Remember current conflicting definitions on the preprocessor stack // Undefine current conflicting definitions #endif #include "mcsconfig.h" #include "m_ctype.h" #if defined(PREFER_MY_CONFIG_H) && defined(MY_CONFIG_H) # Restore conflicting definitions from the preprocessor stack #endif and can be included as follows: a. using only mcsconfig.h as a configuration header: // my_config.h must not be included so far #include "collation.h" b. using my_config.h as the first included configuration file: #define PREFER_MY_CONFIG_H // Force conflict resolution #include "my_config.h" // can be included directly or indirectly ... #include "collation.h" Other changes: - Adding helper header files utils/common/mcsconfig_conflicting_defs_remember.h utils/common/mcsconfig_conflicting_defs_restore.h utils/common/mcsconfig_conflicting_defs_undef.h to perform conflict resolution easier. - Removing `#include "collation.h"` from a number of files, as it's automatically included from rowgroup.h. - Removing redundant `#include "utils_utf8.h"`. This change is not directly related to the problem being fixed, but it's nice to remove redundant directives for both collation.h and utils_utf8.h from all the files that do not really need them. (this change could probably have gone as a separate commit) - Changing my_init() to MY_INIT(argv[0]) in the MCS services sources. After the fix of the complitation failure it appeared that ColumnStore services compiled with the debug build crash due to recent changes in safemalloc. The crash happened in strcmp() with `my_progname` as an argument (where my_progname is a mysys global variable). This problem should probably be fixed on the server side as well to avoid passing NULL. But, the majority of MariaDB executable programs also use MY_INIT(argv[0]) rather than my_init(). So let's make MCS do like the other programs do. --- datatypes/mcs_string.h | 2 +- dbcon/ddlpackage/ddl.y | 3 +- dbcon/ddlpackage/sqlparser.h | 3 +- dbcon/execplan/calpontsystemcatalog.cpp | 1 - dbcon/execplan/calpontsystemcatalog.h | 2 +- dbcon/execplan/predicateoperator.cpp | 1 - dbcon/execplan/predicateoperator.h | 3 +- dbcon/joblist/crossenginestep.cpp | 1 + dbcon/joblist/jlf_graphics.cpp | 1 + dbcon/joblist/jlf_tuplejoblist.cpp | 1 + dbcon/joblist/joblist.cpp | 1 + dbcon/joblist/tupleaggregatestep.cpp | 1 + dbcon/mysql/ha_exists_sub.cpp | 1 + dbcon/mysql/ha_from_sub.cpp | 1 + dbcon/mysql/ha_in_sub.cpp | 1 + dbcon/mysql/ha_mcs_client_udfs.cpp | 1 + dbcon/mysql/ha_mcs_ddl.cpp | 5 +-- dbcon/mysql/ha_mcs_dml.cpp | 1 + dbcon/mysql/ha_mcs_execplan.cpp | 36 ++++++++++--------- dbcon/mysql/ha_mcs_impl.cpp | 1 + dbcon/mysql/ha_mcs_opt_rewrites.cpp | 2 +- dbcon/mysql/ha_mcs_partition.cpp | 1 + dbcon/mysql/ha_mcs_pushdown.h | 1 + dbcon/mysql/ha_pseudocolumn.cpp | 1 + dbcon/mysql/ha_scalar_sub.cpp | 1 + dbcon/mysql/ha_select_sub.cpp | 1 + dbcon/mysql/ha_view.cpp | 1 + dbcon/mysql/ha_window_function.cpp | 1 + dbcon/mysql/idb_mysql.h | 10 +++--- dbcon/mysql/is_columnstore_columns.cpp | 1 + dbcon/mysql/is_columnstore_extents.cpp | 1 + dbcon/mysql/is_columnstore_files.cpp | 1 + dbcon/mysql/is_columnstore_tables.cpp | 1 + dbcon/mysql/sm.cpp | 4 ++- ddlproc/ddlproc.cpp | 3 +- dmlproc/dmlproc.cpp | 3 +- exemgr/main.cpp | 3 +- primitives/linux-port/dictionary.cpp | 2 -- primitives/primproc/primproc.cpp | 3 +- utils/common/collation.h | 22 ++++++++++++ utils/common/mariadb_my_sys.h | 10 ++++++ .../mcsconfig_conflicting_defs_remember.h | 32 +++++++++++++++++ .../mcsconfig_conflicting_defs_restore.h | 32 +++++++++++++++++ .../common/mcsconfig_conflicting_defs_undef.h | 34 ++++++++++++++++++ utils/common/utils_utf8.cpp | 2 -- utils/funcexp/func_between.cpp | 1 - utils/funcexp/func_case.cpp | 2 -- utils/funcexp/func_cast.cpp | 1 - utils/funcexp/func_char.cpp | 4 +-- utils/funcexp/func_char_length.cpp | 2 -- utils/funcexp/func_concat.cpp | 1 - utils/funcexp/func_concat_oracle.cpp | 1 - utils/funcexp/func_concat_ws.cpp | 3 +- utils/funcexp/func_decode_oracle.cpp | 2 -- utils/funcexp/func_find_in_set.cpp | 1 - utils/funcexp/func_greatest.cpp | 2 -- utils/funcexp/func_in.cpp | 2 -- utils/funcexp/func_insert.cpp | 1 - utils/funcexp/func_instr.cpp | 3 -- utils/funcexp/func_lcase.cpp | 2 -- utils/funcexp/func_least.cpp | 2 -- utils/funcexp/func_left.cpp | 2 -- utils/funcexp/func_length.cpp | 1 - utils/funcexp/func_lpad.cpp | 5 +-- utils/funcexp/func_ltrim.cpp | 2 -- utils/funcexp/func_ltrim_oracle.cpp | 2 -- utils/funcexp/func_nullif.cpp | 2 -- utils/funcexp/func_replace.cpp | 1 - utils/funcexp/func_replace_oracle.cpp | 1 - utils/funcexp/func_reverse.cpp | 4 +-- utils/funcexp/func_right.cpp | 2 -- utils/funcexp/func_rpad.cpp | 4 +-- utils/funcexp/func_rtrim.cpp | 2 -- utils/funcexp/func_rtrim_oracle.cpp | 2 -- utils/funcexp/func_strcmp.cpp | 2 -- utils/funcexp/func_substr.cpp | 2 -- utils/funcexp/func_substring_index.cpp | 1 - utils/funcexp/func_trim.cpp | 2 -- utils/funcexp/func_trim_oracle.cpp | 2 -- utils/funcexp/func_ucase.cpp | 2 -- utils/idbdatafile/IDBPolicy.cpp | 2 +- utils/querystats/querystats.cpp | 2 ++ utils/rowgroup/rowaggregation.cpp | 2 -- utils/rowgroup/rowaggregation.h | 1 - utils/rowgroup/rowgroup.cpp | 1 - utils/windowfunction/idborderby.cpp | 1 - versioning/BRM/masternode.cpp | 1 - versioning/BRM/slavenode.cpp | 1 - writeengine/bulk/cpimport.cpp | 1 - writeengine/bulk/we_bulkloadbuffer.cpp | 2 +- writeengine/dictionary/we_dctnry.cpp | 2 +- writeengine/server/we_server.cpp | 3 +- 92 files changed, 203 insertions(+), 127 deletions(-) create mode 100644 utils/common/mcsconfig_conflicting_defs_remember.h create mode 100644 utils/common/mcsconfig_conflicting_defs_restore.h create mode 100644 utils/common/mcsconfig_conflicting_defs_undef.h diff --git a/datatypes/mcs_string.h b/datatypes/mcs_string.h index 74527da15..abbd34151 100644 --- a/datatypes/mcs_string.h +++ b/datatypes/mcs_string.h @@ -20,7 +20,7 @@ #define MCS_DATATYPES_STRING_H #include "conststring.h" -#include "collation.h" +#include "collation.h" // class Charset namespace datatypes { diff --git a/dbcon/ddlpackage/ddl.y b/dbcon/ddlpackage/ddl.y index 60abce1c7..98894873b 100644 --- a/dbcon/ddlpackage/ddl.y +++ b/dbcon/ddlpackage/ddl.y @@ -49,8 +49,7 @@ #include "ddl-gram.h" #endif -#include "my_global.h" -#include "my_sys.h" +#include "mariadb_my_sys.h" // CHARSET_INFO #define scanner x->scanner diff --git a/dbcon/ddlpackage/sqlparser.h b/dbcon/ddlpackage/sqlparser.h index c8d77f2e5..ac1f0a0ff 100644 --- a/dbcon/ddlpackage/sqlparser.h +++ b/dbcon/ddlpackage/sqlparser.h @@ -27,8 +27,7 @@ */ #include -#include -#include +#include "collation.h" // CHARSET_INFO #include "ddlpkg.h" #if defined(_MSC_VER) && defined(xxxDDLPKGSQLPARSER_DLLEXPORT) diff --git a/dbcon/execplan/calpontsystemcatalog.cpp b/dbcon/execplan/calpontsystemcatalog.cpp index 3abb7154b..f122fbae8 100644 --- a/dbcon/execplan/calpontsystemcatalog.cpp +++ b/dbcon/execplan/calpontsystemcatalog.cpp @@ -78,7 +78,6 @@ using namespace rowgroup; #include "idbregistry.h" #endif -#include "collation.h" #undef BAIL_IF_0 #if 1 diff --git a/dbcon/execplan/calpontsystemcatalog.h b/dbcon/execplan/calpontsystemcatalog.h index 8ab9f3511..8f64b90cb 100644 --- a/dbcon/execplan/calpontsystemcatalog.h +++ b/dbcon/execplan/calpontsystemcatalog.h @@ -50,7 +50,7 @@ #undef max #include "mcs_datatype.h" -#include "collation.h" +#include "collation.h" // CHARSET_INFO, class Charset class ExecPlanTest; diff --git a/dbcon/execplan/predicateoperator.cpp b/dbcon/execplan/predicateoperator.cpp index cb79a5895..d5bbd3b24 100644 --- a/dbcon/execplan/predicateoperator.cpp +++ b/dbcon/execplan/predicateoperator.cpp @@ -30,7 +30,6 @@ #include "liboamcpp.h" -#include "collation.h" using namespace oam; diff --git a/dbcon/execplan/predicateoperator.h b/dbcon/execplan/predicateoperator.h index 8ff970777..c14b4bcdf 100644 --- a/dbcon/execplan/predicateoperator.h +++ b/dbcon/execplan/predicateoperator.h @@ -39,12 +39,11 @@ #include #include -#include "utils_utf8.h" #include "expressionparser.h" #include "returnedcolumn.h" #include "dataconvert.h" -#include "collation.h" +#include "collation.h" // CHARSET_INFO namespace messageqcpp { diff --git a/dbcon/joblist/crossenginestep.cpp b/dbcon/joblist/crossenginestep.cpp index bbdefce0e..0929d5b94 100644 --- a/dbcon/joblist/crossenginestep.cpp +++ b/dbcon/joblist/crossenginestep.cpp @@ -17,6 +17,7 @@ // $Id: crossenginestep.cpp 9709 2013-07-20 06:08:46Z xlou $ +#define PREFER_MY_CONFIG_H #include "crossenginestep.h" #include //#define NDEBUG diff --git a/dbcon/joblist/jlf_graphics.cpp b/dbcon/joblist/jlf_graphics.cpp index 1759a70be..126da5b34 100644 --- a/dbcon/joblist/jlf_graphics.cpp +++ b/dbcon/joblist/jlf_graphics.cpp @@ -18,6 +18,7 @@ // $Id: jlf_graphics.cpp 9550 2013-05-17 23:58:07Z xlou $ // Cross engine at the top due to MySQL includes +#define PREFER_MY_CONFIG_H #include "crossenginestep.h" #include using namespace std; diff --git a/dbcon/joblist/jlf_tuplejoblist.cpp b/dbcon/joblist/jlf_tuplejoblist.cpp index b1215ecc5..ed8ae3d66 100644 --- a/dbcon/joblist/jlf_tuplejoblist.cpp +++ b/dbcon/joblist/jlf_tuplejoblist.cpp @@ -19,6 +19,7 @@ // $Id: jlf_tuplejoblist.cpp 9728 2013-07-26 22:08:20Z xlou $ // Cross engine needs to be at the top due to MySQL includes +#define PREFER_MY_CONFIG_H #include "crossenginestep.h" #include #include diff --git a/dbcon/joblist/joblist.cpp b/dbcon/joblist/joblist.cpp index 8a8a89065..03692de15 100644 --- a/dbcon/joblist/joblist.cpp +++ b/dbcon/joblist/joblist.cpp @@ -19,6 +19,7 @@ // $Id: joblist.cpp 9655 2013-06-25 23:08:13Z xlou $ // Cross engine needs to be at the top due to MySQL includes +#define PREFER_MY_CONFIG_H #include "crossenginestep.h" #include "errorcodes.h" #include diff --git a/dbcon/joblist/tupleaggregatestep.cpp b/dbcon/joblist/tupleaggregatestep.cpp index bc5920d75..8a995b4e0 100644 --- a/dbcon/joblist/tupleaggregatestep.cpp +++ b/dbcon/joblist/tupleaggregatestep.cpp @@ -21,6 +21,7 @@ //#define NDEBUG // Cross engine needs to be at top due to MySQL includes +#define PREFER_MY_CONFIG_H #include "crossenginestep.h" #include diff --git a/dbcon/mysql/ha_exists_sub.cpp b/dbcon/mysql/ha_exists_sub.cpp index 4c6ebd424..9b80fbe28 100644 --- a/dbcon/mysql/ha_exists_sub.cpp +++ b/dbcon/mysql/ha_exists_sub.cpp @@ -25,6 +25,7 @@ /** class ExistsSub definition */ //#define NDEBUG +#define PREFER_MY_CONFIG_H #include #include diff --git a/dbcon/mysql/ha_from_sub.cpp b/dbcon/mysql/ha_from_sub.cpp index c95bbe96c..19c96e1d0 100644 --- a/dbcon/mysql/ha_from_sub.cpp +++ b/dbcon/mysql/ha_from_sub.cpp @@ -25,6 +25,7 @@ /** class FromSubSelect definition */ //#define NDEBUG +#define PREFER_MY_CONFIG_H #include #include #include diff --git a/dbcon/mysql/ha_in_sub.cpp b/dbcon/mysql/ha_in_sub.cpp index 6aa0738e7..b57b78c56 100644 --- a/dbcon/mysql/ha_in_sub.cpp +++ b/dbcon/mysql/ha_in_sub.cpp @@ -24,6 +24,7 @@ /** @file */ /** class InSub definition */ +#define PREFER_MY_CONFIG_H #include #include //#define NDEBUG diff --git a/dbcon/mysql/ha_mcs_client_udfs.cpp b/dbcon/mysql/ha_mcs_client_udfs.cpp index 6dd48d102..5670d1313 100644 --- a/dbcon/mysql/ha_mcs_client_udfs.cpp +++ b/dbcon/mysql/ha_mcs_client_udfs.cpp @@ -17,6 +17,7 @@ MA 02110-1301, USA. */ #define NEED_CALPONT_INTERFACE +#define PREFER_MY_CONFIG_H 1 #include "ha_mcs_impl.h" #include "ha_mcs_impl_if.h" diff --git a/dbcon/mysql/ha_mcs_ddl.cpp b/dbcon/mysql/ha_mcs_ddl.cpp index 61b0900a6..e5738e993 100644 --- a/dbcon/mysql/ha_mcs_ddl.cpp +++ b/dbcon/mysql/ha_mcs_ddl.cpp @@ -20,6 +20,7 @@ * $Id: ha_mcs_ddl.cpp 9675 2013-07-11 15:38:12Z chao $ */ +#define PREFER_MY_CONFIG_H #include #include #include @@ -2403,7 +2404,7 @@ int ha_mcs_impl_create_(const char* name, TABLE* table_arg, HA_CREATE_INFO* crea (!share->table_charset || field_cs->number != share->table_charset->number)) { - oss << " CHARACTER SET " << field_cs->csname; + oss << " CHARACTER SET " << field_cs->cs_name.str; } } @@ -2445,7 +2446,7 @@ int ha_mcs_impl_create_(const char* name, TABLE* table_arg, HA_CREATE_INFO* crea if (share->table_charset) { - oss << " DEFAULT CHARSET=" << share->table_charset->csname; + oss << " DEFAULT CHARSET=" << share->table_charset->cs_name.str; } // Process table level options such as MIN_ROWS, MAX_ROWS, COMMENT diff --git a/dbcon/mysql/ha_mcs_dml.cpp b/dbcon/mysql/ha_mcs_dml.cpp index 68ccff713..742488592 100644 --- a/dbcon/mysql/ha_mcs_dml.cpp +++ b/dbcon/mysql/ha_mcs_dml.cpp @@ -20,6 +20,7 @@ * $Id: ha_mcs_dml.cpp 9711 2013-07-23 21:01:27Z chao $ */ +#define PREFER_MY_CONFIG_H #include #include #include diff --git a/dbcon/mysql/ha_mcs_execplan.cpp b/dbcon/mysql/ha_mcs_execplan.cpp index ef77ed803..dc65c68f8 100755 --- a/dbcon/mysql/ha_mcs_execplan.cpp +++ b/dbcon/mysql/ha_mcs_execplan.cpp @@ -39,7 +39,6 @@ #include #include -#include "mcsv1_udaf.h" using namespace std; @@ -51,8 +50,12 @@ using namespace std; #include "errorids.h" using namespace logging; +#define PREFER_MY_CONFIG_H +#include #include "idb_mysql.h" +#include "mcsv1_udaf.h" + #include "ha_mcs_impl_if.h" #include "ha_mcs_sysvars.h" #include "ha_subquery.h" @@ -85,7 +88,6 @@ using namespace execplan; #include "functor.h" using namespace funcexp; -#include "collation.h" #include "vlarray.h" const uint64_t AGG_BIT = 0x01; @@ -2287,7 +2289,7 @@ SimpleColumn* buildSimpleColFromDerivedTable(gp_walk_info& gwi, Item_field* ifp) sc->oid(oidlist[j].objnum); // @bug 3003. Keep column alias if it has. - sc->alias(ifp->is_autogenerated_name() ? tcn.column : ifp->name.str); + sc->alias(!ifp->is_explicit_name() ? tcn.column : ifp->name.str); sc->tableAlias(gwi.tbList[i].alias); sc->viewName(viewName, lower_case_table_names); @@ -2345,7 +2347,7 @@ SimpleColumn* buildSimpleColFromDerivedTable(gp_walk_info& gwi, Item_field* ifp) sc->columnName(col->columnName()); // @bug 3003. Keep column alias if it has. - sc->alias(ifp->is_autogenerated_name() ? cols[j]->alias() : ifp->name.str); + sc->alias(!ifp->is_explicit_name() ? cols[j]->alias() : ifp->name.str); sc->tableName(csep->derivedTbAlias()); sc->colPosition(j); sc->tableAlias(csep->derivedTbAlias()); @@ -3084,7 +3086,7 @@ ReturnedColumn* buildReturnedColumn( { //if ( ((gwi.thd->lex)->sql_command == SQLCOM_UPDATE ) || ((gwi.thd->lex)->sql_command == SQLCOM_UPDATE_MULTI )) { - if ( !item->is_fixed()) + if ( !item->fixed()) { item->fix_fields(gwi.thd, (Item**)&item); } @@ -3699,11 +3701,11 @@ ReturnedColumn* buildFunctionColumn( if (funcName == "charset") { - val = info->csname; + val = info->cs_name.str; } else // collation { - val = info->name; + val = info->coll_name.str; } rc = new ConstantColumn(val, ConstantColumn::LITERAL); @@ -4108,7 +4110,7 @@ ReturnedColumn* buildFunctionColumn( funcName == "strcmp") { DTCollation dt; - ifp->Type_std_attributes::agg_arg_charsets_for_comparison(dt, ifp->func_name(), ifp->arguments(), 1, 1); + ifp->Type_std_attributes::agg_arg_charsets_for_comparison(dt, ifp->func_name_cstring(), ifp->arguments(), 1, 1); fc->charsetNumber(dt.collation->number); } else @@ -5380,7 +5382,7 @@ void gp_walk(const Item* item, void* arg) if (!gwip->condPush) { - if (!ifp->is_fixed()) + if (!ifp->fixed()) { ifp->fix_fields(gwip->thd, reinterpret_cast(&ifp)); } @@ -6411,7 +6413,7 @@ int processWhere(SELECT_LEX &select_lex, { // MariaDB bug 624 - without the fix_fields call, delete with join may error with "No query step". //@bug 3039. fix fields for constants - if (!icp->is_fixed()) + if (!icp->fixed()) { icp->fix_fields(gwi.thd, (Item**)&icp); } @@ -6732,9 +6734,9 @@ int processLimitAndOffset( // select_lex->limit_params.offset_limit if not null. if (join->select_lex && join->select_lex->limit_params.offset_limit && - join->select_lex->limit_params.offset_limit->is_fixed() && + join->select_lex->limit_params.offset_limit->fixed() && join->select_lex->limit_params.select_limit && - join->select_lex->limit_params.select_limit->is_fixed()) + join->select_lex->limit_params.select_limit->fixed()) { limitOffset = join->select_lex->limit_params.offset_limit->val_int(); limitNum = join->select_lex->limit_params.select_limit->val_int(); @@ -7035,7 +7037,7 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, ifp->print(&str, QT_ORDINARY); fullname = str.c_ptr(); - if (ifp->is_autogenerated_name()) // no alias + if (!ifp->is_explicit_name()) // no alias { sc->alias(fullname); } @@ -7681,7 +7683,7 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, gwi.groupByCols.push_back(srcp); continue; } - else if (!groupItem->is_autogenerated_name()) // alias + else if (groupItem->is_explicit_name()) // alias { uint32_t i = 0; @@ -8653,7 +8655,7 @@ int getGroupPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, cal_gro // MariaDB bug 624 - without the fix_fields call, delete with join may error with "No query step". //#if MYSQL_VERSION_ID < 50172 //@bug 3039. fix fields for constants - if (!icp->is_fixed()) + if (!icp->fixed()) { icp->fix_fields(gwi.thd, (Item**)&icp); } @@ -8876,7 +8878,7 @@ int getGroupPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, cal_gro ifp->print(&str, QT_ORDINARY); fullname = str.c_ptr(); - if (ifp->is_autogenerated_name()) // no alias + if (!ifp->is_explicit_name()) // no alias { sc->alias(fullname); } @@ -9475,7 +9477,7 @@ int getGroupPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, cal_gro gwi.groupByCols.push_back(srcp); continue; } - else if (!groupItem->is_autogenerated_name()) // alias + else if (groupItem->is_explicit_name()) // alias { uint32_t i = 0; diff --git a/dbcon/mysql/ha_mcs_impl.cpp b/dbcon/mysql/ha_mcs_impl.cpp index 64a8a1bdf..63fb8c026 100644 --- a/dbcon/mysql/ha_mcs_impl.cpp +++ b/dbcon/mysql/ha_mcs_impl.cpp @@ -16,6 +16,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#define PREFER_MY_CONFIG_H #include #ifndef _MSC_VER #include diff --git a/dbcon/mysql/ha_mcs_opt_rewrites.cpp b/dbcon/mysql/ha_mcs_opt_rewrites.cpp index 28acfa0a8..af8ca011a 100644 --- a/dbcon/mysql/ha_mcs_opt_rewrites.cpp +++ b/dbcon/mysql/ha_mcs_opt_rewrites.cpp @@ -125,7 +125,7 @@ simplify_joins_mcs(JOIN *join, List *join_list, COND *conds, bool to conds= and_conds(join->thd, conds, table->on_expr); conds->top_level_item(); /* conds is always a new item as both cond and on_expr existed */ - DBUG_ASSERT(!conds->is_fixed()); + DBUG_ASSERT(!conds->fixed()); conds->fix_fields(join->thd, &conds); } else diff --git a/dbcon/mysql/ha_mcs_partition.cpp b/dbcon/mysql/ha_mcs_partition.cpp index a707acb4a..c8cacf0fb 100644 --- a/dbcon/mysql/ha_mcs_partition.cpp +++ b/dbcon/mysql/ha_mcs_partition.cpp @@ -20,6 +20,7 @@ * $Id: ha_mcs_partition.cpp 9642 2013-06-24 14:57:42Z rdempsey $ */ +#define PREFER_MY_CONFIG_H #include #include #include diff --git a/dbcon/mysql/ha_mcs_pushdown.h b/dbcon/mysql/ha_mcs_pushdown.h index 4492f0470..ce4dc839e 100644 --- a/dbcon/mysql/ha_mcs_pushdown.h +++ b/dbcon/mysql/ha_mcs_pushdown.h @@ -18,6 +18,7 @@ #ifndef HA_MCS_PUSH #define HA_MCS_PUSH +#define PREFER_MY_CONFIG_H #include "idb_mysql.h" #include "ha_mcs.h" #include "ha_mcs_sysvars.h" diff --git a/dbcon/mysql/ha_pseudocolumn.cpp b/dbcon/mysql/ha_pseudocolumn.cpp index c355efea0..ae1ddc01e 100644 --- a/dbcon/mysql/ha_pseudocolumn.cpp +++ b/dbcon/mysql/ha_pseudocolumn.cpp @@ -1,3 +1,4 @@ +#define PREFER_MY_CONFIG_H #include //#include #include diff --git a/dbcon/mysql/ha_scalar_sub.cpp b/dbcon/mysql/ha_scalar_sub.cpp index 7d6d2dd11..b0170e2fd 100644 --- a/dbcon/mysql/ha_scalar_sub.cpp +++ b/dbcon/mysql/ha_scalar_sub.cpp @@ -25,6 +25,7 @@ /** class ScalarSub definition */ //#define NDEBUG +#define PREFER_MY_CONFIG_H #include #include #include diff --git a/dbcon/mysql/ha_select_sub.cpp b/dbcon/mysql/ha_select_sub.cpp index 6d5dfd611..000c61720 100644 --- a/dbcon/mysql/ha_select_sub.cpp +++ b/dbcon/mysql/ha_select_sub.cpp @@ -24,6 +24,7 @@ /** class SelectSubQuery definition */ //#define NDEBUG +#define PREFER_MY_CONFIG_H #include #include using namespace std; diff --git a/dbcon/mysql/ha_view.cpp b/dbcon/mysql/ha_view.cpp index 321e645ac..e3b82b141 100644 --- a/dbcon/mysql/ha_view.cpp +++ b/dbcon/mysql/ha_view.cpp @@ -22,6 +22,7 @@ * ***********************************************************************/ +#define PREFER_MY_CONFIG_H #include #include "idb_mysql.h" diff --git a/dbcon/mysql/ha_window_function.cpp b/dbcon/mysql/ha_window_function.cpp index 6a15d30fb..2f8025e3f 100644 --- a/dbcon/mysql/ha_window_function.cpp +++ b/dbcon/mysql/ha_window_function.cpp @@ -21,6 +21,7 @@ * * ***********************************************************************/ +#define PREFER_MY_CONFIG_H #include #include #include diff --git a/dbcon/mysql/idb_mysql.h b/dbcon/mysql/idb_mysql.h index 70bafeced..921505f53 100644 --- a/dbcon/mysql/idb_mysql.h +++ b/dbcon/mysql/idb_mysql.h @@ -21,6 +21,10 @@ #ifndef IDB_MYSQL_H__ #define IDB_MYSQL_H__ +#ifdef TEST_MCSCONFIG_H +#error mcsconfig.h was included before idb_mysql.h +#endif + #ifdef _MSC_VER #include #if _MSC_VER >= 1800 @@ -79,6 +83,7 @@ template bool isnan(T); #include "my_dbug.h" // Now clean up the pollution as best we can... +#include "mcsconfig_conflicting_defs_undef.h" #undef min #undef max #undef UNKNOWN @@ -96,11 +101,6 @@ template bool isnan(T); #undef sleep #undef getpid #undef SIZEOF_LONG -#undef PACKAGE_VERSION -#undef PACKAGE_TARNAME -#undef PACKAGE_STRING -#undef PACKAGE_NAME -#undef PACKAGE_BUGREPORT #undef DEBUG #undef set_bits #undef likely diff --git a/dbcon/mysql/is_columnstore_columns.cpp b/dbcon/mysql/is_columnstore_columns.cpp index 75a368cec..1166b13d0 100644 --- a/dbcon/mysql/is_columnstore_columns.cpp +++ b/dbcon/mysql/is_columnstore_columns.cpp @@ -20,6 +20,7 @@ * MA 02110-1301, USA. */ +#define PREFER_MY_CONFIG_H #include "idb_mysql.h" #include #include diff --git a/dbcon/mysql/is_columnstore_extents.cpp b/dbcon/mysql/is_columnstore_extents.cpp index f1ab1f3a7..38e3ac262 100644 --- a/dbcon/mysql/is_columnstore_extents.cpp +++ b/dbcon/mysql/is_columnstore_extents.cpp @@ -20,6 +20,7 @@ * MA 02110-1301, USA. */ +#define PREFER_MY_CONFIG_H #include "idb_mysql.h" #include #include diff --git a/dbcon/mysql/is_columnstore_files.cpp b/dbcon/mysql/is_columnstore_files.cpp index a64578acc..bbaa5293f 100644 --- a/dbcon/mysql/is_columnstore_files.cpp +++ b/dbcon/mysql/is_columnstore_files.cpp @@ -20,6 +20,7 @@ * MA 02110-1301, USA. */ +#define PREFER_MY_CONFIG_H #include "idb_mysql.h" #include "dbrm.h" diff --git a/dbcon/mysql/is_columnstore_tables.cpp b/dbcon/mysql/is_columnstore_tables.cpp index 4bc29837b..178d14f71 100644 --- a/dbcon/mysql/is_columnstore_tables.cpp +++ b/dbcon/mysql/is_columnstore_tables.cpp @@ -20,6 +20,7 @@ * MA 02110-1301, USA. */ +#define PREFER_MY_CONFIG_H #include "idb_mysql.h" #include diff --git a/dbcon/mysql/sm.cpp b/dbcon/mysql/sm.cpp index 5acef3805..a4894c543 100644 --- a/dbcon/mysql/sm.cpp +++ b/dbcon/mysql/sm.cpp @@ -21,6 +21,7 @@ ***********************************************************************/ +#define PREFER_MY_CONFIG_H #include #include #include @@ -536,7 +537,8 @@ unsigned long mysql_real_escape_string(MYSQL* mysql, char* to, const char* from, unsigned long length) { - return escape_string_for_mysql(mysql->charset, to, length * 2 + 1, from, length); + my_bool overflow; + return escape_string_for_mysql(mysql->charset, to, length * 2 + 1, from, length, &overflow); } // Clone of sql-common/client.c cli_use_result diff --git a/ddlproc/ddlproc.cpp b/ddlproc/ddlproc.cpp index 2a6745d3b..86594ce73 100644 --- a/ddlproc/ddlproc.cpp +++ b/ddlproc/ddlproc.cpp @@ -58,7 +58,6 @@ using namespace execplan; #include "../writeengine/client/we_clients.h" #include "dbrm.h" #include "IDBPolicy.h" -#include "utils_utf8.h" #include "crashtrace.h" #include "installdir.h" @@ -257,7 +256,7 @@ int main(int argc, char** argv) // This is unset due to the way we start it program_invocation_short_name = const_cast("DDLProc"); // Initialize the charset library - my_init(); + MY_INIT(argv[0]); return ServiceDDLProc(opt).Run(); } diff --git a/dmlproc/dmlproc.cpp b/dmlproc/dmlproc.cpp index 9736d4b06..b4a930617 100644 --- a/dmlproc/dmlproc.cpp +++ b/dmlproc/dmlproc.cpp @@ -76,7 +76,6 @@ using namespace messageqcpp; #include "distributedenginecomm.h" using namespace joblist; -#include "utils_utf8.h" #include "crashtrace.h" #include "installdir.h" @@ -701,7 +700,7 @@ int main(int argc, char** argv) // This is unset due to the way we start it program_invocation_short_name = const_cast("DMLProc"); // Initialize the charset library - my_init(); + MY_INIT(argv[0]); return ServiceDMLProc(opt).Run(); } diff --git a/exemgr/main.cpp b/exemgr/main.cpp index 0511326d3..52fab7c55 100644 --- a/exemgr/main.cpp +++ b/exemgr/main.cpp @@ -68,7 +68,6 @@ #include "MonitorProcMem.h" #include "liboamcpp.h" #include "crashtrace.h" -#include "utils_utf8.h" #include "service.h" #include @@ -1697,7 +1696,7 @@ int main(int argc, char* argv[]) program_invocation_short_name = const_cast("ExeMgr"); // Initialize the charset library - my_init(); + MY_INIT(argv[0]); return ServiceExeMgr(opt).Run(); } diff --git a/primitives/linux-port/dictionary.cpp b/primitives/linux-port/dictionary.cpp index c50154625..2403cc99b 100644 --- a/primitives/linux-port/dictionary.cpp +++ b/primitives/linux-port/dictionary.cpp @@ -30,11 +30,9 @@ using namespace std; #include "messagelog.h" #include "messageobj.h" #include "exceptclasses.h" -#include "utils_utf8.h" #include "dataconvert.h" #include -#include "collation.h" using namespace logging; diff --git a/primitives/primproc/primproc.cpp b/primitives/primproc/primproc.cpp index bd9f1c344..644ac1eb7 100644 --- a/primitives/primproc/primproc.cpp +++ b/primitives/primproc/primproc.cpp @@ -64,7 +64,6 @@ using namespace primitiveprocessor; #include "liboamcpp.h" using namespace oam; -#include "utils_utf8.h" #include "IDBPolicy.h" using namespace idbdatafile; @@ -806,7 +805,7 @@ int main(int argc, char** argv) // This is unset due to the way we start it program_invocation_short_name = const_cast("PrimProc"); // Initialize the charset library - my_init(); + MY_INIT(argv[0]); return ServicePrimProc(opt).Run(); } diff --git a/utils/common/collation.h b/utils/common/collation.h index b7f8815d4..8d4306213 100644 --- a/utils/common/collation.h +++ b/utils/common/collation.h @@ -18,6 +18,23 @@ #ifndef COLLATION_H_INCLUDED #define COLLATION_H_INCLUDED +#if defined(PREFER_MY_CONFIG_H) + + #if !defined(MY_CONFIG_H) + #error my_config.h was not included (but PREFER_MY_CONFIG_H was set) + #endif + + #include "mcsconfig_conflicting_defs_remember.h" + #include "mcsconfig_conflicting_defs_undef.h" + +#else + #if defined(MY_CONFIG_H) + #error my_config.h was included before mcsconfig.h (and PREFER_MY_CONFIG_H was not set) + #endif +#endif //PREFER_MY_CONFIG_H + +#include "mcsconfig.h" + #include "exceptclasses.h" #include "conststring.h" @@ -82,6 +99,11 @@ extern "C" MYSQL_PLUGIN_IMPORT CHARSET_INFO *default_charset_info; #endif +#if defined(PREFER_MY_CONFIG_H) + #include "mcsconfig_conflicting_defs_restore.h" +#endif + + namespace datatypes { diff --git a/utils/common/mariadb_my_sys.h b/utils/common/mariadb_my_sys.h index bd07556a9..409e1e683 100644 --- a/utils/common/mariadb_my_sys.h +++ b/utils/common/mariadb_my_sys.h @@ -22,8 +22,18 @@ // This must be included after any boost headers, or anything that includes // boost headers. and boost are not friends. + +#ifndef TEST_MCSCONFIG_H +#error mcscofig.h was not included +#endif + +#include "mcsconfig_conflicting_defs_remember.h" +#include "mcsconfig_conflicting_defs_undef.h" + #include #undef set_bits // mariadb.h defines set_bits, which is incompatible with boost #include +#include "mcsconfig_conflicting_defs_restore.h" + #endif diff --git a/utils/common/mcsconfig_conflicting_defs_remember.h b/utils/common/mcsconfig_conflicting_defs_remember.h new file mode 100644 index 000000000..0a1203eca --- /dev/null +++ b/utils/common/mcsconfig_conflicting_defs_remember.h @@ -0,0 +1,32 @@ +/* + Copyright (C) 2021 MariaDB Corporation + + 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 the Free Software Foundation; version 2 of + the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + MA 02110-1301, USA. */ + +/* + Remember all conflicting definitions + (between my_config.h and mcsconfig.h) + so that we can restore them later. +*/ + +#pragma push_macro("PACKAGE") +#pragma push_macro("PACKAGE_BUGREPORT") +#pragma push_macro("PACKAGE_NAME") +#pragma push_macro("PACKAGE_STRING") +#pragma push_macro("PACKAGE_TARNAME") +#pragma push_macro("PACKAGE_VERSION") +#pragma push_macro("VERSION") +#pragma push_macro("HAVE_STRTOLL") diff --git a/utils/common/mcsconfig_conflicting_defs_restore.h b/utils/common/mcsconfig_conflicting_defs_restore.h new file mode 100644 index 000000000..cef316b89 --- /dev/null +++ b/utils/common/mcsconfig_conflicting_defs_restore.h @@ -0,0 +1,32 @@ +/* + Copyright (C) 2021 MariaDB Corporation + + 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 the Free Software Foundation; version 2 of + the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + MA 02110-1301, USA. */ + +/* + Restore all conflicting definitions + (between my_config.h and mcsconfig.h) + previously remembered by mcsconfig_conflicting_defs_remember.h +*/ + +#pragma pop_macro("PACKAGE") +#pragma pop_macro("PACKAGE_BUGREPORT") +#pragma pop_macro("PACKAGE_NAME") +#pragma pop_macro("PACKAGE_STRING") +#pragma pop_macro("PACKAGE_TARNAME") +#pragma pop_macro("PACKAGE_VERSION") +#pragma pop_macro("VERSION") +#pragma pop_macro("HAVE_STRTOLL") diff --git a/utils/common/mcsconfig_conflicting_defs_undef.h b/utils/common/mcsconfig_conflicting_defs_undef.h new file mode 100644 index 000000000..86af3bd09 --- /dev/null +++ b/utils/common/mcsconfig_conflicting_defs_undef.h @@ -0,0 +1,34 @@ +/* + Copyright (C) 2021 MariaDB Corporation + + 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 the Free Software Foundation; version 2 of + the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + MA 02110-1301, USA. */ + +/* + Undefine all conflicting definitions + (between my_config.h and mcsconfig.h) + so that we include: + - mcsconfig.h after my_config.h, or + - my_config.h after mcsconfig.h +*/ + +#undef PACKAGE +#undef PACKAGE_BUGREPORT +#undef PACKAGE_NAME +#undef PACKAGE_STRING +#undef PACKAGE_TARNAME +#undef PACKAGE_VERSION +#undef VERSION +#undef HAVE_STRTOLL diff --git a/utils/common/utils_utf8.cpp b/utils/common/utils_utf8.cpp index 7ed4003aa..cb23bb6a8 100644 --- a/utils/common/utils_utf8.cpp +++ b/utils/common/utils_utf8.cpp @@ -14,10 +14,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ #include "utils_utf8.h" -#include "collation.h" #include "mariadb_my_sys.h" -#include namespace datatypes diff --git a/utils/funcexp/func_between.cpp b/utils/funcexp/func_between.cpp index a7a6da074..b5632b94b 100644 --- a/utils/funcexp/func_between.cpp +++ b/utils/funcexp/func_between.cpp @@ -38,7 +38,6 @@ using namespace execplan; #include "idberrorinfo.h" #include "errorids.h" -#include "collation.h" using namespace logging; diff --git a/utils/funcexp/func_case.cpp b/utils/funcexp/func_case.cpp index 0204d9abf..40f55e1fd 100644 --- a/utils/funcexp/func_case.cpp +++ b/utils/funcexp/func_case.cpp @@ -40,10 +40,8 @@ using namespace rowgroup; #include "errorids.h" using namespace logging; -#include "utils_utf8.h" using namespace funcexp; -#include "collation.h" namespace { diff --git a/utils/funcexp/func_cast.cpp b/utils/funcexp/func_cast.cpp index 9ee592234..35624aeef 100644 --- a/utils/funcexp/func_cast.cpp +++ b/utils/funcexp/func_cast.cpp @@ -42,7 +42,6 @@ using namespace logging; #include "dataconvert.h" #include "numericliteral.h" using namespace dataconvert; -#include "collation.h" #include "checks.h" diff --git a/utils/funcexp/func_char.cpp b/utils/funcexp/func_char.cpp index 560af215b..46c79d82b 100644 --- a/utils/funcexp/func_char.cpp +++ b/utils/funcexp/func_char.cpp @@ -38,8 +38,6 @@ using namespace rowgroup; #include "errorids.h" using namespace logging; -#include "collation.h" -#include "mariadb_my_sys.h" #include // min_intXstore() #include "vlarray.h" @@ -169,7 +167,7 @@ string Func_char::getStrVal(Row& row, { numBytes = actualBytes; ostringstream os; - os << "Invalid character string for " << cs->csname << ": value = " << hex << buf + actualBytes; + os << "Invalid character string for " << cs->cs_name.str << ": value = " << hex << buf + actualBytes; logging::Message::Args args; logging::Message message(9); args.add(os.str()); diff --git a/utils/funcexp/func_char_length.cpp b/utils/funcexp/func_char_length.cpp index 6812e8f0f..bb322241a 100644 --- a/utils/funcexp/func_char_length.cpp +++ b/utils/funcexp/func_char_length.cpp @@ -30,7 +30,6 @@ using namespace std; #include "functioncolumn.h" #include "rowgroup.h" #include "calpontsystemcatalog.h" -#include "utils_utf8.h" using namespace execplan; #include "dataconvert.h" @@ -39,7 +38,6 @@ using namespace execplan; #include "idberrorinfo.h" #include "errorids.h" -#include "collation.h" using namespace logging; diff --git a/utils/funcexp/func_concat.cpp b/utils/funcexp/func_concat.cpp index e2415f7d5..74a43ca28 100644 --- a/utils/funcexp/func_concat.cpp +++ b/utils/funcexp/func_concat.cpp @@ -26,7 +26,6 @@ using namespace std; #include "functor_str.h" #include "functioncolumn.h" -#include "utils_utf8.h" using namespace execplan; #include "rowgroup.h" diff --git a/utils/funcexp/func_concat_oracle.cpp b/utils/funcexp/func_concat_oracle.cpp index fbc0be844..06f7ed254 100644 --- a/utils/funcexp/func_concat_oracle.cpp +++ b/utils/funcexp/func_concat_oracle.cpp @@ -20,7 +20,6 @@ using namespace std; #include "functor_str.h" #include "functioncolumn.h" -#include "utils_utf8.h" using namespace execplan; #include "rowgroup.h" diff --git a/utils/funcexp/func_concat_ws.cpp b/utils/funcexp/func_concat_ws.cpp index 21d1ae955..eb89c1b31 100644 --- a/utils/funcexp/func_concat_ws.cpp +++ b/utils/funcexp/func_concat_ws.cpp @@ -26,13 +26,12 @@ using namespace std; #include "functor_str.h" #include "functioncolumn.h" -#include "utils_utf8.h" +#include "utils_utf8.h" // idb_mbstowcs() using namespace execplan; #include "rowgroup.h" using namespace rowgroup; -#include "collation.h" namespace funcexp { diff --git a/utils/funcexp/func_decode_oracle.cpp b/utils/funcexp/func_decode_oracle.cpp index 11bb3a0b7..2caf2fa15 100644 --- a/utils/funcexp/func_decode_oracle.cpp +++ b/utils/funcexp/func_decode_oracle.cpp @@ -33,10 +33,8 @@ using namespace rowgroup; #include "errorids.h" using namespace logging; -#include "utils_utf8.h" using namespace funcexp; -#include "collation.h" namespace { diff --git a/utils/funcexp/func_find_in_set.cpp b/utils/funcexp/func_find_in_set.cpp index 21f45943d..a272e0bc3 100644 --- a/utils/funcexp/func_find_in_set.cpp +++ b/utils/funcexp/func_find_in_set.cpp @@ -42,7 +42,6 @@ using namespace execplan; #include "errorids.h" using namespace logging; -#include "collation.h" namespace funcexp { diff --git a/utils/funcexp/func_greatest.cpp b/utils/funcexp/func_greatest.cpp index b8bbef60f..5a1085a19 100644 --- a/utils/funcexp/func_greatest.cpp +++ b/utils/funcexp/func_greatest.cpp @@ -37,10 +37,8 @@ using namespace rowgroup; #include "joblisttypes.h" using namespace joblist; -#include "utils_utf8.h" using namespace funcexp; -#include "collation.h" namespace funcexp { diff --git a/utils/funcexp/func_in.cpp b/utils/funcexp/func_in.cpp index bd0ae3662..ad5270805 100644 --- a/utils/funcexp/func_in.cpp +++ b/utils/funcexp/func_in.cpp @@ -41,10 +41,8 @@ using namespace execplan; #include "errorids.h" using namespace logging; -#include "utils_utf8.h" using namespace funcexp; -#include "collation.h" namespace { diff --git a/utils/funcexp/func_insert.cpp b/utils/funcexp/func_insert.cpp index b8fa0588c..a9d707d34 100644 --- a/utils/funcexp/func_insert.cpp +++ b/utils/funcexp/func_insert.cpp @@ -37,7 +37,6 @@ using namespace joblist; #include "utf8.h" using namespace utf8; -#include "collation.h" namespace funcexp { diff --git a/utils/funcexp/func_instr.cpp b/utils/funcexp/func_instr.cpp index dae5fb473..3b89aa453 100644 --- a/utils/funcexp/func_instr.cpp +++ b/utils/funcexp/func_instr.cpp @@ -29,11 +29,8 @@ using namespace std; #include "functor_int.h" #include "functioncolumn.h" #include "rowgroup.h" -#include "utils_utf8.h" using namespace execplan; -#include "collation.h" - namespace funcexp { CalpontSystemCatalog::ColType Func_instr::operationType( FunctionParm& fp, CalpontSystemCatalog::ColType& resultType ) diff --git a/utils/funcexp/func_lcase.cpp b/utils/funcexp/func_lcase.cpp index 64296d156..53e4bc5b1 100644 --- a/utils/funcexp/func_lcase.cpp +++ b/utils/funcexp/func_lcase.cpp @@ -26,7 +26,6 @@ using namespace std; #include "functor_str.h" #include "functioncolumn.h" -#include "utils_utf8.h" using namespace execplan; #include "rowgroup.h" @@ -35,7 +34,6 @@ using namespace rowgroup; #include "joblisttypes.h" using namespace joblist; -#include "collation.h" namespace funcexp { diff --git a/utils/funcexp/func_least.cpp b/utils/funcexp/func_least.cpp index 51add0c17..3fe002d29 100644 --- a/utils/funcexp/func_least.cpp +++ b/utils/funcexp/func_least.cpp @@ -37,10 +37,8 @@ using namespace rowgroup; #include "joblisttypes.h" using namespace joblist; -#include "utils_utf8.h" using namespace funcexp; -#include "collation.h" namespace funcexp { diff --git a/utils/funcexp/func_left.cpp b/utils/funcexp/func_left.cpp index 6c8bad1e2..ae81a6b41 100644 --- a/utils/funcexp/func_left.cpp +++ b/utils/funcexp/func_left.cpp @@ -25,7 +25,6 @@ using namespace std; #include "functor_str.h" #include "functioncolumn.h" -#include "utils_utf8.h" using namespace execplan; #include "rowgroup.h" @@ -34,7 +33,6 @@ using namespace rowgroup; #include "joblisttypes.h" using namespace joblist; -#include "collation.h" namespace funcexp { diff --git a/utils/funcexp/func_length.cpp b/utils/funcexp/func_length.cpp index 98e941ab1..89900f680 100644 --- a/utils/funcexp/func_length.cpp +++ b/utils/funcexp/func_length.cpp @@ -33,7 +33,6 @@ using namespace execplan; #include "rowgroup.h" -#include "collation.h" namespace funcexp { diff --git a/utils/funcexp/func_lpad.cpp b/utils/funcexp/func_lpad.cpp index 737edef70..1022f3b24 100644 --- a/utils/funcexp/func_lpad.cpp +++ b/utils/funcexp/func_lpad.cpp @@ -27,7 +27,6 @@ using namespace std; #include "functor_str.h" #include "functioncolumn.h" -#include "utils_utf8.h" using namespace execplan; #include "rowgroup.h" @@ -36,9 +35,7 @@ using namespace rowgroup; #include "joblisttypes.h" using namespace joblist; -#include "collation.h" -#include // INT_MAX32 - +#define INT_MAX32 0x7FFFFFFF namespace funcexp { diff --git a/utils/funcexp/func_ltrim.cpp b/utils/funcexp/func_ltrim.cpp index 5af7dd3b9..f7ef9a38d 100644 --- a/utils/funcexp/func_ltrim.cpp +++ b/utils/funcexp/func_ltrim.cpp @@ -26,7 +26,6 @@ using namespace std; #include "functor_str.h" #include "functioncolumn.h" -#include "utils_utf8.h" using namespace execplan; #include "rowgroup.h" @@ -35,7 +34,6 @@ using namespace rowgroup; #include "joblisttypes.h" using namespace joblist; -#include "collation.h" namespace funcexp { diff --git a/utils/funcexp/func_ltrim_oracle.cpp b/utils/funcexp/func_ltrim_oracle.cpp index 522459449..3a726c29e 100644 --- a/utils/funcexp/func_ltrim_oracle.cpp +++ b/utils/funcexp/func_ltrim_oracle.cpp @@ -26,7 +26,6 @@ using namespace std; #include "functor_str.h" #include "functioncolumn.h" -#include "utils_utf8.h" using namespace execplan; #include "rowgroup.h" @@ -35,7 +34,6 @@ using namespace rowgroup; #include "joblisttypes.h" using namespace joblist; -#include "collation.h" namespace funcexp { diff --git a/utils/funcexp/func_nullif.cpp b/utils/funcexp/func_nullif.cpp index f71b62e5d..5fb5062b0 100644 --- a/utils/funcexp/func_nullif.cpp +++ b/utils/funcexp/func_nullif.cpp @@ -42,10 +42,8 @@ using namespace logging; using namespace dataconvert; #include "funchelpers.h" -#include "utils_utf8.h" using namespace funcexp; -#include "collation.h" namespace funcexp { diff --git a/utils/funcexp/func_replace.cpp b/utils/funcexp/func_replace.cpp index 751e7bb36..20299f027 100644 --- a/utils/funcexp/func_replace.cpp +++ b/utils/funcexp/func_replace.cpp @@ -34,7 +34,6 @@ using namespace rowgroup; #include "joblisttypes.h" using namespace joblist; -#include "collation.h" namespace funcexp { diff --git a/utils/funcexp/func_replace_oracle.cpp b/utils/funcexp/func_replace_oracle.cpp index 312d2243f..79c09e12d 100644 --- a/utils/funcexp/func_replace_oracle.cpp +++ b/utils/funcexp/func_replace_oracle.cpp @@ -28,7 +28,6 @@ using namespace rowgroup; #include "joblisttypes.h" using namespace joblist; -#include "collation.h" namespace funcexp { diff --git a/utils/funcexp/func_reverse.cpp b/utils/funcexp/func_reverse.cpp index 3ab9bf9dd..9749c0a83 100644 --- a/utils/funcexp/func_reverse.cpp +++ b/utils/funcexp/func_reverse.cpp @@ -34,8 +34,6 @@ using namespace rowgroup; #include "joblisttypes.h" using namespace joblist; -#include "collation.h" -#include // DBUG_ASSERT namespace funcexp { @@ -76,7 +74,7 @@ std::string Func_reverse::getStrVal(rowgroup::Row& row, if ((l = my_ismbchar(cs, pos, end))) { tmp -= l; - DBUG_ASSERT(tmp >= pbuf); + idbassert(tmp >= pbuf); memcpy(tmp, pos, l); pos += l; } diff --git a/utils/funcexp/func_right.cpp b/utils/funcexp/func_right.cpp index cfcb3c45f..6c96882ce 100644 --- a/utils/funcexp/func_right.cpp +++ b/utils/funcexp/func_right.cpp @@ -26,7 +26,6 @@ using namespace std; #include "functor_str.h" #include "functioncolumn.h" -#include "utils_utf8.h" using namespace execplan; #include "rowgroup.h" @@ -35,7 +34,6 @@ using namespace rowgroup; #include "joblisttypes.h" using namespace joblist; -#include "collation.h" namespace funcexp { diff --git a/utils/funcexp/func_rpad.cpp b/utils/funcexp/func_rpad.cpp index d521e8d41..483121369 100644 --- a/utils/funcexp/func_rpad.cpp +++ b/utils/funcexp/func_rpad.cpp @@ -26,7 +26,6 @@ using namespace std; #include "functor_str.h" #include "functioncolumn.h" -#include "utils_utf8.h" using namespace execplan; #include "rowgroup.h" @@ -35,8 +34,7 @@ using namespace rowgroup; #include "joblisttypes.h" using namespace joblist; -#include "collation.h" -#include // INT_MAX32 +#define INT_MAX32 0x7FFFFFFF namespace funcexp { diff --git a/utils/funcexp/func_rtrim.cpp b/utils/funcexp/func_rtrim.cpp index 77dc22424..70233dc8c 100644 --- a/utils/funcexp/func_rtrim.cpp +++ b/utils/funcexp/func_rtrim.cpp @@ -26,7 +26,6 @@ using namespace std; #include "functor_str.h" #include "functioncolumn.h" -#include "utils_utf8.h" using namespace execplan; #include "rowgroup.h" @@ -35,7 +34,6 @@ using namespace rowgroup; #include "joblisttypes.h" using namespace joblist; -#include "collation.h" namespace funcexp { diff --git a/utils/funcexp/func_rtrim_oracle.cpp b/utils/funcexp/func_rtrim_oracle.cpp index d45136aa1..f3b104c39 100644 --- a/utils/funcexp/func_rtrim_oracle.cpp +++ b/utils/funcexp/func_rtrim_oracle.cpp @@ -26,7 +26,6 @@ using namespace std; #include "functor_str.h" #include "functioncolumn.h" -#include "utils_utf8.h" using namespace execplan; #include "rowgroup.h" @@ -35,7 +34,6 @@ using namespace rowgroup; #include "joblisttypes.h" using namespace joblist; -#include "collation.h" namespace funcexp { diff --git a/utils/funcexp/func_strcmp.cpp b/utils/funcexp/func_strcmp.cpp index 95d786777..e3a28aedf 100644 --- a/utils/funcexp/func_strcmp.cpp +++ b/utils/funcexp/func_strcmp.cpp @@ -36,10 +36,8 @@ using namespace rowgroup; #include "joblisttypes.h" using namespace joblist; -#include "utils_utf8.h" using namespace funcexp; -#include "collation.h" namespace funcexp diff --git a/utils/funcexp/func_substr.cpp b/utils/funcexp/func_substr.cpp index 6b01f56a2..469b28c74 100644 --- a/utils/funcexp/func_substr.cpp +++ b/utils/funcexp/func_substr.cpp @@ -26,7 +26,6 @@ using namespace std; #include "functor_str.h" #include "functioncolumn.h" -#include "utils_utf8.h" using namespace execplan; #include "rowgroup.h" @@ -35,7 +34,6 @@ using namespace rowgroup; #include "joblisttypes.h" using namespace joblist; -#include "collation.h" namespace funcexp { diff --git a/utils/funcexp/func_substring_index.cpp b/utils/funcexp/func_substring_index.cpp index 2f318b0cc..83fd44063 100644 --- a/utils/funcexp/func_substring_index.cpp +++ b/utils/funcexp/func_substring_index.cpp @@ -34,7 +34,6 @@ using namespace rowgroup; #include "joblisttypes.h" using namespace joblist; -#include "collation.h" namespace funcexp { diff --git a/utils/funcexp/func_trim.cpp b/utils/funcexp/func_trim.cpp index 005183fcd..f8175a4be 100644 --- a/utils/funcexp/func_trim.cpp +++ b/utils/funcexp/func_trim.cpp @@ -26,7 +26,6 @@ using namespace std; #include "functor_str.h" #include "functioncolumn.h" -#include "utils_utf8.h" using namespace execplan; #include "rowgroup.h" @@ -35,7 +34,6 @@ using namespace rowgroup; #include "joblisttypes.h" using namespace joblist; -#include "collation.h" namespace funcexp { diff --git a/utils/funcexp/func_trim_oracle.cpp b/utils/funcexp/func_trim_oracle.cpp index 4b27a4d56..56f2c1c4b 100644 --- a/utils/funcexp/func_trim_oracle.cpp +++ b/utils/funcexp/func_trim_oracle.cpp @@ -21,7 +21,6 @@ using namespace std; #include "functor_str.h" #include "functioncolumn.h" -#include "utils_utf8.h" using namespace execplan; #include "rowgroup.h" @@ -30,7 +29,6 @@ using namespace rowgroup; #include "joblisttypes.h" using namespace joblist; -#include "collation.h" namespace funcexp { diff --git a/utils/funcexp/func_ucase.cpp b/utils/funcexp/func_ucase.cpp index f8d21b8a2..66157f3b2 100644 --- a/utils/funcexp/func_ucase.cpp +++ b/utils/funcexp/func_ucase.cpp @@ -26,7 +26,6 @@ using namespace std; #include "functor_str.h" #include "functioncolumn.h" -#include "utils_utf8.h" using namespace execplan; #include "rowgroup.h" @@ -35,7 +34,6 @@ using namespace rowgroup; #include "joblisttypes.h" using namespace joblist; -#include "collation.h" class to_upper { diff --git a/utils/idbdatafile/IDBPolicy.cpp b/utils/idbdatafile/IDBPolicy.cpp index 514681859..8210ce93f 100644 --- a/utils/idbdatafile/IDBPolicy.cpp +++ b/utils/idbdatafile/IDBPolicy.cpp @@ -32,7 +32,7 @@ #include "IDBLogger.h" #include "IDBFactory.h" #ifdef _MSC_VER -#include "utils_utf8.h" +#include "utils_utf8.h" // idb_wcstombs() #endif #include "installdir.h" diff --git a/utils/querystats/querystats.cpp b/utils/querystats/querystats.cpp index cc9a1d51c..4810c1650 100644 --- a/utils/querystats/querystats.cpp +++ b/utils/querystats/querystats.cpp @@ -21,8 +21,10 @@ * ***********************************************************************/ +#define PREFER_MY_CONFIG_H #include #include + #include using namespace std; diff --git a/utils/rowgroup/rowaggregation.cpp b/utils/rowgroup/rowaggregation.cpp index e25c9b465..25f89b305 100755 --- a/utils/rowgroup/rowaggregation.cpp +++ b/utils/rowgroup/rowaggregation.cpp @@ -49,10 +49,8 @@ #include "funcexp.h" #include "rowaggregation.h" #include "calpontsystemcatalog.h" -#include "utils_utf8.h" #include "vlarray.h" -#include "collation.h" //..comment out NDEBUG to enable assertions, uncomment NDEBUG to disable //#define NDEBUG diff --git a/utils/rowgroup/rowaggregation.h b/utils/rowgroup/rowaggregation.h index 7d40faadd..0e7bd3cb1 100644 --- a/utils/rowgroup/rowaggregation.h +++ b/utils/rowgroup/rowaggregation.h @@ -53,7 +53,6 @@ #include "mcsv1_udaf.h" #include "constantcolumn.h" -#include "collation.h" // To do: move code that depends on joblist to a proper subsystem. namespace joblist diff --git a/utils/rowgroup/rowgroup.cpp b/utils/rowgroup/rowgroup.cpp index ec9c70438..be46b2929 100644 --- a/utils/rowgroup/rowgroup.cpp +++ b/utils/rowgroup/rowgroup.cpp @@ -45,7 +45,6 @@ using namespace execplan; #include "dataconvert.h" #include "columnwidth.h" -#include "collation.h" namespace rowgroup { diff --git a/utils/windowfunction/idborderby.cpp b/utils/windowfunction/idborderby.cpp index efec1b47a..bc5598db5 100644 --- a/utils/windowfunction/idborderby.cpp +++ b/utils/windowfunction/idborderby.cpp @@ -48,7 +48,6 @@ using namespace rowgroup; #include "joblisttypes.h" #include "mcs_decimal.h" -#include "collation.h" // See agg_arg_charsets in sql_type.h to see conversion rules for // items that have different char sets diff --git a/versioning/BRM/masternode.cpp b/versioning/BRM/masternode.cpp index ae01a922d..e8c92267a 100644 --- a/versioning/BRM/masternode.cpp +++ b/versioning/BRM/masternode.cpp @@ -34,7 +34,6 @@ #include #include "IDBPolicy.h" #include "brmtypes.h" -#include "utils_utf8.h" #include "service.h" #include "jobstep.h" diff --git a/versioning/BRM/slavenode.cpp b/versioning/BRM/slavenode.cpp index 2c4bb528f..2482791d6 100644 --- a/versioning/BRM/slavenode.cpp +++ b/versioning/BRM/slavenode.cpp @@ -35,7 +35,6 @@ #include "brmtypes.h" #include "rwlockmonitor.h" -#include "utils_utf8.h" #include "IDBPolicy.h" #include "crashtrace.h" diff --git a/writeengine/bulk/cpimport.cpp b/writeengine/bulk/cpimport.cpp index 550529fad..08d93f5d5 100644 --- a/writeengine/bulk/cpimport.cpp +++ b/writeengine/bulk/cpimport.cpp @@ -48,7 +48,6 @@ #include "we_xmlgenproc.h" #include "we_tempxmlgendata.h" #include "liboamcpp.h" -#include "utils_utf8.h" #include "IDBPolicy.h" #include "MonitorProcMem.h" #include "dataconvert.h" diff --git a/writeengine/bulk/we_bulkloadbuffer.cpp b/writeengine/bulk/we_bulkloadbuffer.cpp index 26d7c91ab..290d2ae62 100644 --- a/writeengine/bulk/we_bulkloadbuffer.cpp +++ b/writeengine/bulk/we_bulkloadbuffer.cpp @@ -43,7 +43,7 @@ #include "joblisttypes.h" -#include "utils_utf8.h" +#include "utils_utf8.h" // utf8_truncate_point() using namespace std; using namespace boost; diff --git a/writeengine/dictionary/we_dctnry.cpp b/writeengine/dictionary/we_dctnry.cpp index 7bcfc48c2..6a1be9c29 100644 --- a/writeengine/dictionary/we_dctnry.cpp +++ b/writeengine/dictionary/we_dctnry.cpp @@ -48,7 +48,7 @@ using namespace BRM; #include "IDBPolicy.h" #include "cacheutils.h" using namespace idbdatafile; -#include "utils_utf8.h" +#include "utils_utf8.h" // utf8_truncate_point() #include "checks.h" namespace diff --git a/writeengine/server/we_server.cpp b/writeengine/server/we_server.cpp index 41ab037dd..e0b0aabb1 100644 --- a/writeengine/server/we_server.cpp +++ b/writeengine/server/we_server.cpp @@ -47,7 +47,6 @@ using namespace oam; #include "distributedenginecomm.h" #include "IDBPolicy.h" -#include "utils_utf8.h" #include "dbrm.h" #include "crashtrace.h" @@ -348,7 +347,7 @@ int main(int argc, char** argv) // This is unset due to the way we start it program_invocation_short_name = const_cast("WriteEngineServ"); // Initialize the charset library - my_init(); + MY_INIT(argv[0]); return ServiceWriteEngine(opt).Run(); }