summaryrefslogtreecommitdiff
path: root/innobase/include
diff options
context:
space:
mode:
Diffstat (limited to 'innobase/include')
-rw-r--r--innobase/include/dict0dict.h20
-rw-r--r--innobase/include/dict0mem.h4
-rw-r--r--innobase/include/dyn0dyn.h4
-rw-r--r--innobase/include/fsp0fsp.h10
-rw-r--r--innobase/include/log0log.h34
-rw-r--r--innobase/include/log0log.ic85
-rw-r--r--innobase/include/log0recv.h6
-rw-r--r--innobase/include/trx0sys.h13
-rw-r--r--innobase/include/trx0trx.h4
9 files changed, 132 insertions, 48 deletions
diff --git a/innobase/include/dict0dict.h b/innobase/include/dict0dict.h
index fd79e17090a..832654d2666 100644
--- a/innobase/include/dict0dict.h
+++ b/innobase/include/dict0dict.h
@@ -96,17 +96,17 @@ dict_col_get_clust_pos(
/*===================*/
dict_col_t* col);
/************************************************************************
-Initializes the autoinc counter. It is not an error to initialize already
+Initializes the autoinc counter. It is not an error to initialize an already
initialized counter. */
void
dict_table_autoinc_initialize(
/*==========================*/
dict_table_t* table, /* in: table */
- ib_longlong value); /* in: value which was assigned to a row */
+ ib_longlong value); /* in: next value to assign to a row */
/************************************************************************
-Gets the next autoinc value, 0 if not yet initialized. If initialized,
-increments the counter by 1. */
+Gets the next autoinc value (== autoinc counter value), 0 if not yet
+initialized. If initialized, increments the counter by 1. */
ib_longlong
dict_table_autoinc_get(
@@ -123,12 +123,22 @@ dict_table_autoinc_read(
/* out: value of the counter */
dict_table_t* table); /* in: table */
/************************************************************************
-Updates the autoinc counter if the value supplied is bigger than the
+Peeks the autoinc counter value, 0 if not yet initialized. Does not
+increment the counter. The read not protected by any mutex! */
+
+ib_longlong
+dict_table_autoinc_peek(
+/*====================*/
+ /* out: value of the counter */
+ dict_table_t* table); /* in: table */
+/************************************************************************
+Updates the autoinc counter if the value supplied is equal or bigger than the
current value. If not inited, does nothing. */
void
dict_table_autoinc_update(
/*======================*/
+
dict_table_t* table, /* in: table */
ib_longlong value); /* in: value which was assigned to a row */
/**************************************************************************
diff --git a/innobase/include/dict0mem.h b/innobase/include/dict0mem.h
index ef15c99fdba..cc27f2bad12 100644
--- a/innobase/include/dict0mem.h
+++ b/innobase/include/dict0mem.h
@@ -388,8 +388,8 @@ struct dict_table_struct{
/* TRUE if the autoinc counter has been
inited; MySQL gets the init value by executing
SELECT MAX(auto inc column) */
- ib_longlong autoinc;/* autoinc counter value already given to
- a row */
+ ib_longlong autoinc;/* autoinc counter value to give to the
+ next inserted row */
ulint magic_n;/* magic number */
};
#define DICT_TABLE_MAGIC_N 76333786
diff --git a/innobase/include/dyn0dyn.h b/innobase/include/dyn0dyn.h
index 6f08da1533b..504aade29d2 100644
--- a/innobase/include/dyn0dyn.h
+++ b/innobase/include/dyn0dyn.h
@@ -17,7 +17,9 @@ typedef struct dyn_block_struct dyn_block_t;
typedef dyn_block_t dyn_array_t;
-/* This must be > MLOG_BUF_MARGIN + 30 */
+/* This is the initial 'payload' size of a dynamic array;
+this must be > MLOG_BUF_MARGIN + 30! */
+
#define DYN_ARRAY_DATA_SIZE 512
/*************************************************************************
diff --git a/innobase/include/fsp0fsp.h b/innobase/include/fsp0fsp.h
index a0197ec2d97..3494f336b1e 100644
--- a/innobase/include/fsp0fsp.h
+++ b/innobase/include/fsp0fsp.h
@@ -57,6 +57,16 @@ fsp_header_get_free_limit(
/* out: free limit in megabytes */
ulint space); /* in: space id */
/**************************************************************************
+Gets the size of the tablespace from the tablespace header. If we do not
+have an auto-extending data file, this should be equal to the size of the
+data files. If there is an auto-extending data file, this can be smaller. */
+
+ulint
+fsp_header_get_tablespace_size(
+/*===========================*/
+ /* out: size in pages */
+ ulint space); /* in: space id */
+/**************************************************************************
Initializes the space header of a new created space. */
void
diff --git a/innobase/include/log0log.h b/innobase/include/log0log.h
index 5d848b85658..4358577c59c 100644
--- a/innobase/include/log0log.h
+++ b/innobase/include/log0log.h
@@ -431,15 +431,30 @@ log_block_set_data_len(
byte* log_block, /* in: log block */
ulint len); /* in: data length */
/****************************************************************
-Gets a log block number stored in the trailer. */
+Calculates the checksum for a log block. */
UNIV_INLINE
ulint
-log_block_get_trl_no(
-/*=================*/
- /* out: log block number stored in the block
- trailer */
+log_block_calc_checksum(
+/*====================*/
+ /* out: checksum */
+ byte* block); /* in: log block */
+/****************************************************************
+Gets a log block checksum field value. */
+UNIV_INLINE
+ulint
+log_block_get_checksum(
+/*===================*/
+ /* out: checksum */
byte* log_block); /* in: log block */
/****************************************************************
+Sets a log block checksum field value. */
+UNIV_INLINE
+void
+log_block_set_checksum(
+/*===================*/
+ byte* log_block, /* in: log block */
+ ulint checksum); /* in: checksum */
+/****************************************************************
Gets a log block first mtr log record group offset. */
UNIV_INLINE
ulint
@@ -544,10 +559,11 @@ extern log_t* log_sys;
bytes */
/* Offsets of a log block trailer from the end of the block */
-#define LOG_BLOCK_TRL_CHECKSUM 4 /* 1 byte checksum of the log block
- contents */
-#define LOG_BLOCK_TRL_NO 3 /* 3 lowest bytes of the log block
- number */
+#define LOG_BLOCK_CHECKSUM 4 /* 4 byte checksum of the log block
+ contents; in InnoDB versions
+ < 3.23.52 this did not contain the
+ checksum but the same value as
+ .._HDR_NO */
#define LOG_BLOCK_TRL_SIZE 4 /* trailer size in bytes */
/* Offsets for a checkpoint field */
diff --git a/innobase/include/log0log.ic b/innobase/include/log0log.ic
index 36e65239374..9167246fe45 100644
--- a/innobase/include/log0log.ic
+++ b/innobase/include/log0log.ic
@@ -170,33 +170,6 @@ log_block_set_checkpoint_no(
}
/****************************************************************
-Gets a log block number stored in the trailer. */
-UNIV_INLINE
-ulint
-log_block_get_trl_no(
-/*=================*/
- /* out: log block number stored in the block
- trailer */
- byte* log_block) /* in: log block */
-{
- return(mach_read_from_3(log_block + OS_FILE_LOG_BLOCK_SIZE
- - LOG_BLOCK_TRL_NO));
-}
-
-/****************************************************************
-Sets the log block number stored in the trailer. */
-UNIV_INLINE
-void
-log_block_set_trl_no(
-/*=================*/
- byte* log_block, /* in: log block */
- ulint n) /* in: log block number */
-{
- mach_write_to_3(log_block + OS_FILE_LOG_BLOCK_SIZE - LOG_BLOCK_TRL_NO,
- n & 0xFFFFFF);
-}
-
-/****************************************************************
Converts a lsn to a log block number. */
UNIV_INLINE
ulint
@@ -217,6 +190,61 @@ log_block_convert_lsn_to_no(
}
/****************************************************************
+Calculates the checksum for a log block. */
+UNIV_INLINE
+ulint
+log_block_calc_checksum(
+/*====================*/
+ /* out: checksum */
+ byte* block) /* in: log block */
+{
+ ulint sum;
+ ulint sh;
+ ulint i;
+
+ sum = 1;
+ sh = 0;
+
+ for (i = 0; i < OS_FILE_LOG_BLOCK_SIZE - LOG_BLOCK_TRL_SIZE; i++) {
+ sum = sum & 0x7FFFFFFF;
+ sum += ((ulint)(*(block + i))) << sh;
+ sh++;
+ if (sh > 24) {
+ sh = 0;
+ }
+ }
+
+ return(sum);
+}
+
+/****************************************************************
+Gets a log block checksum field value. */
+UNIV_INLINE
+ulint
+log_block_get_checksum(
+/*===================*/
+ /* out: checksum */
+ byte* log_block) /* in: log block */
+{
+ return(mach_read_from_4(log_block + OS_FILE_LOG_BLOCK_SIZE
+ - LOG_BLOCK_CHECKSUM));
+}
+
+/****************************************************************
+Sets a log block checksum field value. */
+UNIV_INLINE
+void
+log_block_set_checksum(
+/*===================*/
+ byte* log_block, /* in: log block */
+ ulint checksum) /* in: checksum */
+{
+ mach_write_to_4(log_block + OS_FILE_LOG_BLOCK_SIZE
+ - LOG_BLOCK_CHECKSUM,
+ checksum);
+}
+
+/****************************************************************
Initializes a log block in the log buffer. */
UNIV_INLINE
void
@@ -232,7 +260,6 @@ log_block_init(
no = log_block_convert_lsn_to_no(lsn);
log_block_set_hdr_no(log_block, no);
- log_block_set_trl_no(log_block, no);
log_block_set_data_len(log_block, LOG_BLOCK_HDR_SIZE);
log_block_set_first_rec_group(log_block, 0);
@@ -256,7 +283,7 @@ log_block_init_in_old_format(
log_block_set_hdr_no(log_block, no);
mach_write_to_4(log_block + OS_FILE_LOG_BLOCK_SIZE
- - LOG_BLOCK_TRL_NO - 1, no);
+ - LOG_BLOCK_CHECKSUM, no);
log_block_set_data_len(log_block, LOG_BLOCK_HDR_SIZE);
log_block_set_first_rec_group(log_block, 0);
}
diff --git a/innobase/include/log0recv.h b/innobase/include/log0recv.h
index 0825325965d..65f80deee93 100644
--- a/innobase/include/log0recv.h
+++ b/innobase/include/log0recv.h
@@ -313,6 +313,10 @@ struct recv_sys_struct{
this lsn */
dulint limit_lsn;/* recovery should be made at most up to this
lsn */
+ ibool found_corrupt_log;
+ /* this is set to TRUE if we during log
+ scan find a corrupt log block, or a corrupt
+ log record */
log_group_t* archive_group;
/* in archive recovery: the log group whose
archive is read */
@@ -328,6 +332,8 @@ extern ibool recv_recovery_on;
extern ibool recv_no_ibuf_operations;
extern ibool recv_needed_recovery;
+extern ibool recv_is_making_a_backup;
+
/* Size of the parsing buffer; it must accommodate RECV_SCAN_SIZE many
times! */
#define RECV_PARSING_BUF_SIZE (2 * 1024 * 1024)
diff --git a/innobase/include/trx0sys.h b/innobase/include/trx0sys.h
index b08df7f6901..a54a6424a4f 100644
--- a/innobase/include/trx0sys.h
+++ b/innobase/include/trx0sys.h
@@ -257,6 +257,15 @@ void
trx_sys_print_mysql_binlog_offset(void);
/*===================================*/
/*********************************************************************
+Prints to stdout the MySQL binlog info in the system header if the
+magic number shows it valid. */
+
+void
+trx_sys_print_mysql_binlog_offset_from_page(
+/*========================================*/
+ byte* page); /* in: buffer containing the trx system header page,
+ i.e., page number TRX_SYS_PAGE_NO in the tablespace */
+/*********************************************************************
Prints to stderr the MySQL master log offset info in the trx system header if
the magic number shows it valid. */
@@ -300,11 +309,11 @@ therefore 256; each slot is currently 8 bytes in size */
#define TRX_SYS_MYSQL_LOG_NAME_LEN 512
#define TRX_SYS_MYSQL_LOG_MAGIC_N 873422344
-/* The offset of the MySQL replication info on the trx system header page;
+/* The offset of the MySQL replication info in the trx system header;
this contains the same fields as TRX_SYS_MYSQL_LOG_INFO below */
#define TRX_SYS_MYSQL_MASTER_LOG_INFO (UNIV_PAGE_SIZE - 2000)
-/* The offset of the MySQL binlog offset info on the trx system header page */
+/* The offset of the MySQL binlog offset info in the trx system header */
#define TRX_SYS_MYSQL_LOG_INFO (UNIV_PAGE_SIZE - 1000)
#define TRX_SYS_MYSQL_LOG_MAGIC_N_FLD 0 /* magic number which shows
if we have valid data in the
diff --git a/innobase/include/trx0trx.h b/innobase/include/trx0trx.h
index 83789966514..6e98f22c34b 100644
--- a/innobase/include/trx0trx.h
+++ b/innobase/include/trx0trx.h
@@ -309,6 +309,9 @@ struct trx_struct{
of view of concurrency control:
TRX_ACTIVE, TRX_COMMITTED_IN_MEMORY,
... */
+ time_t start_time; /* time the trx object was created
+ or the state last time became
+ TRX_ACTIVE */
ibool check_foreigns; /* normally TRUE, but if the user
wants to suppress foreign key checks,
(in table imports, for example) we
@@ -468,6 +471,7 @@ struct trx_struct{
TRX_QUE_LOCK_WAIT, this points to
the lock request, otherwise this is
NULL */
+ time_t wait_started; /* lock wait started at this time */
UT_LIST_BASE_NODE_T(que_thr_t)
wait_thrs; /* query threads belonging to this
trx that are in the QUE_THR_LOCK_WAIT