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