1/***************************************************************************** 2 3Copyright (c) 1996, 2018, Oracle and/or its affiliates. All Rights Reserved. 4 5This program is free software; you can redistribute it and/or modify it under 6the terms of the GNU General Public License, version 2.0, as published by the 7Free Software Foundation. 8 9This program is also distributed with certain software (including but not 10limited to OpenSSL) that is licensed under separate terms, as designated in a 11particular file or component or in included license documentation. The authors 12of MySQL hereby grant you an additional permission to link the program and 13your derivative works with the separately licensed software that they have 14included with MySQL. 15 16This program is distributed in the hope that it will be useful, but WITHOUT 17ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 18FOR A PARTICULAR PURPOSE. See the GNU General Public License, version 2.0, 19for more details. 20 21You should have received a copy of the GNU General Public License along with 22this program; if not, write to the Free Software Foundation, Inc., 2351 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 24 25*****************************************************************************/ 26 27/** @file include/trx0roll.ic 28 Transaction rollback 29 30 Created 3/26/1996 Heikki Tuuri 31 *******************************************************/ 32 33#ifdef UNIV_DEBUG 34/** Check if undo numbering is maintained while processing undo records 35 for rollback. 36 @return true if undo numbering is maintained. */ 37UNIV_INLINE 38bool trx_roll_check_undo_rec_ordering( 39 undo_no_t curr_undo_rec_no, /*!< in: record number of 40 undo record to process. */ 41 space_id_t curr_undo_space_id, /*!< in: space-id of rollback 42 segment that contains the 43 undo record to process. */ 44 const trx_t *trx) /*!< in: transaction */ 45{ 46 /* Each transaction now can have multiple rollback segments. 47 If a transaction involves temp and non-temp tables, both the rollback 48 segments will be active. In this case undo records will be distrubuted 49 across the two rollback segments. 50 CASE-1: UNDO action will apply all undo records from one rollback 51 segment before moving to next. This means undo record numbers can't be 52 sequential but ordering is still enforced as next undo record number 53 should be < processed undo record number. 54 CASE-2: For normal rollback (not initiated by crash) all rollback 55 segments will be active (including non-redo). 56 Based on transaction operation pattern undo record number of first 57 undo record from this new rollback segment can be > last undo number 58 from previous rollback segment and so we ignore this check if 59 rollback segments are switching. Once switched new rollback segment 60 should re-follow undo record number pattern (as mentioned in CASE-1). */ 61 62 return (curr_undo_space_id != trx->undo_rseg_space || 63 curr_undo_rec_no + 1 <= trx->undo_no); 64} 65#endif /* UNIV_DEBUG */ 66