summaryrefslogtreecommitdiff
path: root/plugin/versioning
diff options
context:
space:
mode:
authorAleksey Midenkov <midenok@gmail.com>2017-11-10 17:54:46 +0300
committerAleksey Midenkov <midenok@gmail.com>2017-11-15 00:22:10 +0300
commit33085349e97a5b5c768c38c6f8bed11c666c0643 (patch)
tree83382bd488d28cf114b211a255247cb07cb1d9be /plugin/versioning
parentfa79f6ac86c700c23041dd0f314a71bbfb1f4bdf (diff)
downloadmariadb-git-33085349e97a5b5c768c38c6f8bed11c666c0643.tar.gz
IB, SQL: removed VTQ, added TRT on SQL layer [closes #305]
Diffstat (limited to 'plugin/versioning')
-rw-r--r--plugin/versioning/versioning.cc60
1 files changed, 19 insertions, 41 deletions
diff --git a/plugin/versioning/versioning.cc b/plugin/versioning/versioning.cc
index 05ef5def5b8..150ed23dcff 100644
--- a/plugin/versioning/versioning.cc
+++ b/plugin/versioning/versioning.cc
@@ -22,14 +22,10 @@
#include "sql_plugin.h" // st_plugin_int
#include "sql_class.h"
#include "item.h"
-#include "vtq.h"
#include "vers_utils.h"
-plugin_ref innodb_plugin= NULL;
-static handlerton* innodb_hton= NULL;
-
/* System Versioning: VTQ_TRX_ID(), VTQ_COMMIT_ID(), VTQ_BEGIN_TS(), VTQ_COMMIT_TS(), VTQ_ISO_LEVEL() */
-template <vtq_field_t VTQ_FIELD>
+template <TR_table::field_id_t VTQ_FIELD>
class Create_func_vtq : public Create_native_func
{
public:
@@ -42,10 +38,10 @@ protected:
virtual ~Create_func_vtq<VTQ_FIELD>() {}
};
-template<vtq_field_t VTQ_FIELD>
+template<TR_table::field_id_t VTQ_FIELD>
Create_func_vtq<VTQ_FIELD> Create_func_vtq<VTQ_FIELD>::s_singleton;
-template <vtq_field_t VTQ_FIELD>
+template <TR_table::field_id_t VTQ_FIELD>
Item*
Create_func_vtq<VTQ_FIELD>::create_native(THD *thd, LEX_CSTRING *name,
List<Item> *item_list)
@@ -62,14 +58,14 @@ Create_func_vtq<VTQ_FIELD>::create_native(THD *thd, LEX_CSTRING *name,
Item *param_1= item_list->pop();
switch (VTQ_FIELD)
{
- case VTQ_BEGIN_TS:
- case VTQ_COMMIT_TS:
- func= new (thd->mem_root) Item_func_vtq_ts(thd, innodb_hton, param_1, VTQ_FIELD);
+ case TR_table::FLD_BEGIN_TS:
+ case TR_table::FLD_COMMIT_TS:
+ func= new (thd->mem_root) Item_func_vtq_ts(thd, param_1, VTQ_FIELD);
break;
- case VTQ_TRX_ID:
- case VTQ_COMMIT_ID:
- case VTQ_ISO_LEVEL:
- func= new (thd->mem_root) Item_func_vtq_id(thd, innodb_hton, param_1, VTQ_FIELD);
+ case TR_table::FLD_TRX_ID:
+ case TR_table::FLD_COMMIT_ID:
+ case TR_table::FLD_ISO_LEVEL:
+ func= new (thd->mem_root) Item_func_vtq_id(thd, param_1, VTQ_FIELD);
break;
default:
DBUG_ASSERT(0);
@@ -82,9 +78,9 @@ Create_func_vtq<VTQ_FIELD>::create_native(THD *thd, LEX_CSTRING *name,
Item *param_2= item_list->pop();
switch (VTQ_FIELD)
{
- case VTQ_TRX_ID:
- case VTQ_COMMIT_ID:
- func= new (thd->mem_root) Item_func_vtq_id(thd, innodb_hton, param_1, param_2, VTQ_FIELD);
+ case TR_table::FLD_TRX_ID:
+ case TR_table::FLD_COMMIT_ID:
+ func= new (thd->mem_root) Item_func_vtq_id(thd, param_1, param_2, VTQ_FIELD);
break;
default:
goto error;
@@ -119,7 +115,7 @@ public:
{
Item *param_1= item_list->pop();
Item *param_2= item_list->pop();
- func= new (thd->mem_root) Item_func_vtq_trx_seesX(thd, innodb_hton, param_1, param_2);
+ func= new (thd->mem_root) Item_func_vtq_trx_seesX(thd, param_1, param_2);
break;
}
default:
@@ -144,11 +140,11 @@ Create_func_vtq_trx_sees<X> Create_func_vtq_trx_sees<X>::s_singleton;
static Native_func_registry func_array[] =
{
- { { C_STRING_WITH_LEN("VTQ_BEGIN_TS") }, BUILDER(Create_func_vtq<VTQ_BEGIN_TS>)},
- { { C_STRING_WITH_LEN("VTQ_COMMIT_ID") }, BUILDER(Create_func_vtq<VTQ_COMMIT_ID>)},
- { { C_STRING_WITH_LEN("VTQ_COMMIT_TS") }, BUILDER(Create_func_vtq<VTQ_COMMIT_TS>)},
- { { C_STRING_WITH_LEN("VTQ_ISO_LEVEL") }, BUILDER(Create_func_vtq<VTQ_ISO_LEVEL>)},
- { { C_STRING_WITH_LEN("VTQ_TRX_ID") }, BUILDER(Create_func_vtq<VTQ_TRX_ID>)},
+ { { C_STRING_WITH_LEN("VTQ_BEGIN_TS") }, BUILDER(Create_func_vtq<TR_table::FLD_BEGIN_TS>)},
+ { { C_STRING_WITH_LEN("VTQ_COMMIT_ID") }, BUILDER(Create_func_vtq<TR_table::FLD_COMMIT_ID>)},
+ { { C_STRING_WITH_LEN("VTQ_COMMIT_TS") }, BUILDER(Create_func_vtq<TR_table::FLD_COMMIT_TS>)},
+ { { C_STRING_WITH_LEN("VTQ_ISO_LEVEL") }, BUILDER(Create_func_vtq<TR_table::FLD_ISO_LEVEL>)},
+ { { C_STRING_WITH_LEN("VTQ_TRX_ID") }, BUILDER(Create_func_vtq<TR_table::FLD_TRX_ID>)},
{ { C_STRING_WITH_LEN("VTQ_TRX_SEES") }, BUILDER(Create_func_vtq_trx_sees<Item_func_vtq_trx_sees>)},
{ { C_STRING_WITH_LEN("VTQ_TRX_SEES_EQ") }, BUILDER(Create_func_vtq_trx_sees<Item_func_vtq_trx_sees_eq>)},
{ {0, 0}, NULL}
@@ -164,8 +160,6 @@ static Native_func_registry func_array[] =
static int versioning_plugin_init(void *p __attribute__ ((unused)))
{
- static LString InnoDB= "InnoDB";
-
DBUG_ENTER("versioning_plugin_init");
// No need in locking since we so far single-threaded
int res= item_create_append(func_array);
@@ -175,28 +169,12 @@ static int versioning_plugin_init(void *p __attribute__ ((unused)))
DBUG_RETURN(res);
}
- innodb_plugin= ha_resolve_by_name(NULL, &InnoDB.lex_cstring(), false);
- if (!innodb_plugin)
- {
- my_error(ER_PLUGIN_IS_NOT_LOADED, MYF(0), InnoDB.ptr());
- DBUG_RETURN(1);
- }
-
- innodb_hton= plugin_hton(innodb_plugin);
- if (!innodb_hton || (innodb_hton->flags & HTON_NOT_USER_SELECTABLE))
- {
- my_message(ER_PLUGIN_IS_NOT_LOADED, "Can't get handlerton" , MYF(0));
- DBUG_RETURN(1);
- }
-
DBUG_RETURN(0);
}
static int versioning_plugin_deinit(void *p __attribute__ ((unused)))
{
DBUG_ENTER("versioning_plugin_deinit");
- if (innodb_plugin)
- plugin_unlock(NULL, innodb_plugin);
DBUG_RETURN(0);
}