You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-30 19:23:07 +03:00
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.
This commit is contained in:
@ -25,6 +25,7 @@
|
||||
/** class ExistsSub definition */
|
||||
|
||||
//#define NDEBUG
|
||||
#define PREFER_MY_CONFIG_H
|
||||
#include <my_config.h>
|
||||
#include <cassert>
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
/** class FromSubSelect definition */
|
||||
|
||||
//#define NDEBUG
|
||||
#define PREFER_MY_CONFIG_H
|
||||
#include <my_config.h>
|
||||
#include <cassert>
|
||||
#include <map>
|
||||
|
@ -24,6 +24,7 @@
|
||||
/** @file */
|
||||
/** class InSub definition */
|
||||
|
||||
#define PREFER_MY_CONFIG_H
|
||||
#include <my_config.h>
|
||||
#include <stdint.h>
|
||||
//#define NDEBUG
|
||||
|
@ -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"
|
||||
|
@ -20,6 +20,7 @@
|
||||
* $Id: ha_mcs_ddl.cpp 9675 2013-07-11 15:38:12Z chao $
|
||||
*/
|
||||
|
||||
#define PREFER_MY_CONFIG_H
|
||||
#include <my_config.h>
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
@ -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
|
||||
|
@ -20,6 +20,7 @@
|
||||
* $Id: ha_mcs_dml.cpp 9711 2013-07-23 21:01:27Z chao $
|
||||
*/
|
||||
|
||||
#define PREFER_MY_CONFIG_H
|
||||
#include <my_config.h>
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
@ -39,7 +39,6 @@
|
||||
#include <limits>
|
||||
|
||||
#include <string.h>
|
||||
#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 <my_config.h>
|
||||
#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<Item**>(&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;
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
MA 02110-1301, USA. */
|
||||
|
||||
#define PREFER_MY_CONFIG_H
|
||||
#include <my_config.h>
|
||||
#ifndef _MSC_VER
|
||||
#include <unistd.h>
|
||||
|
@ -125,7 +125,7 @@ simplify_joins_mcs(JOIN *join, List<TABLE_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
|
||||
|
@ -20,6 +20,7 @@
|
||||
* $Id: ha_mcs_partition.cpp 9642 2013-06-24 14:57:42Z rdempsey $
|
||||
*/
|
||||
|
||||
#define PREFER_MY_CONFIG_H
|
||||
#include <my_config.h>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
@ -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"
|
||||
|
@ -1,3 +1,4 @@
|
||||
#define PREFER_MY_CONFIG_H
|
||||
#include <my_config.h>
|
||||
//#include <cmath>
|
||||
#include <iostream>
|
||||
|
@ -25,6 +25,7 @@
|
||||
/** class ScalarSub definition */
|
||||
|
||||
//#define NDEBUG
|
||||
#define PREFER_MY_CONFIG_H
|
||||
#include <my_config.h>
|
||||
#include <cassert>
|
||||
#include <vector>
|
||||
|
@ -24,6 +24,7 @@
|
||||
/** class SelectSubQuery definition */
|
||||
|
||||
//#define NDEBUG
|
||||
#define PREFER_MY_CONFIG_H
|
||||
#include <my_config.h>
|
||||
#include <cassert>
|
||||
using namespace std;
|
||||
|
@ -22,6 +22,7 @@
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
#define PREFER_MY_CONFIG_H
|
||||
#include <my_config.h>
|
||||
#include "idb_mysql.h"
|
||||
|
||||
|
@ -21,6 +21,7 @@
|
||||
*
|
||||
*
|
||||
***********************************************************************/
|
||||
#define PREFER_MY_CONFIG_H
|
||||
#include <my_config.h>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
@ -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 <stdint.h>
|
||||
#if _MSC_VER >= 1800
|
||||
@ -79,6 +83,7 @@ template <class T> 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 <class T> 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
|
||||
|
@ -20,6 +20,7 @@
|
||||
* MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#define PREFER_MY_CONFIG_H
|
||||
#include "idb_mysql.h"
|
||||
#include <vector>
|
||||
#include <limits>
|
||||
|
@ -20,6 +20,7 @@
|
||||
* MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#define PREFER_MY_CONFIG_H
|
||||
#include "idb_mysql.h"
|
||||
#include <vector>
|
||||
#include <limits>
|
||||
|
@ -20,6 +20,7 @@
|
||||
* MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#define PREFER_MY_CONFIG_H
|
||||
#include "idb_mysql.h"
|
||||
|
||||
#include "dbrm.h"
|
||||
|
@ -20,6 +20,7 @@
|
||||
* MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#define PREFER_MY_CONFIG_H
|
||||
#include "idb_mysql.h"
|
||||
#include <vector>
|
||||
|
||||
|
@ -21,6 +21,7 @@
|
||||
***********************************************************************/
|
||||
|
||||
|
||||
#define PREFER_MY_CONFIG_H
|
||||
#include <mariadb.h>
|
||||
#include <mysql.h>
|
||||
#include <my_sys.h>
|
||||
@ -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
|
||||
|
Reference in New Issue
Block a user