summaryrefslogtreecommitdiff
path: root/storage/innobase/include
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2019-11-13 14:34:52 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2019-11-13 14:34:52 +0200
commit2b7aa60b7e6973e33b0990926ddfdab8c7715ff9 (patch)
treecdedfc1f82ac6de945ca1db9069680e10330640f /storage/innobase/include
parentae72205e31e7665238c1757ede352d9ca53d5327 (diff)
downloadmariadb-git-2b7aa60b7e6973e33b0990926ddfdab8c7715ff9.tar.gz
Use constexpr for constants on data pages
Diffstat (limited to 'storage/innobase/include')
-rw-r--r--storage/innobase/include/dict0dict.h2
-rw-r--r--storage/innobase/include/page0page.h12
-rw-r--r--storage/innobase/include/trx0sys.h4
-rw-r--r--storage/innobase/include/trx0undo.h23
4 files changed, 21 insertions, 20 deletions
diff --git a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict0dict.h
index 4933ee90d6c..f024ecb9949 100644
--- a/storage/innobase/include/dict0dict.h
+++ b/storage/innobase/include/dict0dict.h
@@ -37,7 +37,7 @@ extern bool innodb_table_stats_not_found;
extern bool innodb_index_stats_not_found;
/** 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.
diff --git a/storage/innobase/include/page0page.h b/storage/innobase/include/page0page.h
index 6b6cee789e0..54939bc0c94 100644
--- a/storage/innobase/include/page0page.h
+++ b/storage/innobase/include/page0page.h
@@ -158,12 +158,12 @@ Otherwise written as 0. @see PAGE_ROOT_AUTO_INC */
not necessarily collation order;
this record may have been deleted */
-/* Directions of cursor movement */
-#define PAGE_LEFT 1
-#define PAGE_RIGHT 2
-#define PAGE_SAME_REC 3
-#define PAGE_SAME_PAGE 4
-#define PAGE_NO_DIRECTION 5
+/* Directions of cursor movement (stored in PAGE_DIRECTION field) */
+constexpr uint16_t PAGE_LEFT= 1;
+constexpr uint16_t PAGE_RIGHT= 2;
+constexpr uint16_t PAGE_SAME_REC= 3;
+constexpr uint16_t PAGE_SAME_PAGE= 4;
+constexpr uint16_t PAGE_NO_DIRECTION= 5;
#ifndef UNIV_INNOCHECKSUM
diff --git a/storage/innobase/include/trx0sys.h b/storage/innobase/include/trx0sys.h
index e80b222d260..c1d1cf29dfa 100644
--- a/storage/innobase/include/trx0sys.h
+++ b/storage/innobase/include/trx0sys.h
@@ -344,9 +344,9 @@ FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID. */
/*-------------------------------------------------------------*/
/** 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 */
-#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 */
#define TRX_SYS_DOUBLEWRITE_BLOCK_SIZE FSP_EXTENT_SIZE
diff --git a/storage/innobase/include/trx0undo.h b/storage/innobase/include/trx0undo.h
index 939a51ad489..ce92e5de5e1 100644
--- a/storage/innobase/include/trx0undo.h
+++ b/storage/innobase/include/trx0undo.h
@@ -1,7 +1,7 @@
/*****************************************************************************
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
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,
modifys (the name 'UPDATE' is a
historical relic) */
-/* States of an undo log segment */
-#define TRX_UNDO_ACTIVE 1 /* contains an undo log of an active
- transaction */
-#define TRX_UNDO_CACHED 2 /* cached for quick reuse */
-#define TRX_UNDO_TO_FREE 3 /* insert undo segment can be freed */
-#define TRX_UNDO_TO_PURGE 4 /* update undo segment will not be
- reused: it can be freed in purge when
- all undo data in it is removed */
-#define TRX_UNDO_PREPARED 5 /* contains an undo log of an
- prepared transaction */
+/* TRX_UNDO_STATE values of an undo log segment */
+/** contains an undo log of an active transaction */
+constexpr uint16_t TRX_UNDO_ACTIVE = 1;
+/** cached for quick reuse */
+constexpr uint16_t TRX_UNDO_CACHED = 2;
+/** old_insert undo segment that can be freed */
+constexpr uint16_t TRX_UNDO_TO_FREE = 3;
+/** can be freed in purge when all undo data in it is removed */
+constexpr uint16_t TRX_UNDO_TO_PURGE = 4;
+/** contains an undo log of a prepared transaction */
+constexpr uint16_t TRX_UNDO_PREPARED = 5;
#ifndef UNIV_INNOCHECKSUM