Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V1.0.3 10.1 #3

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
10 changes: 8 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
cmake_minimum_required (VERSION 2.8.0)
project (ibmdb2i)
######David Lowes - for compilation under IBMi7R2 with gcc from IBM yum repo
# Dave add -malign-power -malign-natural (below)
# Our power engine will run better. Also fewer gcc odd boundary over runs.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -malign-power -malign-natural")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -malign-power -malign-natural")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DMARIA_PLUGIN_INTERFACE_VERSION=536875296 -malign-power -malign-natural -DDBUG_OFF -mlong-double-128")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DMARIA_PLUGIN_INTERFACE_VERSION=536875296 -malign-power -malign-natural -DDBUG_OFF -mlong-double-128")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@davidl71, what's the magic you used to determine -DMARIA_PLUGIN_INTERFACE_VERSION=536875296?

I believe the other changes to this line are no longer needed due to other source code changes in the master branch

# message("-- ibmdb2i CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}")
# message("-- ibmdb2i CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG}")
# message("-- ibmdb2i CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE}")
#TODO: copy IBM proprietary dependencies to storage/ibmdb2i/special/include
#TODO: include files in correct order so copy is not required
#/usr/include/unistd.h
#/QIBM/include/qmyse.h
###################
include_directories(BEFORE special/include)
include_directories (
../../include
Expand Down
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ MariaDB IBM i DB2 storage engine.

version
```
1.0.1
1.0.3 (in development)
```

copy source
```
> mkdir -p storage/ibmdb2i/special
> unzip maria_ibmdb2i-1.0.1.zip
> unzip maria_ibmdb2i-1.0.3.zip
Note:
Use storage/ibmdb2i, not storage/ibmidb2i (Dave)
```
Expand All @@ -20,6 +20,11 @@ Fix-up for gcc 4.8.3
> chmod +x zzcpy2gccfixed.sh
> ./zzcpy2gccfixed.sh
```
Fixup for gcc 6.3 from IBM yum repo
cd storage/ibmdb2i/special
cp /usr/include/unistd.h
cp /QIBM/include/qmyse.h
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@abmusse , do you know why these steps aren't required for your builds you've done?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks there is qmyse.h in special/include already

https://github.com/zendtech/db2iengine/blob/master/special/include/qmyse.h

We prepend the special/include to our include directories here:

https://github.com/zendtech/db2iengine/blob/master/CMakeLists.txt#L3

https://cmake.org/cmake/help/v3.7/command/include_directories.html#command:include_directories

I'm not sure why /usr/include/unistd.h is needed though. @davidl-zend Can you chime in on this?



mariadb build (subset myisam only)
```
Expand Down
4 changes: 2 additions & 2 deletions db2i_errors.cc
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ void getErrTxt(int errCode, ...)
msg = engineErrors[errCode - DB2I_FIRST_ERR];
}

(void) my_vsnprintf (buffer, MYSQL_ERRMSG_SIZE, msg, args);
vsnprintf (buffer, MYSQL_ERRMSG_SIZE, msg, args);
va_end(args);
fprintf(stderr,"ibmdb2i error %d: %s\n",errCode,buffer);
DBUG_PRINT("error", ("ibmdb2i error %d: %s",errCode,buffer));
Expand Down Expand Up @@ -292,7 +292,7 @@ void warning(THD *thd, int errCode, ...)
DBUG_ASSERT(errCode >= DB2I_FIRST_ERR && errCode <= DB2I_LAST_ERR);
msg = engineErrors[errCode - DB2I_FIRST_ERR];

(void) my_vsnprintf (buffer, MYSQL_ERRMSG_SIZE, msg, args);
vsnprintf (buffer, MYSQL_ERRMSG_SIZE, msg, args);
va_end(args);
DBUG_PRINT("warning", ("ibmdb2i warning %d: %s",errCode,buffer));
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, errCode, buffer);
Expand Down
5 changes: 3 additions & 2 deletions db2i_global.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ OF SUCH DAMAGE.
#include "sql_show.h"
#include "sql_table.h"
#include "sql_class.h"

