Use constexpr for constants on data pages

This commit is contained in:
Marko Mäkelä 2019-11-13 14:34:52 +02:00
parent ae72205e31
commit 2b7aa60b7e
4 changed files with 21 additions and 20 deletions

View File

@ -37,7 +37,7 @@ extern bool innodb_table_stats_not_found;
extern bool innodb_index_stats_not_found; extern bool innodb_index_stats_not_found;
/** the first table or index ID for other than hard-coded system tables */ /** the first table or index ID for other than hard-coded system tables */
#define DICT_HDR_FIRST_ID 10 constexpr uint8_t DICT_HDR_FIRST_ID= 10;
/********************************************************************//** /********************************************************************//**
Get the database name length in a table name. Get the database name length in a table name.

View File

@ -158,12 +158,12 @@ Otherwise written as 0. @see PAGE_ROOT_AUTO_INC */
not necessarily collation order; not necessarily collation order;
this record may have been deleted */ this record may have been deleted */
/* Directions of cursor movement */ /* Directions of cursor movement (stored in PAGE_DIRECTION field) */
#define PAGE_LEFT 1 constexpr uint16_t PAGE_LEFT= 1;
#define PAGE_RIGHT 2 constexpr uint16_t PAGE_RIGHT= 2;
#define PAGE_SAME_REC 3 constexpr uint16_t PAGE_SAME_REC= 3;
#define PAGE_SAME_PAGE 4 constexpr uint16_t PAGE_SAME_PAGE= 4;
#define PAGE_NO_DIRECTION 5 constexpr uint16_t PAGE_NO_DIRECTION= 5;
#ifndef UNIV_INNOCHECKSUM #ifndef UNIV_INNOCHECKSUM

View File

@ -344,9 +344,9 @@ FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID. */
/*-------------------------------------------------------------*/ /*-------------------------------------------------------------*/
/** Contents of TRX_SYS_DOUBLEWRITE_MAGIC */ /** Contents of TRX_SYS_DOUBLEWRITE_MAGIC */
#define TRX_SYS_DOUBLEWRITE_MAGIC_N 536853855 constexpr uint32_t TRX_SYS_DOUBLEWRITE_MAGIC_N= 536853855;
/** Contents of TRX_SYS_DOUBLEWRITE_SPACE_ID_STORED */ /** Contents of TRX_SYS_DOUBLEWRITE_SPACE_ID_STORED */
#define TRX_SYS_DOUBLEWRITE_SPACE_ID_STORED_N 1783657386 constexpr uint32_t TRX_SYS_DOUBLEWRITE_SPACE_ID_STORED_N= 1783657386;
/** Size of the doublewrite block in pages */ /** Size of the doublewrite block in pages */
#define TRX_SYS_DOUBLEWRITE_BLOCK_SIZE FSP_EXTENT_SIZE #define TRX_SYS_DOUBLEWRITE_BLOCK_SIZE FSP_EXTENT_SIZE

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, 2018, MariaDB Corporation. Copyright (c) 2017, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under 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 the terms of the GNU General Public License as published by the Free Software
@ -308,16 +308,17 @@ trx_undo_mem_create_at_db_start(trx_rseg_t* rseg, ulint id, ulint page_no,
and delete markings: in short, and delete markings: in short,
modifys (the name 'UPDATE' is a modifys (the name 'UPDATE' is a
historical relic) */ historical relic) */
/* States of an undo log segment */ /* TRX_UNDO_STATE values of an undo log segment */
#define TRX_UNDO_ACTIVE 1 /* contains an undo log of an active /** contains an undo log of an active transaction */
transaction */ constexpr uint16_t TRX_UNDO_ACTIVE = 1;
#define TRX_UNDO_CACHED 2 /* cached for quick reuse */ /** cached for quick reuse */
#define TRX_UNDO_TO_FREE 3 /* insert undo segment can be freed */ constexpr uint16_t TRX_UNDO_CACHED = 2;
#define TRX_UNDO_TO_PURGE 4 /* update undo segment will not be /** old_insert undo segment that can be freed */
reused: it can be freed in purge when constexpr uint16_t TRX_UNDO_TO_FREE = 3;
all undo data in it is removed */ /** can be freed in purge when all undo data in it is removed */
#define TRX_UNDO_PREPARED 5 /* contains an undo log of an constexpr uint16_t TRX_UNDO_TO_PURGE = 4;
prepared transaction */ /** contains an undo log of a prepared transaction */
constexpr uint16_t TRX_UNDO_PREPARED = 5;
#ifndef UNIV_INNOCHECKSUM #ifndef UNIV_INNOCHECKSUM