Commit 1af7d555 authored by Antony T Curtis's avatar Antony T Curtis

Fixups for OQGraph v3 on MariaDB 10.0

parent f887a956
......@@ -9,7 +9,17 @@ INCLUDE_DIRECTORIES(BEFORE ${Boost_INCLUDE_DIRS})
FIND_PACKAGE(JUDY)
IF(NOT JUDY_FOUND)
MESSAGE(STATUS "Judy not found")
RETURN()
include(ExternalProject)
ExternalProject_Add(
Judy
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Judy
CONFIGURE_COMMAND sh bootstrap && sh configure --with-pic --disable-shared
UPDATE_COMMAND ""
INSTALL_COMMAND ""
BUILD_IN_SOURCE 1
)
SET(JUDY_LIBRARIES ${CMAKE_CURRENT_SOURCE_DIR}/Judy/src/obj/.libs/libJudy.a)
SET(JUDY_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Judy/src)
ENDIF()
INCLUDE_DIRECTORIES(${JUDY_INCLUDE_DIR})
......@@ -24,6 +34,8 @@ ELSE()
# See if that works. On old gcc it'll fail because of -fno-rtti
CHECK_CXX_SOURCE_COMPILES(
"
#define BOOST_NO_RTTI 1
#define BOOST_NO_TYPEID 1
#include <boost/config.hpp>
#include <boost/property_map/property_map.hpp>
int main() { return 0; }
......@@ -40,8 +52,13 @@ IF(BOOST_OK)
STRING(REPLACE "-fno-implicit-templates" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
ENDIF(MSVC)
MYSQL_ADD_PLUGIN(oqgraph ha_oqgraph.cc graphcore.cc STORAGE_ENGINE
MODULE_ONLY)
ADD_DEFINITIONS(-DBOOST_NO_RTTI=1 -DBOOST_NO_TYPEID=1 -DBOOST_DISABLE_ASSERTS=1)
MYSQL_ADD_PLUGIN(oqgraph ha_oqgraph.cc graphcore.cc graphcore-graph.cc
oqgraph_shim.cc oqgraph_thunk.cc oqgraph_judy.cc
STORAGE_ENGINE
MODULE_ONLY
LINK_LIBRARIES ${JUDY_LIBRARIES})
ELSE(BOOST_OK)
MESSAGE(STATUS "Requisites for OQGraph not met")
ENDIF(BOOST_OK)
This diff is collapsed.
#! /bin/sh
set -x
libtoolize --force --copy
if [ ! -x "`which libtoolize`" ]; then
glibtoolize --force --copy
else
libtoolize --force --copy
fi
#aclocal-1.9
aclocal
#autoheader2.50
autoheader
#add --include-deps if you want to bootstrap with any other compiler than gcc
#automake --add-missing --copy --include-deps
automake-1.9 --add-missing --force --copy
automake --add-missing --force --copy
#autoconf2.50
autoconf
rm -f config.cache
......@@ -4,7 +4,7 @@
# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
# Inc.
timestamp='2007-03-06'
timestamp='2006-07-02'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
......@@ -161,7 +161,6 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
arm*) machine=arm-unknown ;;
sh3el) machine=shl-unknown ;;
sh3eb) machine=sh-unknown ;;
sh5el) machine=sh5le-unknown ;;
*) machine=${UNAME_MACHINE_ARCH}-unknown ;;
esac
# The Operating System including object format, if it has switched
......@@ -781,7 +780,7 @@ EOF
i*:CYGWIN*:*)
echo ${UNAME_MACHINE}-pc-cygwin
exit ;;
*:MINGW*:*)
i*:MINGW*:*)
echo ${UNAME_MACHINE}-pc-mingw32
exit ;;
i*:windows32*:*)
......@@ -791,15 +790,12 @@ EOF
i*:PW*:*)
echo ${UNAME_MACHINE}-pc-pw32
exit ;;
*:Interix*:[3456]*)
case ${UNAME_MACHINE} in
x86)
echo i586-pc-interix${UNAME_RELEASE}
exit ;;
EM64T | authenticamd)
echo x86_64-unknown-interix${UNAME_RELEASE}
exit ;;
esac ;;
x86:Interix*:[3456]*)
echo i586-pc-interix${UNAME_RELEASE}
exit ;;
EM64T:Interix*:[3456]*)
echo x86_64-unknown-interix${UNAME_RELEASE}
exit ;;
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
echo i${UNAME_MACHINE}-pc-mks
exit ;;
......@@ -954,9 +950,6 @@ EOF
x86_64:Linux:*:*)
echo x86_64-unknown-linux-gnu
exit ;;
xtensa:Linux:*:*)
echo xtensa-unknown-linux-gnu
exit ;;
i*86:Linux:*:*)
# The BFD linker knows what the default object file format is, so
# first see if it will tell us. cd to the root directory to prevent
......@@ -1215,15 +1208,6 @@ EOF
SX-6:SUPER-UX:*:*)
echo sx6-nec-superux${UNAME_RELEASE}
exit ;;
SX-7:SUPER-UX:*:*)
echo sx7-nec-superux${UNAME_RELEASE}
exit ;;
SX-8:SUPER-UX:*:*)
echo sx8-nec-superux${UNAME_RELEASE}
exit ;;
SX-8R:SUPER-UX:*:*)
echo sx8r-nec-superux${UNAME_RELEASE}
exit ;;
Power*:Rhapsody:*:*)
echo powerpc-apple-rhapsody${UNAME_RELEASE}
exit ;;
......
......@@ -114,6 +114,10 @@
slash. */
#undef LSTAT_FOLLOWS_SLASHED_SYMLINK
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#undef LT_OBJDIR
/* Name of package */
#undef PACKAGE
......
......@@ -4,7 +4,7 @@
# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
# Inc.
timestamp='2007-01-18'
timestamp='2006-09-20'
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
......@@ -245,12 +245,12 @@ case $basic_machine in
| bfin \
| c4x | clipper \
| d10v | d30v | dlx | dsp16xx \
| fido | fr30 | frv \
| fr30 | frv \
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| i370 | i860 | i960 | ia64 \
| ip2k | iq2000 \
| m32c | m32r | m32rle | m68000 | m68k | m88k \
| maxq | mb | microblaze | mcore | mep \
| maxq | mb | microblaze | mcore \
| mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \
| mips64 | mips64el \
......@@ -324,7 +324,7 @@ case $basic_machine in
| clipper-* | craynv-* | cydra-* \
| d10v-* | d30v-* | dlx-* \
| elxsi-* \
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
| f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
| h8300-* | h8500-* \
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
| i*86-* | i860-* | i960-* | ia64-* \
......@@ -925,9 +925,6 @@ case $basic_machine in
basic_machine=sh-hitachi
os=-hms
;;
sh5el)
basic_machine=sh5le-unknown
;;
sh64)
basic_machine=sh64-unknown
;;
......@@ -1222,7 +1219,7 @@ case $os in
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
| -skyos* | -haiku* | -rdos* | -toppers* | -drops*)
| -skyos* | -haiku* | -rdos* | -toppers*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-qnx*)
......@@ -1417,9 +1414,6 @@ case $basic_machine in
m68*-cisco)
os=-aout
;;
mep-*)
os=-elf
;;
mips*-cisco)
os=-elf
;;
......
......@@ -37,6 +37,6 @@ namespace open_query
class Field;
typedef struct st_table TABLE;
typedef struct TABLE TABLE;
#endif
......@@ -454,14 +454,14 @@ namespace open_query
{
graph_traits<Graph>::out_edge_iterator ei, ei_end;
tie(ei, ei_end)= out_edges(orig, g);
if ((ei= find_if(ei, ei_end, target_equals(dest, g))) != ei_end)
if ((ei= std::find_if(ei, ei_end, target_equals(dest, g))) != ei_end)
return *ei;
}
else
{
graph_traits<Graph>::in_edge_iterator ei, ei_end;
tie(ei, ei_end)= in_edges(dest, g);
if ((ei= find_if(ei, ei_end, source_equals(orig, g))) != ei_end)
if ((ei= std::find_if(ei, ei_end, source_equals(orig, g))) != ei_end)
return *ei;
}
return optional<Edge>();
......
......@@ -28,7 +28,6 @@
#pragma implementation // gcc: Class implementation
#endif
#ifdef HAVE_OQGRAPH
#include <stdarg.h>
#include <stdio.h>
......@@ -41,7 +40,8 @@
#include "table.h"
#include "field.h"
#include "key.h"
//#include "sql_class.h"
#include "unireg.h"
#include "sql_class.h"
#define OQGRAPH_STATS_UPDATE_THRESHOLD 10
......@@ -58,7 +58,7 @@ struct oqgraph_table_option_struct
};
#define ha_table_option_struct oqgraph_table_option_struct
ha_create_table_option oqgraph_table_option_list[]=
static const ha_create_table_option oqgraph_table_option_list[]=
{
HA_TOPTION_STRING("data_table", table_name),
HA_TOPTION_STRING("origid", origid),
......@@ -106,6 +106,7 @@ statistic_increment(table->in_use->status_var.X, &LOCK_status)
#define STATISTIC_INCREMENT(X) /* nothing */
#define MOVE(X) move_field_offset(X)
#define RECORDS stats.records
#endif
static bool oqgraph_init_done= 0;
......@@ -116,6 +117,7 @@ static handler* oqgraph_create_handler(handlerton *hton, TABLE_SHARE *table,
return new (mem_root) ha_oqgraph(hton, table);
}
#if MYSQL_VERSION_ID >= 50100
static int oqgraph_init(handlerton *hton)
{
#else
......@@ -123,14 +125,8 @@ static bool oqgraph_init()
{
if (have_oqgraph == SHOW_OPTION_DISABLED)
return 1;
if (pthread_mutex_init(&LOCK_oqgraph, MY_MUTEX_INIT_FAST))
goto error;
if (my_hash_init(&oqgraph_open_tables, &my_charset_bin, 32, 0, 0,
get_key, 0, 0))
{
pthread_mutex_destroy(&LOCK_oqgraph);
goto error;
}
#endif
#if MYSQL_VERSION_ID >= 50100
hton->state= SHOW_OPTION_YES;
hton->db_type= DB_TYPE_AUTOASSIGN;
......@@ -143,64 +139,8 @@ static bool oqgraph_init()
static int oqgraph_fini(void *)
{
my_hash_free(&oqgraph_open_tables);
pthread_mutex_destroy(&LOCK_oqgraph);
oqgraph_init_done= FALSE;
return 0;
}
#endif
static OQGRAPH_INFO *get_share(const char *name, TABLE *table=0)
{
OQGRAPH_INFO *share;
uint length= strlen(name);
safe_mutex_assert_owner(&LOCK_oqgraph);
if (!(share= (OQGRAPH_INFO*) my_hash_search(&oqgraph_open_tables,
(byte*) name, length)))
{
if (!table ||
!(share= new OQGRAPH_INFO))
return 0;
share->use_count= share->key_stat_version= share->records= 0;
share->dropped= 0;
strmov(share->name, name);
if (!(share->graph= oqgraph::create()))
{
delete share;
return 0;
}
if (my_hash_insert(&oqgraph_open_tables, (byte*) share))
{
oqgraph::free(share->graph);
delete share;
return 0;
}
thr_lock_init(&share->lock);
}
share->use_count++;
return share;
}
static int free_share(OQGRAPH_INFO *share, bool drop=0)
{
safe_mutex_assert_owner(&LOCK_oqgraph);
if (!share)
return 0;
if (drop)
{
share->dropped= true;
my_hash_delete(&oqgraph_open_tables, (byte*) share);
}
if (!--share->use_count)
{
if (share->dropped)
{
thr_lock_delete(&share->lock);
oqgraph::free(share->graph);
delete share;
}
}
return 0;
}
......@@ -363,7 +303,7 @@ bool ha_oqgraph::get_error_message(int error, String* buf)
return false;
}
void ha_oqgraph::print_error(const char* fmt, ...)
void ha_oqgraph::fprint_error(const char* fmt, ...)
{
va_list ap;
va_start(ap, fmt);
......@@ -406,18 +346,18 @@ int ha_oqgraph::open(const char *name, int mode, uint test_if_locked)
while (open_table_def(thd, share, 0))
{
if (thd->is_error() && thd->main_da.sql_errno() != ER_NO_SUCH_TABLE)
if (thd->is_error() && thd->stmt_da->sql_errno() != ER_NO_SUCH_TABLE)
{
free_table_share(share);
return thd->main_da.sql_errno();
return thd->stmt_da->sql_errno();
}
if (ha_create_table_from_engine(thd, table->s->db.str, options->table_name))
{
free_table_share(share);
return thd->main_da.sql_errno();
return thd->stmt_da->sql_errno();
}
mysql_reset_errors(thd, 1);
/*mysql_reset_errors(thd, 1);*/
thd->clear_error();
continue;
}
......@@ -433,7 +373,7 @@ int ha_oqgraph::open(const char *name, int mode, uint test_if_locked)
{
open_table_error(share, 1, EMFILE, 0);
free_table_share(share);
print_error("VIEWs are not supported for a backing store");
fprint_error("VIEWs are not supported for a backing store");
return -1;
}
......@@ -464,7 +404,7 @@ int ha_oqgraph::open(const char *name, int mode, uint test_if_locked)
if (!edges->file)
{
print_error("Some error occurred opening table '%s'", options->table_name);
fprint_error("Some error occurred opening table '%s'", options->table_name);
free_table_share(share);
return -1;
}
......@@ -476,7 +416,7 @@ int ha_oqgraph::open(const char *name, int mode, uint test_if_locked)
if ((*field)->cmp_type() != INT_RESULT ||
!((*field)->flags & NOT_NULL_FLAG))
{
print_error("Column '%s.%s' is not a not-null integer type",
fprint_error("Column '%s.%s' is not a not-null integer type",
options->table_name, options->origid);
closefrm(edges, 0);
free_table_share(share);
......@@ -493,7 +433,7 @@ int ha_oqgraph::open(const char *name, int mode, uint test_if_locked)
if ((*field)->type() != origid->type() ||
!((*field)->flags & NOT_NULL_FLAG))
{
print_error("Column '%s.%s' is not a not-null integer type",
fprint_error("Column '%s.%s' is not a not-null integer type",
options->table_name, options->destid);
closefrm(edges, 0);
free_table_share(share);
......@@ -510,7 +450,7 @@ int ha_oqgraph::open(const char *name, int mode, uint test_if_locked)
if ((*field)->result_type() != REAL_RESULT ||
!((*field)->flags & NOT_NULL_FLAG))
{
print_error("Column '%s.%s' is not a not-null real type",
fprint_error("Column '%s.%s' is not a not-null real type",
options->table_name, options->weight);
closefrm(edges, 0);
free_table_share(share);
......@@ -522,7 +462,7 @@ int ha_oqgraph::open(const char *name, int mode, uint test_if_locked)
if (!origid || !destid || (!weight && options->weight))
{
print_error("Data columns missing on table '%s'", options->table_name);
fprint_error("Data columns missing on table '%s'", options->table_name);
closefrm(edges, 0);
free_table_share(share);
return -1;
......@@ -530,7 +470,7 @@ int ha_oqgraph::open(const char *name, int mode, uint test_if_locked)
if (!(graph_share = oqgraph::create(edges, origid, destid, weight)))
{
print_error("Unable to create graph instance.");
fprint_error("Unable to create graph instance.");
closefrm(edges, 0);
free_table_share(share);
return -1;
......@@ -586,17 +526,17 @@ void ha_oqgraph::update_key_stats()
int ha_oqgraph::write_row(byte * buf)
{
return ER_OPEN_AS_READONLY;
return HA_ERR_TABLE_READONLY;
}
int ha_oqgraph::update_row(const byte * old, byte * buf)
{
return ER_OPEN_AS_READONLY;
return HA_ERR_TABLE_READONLY;
}
int ha_oqgraph::delete_row(const byte * buf)
{
return ER_OPEN_AS_READONLY;
return HA_ERR_TABLE_READONLY;
}
int ha_oqgraph::index_read(byte * buf, const byte * key, uint key_len,
......@@ -807,7 +747,7 @@ int ha_oqgraph::extra(enum ha_extra_function operation)
int ha_oqgraph::delete_all_rows()
{
return ER_OPEN_AS_READONLY;
return HA_ERR_TABLE_READONLY;
}
int ha_oqgraph::external_lock(THD *thd, int lock_type)
......@@ -835,14 +775,6 @@ int ha_oqgraph::delete_table(const char *)
int ha_oqgraph::rename_table(const char *, const char *)
{
pthread_mutex_lock(&LOCK_oqgraph);
if (OQGRAPH_INFO *share= get_share(from))
{
strmov(share->name, to);
my_hash_update(&oqgraph_open_tables, (byte*) share,
(byte*) from, strlen(from));
}
pthread_mutex_unlock(&LOCK_oqgraph);
return 0;
}
......@@ -887,7 +819,7 @@ int ha_oqgraph::create(const char *name, TABLE *table_arg,
HA_CREATE_INFO *create_info)
{
oqgraph_table_option_struct *options=
reinterpret_cast<oqgraph_table_option_struct*>(table->s->option_struct);
reinterpret_cast<oqgraph_table_option_struct*>(table_arg->s->option_struct);
if (int res = oqgraph_check_table_structure(table_arg))
return error_code(res);
......@@ -924,7 +856,3 @@ maria_declare_plugin(oqgraph)
MariaDB_PLUGIN_MATURITY_BETA
}
maria_declare_plugin_end;
#endif
#endif
......@@ -29,6 +29,7 @@
#endif
#include "handler.h"
#include "table.h"
typedef struct oqgraph_info_st OQGRAPH_INFO;
typedef uchar byte;
......@@ -112,7 +113,7 @@ public:
bool get_error_message(int error, String* buf);
void print_error(const char* fmt, ...);
void fprint_error(const char* fmt, ...);
private:
void update_key_stats();
......
......@@ -29,7 +29,12 @@
#include <boost/tuple/tuple.hpp>
#define MYSQL_SERVER
#include "mysql_priv.h"
#include "mysql_version.h"
#include "sql_base.h"
#include "table.h"
#include "field.h"
#include "key.h"
#include "unireg.h"
static int debugid = 0;
......@@ -183,7 +188,9 @@ int oqgraph3::cursor::restore_position()
return rc;
}
update_virtual_fields(table.in_use, &table);
if (table.vfield)
update_virtual_fields(table.in_use, &table);
table.file->position(table.record[0]);
while (memcmp(table.file->ref, _position.data(), table.file->ref_length))
......@@ -193,7 +200,9 @@ int oqgraph3::cursor::restore_position()
table.file->ha_index_end();
return rc;
}
update_virtual_fields(table.in_use, &table);
if (table.vfield)
update_virtual_fields(table.in_use, &table);
if ((_origid && vertex_id(_graph->_source->val_int()) != *_origid) ||
(_destid && vertex_id(_graph->_target->val_int()) != *_destid))
......@@ -203,7 +212,6 @@ int oqgraph3::cursor::restore_position()
}
table.file->position(table.record[0]);
}
update_virtual_fields(table.in_use, &table);
}
else
......@@ -217,7 +225,9 @@ int oqgraph3::cursor::restore_position()
table.file->ha_rnd_end();
return rc;
}
update_virtual_fields(table.in_use, &table);
if (table.vfield)
update_virtual_fields(table.in_use, &table);
}
_graph->_cursor= this;
......@@ -292,7 +302,8 @@ int oqgraph3::cursor::seek_next()
return clear_position(rc);
}
update_virtual_fields(table.in_use, &table);
if (table.vfield)
update_virtual_fields(table.in_use, &table);
_graph->_stale= true;
if ((_origid && vertex_id(_graph->_source->val_int()) != *_origid) ||
......@@ -326,7 +337,8 @@ int oqgraph3::cursor::seek_prev()
return clear_position(rc);
}
update_virtual_fields(table.in_use, &table);
if (table.vfield)
update_virtual_fields(table.in_use, &table);
_graph->_stale= true;
if ((_origid && vertex_id(_graph->_source->val_int()) != *_origid) ||
......@@ -487,7 +499,8 @@ int oqgraph3::cursor::seek_to(
return clear_position(rc);
}
update_virtual_fields(table.in_use, &table);
if (table.vfield)
update_virtual_fields(table.in_use, &table);
if ((_origid && vertex_id(_graph->_source->val_int()) != *_origid) ||
(_destid && vertex_id(_graph->_target->val_int()) != *_destid))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment