1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

IB, SQL: removed VTQ, added TRT on SQL layer [closes #305]

This commit is contained in:
Aleksey Midenkov
2017-11-10 17:54:46 +03:00
parent fa79f6ac86
commit 33085349e9
56 changed files with 656 additions and 1605 deletions

View File

@ -34,7 +34,6 @@
#include "structs.h" /* SHOW_COMP_OPTION */
#include "sql_array.h" /* Dynamic_array<> */
#include "mdl.h"
#include "vtq.h"
#include "vers_string.h"
#include "sql_analyze_stmt.h" // for Exec_time_tracker
@ -981,6 +980,7 @@ struct handler_iterator {
class handler;
class group_by_handler;
struct Query;
class TR_table;
typedef class st_select_lex SELECT_LEX;
typedef struct st_order ORDER;
@ -1390,36 +1390,11 @@ struct handlerton
/*
System Versioning
*/
/**
Query VTQ by TRX_ID.
@param[in] thd MySQL thread
@param[out] out field value or whole record returned by query (selected by `field`)
@param[in] in_trx_id query parameter TRX_ID
@param[in] field field to get in `out` or VTQ_ALL for whole record (vtq_record_t)
@return TRUE if record is found, FALSE otherwise */
bool (*vers_query_trx_id)(THD* thd, void *out, ulonglong trx_id, vtq_field_t field);
/** Query VTQ by COMMIT_TS.
@param[in] thd MySQL thread
@param[out] out field value or whole record returned by query (selected by `field`)
@param[in] commit_ts query parameter COMMIT_TS
@param[in] field field to get in `out` or VTQ_ALL for whole record (vtq_record_t)
@param[in] backwards direction of VTQ search
@return TRUE if record is found, FALSE otherwise */
bool (*vers_query_commit_ts)(THD* thd, void *out, const MYSQL_TIME &commit_ts,
vtq_field_t field, bool backwards);
/** Check if transaction TX1 sees transaction TX0.
@param[in] thd MySQL thread
@param[out] result true if TX1 sees TX0
@param[in] trx_id1 TX1 TRX_ID
@param[in] trx_id0 TX0 TRX_ID
@param[in] commit_id1 TX1 COMMIT_ID
@param[in] iso_level1 TX1 isolation level
@param[in] commit_id0 TX0 COMMIT_ID
@return FALSE if there is no trx_id1 in VTQ, otherwise TRUE */
bool (*vers_trx_sees)(THD *thd, bool &result, ulonglong trx_id1, ulonglong trx_id0,
ulonglong commit_id1, uchar iso_level1, ulonglong commit_id0);
/** Fill TRT record for update.
@param[out] trt TRT table which record[0] will be filled with
transaction data.
@return TRUE if update of TRT is required, FALSE otherwise */
bool (*vers_get_trt_data)(TR_table &trt);
};
@ -1607,11 +1582,21 @@ public:
DBUG_ASSERT(is_started());
m_flags|= (int) TRX_READ_WRITE;
}
void set_trx_tmp_read_write()
{
DBUG_ASSERT(is_started());
m_flags|= (int) TRX_TMP_READ_WRITE;
}
bool is_trx_read_write() const
{
DBUG_ASSERT(is_started());
return m_flags & (int) TRX_READ_WRITE;
}
bool is_trx_tmp_read_write() const
{
DBUG_ASSERT(is_started());
return m_flags & (int) (TRX_READ_WRITE | TRX_TMP_READ_WRITE);
}
bool is_started() const { return m_ht != NULL; }
/** Mark this transaction read-write if the argument is read-write. */
void coalesce_trx_with(const Ha_trx_info *stmt_trx)
@ -1636,7 +1621,7 @@ public:
return m_ht;
}
private:
enum { TRX_READ_ONLY= 0, TRX_READ_WRITE= 1 };
enum { TRX_READ_ONLY= 0, TRX_READ_WRITE= 1, TRX_TMP_READ_WRITE= 2 };
/** Auxiliary, used for ha_list management */
Ha_trx_info *m_next;
/**