mariadb/storage/xtradb/include/row0purge.h

139 lines
4.9 KiB
C
Raw Normal View History

2009-03-25 23:11:11 -07:00
/*****************************************************************************
2016-08-10 19:24:58 +02:00
Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved.
2009-03-25 23:11:11 -07:00
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
Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
2013-12-16 15:38:05 +01:00
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
2009-03-25 23:11:11 -07:00
*****************************************************************************/
2009-09-07 10:22:53 +00:00
/**************************************************//**
@file include/row0purge.h
Purge obsolete records
Created 3/14/1997 Heikki Tuuri
*******************************************************/
#ifndef row0purge_h
#define row0purge_h
#include "univ.i"
#include "data0data.h"
#include "btr0types.h"
#include "btr0pcur.h"
#include "dict0types.h"
#include "trx0types.h"
#include "que0types.h"
#include "row0types.h"
2013-12-16 15:38:05 +01:00
#include "row0purge.h"
#include "ut0vec.h"
2009-09-07 10:22:53 +00:00
/********************************************************************//**
Creates a purge node to a query graph.
@return own: purge node */
UNIV_INTERN
purge_node_t*
row_purge_node_create(
/*==================*/
2013-12-16 15:38:05 +01:00
que_thr_t* parent, /*!< in: parent node, i.e., a
thr node */
mem_heap_t* heap) /*!< in: memory heap where created */
2016-08-10 19:24:58 +02:00
MY_ATTRIBUTE((nonnull, warn_unused_result));
2009-09-07 10:22:53 +00:00
/***********************************************************//**
2011-07-14 21:22:41 +02:00
Determines if it is possible to remove a secondary index entry.
Removal is possible if the secondary index entry does not refer to any
not delete marked version of a clustered index record where DB_TRX_ID
is newer than the purge view.
NOTE: This function should only be called by the purge thread, only
while holding a latch on the leaf page of the secondary index entry
(or keeping the buffer pool watch on the page). It is possible that
2013-12-16 15:38:05 +01:00
this function first returns true and then false, if a user transaction
2011-07-14 21:22:41 +02:00
inserts a record that the secondary index entry would refer to.
However, in that case, the user transaction would also re-insert the
secondary index entry after purge has removed it and released the leaf
page latch.
2013-12-16 15:38:05 +01:00
@return true if the secondary index record can be purged */
2011-07-14 21:22:41 +02:00
UNIV_INTERN
2013-12-16 15:38:05 +01:00
bool
2011-07-14 21:22:41 +02:00
row_purge_poss_sec(
/*===============*/
purge_node_t* node, /*!< in/out: row purge node */
dict_index_t* index, /*!< in: secondary index */
2013-12-16 15:38:05 +01:00
const dtuple_t* entry) /*!< in: secondary index entry */
2016-08-10 19:24:58 +02:00
MY_ATTRIBUTE((nonnull, warn_unused_result));
2011-07-14 21:22:41 +02:00
/***************************************************************
Does the purge operation for a single undo log record. This is a high-level
2009-09-07 10:22:53 +00:00
function used in an SQL execution graph.
@return query thread to run next or NULL */
UNIV_INTERN
que_thr_t*
row_purge_step(
/*===========*/
2013-12-16 15:38:05 +01:00
que_thr_t* thr) /*!< in: query thread */
2016-08-10 19:24:58 +02:00
MY_ATTRIBUTE((nonnull, warn_unused_result));
/* Purge node structure */
2013-12-16 15:38:05 +01:00
struct purge_node_t{
2009-09-07 10:22:53 +00:00
que_common_t common; /*!< node type: QUE_NODE_PURGE */
/*----------------------*/
/* Local storage for this graph node */
2009-09-07 10:22:53 +00:00
roll_ptr_t roll_ptr;/* roll pointer to undo log record */
2013-12-16 15:38:05 +01:00
ib_vector_t* undo_recs;/*!< Undo recs to purge */
2009-09-07 10:22:53 +00:00
undo_no_t undo_no;/* undo number of the record */
2013-12-16 15:38:05 +01:00
ulint rec_type;/* undo log record type: TRX_UNDO_INSERT_REC,
... */
2009-09-07 10:22:53 +00:00
dict_table_t* table; /*!< table where purge is done */
2013-12-16 15:38:05 +01:00
ulint cmpl_info;/* compiler analysis info of an update */
2013-12-16 15:38:05 +01:00
2009-09-07 10:22:53 +00:00
upd_t* update; /*!< update vector for a clustered index
record */
2009-09-07 10:22:53 +00:00
dtuple_t* ref; /*!< NULL, or row reference to the next row to
handle */
2009-09-07 10:22:53 +00:00
dtuple_t* row; /*!< NULL, or a copy (also fields copied to
heap) of the indexed fields of the row to
handle */
2009-09-07 10:22:53 +00:00
dict_index_t* index; /*!< NULL, or the next index whose record should
be handled */
2009-09-07 10:22:53 +00:00
mem_heap_t* heap; /*!< memory heap used as auxiliary storage for
row; this must be emptied after a successful
purge of a row */
2013-12-16 15:38:05 +01:00
ibool found_clust;/* TRUE if the clustered index record
determined by ref was found in the clustered
index, and we were able to position pcur on
it */
btr_pcur_t pcur; /*!< persistent cursor used in searching the
clustered index record */
ibool done; /* Debug flag */
2015-10-09 17:20:49 +02:00
#ifdef UNIV_DEBUG
/***********************************************************//**
Validate the persisent cursor. The purge node has two references
to the clustered index record - one via the ref member, and the
other via the persistent cursor. These two references must match
each other if the found_clust flag is set.
@return true if the persistent cursor is consistent with
the ref member.*/
bool validate_pcur();
#endif
};
#ifndef UNIV_NONINL
#include "row0purge.ic"
#endif
#endif