Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
8a039ee1
Commit
8a039ee1
authored
Jan 22, 2020
by
Marko Mäkelä
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-12353: Introduce mtr_t::zmemcpy()
Exclusively write MLOG_ZIP_WRITE_STRING records by mtr_t::zmemcpy().
parent
2e7a0842
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
100 additions
and
258 deletions
+100
-258
storage/innobase/include/mtr0log.h
storage/innobase/include/mtr0log.h
+12
-0
storage/innobase/include/mtr0mtr.h
storage/innobase/include/mtr0mtr.h
+13
-0
storage/innobase/include/page0zip.ic
storage/innobase/include/page0zip.ic
+2
-23
storage/innobase/mtr/mtr0log.cc
storage/innobase/mtr/mtr0log.cc
+29
-0
storage/innobase/page/page0cur.cc
storage/innobase/page/page0cur.cc
+2
-22
storage/innobase/page/page0zip.cc
storage/innobase/page/page0zip.cc
+42
-213
No files found.
storage/innobase/include/mtr0log.h
View file @
8a039ee1
...
...
@@ -144,6 +144,18 @@ void mtr_t::memcpy(buf_block_t *b, ulint offset, const void *str, ulint len)
memcpy
(
*
b
,
offset
,
len
);
}
/** Write a byte string to a page.
@param[in,out] b ROW_FORMAT=COMPRESSED index page
@param[in] ofs byte offset from b->zip.data
@param[in] str the data to write
@param[in] len length of the data to write */
inline
void
mtr_t
::
zmemcpy
(
buf_page_t
*
b
,
ulint
offset
,
const
void
*
str
,
ulint
len
)
{
::
memcpy
(
b
->
zip
.
data
+
offset
,
str
,
len
);
zmemcpy
(
*
b
,
offset
,
len
);
}
/** Writes a log record about an operation.
@param[in] type redo log record type
@param[in] space_id tablespace identifier
...
...
storage/innobase/include/mtr0mtr.h
View file @
8a039ee1
...
...
@@ -432,6 +432,19 @@ struct mtr_t {
@param[in] len length of the data to write */
inline
void
memcpy
(
buf_block_t
*
b
,
ulint
offset
,
const
void
*
str
,
ulint
len
);
/** Write a byte string to a ROW_FORMAT=COMPRESSED page.
@param[in] b ROW_FORMAT=COMPRESSED index page
@param[in] ofs byte offset from b.zip.data
@param[in] len length of the data to write */
void
zmemcpy
(
const
buf_page_t
&
b
,
ulint
offset
,
ulint
len
);
/** Write a byte string to a ROW_FORMAT=COMPRESSED page.
@param[in,out] b ROW_FORMAT=COMPRESSED index page
@param[in] ofs byte offset from b->zip.data
@param[in] str the data to write
@param[in] len length of the data to write */
inline
void
zmemcpy
(
buf_page_t
*
b
,
ulint
offset
,
const
void
*
str
,
ulint
len
);
/** Initialize a string of bytes.
@param[in,out] b buffer page
@param[in] ofs byte offset from b->frame
...
...
storage/innobase/include/page0zip.ic
View file @
8a039ee1
...
...
@@ -332,35 +332,14 @@ page_zip_write_header(
buf_block_t* block, /*!< in/out: compressed page */
const byte* str, /*!< in: address on the uncompressed page */
ulint length, /*!< in: length of the data */
mtr_t* mtr) /*!< in
: mini-transaction, or NULL
*/
mtr_t* mtr) /*!< in
/out: mini-transaction
*/
{
ut_ad(page_align(str) == block->frame);
const uint16_t pos = page_offset(str);
ut_ad(pos < PAGE_DATA);
ut_ad(pos + length < PAGE_DATA);
page_zip_des_t* page_zip = &block->page.zip;
ut_ad(page_zip_simple_validate(page_zip));
UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip));
memcpy(page_zip->data + pos, str, length);
/* The following would fail in page_cur_insert_rec_zip(). */
/* ut_ad(page_zip_validate(page_zip, str - pos)); */
if (byte* log_ptr = mlog_open(mtr, 11 + 2 + 2 + length)) {
log_ptr = mlog_write_initial_log_record_low(
MLOG_ZIP_WRITE_STRING,
block->page.id.space(), block->page.id.page_no(),
log_ptr, mtr);
mach_write_to_2(log_ptr, pos);
mach_write_to_2(log_ptr + 2, length);
memcpy(log_ptr + 4, str, length);
mlog_close(mtr, log_ptr + 4 + length);
}
mtr->zmemcpy(&block->page, pos, str, length);
}
/**********************************************************************//**
...
...
storage/innobase/mtr/mtr0log.cc
View file @
8a039ee1
...
...
@@ -297,6 +297,35 @@ void mtr_t::memcpy(const buf_block_t &b, ulint ofs, ulint len)
mlog_catenate_string
(
this
,
b
.
frame
+
ofs
,
len
);
}
/** Write a byte string to a ROW_FORMAT=COMPRESSED page.
@param[in] b ROW_FORMAT=COMPRESSED index page
@param[in] ofs byte offset from b.zip.data
@param[in] len length of the data to write */
void
mtr_t
::
zmemcpy
(
const
buf_page_t
&
b
,
ulint
offset
,
ulint
len
)
{
ut_ad
(
page_zip_simple_validate
(
&
b
.
zip
));
ut_ad
(
len
);
ut_ad
(
offset
+
len
<=
page_zip_get_size
(
&
b
.
zip
));
ut_ad
(
mach_read_from_2
(
b
.
zip
.
data
+
FIL_PAGE_TYPE
)
==
FIL_PAGE_INDEX
||
mach_read_from_2
(
b
.
zip
.
data
+
FIL_PAGE_TYPE
)
==
FIL_PAGE_RTREE
);
set_modified
();
if
(
get_log_mode
()
!=
MTR_LOG_ALL
)
{
ut_ad
(
get_log_mode
()
==
MTR_LOG_NONE
||
get_log_mode
()
==
MTR_LOG_NO_REDO
);
return
;
}
byte
*
l
=
get_log
()
->
open
(
11
+
2
+
2
);
l
=
mlog_write_initial_log_record_low
(
MLOG_ZIP_WRITE_STRING
,
b
.
id
.
space
(),
b
.
id
.
page_no
(),
l
,
this
);
mach_write_to_2
(
l
,
offset
);
mach_write_to_2
(
l
+
2
,
len
);
mlog_close
(
this
,
l
+
4
);
mlog_catenate_string
(
this
,
b
.
zip
.
data
+
offset
,
len
);
}
/********************************************************//**
Parses a log record written by mtr_t::memcpy().
@return parsed record end, NULL if not a complete record */
...
...
storage/innobase/page/page0cur.cc
View file @
8a039ee1
...
...
@@ -1542,17 +1542,7 @@ static inline void page_zip_dir_add_slot(buf_block_t *block,
{
memmove
(
dst
,
externs
,
len
);
/* TODO: write MEMMOVE record */
if
(
byte
*
log_ptr
=
mlog_open
(
mtr
,
11
+
2
+
2
))
{
log_ptr
=
mlog_write_initial_log_record_low
(
MLOG_ZIP_WRITE_STRING
,
block
->
page
.
id
.
space
(),
block
->
page
.
id
.
page_no
(),
log_ptr
,
mtr
);
mach_write_to_2
(
log_ptr
,
dst
-
page_zip
->
data
);
mach_write_to_2
(
log_ptr
+
2
,
len
);
mlog_close
(
mtr
,
log_ptr
+
4
);
mlog_catenate_string
(
mtr
,
dst
,
len
);
}
mtr
->
zmemcpy
(
block
->
page
,
dst
-
page_zip
->
data
,
len
);
}
}
else
...
...
@@ -1569,17 +1559,7 @@ static inline void page_zip_dir_add_slot(buf_block_t *block,
byte
*
dst
=
stored
-
PAGE_ZIP_DIR_SLOT_SIZE
;
memmove
(
dst
,
stored
,
len
);
/* TODO: write MEMMOVE record */
if
(
byte
*
log_ptr
=
mlog_open
(
mtr
,
11
+
2
+
2
))
{
log_ptr
=
mlog_write_initial_log_record_low
(
MLOG_ZIP_WRITE_STRING
,
block
->
page
.
id
.
space
(),
block
->
page
.
id
.
page_no
(),
log_ptr
,
mtr
);
mach_write_to_2
(
log_ptr
,
dst
-
page_zip
->
data
);
mach_write_to_2
(
log_ptr
+
2
,
len
);
mlog_close
(
mtr
,
log_ptr
+
4
);
mlog_catenate_string
(
mtr
,
dst
,
len
);
}
mtr
->
zmemcpy
(
block
->
page
,
dst
-
page_zip
->
data
,
len
);
}
}
...
...
storage/innobase/page/page0zip.cc
View file @
8a039ee1
...
...
@@ -370,7 +370,7 @@ static void page_zip_compress_write_log(buf_block_t *block,
{
ut_ad
(
!
index
->
is_ibuf
());
byte
*
log_ptr
=
mlog_open
(
mtr
,
11
+
11
+
2
+
2
);
byte
*
log_ptr
=
mlog_open
(
mtr
,
11
);
if
(
!
log_ptr
)
return
;
...
...
@@ -398,28 +398,12 @@ static void page_zip_compress_write_log(buf_block_t *block,
block
->
page
.
id
.
space
(),
block
->
page
.
id
.
page_no
(),
log_ptr
,
mtr
);
log_ptr
=
mlog_write_initial_log_record_low
(
MLOG_ZIP_WRITE_STRING
,
block
->
page
.
id
.
space
(),
block
->
page
.
id
.
page_no
(),
log_ptr
,
mtr
);
mach_write_to_2
(
log_ptr
,
FIL_PAGE_PREV
);
mach_write_to_2
(
log_ptr
+
2
,
page_zip
->
m_end
-
FIL_PAGE_PREV
);
mlog_close
(
mtr
,
log_ptr
+
4
);
mlog_catenate_string
(
mtr
,
page_zip
->
data
+
FIL_PAGE_PREV
,
page_zip
->
m_end
-
FIL_PAGE_PREV
);
mlog_close
(
mtr
,
log_ptr
);
mtr
->
zmemcpy
(
block
->
page
,
FIL_PAGE_PREV
,
page_zip
->
m_end
-
FIL_PAGE_PREV
);
if
(
trailer_size
)
{
log_ptr
=
mlog_open
(
mtr
,
11
+
2
+
2
);
log_ptr
=
mlog_write_initial_log_record_low
(
MLOG_ZIP_WRITE_STRING
,
block
->
page
.
id
.
space
(),
block
->
page
.
id
.
page_no
(),
log_ptr
,
mtr
);
mach_write_to_2
(
log_ptr
,
page_zip_get_size
(
page_zip
)
-
trailer_size
);
mach_write_to_2
(
log_ptr
+
2
,
trailer_size
);
mlog_close
(
mtr
,
log_ptr
+
4
);
mlog_catenate_string
(
mtr
,
page_zip
->
data
+
page_zip_get_size
(
page_zip
)
-
trailer_size
,
trailer_size
);
}
mtr
->
zmemcpy
(
block
->
page
,
page_zip_get_size
(
page_zip
)
-
trailer_size
,
trailer_size
);
block
->
page
.
init_on_flush
=
true
;
/* because of MLOG_INIT_FILE_PAGE2 */
}
...
...
@@ -3564,19 +3548,8 @@ page_zip_write_rec_ext(
-
n_ext
*
FIELD_REF_SIZE
;
memmove
(
ext_start
,
ext_end
,
len
);
/* TODO: write MEMMOVE record */
if
(
byte
*
l
=
mlog_open
(
mtr
,
11
+
2
+
2
))
{
l
=
mlog_write_initial_log_record_low
(
MLOG_ZIP_WRITE_STRING
,
block
->
page
.
id
.
space
(),
block
->
page
.
id
.
page_no
(),
l
,
mtr
);
mach_write_to_2
(
l
,
ext_start
-
page_zip
->
data
);
mach_write_to_2
(
l
+
2
,
len
);
mlog_close
(
mtr
,
l
+
4
);
mlog_catenate_string
(
mtr
,
ext_start
,
len
);
}
mtr
->
zmemcpy
(
block
->
page
,
ext_start
-
page_zip
->
data
,
len
);
}
}
...
...
@@ -3614,19 +3587,8 @@ page_zip_write_rec_ext(
byte
*
sys
=
storage
-
sys_len
*
(
heap_no
-
1
);
memcpy
(
sys
,
src
,
sys_len
);
i
++
;
/* skip also roll_ptr */
if
(
byte
*
log_ptr
=
mlog_open
(
mtr
,
11
+
2
+
2
+
sys_len
))
{
log_ptr
=
mlog_write_initial_log_record_low
(
MLOG_ZIP_WRITE_STRING
,
block
->
page
.
id
.
space
(),
block
->
page
.
id
.
page_no
(),
log_ptr
,
mtr
);
mach_write_to_2
(
log_ptr
,
sys
-
page_zip
->
data
);
mach_write_to_2
(
log_ptr
+
2
,
sys_len
);
memcpy
(
log_ptr
+
4
,
sys
,
sys_len
);
mlog_close
(
mtr
,
log_ptr
+
4
+
sys_len
);
}
mtr
->
zmemcpy
(
block
->
page
,
sys
-
page_zip
->
data
,
sys_len
);
}
else
if
(
rec_offs_nth_extern
(
offsets
,
i
))
{
src
=
rec_get_nth_field
(
rec
,
offsets
,
i
,
&
len
);
...
...
@@ -3644,20 +3606,8 @@ page_zip_write_rec_ext(
externs
-=
FIELD_REF_SIZE
;
ut_ad
(
data
<
externs
);
memcpy
(
externs
,
src
,
FIELD_REF_SIZE
);
if
(
byte
*
log_ptr
=
mlog_open
(
mtr
,
11
+
2
+
2
+
FIELD_REF_SIZE
))
{
log_ptr
=
mlog_write_initial_log_record_low
(
MLOG_ZIP_WRITE_STRING
,
block
->
page
.
id
.
space
(),
block
->
page
.
id
.
page_no
(),
log_ptr
,
mtr
);
mach_write_to_2
(
log_ptr
,
externs
-
page_zip
->
data
);
mach_write_to_2
(
log_ptr
+
2
,
FIELD_REF_SIZE
);
memcpy
(
log_ptr
+
4
,
externs
,
FIELD_REF_SIZE
);
mlog_close
(
mtr
,
log_ptr
+
4
+
FIELD_REF_SIZE
);
}
mtr
->
zmemcpy
(
block
->
page
,
externs
-
page_zip
->
data
,
FIELD_REF_SIZE
);
}
}
...
...
@@ -3797,21 +3747,8 @@ void page_zip_write_rec(buf_block_t *block, const byte *rec,
memcpy
(
sys
,
src
,
sys_len
);
src
+=
sys_len
;
if
(
byte
*
l
=
mlog_open
(
mtr
,
11
+
2
+
2
+
sys_len
))
{
l
=
mlog_write_initial_log_record_low
(
MLOG_ZIP_WRITE_STRING
,
block
->
page
.
id
.
space
(),
block
->
page
.
id
.
page_no
(),
l
,
mtr
);
mach_write_to_2
(
l
,
sys
-
page_zip
->
data
);
mach_write_to_2
(
l
+
2
,
sys_len
);
memcpy
(
l
+
4
,
sys
,
sys_len
);
mlog_close
(
mtr
,
l
+
4
+
sys_len
);
}
mtr
->
zmemcpy
(
block
->
page
,
sys
-
page_zip
->
data
,
sys_len
);
/* Log the last bytes of the record. */
len
=
rec_offs_data_size
(
offsets
)
-
ulint
(
src
-
rec
);
...
...
@@ -3848,36 +3785,14 @@ void page_zip_write_rec(buf_block_t *block, const byte *rec,
/* Copy the node pointer to the uncompressed area. */
byte
*
node_ptr
=
storage
-
REC_NODE_PTR_SIZE
*
(
heap_no
-
1
);
memcpy
(
node_ptr
,
rec
+
len
,
REC_NODE_PTR_SIZE
);
if
(
byte
*
log_ptr
=
mlog_open
(
mtr
,
11
+
2
+
2
+
REC_NODE_PTR_SIZE
))
{
log_ptr
=
mlog_write_initial_log_record_low
(
MLOG_ZIP_WRITE_STRING
,
block
->
page
.
id
.
space
(),
block
->
page
.
id
.
page_no
(),
log_ptr
,
mtr
);
mach_write_to_2
(
log_ptr
,
node_ptr
-
page_zip
->
data
);
mach_write_to_2
(
log_ptr
+
2
,
REC_NODE_PTR_SIZE
);
memcpy
(
log_ptr
+
4
,
node_ptr
,
REC_NODE_PTR_SIZE
);
mlog_close
(
mtr
,
log_ptr
+
4
+
REC_NODE_PTR_SIZE
);
}
mtr
->
zmemcpy
(
&
block
->
page
,
node_ptr
-
page_zip
->
data
,
rec
+
len
,
REC_NODE_PTR_SIZE
);
}
ut_a
(
!*
data
);
ut_ad
((
ulint
)
(
data
-
page_zip
->
data
)
<
page_zip_get_size
(
page_zip
));
if
(
byte
*
log_ptr
=
mlog_open
(
mtr
,
11
+
2
+
2
))
{
log_ptr
=
mlog_write_initial_log_record_low
(
MLOG_ZIP_WRITE_STRING
,
block
->
page
.
id
.
space
(),
block
->
page
.
id
.
page_no
(),
log_ptr
,
mtr
);
mach_write_to_2
(
log_ptr
,
page_zip
->
m_end
);
mach_write_to_2
(
log_ptr
+
2
,
data
-
page_zip
->
data
-
page_zip
->
m_end
);
mlog_close
(
mtr
,
log_ptr
+
4
);
mlog_catenate_string
(
mtr
,
page_zip
->
data
+
page_zip
->
m_end
,
data
-
page_zip
->
data
-
page_zip
->
m_end
);
}
mtr
->
zmemcpy
(
block
->
page
,
page_zip
->
m_end
,
data
-
page_zip
->
data
-
page_zip
->
m_end
);
page_zip
->
m_end
=
unsigned
(
data
-
page_zip
->
data
);
page_zip
->
m_nonempty
=
TRUE
;
...
...
@@ -4004,22 +3919,12 @@ page_zip_write_blob_ptr(
externs
-=
(
blob_no
+
1
)
*
BTR_EXTERN_FIELD_REF_SIZE
;
field
+=
len
-
BTR_EXTERN_FIELD_REF_SIZE
;
memcpy
(
externs
,
field
,
BTR_EXTERN_FIELD_REF_SIZE
);
mtr
->
zmemcpy
(
&
block
->
page
,
ulint
(
externs
-
page_zip
->
data
),
field
,
BTR_EXTERN_FIELD_REF_SIZE
);
#ifdef UNIV_ZIP_DEBUG
ut_a
(
page_zip_validate
(
page_zip
,
page
,
index
));
#endif
/* UNIV_ZIP_DEBUG */
if
(
byte
*
log_ptr
=
mlog_open
(
mtr
,
11
+
2
+
FIELD_REF_SIZE
))
{
log_ptr
=
mlog_write_initial_log_record_low
(
MLOG_ZIP_WRITE_STRING
,
block
->
page
.
id
.
space
(),
block
->
page
.
id
.
page_no
(),
log_ptr
,
mtr
);
mach_write_to_2
(
log_ptr
,
ulint
(
externs
-
page_zip
->
data
));
mach_write_to_2
(
log_ptr
+
2
,
BTR_EXTERN_FIELD_REF_SIZE
);
memcpy
(
log_ptr
+
4
,
externs
,
BTR_EXTERN_FIELD_REF_SIZE
);
mlog_close
(
mtr
,
log_ptr
+
4
+
BTR_EXTERN_FIELD_REF_SIZE
);
}
}
/***********************************************************//**
...
...
@@ -4137,18 +4042,8 @@ page_zip_write_node_ptr(
#endif
/* UNIV_DEBUG || UNIV_ZIP_DEBUG */
compile_time_assert
(
REC_NODE_PTR_SIZE
==
4
);
mach_write_to_4
(
field
,
ptr
);
memcpy
(
storage
,
field
,
REC_NODE_PTR_SIZE
);
if
(
byte
*
log_ptr
=
mlog_open
(
mtr
,
11
+
2
+
REC_NODE_PTR_SIZE
))
{
log_ptr
=
mlog_write_initial_log_record_low
(
MLOG_ZIP_WRITE_STRING
,
block
->
page
.
id
.
space
(),
block
->
page
.
id
.
page_no
(),
log_ptr
,
mtr
);
mach_write_to_2
(
log_ptr
,
ulint
(
storage
-
page_zip
->
data
));
mach_write_to_2
(
log_ptr
+
2
,
REC_NODE_PTR_SIZE
);
memcpy
(
log_ptr
+
4
,
storage
,
REC_NODE_PTR_SIZE
);
mlog_close
(
mtr
,
log_ptr
+
4
+
REC_NODE_PTR_SIZE
);
}
mtr
->
zmemcpy
(
&
block
->
page
,
ulint
(
storage
-
page_zip
->
data
),
field
,
REC_NODE_PTR_SIZE
);
}
/** Write the DB_TRX_ID,DB_ROLL_PTR into a clustered index leaf page record.
...
...
@@ -4208,23 +4103,13 @@ page_zip_write_trx_id_and_roll_ptr(
mach_write_to_6
(
field
,
trx_id
);
compile_time_assert
(
DATA_ROLL_PTR_LEN
==
7
);
mach_write_to_7
(
field
+
DATA_TRX_ID_LEN
,
roll_ptr
);
memcpy
(
storage
,
field
,
sys_len
);
mtr
->
zmemcpy
(
&
block
->
page
,
ulint
(
storage
-
page_zip
->
data
),
field
,
sys_len
);
UNIV_MEM_ASSERT_RW
(
rec
,
rec_offs_data_size
(
offsets
));
UNIV_MEM_ASSERT_RW
(
rec
-
rec_offs_extra_size
(
offsets
),
rec_offs_extra_size
(
offsets
));
UNIV_MEM_ASSERT_RW
(
page_zip
->
data
,
page_zip_get_size
(
page_zip
));
if
(
byte
*
log_ptr
=
mlog_open
(
mtr
,
11
+
2
+
2
+
sys_len
))
{
log_ptr
=
mlog_write_initial_log_record_low
(
MLOG_ZIP_WRITE_STRING
,
block
->
page
.
id
.
space
(),
block
->
page
.
id
.
page_no
(),
log_ptr
,
mtr
);
mach_write_to_2
(
log_ptr
,
ulint
(
storage
-
page_zip
->
data
));
mach_write_to_2
(
log_ptr
+
2
,
sys_len
);
memcpy
(
log_ptr
+
4
,
field
,
sys_len
);
mlog_close
(
mtr
,
log_ptr
+
4
+
sys_len
);
}
}
/** Parse a MLOG_ZIP_WRITE_TRX_ID record.
...
...
@@ -4341,17 +4226,7 @@ page_zip_clear_rec(
clear_page_zip:
/* TODO: write MEMSET record */
memset
(
storage
,
0
,
len
);
if
(
byte
*
log_ptr
=
mlog_open
(
mtr
,
11
+
2
+
2
+
len
))
{
log_ptr
=
mlog_write_initial_log_record_low
(
MLOG_ZIP_WRITE_STRING
,
block
->
page
.
id
.
space
(),
block
->
page
.
id
.
page_no
(),
log_ptr
,
mtr
);
mach_write_to_2
(
log_ptr
,
storage
-
page_zip
->
data
);
mach_write_to_2
(
log_ptr
+
2
,
len
);
memcpy
(
log_ptr
+
4
,
storage
,
len
);
mlog_close
(
mtr
,
log_ptr
+
4
+
len
);
}
mtr
->
zmemcpy
(
block
->
page
,
storage
-
page_zip
->
data
,
len
);
}
else
if
(
index
->
is_clust
())
{
/* Clear trx_id and roll_ptr. On the compressed page,
there is an array of these fields immediately before the
...
...
@@ -4408,24 +4283,18 @@ page_zip_rec_set_deleted(
byte
*
slot
=
page_zip_dir_find
(
&
block
->
page
.
zip
,
page_offset
(
rec
));
ut_a
(
slot
);
UNIV_MEM_ASSERT_RW
(
page_zip
->
data
,
page_zip_get_size
(
page_zip
));
byte
b
=
*
slot
;
if
(
flag
)
{
*
slot
|=
(
PAGE_ZIP_DIR_SLOT_DEL
>>
8
);
b
|=
(
PAGE_ZIP_DIR_SLOT_DEL
>>
8
);
}
else
{
*
slot
&=
~
(
PAGE_ZIP_DIR_SLOT_DEL
>>
8
);
b
&=
~
(
PAGE_ZIP_DIR_SLOT_DEL
>>
8
);
}
if
(
b
!=
*
slot
)
{
mtr
->
zmemcpy
(
&
block
->
page
,
slot
-
page_zip
->
data
,
&
b
,
1
);
}
#ifdef UNIV_ZIP_DEBUG
ut_a
(
page_zip_validate
(
page_zip
,
page_align
(
rec
),
NULL
));
#endif
/* UNIV_ZIP_DEBUG */
if
(
byte
*
log_ptr
=
mlog_open
(
mtr
,
11
+
2
+
2
+
1
))
{
log_ptr
=
mlog_write_initial_log_record_low
(
MLOG_ZIP_WRITE_STRING
,
block
->
page
.
id
.
space
(),
block
->
page
.
id
.
page_no
(),
log_ptr
,
mtr
);
mach_write_to_2
(
log_ptr
,
slot
-
page_zip
->
data
);
mach_write_to_2
(
log_ptr
+
2
,
1
);
log_ptr
[
4
]
=
*
slot
;
mlog_close
(
mtr
,
log_ptr
+
5
);
}
}
/**********************************************************************//**
...
...
@@ -4444,22 +4313,14 @@ page_zip_rec_set_owned(
byte
*
slot
=
page_zip_dir_find
(
page_zip
,
page_offset
(
rec
));
ut_a
(
slot
);
UNIV_MEM_ASSERT_RW
(
page_zip
->
data
,
page_zip_get_size
(
page_zip
));
const
byte
b
=
*
slot
;
byte
b
=
*
slot
;
if
(
flag
)
{
*
slot
|=
(
PAGE_ZIP_DIR_SLOT_OWNED
>>
8
);
b
|=
(
PAGE_ZIP_DIR_SLOT_OWNED
>>
8
);
}
else
{
*
slot
&=
~
(
PAGE_ZIP_DIR_SLOT_OWNED
>>
8
);
}
if
(
b
==
*
slot
)
{
}
else
if
(
byte
*
log_ptr
=
mlog_open
(
mtr
,
11
+
2
+
2
+
1
))
{
log_ptr
=
mlog_write_initial_log_record_low
(
MLOG_ZIP_WRITE_STRING
,
block
->
page
.
id
.
space
(),
block
->
page
.
id
.
page_no
(),
log_ptr
,
mtr
);
mach_write_to_2
(
log_ptr
,
slot
-
page_zip
->
data
);
mach_write_to_2
(
log_ptr
+
2
,
1
);
log_ptr
[
4
]
=
*
slot
;
mlog_close
(
mtr
,
log_ptr
+
5
);
b
&=
~
(
PAGE_ZIP_DIR_SLOT_OWNED
>>
8
);
}
if
(
b
!=
*
slot
)
{
mtr
->
zmemcpy
(
&
block
->
page
,
slot
-
page_zip
->
data
,
&
b
,
1
);
}
}
...
...
@@ -4544,20 +4405,8 @@ page_zip_dir_insert(
The "owned" and "deleted" flags must be zero. */
mach_write_to_2
(
slot_rec
-
PAGE_ZIP_DIR_SLOT_SIZE
,
page_offset
(
rec
));
/* TODO: issue MEMMOVE record to reduce log volume */
if
(
byte
*
log_ptr
=
mlog_open
(
mtr
,
11
+
2
+
2
))
{
log_ptr
=
mlog_write_initial_log_record_low
(
MLOG_ZIP_WRITE_STRING
,
cursor
->
block
->
page
.
id
.
space
(),
cursor
->
block
->
page
.
id
.
page_no
(),
log_ptr
,
mtr
);
mach_write_to_2
(
log_ptr
,
slot_free
-
PAGE_ZIP_DIR_SLOT_SIZE
-
page_zip
->
data
);
mach_write_to_2
(
log_ptr
+
2
,
PAGE_ZIP_DIR_SLOT_SIZE
+
slot_len
);
mlog_close
(
mtr
,
log_ptr
+
4
);
mlog_catenate_string
(
mtr
,
slot_free
-
PAGE_ZIP_DIR_SLOT_SIZE
,
PAGE_ZIP_DIR_SLOT_SIZE
+
slot_len
);
}
mtr
->
zmemcpy
(
cursor
->
block
->
page
,
slot_free
-
PAGE_ZIP_DIR_SLOT_SIZE
-
page_zip
->
data
,
PAGE_ZIP_DIR_SLOT_SIZE
+
slot_len
);
}
/** Shift the dense page directory and the array of BLOB pointers
...
...
@@ -4629,17 +4478,8 @@ void page_zip_dir_delete(buf_block_t *block, byte *rec,
The "owned" and "deleted" flags will be cleared. */
mach_write_to_2
(
slot_free
,
page_offset
(
rec
));
if
(
byte
*
log_ptr
=
mlog_open
(
mtr
,
11
+
2
+
2
))
{
log_ptr
=
mlog_write_initial_log_record_low
(
MLOG_ZIP_WRITE_STRING
,
block
->
page
.
id
.
space
(),
block
->
page
.
id
.
page_no
(),
log_ptr
,
mtr
);
mach_write_to_2
(
log_ptr
,
slot_free
-
page_zip
->
data
);
mach_write_to_2
(
log_ptr
+
2
,
slot_len
+
PAGE_ZIP_DIR_SLOT_SIZE
);
mlog_close
(
mtr
,
log_ptr
+
4
);
mlog_catenate_string
(
mtr
,
slot_free
,
slot_len
+
PAGE_ZIP_DIR_SLOT_SIZE
);
}
mtr
->
zmemcpy
(
block
->
page
,
slot_free
-
page_zip
->
data
,
slot_len
+
PAGE_ZIP_DIR_SLOT_SIZE
);
if
(
const
ulint
n_ext
=
rec_offs_n_extern
(
offsets
))
{
...
...
@@ -4664,18 +4504,7 @@ void page_zip_dir_delete(buf_block_t *block, byte *rec,
/* TODO: use MEMMOVE and MEMSET records to reduce volume */
const
ulint
ext_len
=
ulint
(
page_zip
->
n_blobs
-
blob_no
)
*
FIELD_REF_SIZE
;
if
(
byte
*
log_ptr
=
mlog_open
(
mtr
,
11
+
2
+
2
))
{
log_ptr
=
mlog_write_initial_log_record_low
(
MLOG_ZIP_WRITE_STRING
,
block
->
page
.
id
.
space
(),
block
->
page
.
id
.
page_no
(),
log_ptr
,
mtr
);
mach_write_to_2
(
log_ptr
,
ext_end
-
page_zip
->
data
);
mach_write_to_2
(
log_ptr
+
2
,
ext_len
);
mlog_close
(
mtr
,
log_ptr
+
4
);
mlog_catenate_string
(
mtr
,
ext_end
,
ext_len
);
}
mtr
->
zmemcpy
(
block
->
page
,
ext_end
-
page_zip
->
data
,
ext_len
);
page_zip
->
n_blobs
-=
static_cast
<
unsigned
>
(
n_ext
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment