MySQL  8.0.23
Source Code Documentation
lob0first.h
Go to the documentation of this file.
1 /*****************************************************************************
2 
3 Copyright (c) 2016, 2020, Oracle and/or its affiliates.
4 
5 This program is free software; you can redistribute it and/or modify it under
6 the terms of the GNU General Public License, version 2.0, as published by the
7 Free Software Foundation.
8 
9 This program is also distributed with certain software (including but not
10 limited to OpenSSL) that is licensed under separate terms, as designated in a
11 particular file or component or in included license documentation. The authors
12 of MySQL hereby grant you an additional permission to link the program and
13 your derivative works with the separately licensed software that they have
14 included with MySQL.
15 
16 This program is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18 FOR A PARTICULAR PURPOSE. See the GNU General Public License, version 2.0,
19 for more details.
20 
21 You should have received a copy of the GNU General Public License along with
22 this program; if not, write to the Free Software Foundation, Inc.,
23 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 
25 *****************************************************************************/
26 
27 #ifndef lob0first_h
28 #define lob0first_h
29 
30 #include "btr0btr.h"
31 #include "buf0buf.h"
32 #include "dict0dict.h"
33 #include "fut0lst.h"
34 #include "lob0index.h"
35 #include "lob0lob.h"
36 #include "lob0util.h"
37 #include "mtr0log.h"
38 
39 namespace lob {
40 
41 /** The first page of an uncompressed LOB. */
42 struct first_page_t : public basic_page_t {
43  /** Version information. One byte. */
44  static const ulint OFFSET_VERSION = FIL_PAGE_DATA;
45 
46  /** One byte of flag bits. Currently only one bit (the least
47  significant bit) is used, other 7 bits are available for future use.*/
48  static const ulint OFFSET_FLAGS = FIL_PAGE_DATA + 1;
49 
50  /** LOB version. 4 bytes.*/
51  static const uint32_t OFFSET_LOB_VERSION = OFFSET_FLAGS + 1;
52 
53  /** The latest transaction that modified this LOB. */
54  static const ulint OFFSET_LAST_TRX_ID = OFFSET_LOB_VERSION + 4;
55 
56  /** The latest transaction undo_no that modified this LOB. */
57  static const ulint OFFSET_LAST_UNDO_NO = OFFSET_LAST_TRX_ID + 6;
58 
59  /** Length of data stored in this page. 4 bytes. */
60  static const ulint OFFSET_DATA_LEN = OFFSET_LAST_UNDO_NO + 4;
61 
62  /** The trx that created the data stored in this page. */
63  static const ulint OFFSET_TRX_ID = OFFSET_DATA_LEN + 4;
64 
65  /** The offset where the list base node is located. This is the list
66  of LOB pages. */
67  static const ulint OFFSET_INDEX_LIST = OFFSET_TRX_ID + 6;
68 
69  /** The offset where the list base node is located. This is the list
70  of free nodes. */
71  static const ulint OFFSET_INDEX_FREE_NODES =
73 
74  /** The offset where the contents of the first page begins. */
75  static const ulint LOB_PAGE_DATA =
77 
78  static const ulint LOB_PAGE_TRAILER_LEN = FIL_PAGE_DATA_END;
79 
80  /** The default constructor. */
81  first_page_t() {}
82 
83  /** Constructor.
84  @param[in] block Buffer block of the first page.
85  @param[in] mtr Mini-transaction context. */
86  first_page_t(buf_block_t *block, mtr_t *mtr) : basic_page_t(block, mtr) {}
87 
88  /** Constructor.
89  @param[in] block the buffer block of the first page.*/
90  first_page_t(buf_block_t *block) : basic_page_t(block, nullptr) {}
91 
92  /** Constructor.
93  @param[in] block Buffer block of the first page.
94  @param[in] mtr Mini-transaction context.
95  @param[in] index Clustered index containing the LOB. */
97  : basic_page_t(block, mtr, index) {}
98 
99  /** Constructor.
100  @param[in] mtr Mini-transaction context.
101  @param[in] index Clustered index containing the LOB. */
103  : basic_page_t(nullptr, mtr, index) {}
104 
105  /** Set the LOB format version number to 0. */
106  void set_version_0() {
108  }
109 
110  /** Obtain the flags value. This has 8 bits of which only the first
111  bit is used.
112  @return one byte flag */
113  uint8_t get_flags() { return (mach_read_from_1(frame() + OFFSET_FLAGS)); }
114 
115  /** When the bit is set, the LOB is not partially updatable anymore.
116  @return true, if partially updatable.
117  @return false, if partially NOT updatable. */
118  bool can_be_partially_updated() {
119  uint8_t flags = get_flags();
120  return (!(flags & 0x01));
121  }
122 
123  /** Do tablespace import. */
124  void import(trx_id_t trx_id);
125 
126  /** When the bit is set, the LOB is not partially updatable anymore.
127  Enable the bit.
128  @param[in] trx the current transaction. */
130 
131  /** Allocate the first page for uncompressed LOB.
132  @param[in,out] alloc_mtr the allocation mtr.
133  @param[in] is_bulk true if it is bulk operation.
134  (OPCODE_INSERT_BULK)
135  return the allocated buffer block.*/
136  buf_block_t *alloc(mtr_t *alloc_mtr, bool is_bulk);
137 
138  /** Free all the index pages. The list of index pages can be accessed
139  by traversing via the FIL_PAGE_NEXT field.*/
140  void free_all_index_pages();
141 
142  /** Free all the data pages. The data pages can be accessed through
143  index entry. */
145 
146  /** Load the first page of LOB with s-latch.
147  @param[in] page_id the page identifier of the first page.
148  @param[in] page_size the page size information.
149  @return the buffer block of the first page. */
150  buf_block_t *load_s(page_id_t page_id, page_size_t page_size) {
151  m_block = buf_page_get(page_id, page_size, RW_S_LATCH, m_mtr);
152  return (m_block);
153  }
154 
155  /** Load the first page of LOB with x-latch.
156  @param[in] page_id Page identifier of the first page.
157  @param[in] page_size Page size information.
158  @param[in] mtr Mini-transaction context for latch.
159  @return the buffer block of the first page. */
160  buf_block_t *load_x(const page_id_t &page_id, const page_size_t &page_size,
161  mtr_t *mtr);
162 
163  /** Load the first page of LOB with x-latch in the given mtr context.
164  The first page must already be x-latched by the m_mtr.
165  @param[in] mtr Mini-transaction context for latch.
166  @return the buffer block of the first page. */
167  buf_block_t *load_x(mtr_t *mtr) const {
170  RW_X_LATCH, mtr);
171  ut_ad(tmp == m_block);
172  return (tmp);
173  }
174 
175  /** Load the first page of LOB with x-latch.
176  @param[in] page_id the page identifier of the first page.
177  @param[in] page_size the page size information.
178  @return the buffer block of the first page. */
179  buf_block_t *load_x(const page_id_t &page_id, const page_size_t &page_size) {
180  return (load_x(page_id, page_size, m_mtr));
181  }
182 
183  /** Get the buffer block of the LOB first page.
184  @return the buffer block. */
185  buf_block_t *get_block() { return (m_block); }
186 
187  /** Load the file list node from the given location. An x-latch is taken
188  on the page containing the file list node.
189  @param[in] addr Location of file list node.
190  @param[in] mtr Mini-transaction context to be used.
191  @return the file list node.*/
192  flst_node_t *addr2ptr_x(fil_addr_t &addr, mtr_t *mtr) const {
194  const page_size_t page_size = dict_table_page_size(m_index->table);
195  return (fut_get_ptr(space, page_size, addr, RW_X_LATCH, mtr));
196  }
197 
198  /** Load the file list node from the given location. An x-latch is taken
199  on the page containing the file list node.
200  @param[in] addr the location of file list node.
201  @return the file list node.*/
202  flst_node_t *addr2ptr_x(fil_addr_t &addr) const {
203  return (addr2ptr_x(addr, m_mtr));
204  }
205 
206  /** Load the file list node from the given location, assuming that it
207  exists in the first page itself.
208  @param[in] addr the location of file list node.
209  @return the file list node.*/
210  flst_node_t *addr2ptr(const fil_addr_t &addr) {
211  ut_ad(m_block->page.id.page_no() == addr.page);
212  return (buf_block_get_frame(m_block) + addr.boffset);
213  }
214 
215  /** Load the file list node from the given location. An s-latch is taken
216  on the page containing the file list node.
217  @param[in] addr the location of file list node.
218  @return the file list node.*/
221  const page_size_t page_size = dict_table_page_size(m_index->table);
222  return (fut_get_ptr(space, page_size, addr, RW_S_LATCH, m_mtr));
223  }
224 
225  /** Load the file list node from the given location. An s-latch is taken
226  on the page containing the file list node. The given cache is checked to
227  see if the page is already loaded.
228  @param[in] cache cache of loaded buffer blocks.
229  @param[in] addr the location of file list node.
230  @return the file list node.*/
231  flst_node_t *addr2ptr_s_cache(std::map<page_no_t, buf_block_t *> &cache,
232  fil_addr_t &addr) const {
233  byte *result;
235  const page_size_t page_size = dict_table_page_size(m_index->table);
236 
237  auto iter = cache.find(addr.page);
238 
239  if (iter == cache.end()) {
240  /* Not there in cached blocks. Add the loaded block to cache. */
241  buf_block_t *block = nullptr;
242  result = fut_get_ptr(space, page_size, addr, RW_S_LATCH, m_mtr, &block);
243  cache.insert(std::make_pair(addr.page, block));
244  } else {
245  buf_block_t *block = iter->second;
246  ut_ad(block->page.id.page_no() == addr.page);
247  result = buf_block_get_frame(block) + addr.boffset;
248  }
249  return (result);
250  }
251 
252  /** Free the first page. This is done when all other LOB pages have
253  been freed. */
254  void dealloc();
255 
256  /** Free all the pages associated with this LOB. */
257  void destroy();
258 
259  /** Check if the index list is empty or not.
260  @return true if empty, false otherwise. */
261  bool is_empty() const {
262  flst_base_node_t *base = index_list();
263  ut_ad(base != nullptr);
264  return (flst_get_len(base) == 0);
265  }
266 
267  /** Allocate one index entry. If required an index page (of type
268  FIL_PAGE_TYPE_LOB_INDEX) will be allocated.
269  @param[in] bulk true if it is a bulk operation
270  (OPCODE_INSERT_BULK), false otherwise.
271  @return the file list node of the index entry. */
272  flst_node_t *alloc_index_entry(bool bulk);
273 
274  /** Get a pointer to the beginning of the index entry nodes in the
275  first part of the page.
276  @return the first index entry node. */
277  byte *nodes_begin() const { return (frame() + LOB_PAGE_DATA); }
278 
279  /** Calculate and return the payload.
280  @return the payload possible in this page. */
281  static ulint payload() {
282  return (UNIV_PAGE_SIZE - LOB_PAGE_DATA - LOB_PAGE_TRAILER_LEN);
283  }
284 
285  /** Set the transaction identifier in the first page header without
286  generating redo logs.
287  @param[in] id the transaction identifier. */
288  void set_trx_id_no_redo(trx_id_t id) {
289  byte *ptr = frame() + OFFSET_TRX_ID;
290  mach_write_to_6(ptr, id);
291  }
292 
293  /** Set the transaction identifier in the first page header.
294  @param[in] id the transaction identifier. */
295  void set_trx_id(trx_id_t id) {
296  byte *ptr = frame() + OFFSET_TRX_ID;
297  mach_write_to_6(ptr, id);
298  mlog_log_string(ptr, 6, m_mtr);
299  }
300 
301  /** Initialize the LOB version to 1. */
302  void init_lob_version() {
303  ut_ad(m_mtr != nullptr);
304 
306  }
307 
308  /** Get the lob version number.
309  @return the lob version. */
310  uint32_t get_lob_version() {
312  }
313 
314  /** Increment the lob version by 1. */
315  uint32_t incr_lob_version();
316 
317  /** Set the last transaction identifier, without generating redo log
318  records.
319  @param[in] id the trx identifier. */
321  byte *ptr = frame() + OFFSET_LAST_TRX_ID;
322  mach_write_to_6(ptr, id);
323  }
324 
325  /** Set the last transaction identifier.
326  @param[in] id the trx identifier. */
327  void set_last_trx_id(trx_id_t id) {
328  byte *ptr = frame() + OFFSET_LAST_TRX_ID;
329  mach_write_to_6(ptr, id);
330  mlog_log_string(ptr, 6, m_mtr);
331  }
332 
333  /** Set the last transaction undo number.
334  @param[in] undo_no the trx undo number. */
335  void set_last_trx_undo_no(undo_no_t undo_no) {
336  ut_ad(m_mtr != nullptr);
337 
338  byte *ptr = frame() + OFFSET_LAST_UNDO_NO;
339  mlog_write_ulint(ptr, undo_no, MLOG_4BYTES, m_mtr);
340  }
341 
342  /** Get the last transaction identifier.
343  @return the transaction identifier. */
344  trx_id_t get_last_trx_id() const {
345  byte *ptr = frame() + OFFSET_LAST_TRX_ID;
346  return (mach_read_from_6(ptr));
347  }
348 
349  /** Get the last transaction undo number.
350  @return the transaction undo number. */
352  byte *ptr = frame() + OFFSET_LAST_UNDO_NO;
353  return (mach_read_from_4(ptr));
354  }
355 
356  /** Set the length of data stored in bytes.
357  @param[in] len amount of data stored in bytes. */
358  void set_data_len(ulint len) {
359  ut_ad(m_mtr != nullptr);
360 
362  }
363 
364  /** Write as much as possible of the given data into the page.
365  @param[in] trxid the current transaction.
366  @param[in] data the data to be written.
367  @param[in] len the length of the given data.
368  @return number of bytes actually written. */
369  ulint write(trx_id_t trxid, const byte *&data, ulint &len);
370 
371  /** Replace data in the page by making a copy-on-write.
372  @param[in] trx Current transaction.
373  @param[in] offset Location where replace operation starts.
374  @param[in,out] ptr Buffer containing new data. after the call it will
375  point to remaining data.
376  @param[in,out] want Requested amount of data to be replaced. After the
377  call it will contain amount of data yet to be replaced.
378  @param[in] mtr Mini-transaction context.
379  @return the newly allocated buffer block.
380  @return nullptr if new page could not be allocated
381  (DB_OUT_OF_FILE_SPACE). */
382  buf_block_t *replace(trx_t *trx, ulint offset, const byte *&ptr, ulint &want,
383  mtr_t *mtr);
384 
385  /** Replace data in the page inline.
386  @param[in] trx Current transaction.
387  @param[in] offset Location where replace operation starts.
388  @param[in,out] ptr Buffer containing new data. after the
389  call it will point to remaining data.
390  @param[in,out] want Requested amount of data to be replaced.
391  after the call it will contain amount of
392  data yet to be replaced.
393  @param[in] mtr Mini-transaction context.*/
394  void replace_inline(trx_t *trx, ulint offset, const byte *&ptr, ulint &want,
395  mtr_t *mtr);
396 
397  ulint get_data_len() const {
398  return (mach_read_from_4(frame() + OFFSET_DATA_LEN));
399  }
400 
401  /** Read data from the first page.
402  @param[in] offset the offset from where read starts.
403  @param[out] ptr the output buffer
404  @param[in] want number of bytes to read.
405  @return number of bytes read. */
406  ulint read(ulint offset, byte *ptr, ulint want);
407 
408  void set_page_type() {
409  ut_ad(m_mtr != nullptr);
410 
412  MLOG_2BYTES, m_mtr);
413  }
414 
415  flst_base_node_t *index_list() const { return (frame() + OFFSET_INDEX_LIST); }
416 
417  flst_base_node_t *free_list() const {
418  return (frame() + OFFSET_INDEX_FREE_NODES);
419  }
420 
421  /** Get the number of bytes used to store LOB data in the first page
422  of uncompressed LOB.
423  @return Number of bytes available for LOB data. */
424  static ulint max_space_available() {
425  const ulint index_array_size = node_count() * index_entry_t::SIZE;
426 
427  return (payload() - index_array_size);
428  }
429 
430  /** Get the number of index entries this page can hold.
431  @return Number of index entries this page can hold. */
432  constexpr static ulint node_count() {
433  /* Each index entry is of size 60 bytes. We store only 10
434  index entries in the first page of the LOB. This means that
435  only 600 bytes are used for index data in the first page of
436  LOB. This will help to reserve more space in the first page
437  for the LOB data.*/
438  return (10);
439  }
440 
441  std::ostream &print_index_entries(std::ostream &out) const;
442 
443  std::ostream &print_index_entries_cache_s(std::ostream &out,
444  BlockCache &cache) const;
445 
446  /** Obtain the location where the data begins.
447  @return pointer to location within page where data begins. */
448  byte *data_begin() const {
450 
451  constexpr ulint index_array_size = node_count() * index_entry_t::SIZE;
452 
453  return (frame() + LOB_PAGE_DATA + index_array_size);
454  }
455 
456  /** Append data into a LOB first page. */
457  ulint append(trx_id_t trxid, byte *&data, ulint &len);
458 
459 #ifdef UNIV_DEBUG
460  /** Validate the first page. */
461  bool validate() const;
462 #endif /* UNIV_DEBUG */
463 
465 
466  static page_type_t get_page_type(dict_index_t *index,
467  const page_id_t &page_id,
468  const page_size_t &page_size) {
469  mtr_t local_mtr;
470  mtr_start(&local_mtr);
471  first_page_t first(&local_mtr, index);
472  first.load_x(page_id, page_size);
473  page_type_t page_type = first.get_page_type();
474  mtr_commit(&local_mtr);
475  return (page_type);
476  }
477 
478  public:
479  /** Restart the given mtr. The first page must already be x-latched by
480  the m_mtr.
481  @param[in] mtr Mini-transaction context which is to be restarted. */
482  void restart_mtr(mtr_t *mtr) {
483  ut_ad(mtr != m_mtr);
484  mtr_commit(mtr);
485  mtr_start(mtr);
487  load_x(mtr);
488  }
489 };
490 
491 } /* namespace lob */
492 
493 #endif /* lob0first_h */
lob::first_page_t::OFFSET_LOB_VERSION
static const uint32_t OFFSET_LOB_VERSION
LOB version.
Definition: lob0first.h:99
FIL_PAGE_DATA
constexpr ulint FIL_PAGE_DATA
start of the data on the page
Definition: fil0types.h:110
lob::first_page_t::set_version_0
void set_version_0()
Set the LOB format version number to 0.
Definition: lob0first.h:154
lob::first_page_t::mark_cannot_be_partially_updated
void mark_cannot_be_partially_updated(trx_t *trx)
When the bit is set, the LOB is not partially updatable anymore.
Definition: lob0first.cc:412
lob::first_page_t::addr2ptr_s
flst_node_t * addr2ptr_s(fil_addr_t &addr)
Load the file list node from the given location.
Definition: lob0first.h:267
lob::first_page_t::get_last_trx_undo_no
undo_no_t get_last_trx_undo_no() const
Get the last transaction undo number.
Definition: lob0first.h:399
lob::basic_page_t::m_block
buf_block_t * m_block
Definition: lob0util.h:147
undo_no_t
ib_id_t undo_no_t
Undo number.
Definition: trx0types.h:148
lob::first_page_t::is_empty
bool is_empty() const
Check if the index list is empty or not.
Definition: lob0first.h:309
lob::first_page_t::max_space_available
static ulint max_space_available()
Get the number of bytes used to store LOB data in the first page of uncompressed LOB.
Definition: lob0first.h:472
lob::first_page_t::destroy
void destroy()
Free all the pages associated with this LOB.
Definition: lob0first.cc:484
trx_id_t
ib_id_t trx_id_t
Transaction identifier (DB_TRX_ID, DATA_TRX_ID)
Definition: trx0types.h:144
lob::first_page_t::get_flags
uint8_t get_flags()
Obtain the flags value.
Definition: lob0first.h:161
lob::first_page_t::init_lob_version
void init_lob_version()
Initialize the LOB version to 1.
Definition: lob0first.h:350
lob::first_page_t::addr2ptr_x
flst_node_t * addr2ptr_x(fil_addr_t &addr, mtr_t *mtr) const
Load the file list node from the given location.
Definition: lob0first.h:240
ut_ad
#define ut_ad(EXPR)
Debug assertion.
Definition: ut0dbg.h:66
lob::basic_page_t
Definition: lob0util.h:65
nullptr
Dialog Client Authentication nullptr
Definition: dialog.cc:353
dict_index_get_space
UNIV_INLINE space_id_t dict_index_get_space(const dict_index_t *index)
Gets the space id of the root of the index tree.
lob::first_page_t::OFFSET_LAST_TRX_ID
static const ulint OFFSET_LAST_TRX_ID
The latest transaction that modified this LOB.
Definition: lob0first.h:102
dict_index_t
Data structure for an index.
Definition: dict0mem.h:879
mtr_t
Mini-transaction handle and buffer.
Definition: mtr0mtr.h:169
lob::first_page_t::replace_inline
void replace_inline(trx_t *trx, ulint offset, const byte *&ptr, ulint &want, mtr_t *mtr)
Replace data in the page inline.
Definition: lob0first.cc:59
lob::first_page_t
The first page of an uncompressed LOB.
Definition: lob0first.h:66
lob::first_page_t::load_s
buf_block_t * load_s(page_id_t page_id, page_size_t page_size)
Load the first page of LOB with s-latch.
Definition: lob0first.h:198
lob::first_page_t::can_be_partially_updated
bool can_be_partially_updated()
When the bit is set, the LOB is not partially updatable anymore.
Definition: lob0first.h:166
lob::first_page_t::OFFSET_DATA_LEN
static const ulint OFFSET_DATA_LEN
Length of data stored in this page.
Definition: lob0first.h:108
flst_base_node_t
byte flst_base_node_t
Definition: fut0lst.h:45
flst_node_t
byte flst_node_t
Definition: fut0lst.h:46
mach_read_from_1
UNIV_INLINE uint8_t mach_read_from_1(const byte *b)
The following function is used to fetch data from one byte.
lob::first_page_t::free_all_index_pages
void free_all_index_pages()
Free all the index pages.
Definition: lob0first.cc:336
result
Definition: result.h:29
FLST_BASE_NODE_SIZE
constexpr ulint FLST_BASE_NODE_SIZE
Definition: fut0lst.h:49
lob::basic_page_t::m_index
dict_index_t * m_index
Definition: lob0util.h:149
MLOG_1BYTE
@ MLOG_1BYTE
one byte is written
Definition: mtr0types.h:69
buf0buf.h
lob::first_page_t::validate
bool validate() const
Validate the first page.
Definition: lob0first.cc:231
lob::first_page_t::OFFSET_FLAGS
static const ulint OFFSET_FLAGS
One byte of flag bits.
Definition: lob0first.h:96
MLOG_4BYTES
@ MLOG_4BYTES
4 bytes ...
Definition: mtr0types.h:75
buf_block_t
The buffer control block structure.
Definition: buf0buf.h:1544
lob0util.h
lob::first_page_t::restart_mtr
void restart_mtr(mtr_t *mtr)
Restart the given mtr.
Definition: lob0first.h:530
lob::first_page_t::set_trx_id_no_redo
void set_trx_id_no_redo(trx_id_t id)
Set the transaction identifier in the first page header without generating redo logs.
Definition: lob0first.h:336
buf_page_get
#define buf_page_get(ID, SIZE, LA, MTR)
NOTE! The following macros should be used instead of buf_page_get_gen, to improve debugging.
Definition: buf0buf.h:363
FIL_PAGE_DATA_END
constexpr ulint FIL_PAGE_DATA_END
size of the page trailer
Definition: fil0types.h:118
lob::first_page_t::alloc
buf_block_t * alloc(mtr_t *alloc_mtr, bool is_bulk)
Allocate the first page for uncompressed LOB.
Definition: lob0first.cc:243
lob::first_page_t::dealloc
void dealloc()
Free the first page.
Definition: lob0first.cc:476
lob::first_page_t::incr_lob_version
uint32_t incr_lob_version()
Increment the lob version by 1.
Definition: lob0first.cc:401
lob::first_page_t::set_last_trx_id
void set_last_trx_id(trx_id_t id)
Set the last transaction identifier.
Definition: lob0first.h:375
btr0btr.h
lob::basic_page_t::get_page_type
page_type_t get_page_type() const
Definition: lob0util.h:118
lob::first_page_t::print_index_entries
std::ostream & print_index_entries(std::ostream &out) const
Definition: lob0first.cc:187
lob::first_page_t::get_lob_version
uint32_t get_lob_version()
Get the lob version number.
Definition: lob0first.h:358
FIL_PAGE_TYPE_LOB_FIRST
constexpr page_type_t FIL_PAGE_TYPE_LOB_FIRST
The first page of an uncompressed LOB.
Definition: fil0fil.h:1283
mlog_log_string
void mlog_log_string(byte *ptr, ulint len, mtr_t *mtr)
Logs a write of a string to a file page buffered in the buffer pool.
Definition: mtr0log.cc:333
MLOG_2BYTES
@ MLOG_2BYTES
2 bytes ...
Definition: mtr0types.h:72
lob::first_page_t::replace
buf_block_t * replace(trx_t *trx, ulint offset, const byte *&ptr, ulint &want, mtr_t *mtr)
Replace data in the page by making a copy-on-write.
Definition: lob0first.cc:83
lob::first_page_t::append
ulint append(trx_id_t trxid, byte *&data, ulint &len)
Append data into a LOB first page.
lob::first_page_t::get_block
buf_block_t * get_block()
Get the buffer block of the LOB first page.
Definition: lob0first.h:233
lob::first_page_t::free_all_data_pages
void free_all_data_pages()
Free all the data pages.
Definition: lob0first.cc:305
lob::first_page_t::set_last_trx_undo_no
void set_last_trx_undo_no(undo_no_t undo_no)
Set the last transaction undo number.
Definition: lob0first.h:383
mtr_start
#define mtr_start(m)
Start a mini-transaction.
Definition: mtr0mtr.h:50
lob::index_entry_t::SIZE
static const ulint SIZE
Total length of an index node.
Definition: lob0index.h:129
RW_S_LATCH
@ RW_S_LATCH
Definition: sync0rw.h:136
lob::basic_page_t::frame
byte * frame() const
Definition: lob0util.h:122
mach_write_to_6
UNIV_INLINE void mach_write_to_6(byte *b, ib_uint64_t id)
The following function is used to store data in 6 consecutive bytes.
lob::first_page_t::get_last_trx_id
trx_id_t get_last_trx_id() const
Get the last transaction identifier.
Definition: lob0first.h:392
mlog_write_ulint
void mlog_write_ulint(byte *ptr, ulint val, mlog_id_t type, mtr_t *mtr)
Writes 1, 2 or 4 bytes to a file page.
Definition: mtr0log.cc:247
NULL
#define NULL
Definition: types.h:54
lob::first_page_t::get_page_type
page_type_t get_page_type()
Definition: lob0first.h:512
page_size_t
Page size descriptor.
Definition: page0size.h:49
lob::first_page_t::node_count
constexpr static ulint node_count()
Get the number of index entries this page can hold.
Definition: lob0first.h:480
buf_block_t::page
buf_page_t page
page information; this must be the first field, so that buf_pool->page_hash can point to buf_page_t o...
Definition: buf0buf.h:1550
mtr_t::set_log_mode
mtr_log_t set_log_mode(mtr_log_t mode)
Change the logging mode.
Definition: mtr0mtr.cc:422
mach_read_from_4
UNIV_INLINE uint32_t mach_read_from_4(const byte *b)
The following function is used to fetch data from 4 consecutive bytes.
dict_index_t::get_page_size
page_size_t get_page_size() const
Get the page size of the tablespace to which this index belongs.
Definition: dict0mem.cc:833
BlockCache
std::map< page_no_t, buf_block_t * > BlockCache
Definition: lob0lob.h:41
lob::basic_page_t::m_mtr
mtr_t * m_mtr
Definition: lob0util.h:148
lob::basic_page_t::basic_page_t
basic_page_t()
Definition: lob0util.h:66
lob::first_page_t::get_data_len
ulint get_data_len() const
Definition: lob0first.h:445
RW_X_LATCH
@ RW_X_LATCH
Definition: sync0rw.h:137
lob::first_page_t::set_data_len
void set_data_len(ulint len)
Set the length of data stored in bytes.
Definition: lob0first.h:406
lob::first_page_t::alloc_index_entry
flst_node_t * alloc_index_entry(bool bulk)
Allocate one index entry.
Definition: lob0first.cc:287
lob::first_page_t::data_begin
byte * data_begin() const
Obtain the location where the data begins.
Definition: lob0first.h:496
mach_read_from_6
UNIV_INLINE ib_uint64_t mach_read_from_6(const byte *b)
The following function is used to fetch data from 6 consecutive bytes.
mtr_commit
#define mtr_commit(m)
Commit a mini-transaction.
Definition: mtr0mtr.h:59
lob::first_page_t::set_trx_id
void set_trx_id(trx_id_t id)
Set the transaction identifier in the first page header.
Definition: lob0first.h:343
dict_table_page_size
UNIV_INLINE const page_size_t dict_table_page_size(const dict_table_t *table)
Get the table page size.
lob::first_page_t::addr2ptr_s_cache
flst_node_t * addr2ptr_s_cache(std::map< page_no_t, buf_block_t * > &cache, fil_addr_t &addr) const
Load the file list node from the given location.
Definition: lob0first.h:279
mtr0log.h
fil_addr_t::boffset
uint32_t boffset
Byte offset within the page.
Definition: fil0fil.h:1186
FIL_PAGE_TYPE
#define FIL_PAGE_TYPE
file page type: FIL_PAGE_INDEX,..., 2 bytes.
Definition: fil0types.h:75
lob::first_page_t::OFFSET_INDEX_FREE_NODES
static const ulint OFFSET_INDEX_FREE_NODES
The offset where the list base node is located.
Definition: lob0first.h:119
lob::first_page_t::index_list
flst_base_node_t * index_list() const
Definition: lob0first.h:463
mtr_memo_contains
#define mtr_memo_contains(m, o, t)
Check if memo contains the given item.
Definition: mtr0mtr.h:107
buf_block_get_page_zip
#define buf_block_get_page_zip(block)
Gets the compressed page descriptor corresponding to an uncompressed page if applicable.
Definition: buf0buf.h:916
lob::first_page_t::OFFSET_INDEX_LIST
static const ulint OFFSET_INDEX_LIST
The offset where the list base node is located.
Definition: lob0first.h:115
lob::first_page_t::payload
static ulint payload()
Calculate and return the payload.
Definition: lob0first.h:329
fut_get_ptr
UNIV_INLINE byte * fut_get_ptr(space_id_t space, const page_size_t &page_size, fil_addr_t addr, rw_lock_type_t rw_latch, mtr_t *mtr, buf_block_t **ptr_block=nullptr)
Gets a pointer to a file address and latches the page.
page_id_t
Page identifier.
Definition: buf0types.h:168
lob::first_page_t::free_list
flst_base_node_t * free_list() const
Definition: lob0first.h:465
page_type_t
uint16_t page_type_t
Definition: fil0fil.h:1199
lob::first_page_t::first_page_t
first_page_t()
The default constructor.
Definition: lob0first.h:129
dict_index_t::table
dict_table_t * table
back pointer to table
Definition: dict0mem.h:884
flst_get_len
UNIV_INLINE ulint flst_get_len(const flst_base_node_t *base)
Get the length of a list.
lob::first_page_t::print_index_entries_cache_s
std::ostream & print_index_entries_cache_s(std::ostream &out, BlockCache &cache) const
Definition: lob0first.cc:147
lob::first_page_t::read
ulint read(ulint offset, byte *ptr, ulint want)
Read data from the first page.
Definition: lob0first.cc:429
buf_block_get_frame
UNIV_INLINE buf_frame_t * buf_block_get_frame(const buf_block_t *block)
Gets a pointer to the memory frame of a block.
lob::first_page_t::set_page_type
void set_page_type()
Definition: lob0first.h:456
lob::first_page_t::set_last_trx_id_no_redo
void set_last_trx_id_no_redo(trx_id_t id)
Set the last transaction identifier, without generating redo log records.
Definition: lob0first.h:368
fut0lst.h
space_id_t
uint32 space_id_t
Tablespace identifier.
Definition: api0api.h:59
lob::first_page_t::write
ulint write(trx_id_t trxid, const byte *&data, ulint &len)
Write as much as possible of the given data into the page.
Definition: lob0first.cc:444
lob::first_page_t::OFFSET_LAST_UNDO_NO
static const ulint OFFSET_LAST_UNDO_NO
The latest transaction undo_no that modified this LOB.
Definition: lob0first.h:105
fil_addr_t::page
page_no_t page
Page number within a space.
Definition: fil0fil.h:1183
lob::first_page_t::OFFSET_TRX_ID
static const ulint OFFSET_TRX_ID
The trx that created the data stored in this page.
Definition: lob0first.h:111
lob0lob.h
Implements the large objects (LOB) module.
lob::first_page_t::addr2ptr
flst_node_t * addr2ptr(const fil_addr_t &addr)
Load the file list node from the given location, assuming that it exists in the first page itself.
Definition: lob0first.h:258
lob::first_page_t::OFFSET_VERSION
static const ulint OFFSET_VERSION
Version information.
Definition: lob0first.h:92
fil_addr_t
File space address.
Definition: fil0fil.h:1154
mtr_t::get_log_mode
mtr_log_t get_log_mode() const
Get the logging mode.
result
struct result result
Definition: result.h:33
lob0index.h
page_id_t::page_no
page_no_t page_no() const
Retrieve the page number.
Definition: buf0types.h:204
lob
Provides the large objects (LOB) module.
Definition: lob0del.h:31
lob::first_page_t::LOB_PAGE_DATA
static const ulint LOB_PAGE_DATA
The offset where the contents of the first page begins.
Definition: lob0first.h:123
MTR_MEMO_PAGE_X_FIX
@ MTR_MEMO_PAGE_X_FIX
Definition: mtr0types.h:261
dict0dict.h
trx_t
Definition: trx0trx.h:836
lob::first_page_t::nodes_begin
byte * nodes_begin() const
Get a pointer to the beginning of the index entry nodes in the first part of the page.
Definition: lob0first.h:325
buf_page_t::id
page_id_t id
Page id.
Definition: buf0buf.h:1401
flags
static int flags[50]
Definition: hp_test1.cc:39
lob::first_page_t::LOB_PAGE_TRAILER_LEN
static const ulint LOB_PAGE_TRAILER_LEN
Definition: lob0first.h:126
lob::first_page_t::load_x
buf_block_t * load_x(const page_id_t &page_id, const page_size_t &page_size, mtr_t *mtr)
Load the first page of LOB with x-latch.
Definition: lob0first.cc:370