Skip to content

Commit c5922c5

Browse files
author
Jan Lindström
committed
MDEV-8821: Failing assertion: !page || page_type != 0 in file log0recv. cc line 1404
Alloc creating crypt_data to empty page at crash recovery and redo.
1 parent 3cc6e5b commit c5922c5

File tree

2 files changed

+4
-154
lines changed

2 files changed

+4
-154
lines changed

storage/innobase/log/log0recv.cc

Lines changed: 2 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1089,82 +1089,7 @@ recv_parse_or_apply_log_rec_body(
10891089
break;
10901090
#endif /* UNIV_LOG_LSN_DEBUG */
10911091
case MLOG_1BYTE: case MLOG_2BYTES: case MLOG_4BYTES: case MLOG_8BYTES:
1092-
#ifdef UNIV_DEBUG
1093-
if (page && page_type == FIL_PAGE_TYPE_ALLOCATED
1094-
&& end_ptr >= ptr + 2) {
1095-
/* It is OK to set FIL_PAGE_TYPE and certain
1096-
list node fields on an empty page. Any other
1097-
write is not OK. */
1098-
1099-
/* NOTE: There may be bogus assertion failures for
1100-
dict_hdr_create(), trx_rseg_header_create(),
1101-
trx_sys_create_doublewrite_buf(), and
1102-
trx_sysf_create().
1103-
These are only called during database creation. */
1104-
ulint offs = mach_read_from_2(ptr);
1105-
1106-
switch (type) {
1107-
default:
1108-
ut_error;
1109-
case MLOG_2BYTES:
1110-
/* Note that this can fail when the
1111-
redo log been written with something
1112-
older than InnoDB Plugin 1.0.4. */
1113-
ut_ad(offs == FIL_PAGE_TYPE
1114-
|| offs == IBUF_TREE_SEG_HEADER
1115-
+ IBUF_HEADER + FSEG_HDR_OFFSET
1116-
|| offs == PAGE_BTR_IBUF_FREE_LIST
1117-
+ PAGE_HEADER + FIL_ADDR_BYTE
1118-
|| offs == PAGE_BTR_IBUF_FREE_LIST
1119-
+ PAGE_HEADER + FIL_ADDR_BYTE
1120-
+ FIL_ADDR_SIZE
1121-
|| offs == PAGE_BTR_SEG_LEAF
1122-
+ PAGE_HEADER + FSEG_HDR_OFFSET
1123-
|| offs == PAGE_BTR_SEG_TOP
1124-
+ PAGE_HEADER + FSEG_HDR_OFFSET
1125-
|| offs == PAGE_BTR_IBUF_FREE_LIST_NODE
1126-
+ PAGE_HEADER + FIL_ADDR_BYTE
1127-
+ 0 /*FLST_PREV*/
1128-
|| offs == PAGE_BTR_IBUF_FREE_LIST_NODE
1129-
+ PAGE_HEADER + FIL_ADDR_BYTE
1130-
+ FIL_ADDR_SIZE /*FLST_NEXT*/);
1131-
break;
1132-
case MLOG_4BYTES:
1133-
/* Note that this can fail when the
1134-
redo log been written with something
1135-
older than InnoDB Plugin 1.0.4. */
1136-
ut_ad(0
1137-
|| offs == IBUF_TREE_SEG_HEADER
1138-
+ IBUF_HEADER + FSEG_HDR_SPACE
1139-
|| offs == IBUF_TREE_SEG_HEADER
1140-
+ IBUF_HEADER + FSEG_HDR_PAGE_NO
1141-
|| offs == PAGE_BTR_IBUF_FREE_LIST
1142-
+ PAGE_HEADER/* flst_init */
1143-
|| offs == PAGE_BTR_IBUF_FREE_LIST
1144-
+ PAGE_HEADER + FIL_ADDR_PAGE
1145-
|| offs == PAGE_BTR_IBUF_FREE_LIST
1146-
+ PAGE_HEADER + FIL_ADDR_PAGE
1147-
+ FIL_ADDR_SIZE
1148-
|| offs == PAGE_BTR_SEG_LEAF
1149-
+ PAGE_HEADER + FSEG_HDR_PAGE_NO
1150-
|| offs == PAGE_BTR_SEG_LEAF
1151-
+ PAGE_HEADER + FSEG_HDR_SPACE
1152-
|| offs == PAGE_BTR_SEG_TOP
1153-
+ PAGE_HEADER + FSEG_HDR_PAGE_NO
1154-
|| offs == PAGE_BTR_SEG_TOP
1155-
+ PAGE_HEADER + FSEG_HDR_SPACE
1156-
|| offs == PAGE_BTR_IBUF_FREE_LIST_NODE
1157-
+ PAGE_HEADER + FIL_ADDR_PAGE
1158-
+ 0 /*FLST_PREV*/
1159-
|| offs == PAGE_BTR_IBUF_FREE_LIST_NODE
1160-
+ PAGE_HEADER + FIL_ADDR_PAGE
1161-
+ FIL_ADDR_SIZE /*FLST_NEXT*/
1162-
|| offs ==
1163-
FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
1164-
break;
1165-
}
1166-
}
1167-
#endif /* UNIV_DEBUG */
1092+
/* Note that crypt data can be set to empty page */
11681093
ptr = mlog_parse_nbytes(type, ptr, end_ptr, page, page_zip);
11691094
break;
11701095
case MLOG_REC_INSERT: case MLOG_COMP_REC_INSERT:
@@ -1336,7 +1261,7 @@ recv_parse_or_apply_log_rec_body(
13361261
ptr = fsp_parse_init_file_page(ptr, end_ptr, block);
13371262
break;
13381263
case MLOG_WRITE_STRING:
1339-
ut_ad(!page || page_type != FIL_PAGE_TYPE_ALLOCATED);
1264+
/* Allow setting crypt_data also for empty page */
13401265
ptr = mlog_parse_string(ptr, end_ptr, page, page_zip);
13411266
break;
13421267
case MLOG_FILE_RENAME:

storage/xtradb/log/log0recv.cc

Lines changed: 2 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1154,82 +1154,7 @@ recv_parse_or_apply_log_rec_body(
11541154
break;
11551155
#endif /* UNIV_LOG_LSN_DEBUG */
11561156
case MLOG_1BYTE: case MLOG_2BYTES: case MLOG_4BYTES: case MLOG_8BYTES:
1157-
#ifdef UNIV_DEBUG
1158-
if (page && page_type == FIL_PAGE_TYPE_ALLOCATED
1159-
&& end_ptr >= ptr + 2) {
1160-
/* It is OK to set FIL_PAGE_TYPE and certain
1161-
list node fields on an empty page. Any other
1162-
write is not OK. */
1163-
1164-
/* NOTE: There may be bogus assertion failures for
1165-
dict_hdr_create(), trx_rseg_header_create(),
1166-
trx_sys_create_doublewrite_buf(), and
1167-
trx_sysf_create().
1168-
These are only called during database creation. */
1169-
ulint offs = mach_read_from_2(ptr);
1170-
1171-
switch (type) {
1172-
default:
1173-
ut_error;
1174-
case MLOG_2BYTES:
1175-
/* Note that this can fail when the
1176-
redo log been written with something
1177-
older than InnoDB Plugin 1.0.4. */
1178-
ut_ad(offs == FIL_PAGE_TYPE
1179-
|| offs == IBUF_TREE_SEG_HEADER
1180-
+ IBUF_HEADER + FSEG_HDR_OFFSET
1181-
|| offs == PAGE_BTR_IBUF_FREE_LIST
1182-
+ PAGE_HEADER + FIL_ADDR_BYTE
1183-
|| offs == PAGE_BTR_IBUF_FREE_LIST
1184-
+ PAGE_HEADER + FIL_ADDR_BYTE
1185-
+ FIL_ADDR_SIZE
1186-
|| offs == PAGE_BTR_SEG_LEAF
1187-
+ PAGE_HEADER + FSEG_HDR_OFFSET
1188-
|| offs == PAGE_BTR_SEG_TOP
1189-
+ PAGE_HEADER + FSEG_HDR_OFFSET
1190-
|| offs == PAGE_BTR_IBUF_FREE_LIST_NODE
1191-
+ PAGE_HEADER + FIL_ADDR_BYTE
1192-
+ 0 /*FLST_PREV*/
1193-
|| offs == PAGE_BTR_IBUF_FREE_LIST_NODE
1194-
+ PAGE_HEADER + FIL_ADDR_BYTE
1195-
+ FIL_ADDR_SIZE /*FLST_NEXT*/);
1196-
break;
1197-
case MLOG_4BYTES:
1198-
/* Note that this can fail when the
1199-
redo log been written with something
1200-
older than InnoDB Plugin 1.0.4. */
1201-
ut_ad(0
1202-
|| offs == IBUF_TREE_SEG_HEADER
1203-
+ IBUF_HEADER + FSEG_HDR_SPACE
1204-
|| offs == IBUF_TREE_SEG_HEADER
1205-
+ IBUF_HEADER + FSEG_HDR_PAGE_NO
1206-
|| offs == PAGE_BTR_IBUF_FREE_LIST
1207-
+ PAGE_HEADER/* flst_init */
1208-
|| offs == PAGE_BTR_IBUF_FREE_LIST
1209-
+ PAGE_HEADER + FIL_ADDR_PAGE
1210-
|| offs == PAGE_BTR_IBUF_FREE_LIST
1211-
+ PAGE_HEADER + FIL_ADDR_PAGE
1212-
+ FIL_ADDR_SIZE
1213-
|| offs == PAGE_BTR_SEG_LEAF
1214-
+ PAGE_HEADER + FSEG_HDR_PAGE_NO
1215-
|| offs == PAGE_BTR_SEG_LEAF
1216-
+ PAGE_HEADER + FSEG_HDR_SPACE
1217-
|| offs == PAGE_BTR_SEG_TOP
1218-
+ PAGE_HEADER + FSEG_HDR_PAGE_NO
1219-
|| offs == PAGE_BTR_SEG_TOP
1220-
+ PAGE_HEADER + FSEG_HDR_SPACE
1221-
|| offs == PAGE_BTR_IBUF_FREE_LIST_NODE
1222-
+ PAGE_HEADER + FIL_ADDR_PAGE
1223-
+ 0 /*FLST_PREV*/
1224-
|| offs == PAGE_BTR_IBUF_FREE_LIST_NODE
1225-
+ PAGE_HEADER + FIL_ADDR_PAGE
1226-
+ FIL_ADDR_SIZE /*FLST_NEXT*/
1227-
|| offs ==
1228-
FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
1229-
break;
1230-
}
1231-
}
1232-
#endif /* UNIV_DEBUG */
1157+
/* Note that crypt data can be set to empty page */
12331158
ptr = mlog_parse_nbytes(type, ptr, end_ptr, page, page_zip);
12341159
break;
12351160
case MLOG_REC_INSERT: case MLOG_COMP_REC_INSERT:
@@ -1401,7 +1326,7 @@ recv_parse_or_apply_log_rec_body(
14011326
ptr = fsp_parse_init_file_page(ptr, end_ptr, block);
14021327
break;
14031328
case MLOG_WRITE_STRING:
1404-
ut_ad(!page || page_type != FIL_PAGE_TYPE_ALLOCATED);
1329+
/* Allow setting crypt_data also for empty page */
14051330
ptr = mlog_parse_string(ptr, end_ptr, page, page_zip);
14061331
break;
14071332
case MLOG_FILE_RENAME:

0 commit comments

Comments
 (0)