Skip to content

Commit a03ce7b

Browse files
author
Alexey Botchkov
committed
MDEV-31521 bzero wipes more bytes than necessary in set_global_from_ddl_log_entry.
'defaults' made into 'constexpr' variables.
1 parent a4e103a commit a03ce7b

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

sql/ddl_log.cc

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -141,43 +141,43 @@ static st_ddl_recovery recovery_state;
141141
mysql_mutex_t LOCK_gdl;
142142

143143
/* Positions to different data in a ddl log block */
144-
#define DDL_LOG_ENTRY_TYPE_POS 0
144+
static constexpr unsigned DDL_LOG_ENTRY_TYPE_POS= 0;
145145
/*
146146
Note that ACTION_TYPE and PHASE_POS must be after each other.
147147
See update_phase()
148148
*/
149-
#define DDL_LOG_ACTION_TYPE_POS 1
150-
#define DDL_LOG_PHASE_POS 2
151-
#define DDL_LOG_NEXT_ENTRY_POS 4
149+
static constexpr unsigned DDL_LOG_ACTION_TYPE_POS= 1;
150+
static constexpr unsigned DDL_LOG_PHASE_POS= 2;
151+
static constexpr unsigned DDL_LOG_NEXT_ENTRY_POS= 4;
152152
/* Flags to remember something unique about the query, like if .frm was used */
153-
#define DDL_LOG_FLAG_POS 8
153+
static constexpr unsigned DDL_LOG_FLAG_POS= 8;
154154
/* Used to store XID entry that was written to binary log */
155-
#define DDL_LOG_XID_POS 10
155+
static constexpr unsigned DDL_LOG_XID_POS= 10;
156156
/* Used to store unique uuid from the .frm file */
157-
#define DDL_LOG_UUID_POS 18
157+
static constexpr unsigned DDL_LOG_UUID_POS= 18;
158158
/* ID_POS can be used to store something unique, like file size (4 bytes) */
159-
#define DDL_LOG_ID_POS DDL_LOG_UUID_POS + MY_UUID_SIZE
160-
#define DDL_LOG_END_POS DDL_LOG_ID_POS + 8
159+
static constexpr unsigned DDL_LOG_ID_POS= DDL_LOG_UUID_POS + MY_UUID_SIZE;
160+
static constexpr unsigned DDL_LOG_END_POS= DDL_LOG_ID_POS + 8;
161161

162162
/*
163163
Position to where names are stored in the ddl log blocks. The current
164164
value is stored in the header and can thus be changed if we need more
165165
space for constants in the header than what is between DDL_LOG_ID_POS and
166166
DDL_LOG_TMP_NAME_POS.
167167
*/
168-
#define DDL_LOG_TMP_NAME_POS 56
168+
static constexpr unsigned DDL_LOG_TMP_NAME_POS= 56;
169169

170170
/* Definitions for the ddl log header, the first block in the file */
171171
/* IO_SIZE is stored in the header and can thus be changed */
172-
#define DDL_LOG_IO_SIZE IO_SIZE
172+
static constexpr unsigned DDL_LOG_IO_SIZE= IO_SIZE;
173173

174174
/* Header is stored in positions 0-3 */
175-
#define DDL_LOG_IO_SIZE_POS 4
176-
#define DDL_LOG_NAME_OFFSET_POS 6
175+
static constexpr unsigned DDL_LOG_IO_SIZE_POS= 4;
176+
static constexpr unsigned DDL_LOG_NAME_OFFSET_POS= 6;
177177
/* Marks if we have done a backup of the ddl log */
178-
#define DDL_LOG_BACKUP_OFFSET_POS 8
178+
static constexpr unsigned DDL_LOG_BACKUP_OFFSET_POS= 8;
179179
/* Sum of the above variables */
180-
#define DDL_LOG_HEADER_SIZE 4+2+2+1
180+
static constexpr unsigned DDL_LOG_HEADER_SIZE= 4+2+2+1;
181181

182182
/**
183183
Sync the ddl log file.

0 commit comments

Comments
 (0)