#include "my_dbug.h"
#ifdef __cplusplus
#define EXTERN extern "C"
#else
Expand All @@ -76,6 +76,7 @@ OF SUCH DAMAGE.
* gcc anonymous memcpy appears to link incorrect.
* Explicit link to correct memcpy signature in libc.a.
*/
/*
EXTERN void *___memchr(const void *, int , size_t );
EXTERN void *___memcpy(void *, const void *, size_t );
EXTERN void *___memmove(void *, const void *, size_t );
Expand All @@ -90,7 +91,7 @@ EXTERN char *___strstr(const char *, const char *);
#define memset(a,b,c) ___memset(a,b,c)
#define memccpy(a,b,c) ___memccpy(a,b,c)
#define strstr(a,b) ___strstr(a,b)

*/
#define db2i_beint16_from_ptr2leint16(V,M) \
do { int16 def_temp;\
((uchar*) &def_temp)[0]=(M)[1];\
Expand Down
35 changes: 9 additions & 26 deletions ha_ibmdb2i.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ OF SUCH DAMAGE.
The ha_ibmdb2i storage engine provides an interface from MySQL to IBM DB2 for i.

*/

#define NDEBUG
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
Expand All @@ -51,12 +51,13 @@ OF SUCH DAMAGE.
#include "sql_priv.h"
#include "key.h" // key_copy
#include "ha_ibmdb2i.h"
#include <mysql/plugin.h>
//#include <mysql/plugin.h>
#include "db2i_ileBridge.h"
#include "db2i_charsetSupport.h"
#include <sys/utsname.h>
#include "db2i_safeString.h"


static const char __NOT_NULL_VALUE_EBCDIC = 0xF0; // '0'
static const char __NULL_VALUE_EBCDIC = 0xF1; // '1'
static const char __DEFAULT_VALUE_EBCDIC = 0xC4; // 'D'
Expand Down Expand Up @@ -382,7 +383,9 @@ static int ibmdb2i_init_func(void *p)

DBUG_PRINT("ibmdb2i_init_func",("(adc) leaving"));

DBUG_RETURN(rc);
//David Lowes - disable debug return to prevent crash until fix found
//DBUG_RETURN(rc);
return rc;
}


Expand Down Expand Up @@ -662,7 +665,7 @@ ha_ibmdb2i::ha_ibmdb2i(handlerton *hton, TABLE_SHARE *table_arg) :
activeReadBuf(NULL),
activeWriteBuf(NULL),
blobReadBuffers(NULL),
// blobWriteBuffers,
blobWriteBuffers(NULL),
last_rnd_init_rc(0),
last_index_init_rc(0),
last_start_bulk_insert_rc(0),
Expand Down Expand Up @@ -3827,28 +3830,8 @@ void ha_ibmdb2i::generateAndAppendRCDFMT(const char* tableName, String& query)
// plugin definition
// note: ibmdb2i
// zenddbi/storage/ibmdb2i

struct st_mysql_storage_engine ibmdb2i_storage_engine=
{ MYSQL_HANDLERTON_INTERFACE_VERSION };

mysql_declare_plugin(ibmdb2i)
{
MYSQL_STORAGE_ENGINE_PLUGIN,
&ibmdb2i_storage_engine,
ibmdb2i_hton_name,
"The IBM development team in Rochester, Minnesota",
"IBM DB2 for i Storage Engine",
PLUGIN_LICENSE_GPL,
ibmdb2i_init_func, /* Plugin Init */
ibmdb2i_done_func, /* Plugin Deinit */
0x0100 /* 1.0 */,
NULL, /* status variables */
ibmdb2i_system_variables, /* system variables */
NULL, /* config options */
0, /* flags */
}
mysql_declare_plugin_end;

maria_declare_plugin(ibmdb2i)
{
MYSQL_STORAGE_ENGINE_PLUGIN,
Expand All @@ -3859,10 +3842,10 @@ maria_declare_plugin(ibmdb2i)
PLUGIN_LICENSE_GPL,
ibmdb2i_init_func,
ibmdb2i_done_func,
0x0100,
0x0102,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@davidl71, please explain this change. We might need this!

NULL,
ibmdb2i_system_variables,
"1.0",
"1.0.3",
MariaDB_PLUGIN_MATURITY_STABLE
}
maria_declare_plugin_end;
Expand Down
20 changes: 19 additions & 1 deletion ha_ibmdb2i.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ OF SUCH DAMAGE.

#include <as400_types.h>
#include <as400_protos.h>
#include <mysql/plugin.h>
//#include <mysql/plugin.h>
#include "db2i_global.h"
#include "db2i_ileBridge.h"
/* #include "builtins.h" */
Expand All @@ -61,6 +61,24 @@ OF SUCH DAMAGE.
#include "db2i_errors.h"
#include "db2i_sqlStatementStream.h"

//David Lowes - Temporarily exclude mysql/plugin.h and manually define used constants
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any idea why you needed to do this?
IBM has been building against 10.3, so curious if something changed between mariadb versions

#define MYSQL_VERSION_MAJOR 10
#define MYSQL_VERSION_MINOR 1
#define MYSQL_VERSION_PATCH 21
#define MYSQL_VERSION_EXTRA ""

#define PACKAGE "mysql"
#define PACKAGE_BUGREPORT ""
#define PACKAGE_NAME "MySQL Server"
#define PACKAGE_STRING "MySQL Server 10.1.21"
#define PACKAGE_TARNAME "mysql"
#define PACKAGE_VERSION "10.1.21"
#define VERSION "10.1.21"
#define PROTOCOL_VERSION 10

#undef HAVE_ATTRIBUTE_CLEANUP
//David Lowes - temporarily disable DBUG_PRINT to prevent crashes
#define DBUG_PRINT(keyword,arglist) do { } while(0)
/** @brief
IBMDB2I_SHARE is a structure that will be shared among all open handlers.
It is used to describe the underlying table definition, and it caches
Expand Down
Loading