Merge 10.2 into 10.3

This commit is contained in:
Marko Mäkelä 2020-03-30 11:12:56 +03:00
commit 1a9b6c4c7f
70 changed files with 958 additions and 727 deletions

View file

@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, 2019, MariaDB Corporation.
Copyright (c) 2017, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@ -31,6 +31,7 @@ Created 4/20/1996 Heikki Tuuri
#include "que0types.h"
#include "trx0types.h"
#include "row0types.h"
#include <vector>
/***************************************************************//**
Checks if foreign key constraint fails for an index entry. Sets shared locks
@ -52,15 +53,7 @@ row_ins_check_foreign_constraint(
dtuple_t* entry, /*!< in: index entry for index */
que_thr_t* thr) /*!< in: query thread */
MY_ATTRIBUTE((nonnull, warn_unused_result));
/*********************************************************************//**
Creates an insert node struct.
@return own: insert node struct */
ins_node_t*
ins_node_create(
/*============*/
ulint ins_type, /*!< in: INS_VALUES, ... */
dict_table_t* table, /*!< in: table where to insert */
mem_heap_t* heap); /*!< in: mem heap where created */
/*********************************************************************//**
Sets a new row to insert for an INS_DIRECT node. This function is only used
if we have constructed the row separately, which is a rare case; this
@ -158,10 +151,31 @@ row_ins_step(
/*=========*/
que_thr_t* thr); /*!< in: query thread */
/* Insert node structure */
/* Insert node types */
#define INS_SEARCHED 0 /* INSERT INTO ... SELECT ... */
#define INS_VALUES 1 /* INSERT INTO ... VALUES ... */
#define INS_DIRECT 2 /* this is for internal use in dict0crea:
insert the row directly */
struct ins_node_t{
que_common_t common; /*!< node type: QUE_NODE_INSERT */
/* Node execution states */
#define INS_NODE_SET_IX_LOCK 1 /* we should set an IX lock on table */
#define INS_NODE_ALLOC_ROW_ID 2 /* row id should be allocated */
#define INS_NODE_INSERT_ENTRIES 3 /* index entries should be built and
inserted */
/** Insert node structure */
struct ins_node_t
{
explicit ins_node_t(ulint ins_type, dict_table_t *table) :
common(QUE_NODE_INSERT, NULL),
ins_type(ins_type),
row(NULL), table(table), select(NULL), values_list(NULL),
state(INS_NODE_SET_IX_LOCK), index(NULL),
entry_list(), entry(entry_list.end()),
trx_id(0), entry_sys_heap(mem_heap_create(128))
{
}
que_common_t common; /*!< node type: QUE_NODE_INSERT */
ulint ins_type;/* INS_VALUES, INS_SEARCHED, or INS_DIRECT */
dtuple_t* row; /*!< row to insert */
dict_table_t* table; /*!< table where to insert */
@ -171,11 +185,12 @@ struct ins_node_t{
ulint state; /*!< node execution state */
dict_index_t* index; /*!< NULL, or the next index where the index
entry should be inserted */
dtuple_t* entry; /*!< NULL, or entry to insert in the index;
std::vector<dtuple_t*>
entry_list;/* list of entries, one for each index */
std::vector<dtuple_t*>::iterator
entry; /*!< NULL, or entry to insert in the index;
after a successful insert of the entry,
this should be reset to NULL */
UT_LIST_BASE_NODE_T(dtuple_t)
entry_list;/* list of entries, one for each index */
/** buffer for the system columns */
byte sys_buf[DATA_ROW_ID_LEN
+ DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN];
@ -188,20 +203,18 @@ struct ins_node_t{
entry_list and sys fields are stored here;
if this is NULL, entry list should be created
and buffers for sys fields in row allocated */
ulint magic_n;
};
#define INS_NODE_MAGIC_N 15849075
/** Create an insert object.
@param ins_type INS_VALUES, ...
@param table table where to insert
@param heap memory heap
@return the created object */
inline ins_node_t *ins_node_create(ulint ins_type, dict_table_t *table,
mem_heap_t *heap)
{
return new (mem_heap_alloc(heap, sizeof(ins_node_t)))
ins_node_t(ins_type, table);
}
/* Insert node types */
#define INS_SEARCHED 0 /* INSERT INTO ... SELECT ... */
#define INS_VALUES 1 /* INSERT INTO ... VALUES ... */
#define INS_DIRECT 2 /* this is for internal use in dict0crea:
insert the row directly */
/* Node execution states */
#define INS_NODE_SET_IX_LOCK 1 /* we should set an IX lock on table */
#define INS_NODE_ALLOC_ROW_ID 2 /* row id should be allocated */
#define INS_NODE_INSERT_ENTRIES 3 /* index entries should be built and
inserted */
#endif