MySQL 8.3.0
Source Code Documentation
constants.h
Go to the documentation of this file.
1/* Copyright (c) 2017, 2023, Oracle and/or its affiliates.
2
3This program is free software; you can redistribute it and/or modify it under
4the terms of the GNU General Public License, version 2.0, as published by the
5Free Software Foundation.
6
7This program is also distributed with certain software (including but not
8limited to OpenSSL) that is licensed under separate terms, as designated in a
9particular file or component or in included license documentation. The authors
10of MySQL hereby grant you an additional permission to link the program and
11your derivative works with the separately licensed software that they have
12included with MySQL.
13
14This program is distributed in the hope that it will be useful, but WITHOUT
15ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16FOR A PARTICULAR PURPOSE. See the GNU General Public License, version 2.0,
17for more details.
18
19You should have received a copy of the GNU General Public License along with
20this program; if not, write to the Free Software Foundation, Inc.,
2151 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22
23/** @file storage/temptable/include/temptable/constants.h
24TempTable constants. */
25
26#ifndef TEMPTABLE_CONSTANTS_H
27#define TEMPTABLE_CONSTANTS_H
28
29#include "my_config.h"
30
31namespace temptable {
32
33/** Multiply a number by 1024.
34 * @return n * 1024. */
35inline constexpr unsigned long long operator"" _KiB(
36 /** [in] Number to multiply. */
37 unsigned long long n) {
38 return n << 10;
39}
40
41/** Multiply a number by 1024 * 1024.
42 * @return n * 1024 * 1024. */
43inline constexpr unsigned long long operator"" _MiB(
44 /** [in] Number to multiply. */
45 unsigned long long n) {
46 return n << 20;
47}
48
49/** Multiply a number by 1024 * 1024 * 1024.
50 * @return n * 1024 * 1024 * 1024. */
51inline constexpr unsigned long long operator"" _GiB(
52 /** [in] Number to multiply. */
53 unsigned long long n) {
54 return n << 30;
55}
56
57/** log2(allocator max block size in MiB). Ie.
58 * 2 ^ ALLOCATOR_MAX_BLOCK_MB_EXP * 1024^2 = ALLOCATOR_MAX_BLOCK_BYTES. */
59constexpr size_t ALLOCATOR_MAX_BLOCK_MB_EXP = 9;
60
61/** Limit on the size of a block created by `Allocator` (in bytes). A larger
62 * block could still be created if a single allocation request with bigger size
63 * is received. */
64constexpr size_t ALLOCATOR_MAX_BLOCK_BYTES = 1_MiB
66
67/** `Storage` page size. */
68constexpr size_t STORAGE_PAGE_SIZE = 64_KiB;
69
70/** Number of buckets to have by default in a hash index. */
71constexpr size_t INDEX_DEFAULT_HASH_TABLE_BUCKETS = 1024;
72
73/** Store build-type information into the constexpr expression. */
74#ifndef NDEBUG
75constexpr bool DEBUG_BUILD = true;
76#else
77constexpr bool DEBUG_BUILD = false;
78#endif /* NDEBUG */
79
80/** Store L1-dcache size information into the constexpr expression. */
82
83/** Number of shards in key-value store. */
84constexpr size_t KV_STORE_SHARDS_COUNT = 16 * 1024;
85
86/** Size of a pool containing shared-blocks. */
87constexpr size_t SHARED_BLOCK_POOL_SIZE = 16 * 1024;
88
89} /* namespace temptable */
90
91#endif /* TEMPTABLE_CONSTANTS_H */
#define CPU_LEVEL1_DCACHE_LINESIZE
Definition: config.h:310
Definition: allocator.h:44
constexpr size_t ALLOCATOR_MAX_BLOCK_MB_EXP
log2(allocator max block size in MiB).
Definition: constants.h:59
constexpr size_t KV_STORE_SHARDS_COUNT
Number of shards in key-value store.
Definition: constants.h:84
constexpr size_t STORAGE_PAGE_SIZE
Storage page size.
Definition: constants.h:68
constexpr size_t INDEX_DEFAULT_HASH_TABLE_BUCKETS
Number of buckets to have by default in a hash index.
Definition: constants.h:71
constexpr size_t ALLOCATOR_MAX_BLOCK_BYTES
Limit on the size of a block created by Allocator (in bytes).
Definition: constants.h:64
constexpr bool DEBUG_BUILD
Store build-type information into the constexpr expression.
Definition: constants.h:75
constexpr size_t SHARED_BLOCK_POOL_SIZE
Size of a pool containing shared-blocks.
Definition: constants.h:87
constexpr size_t L1_DCACHE_SIZE
Store L1-dcache size information into the constexpr expression.
Definition: constants.h:81
int n
Definition: xcom_base.cc:508