mirror of
https://github.com/MariaDB/server.git
synced 2025-01-20 14:02:32 +01:00
a8aacf8764
BitKeeper/etc/logging_ok: auto-union VC++Files/innobase/innobase.dsp: Auto merged VC++Files/libmysql/libmysql.dsp: Auto merged acinclude.m4: Auto merged configure.in: Auto merged BitKeeper/deleted/.del-com0shm.c~6a16f0c3d81de1f: Auto merged BitKeeper/deleted/.del-mysql_fix_privilege_tables.sql: Auto merged extra/replace.c: Auto merged include/my_sys.h: Auto merged innobase/btr/btr0btr.c: Auto merged innobase/btr/btr0cur.c: Auto merged innobase/btr/btr0pcur.c: Auto merged innobase/btr/btr0sea.c: Auto merged innobase/configure.in: Auto merged innobase/data/data0data.c: Auto merged innobase/dict/dict0boot.c: Auto merged innobase/dict/dict0crea.c: Auto merged innobase/dict/dict0dict.c: Auto merged innobase/dict/dict0load.c: Auto merged innobase/dict/dict0mem.c: Auto merged innobase/ha/ha0ha.c: Auto merged innobase/ha/hash0hash.c: Auto merged innobase/include/btr0btr.ic: Auto merged innobase/include/data0type.ic: Auto merged innobase/include/dict0mem.h: Auto merged innobase/include/log0log.ic: Auto merged innobase/include/mach0data.ic: Auto merged innobase/include/mtr0log.h: Auto merged innobase/include/mtr0mtr.h: Auto merged innobase/include/os0file.h: Auto merged innobase/include/row0upd.ic: Auto merged innobase/include/srv0srv.h: Auto merged innobase/include/sync0sync.h: Auto merged innobase/include/trx0rseg.ic: Auto merged innobase/lock/lock0lock.c: Auto merged innobase/log/log0recv.c: Auto merged innobase/mem/mem0dbg.c: Auto merged innobase/mtr/mtr0log.c: Auto merged innobase/mtr/mtr0mtr.c: Auto merged innobase/os/os0file.c: Auto merged innobase/page/page0cur.c: Auto merged innobase/page/page0page.c: Auto merged innobase/pars/lexyy.c: Auto merged innobase/read/read0read.c: Auto merged innobase/rem/rem0cmp.c: Auto merged innobase/rem/rem0rec.c: Auto merged innobase/row/row0ins.c: Auto merged innobase/row/row0mysql.c: Auto merged innobase/row/row0purge.c: Auto merged innobase/row/row0sel.c: Auto merged innobase/row/row0undo.c: Auto merged innobase/row/row0upd.c: Auto merged innobase/srv/srv0srv.c: Auto merged innobase/srv/srv0start.c: Auto merged innobase/sync/sync0rw.c: Auto merged innobase/thr/thr0loc.c: Auto merged innobase/trx/trx0purge.c: Auto merged innobase/trx/trx0rec.c: Auto merged innobase/trx/trx0roll.c: Auto merged innobase/trx/trx0trx.c: Auto merged innobase/trx/trx0undo.c: Auto merged myisam/mi_check.c: Auto merged myisam/myisamchk.c: Auto merged mysql-test/r/multi_update.result: Auto merged mysql-test/r/mysqlbinlog.result: Auto merged mysql-test/r/rpl_error_ignored_table.result: Auto merged mysql-test/t/multi_update.test: Auto merged mysql-test/t/rpl_error_ignored_table.test: Auto merged mysys/mf_iocache.c: Auto merged mysys/mf_pack.c: Auto merged mysys/my_getopt.c: Auto merged sql/ha_berkeley.cc: Auto merged sql/ha_myisam.cc: Auto merged sql/lock.cc: Auto merged sql/log.cc: Auto merged sql/opt_range.cc: Auto merged sql/set_var.h: Auto merged sql/sql_cache.cc: Auto merged sql/sql_cache.h: Auto merged sql/sql_delete.cc: Auto merged sql/sql_handler.cc: Auto merged sql/sql_insert.cc: Auto merged sql/sql_list.h: Auto merged sql/sql_select.cc: Auto merged sql/sql_show.cc: Auto merged sql/sql_table.cc: Auto merged sql/sql_update.cc: Auto merged tests/thread_test.c: Auto merged client/mysqldump.c: Keep original indentation mysql-test/r/merge.result: keep old file scripts/mysql_fix_privilege_tables.sh: Keep old structure in merge with 4.0 sql/table.cc: merge with 4.0 + simple optimizations
181 lines
5.9 KiB
C
181 lines
5.9 KiB
C
/******************************************************
|
|
Mini-transaction logging routines
|
|
|
|
(c) 1995 Innobase Oy
|
|
|
|
Created 12/7/1995 Heikki Tuuri
|
|
*******************************************************/
|
|
|
|
#ifndef mtr0log_h
|
|
#define mtr0log_h
|
|
|
|
#include "univ.i"
|
|
#include "mtr0mtr.h"
|
|
|
|
/************************************************************
|
|
Writes 1 - 4 bytes to a file page buffered in the buffer pool.
|
|
Writes the corresponding log record to the mini-transaction log. */
|
|
|
|
void
|
|
mlog_write_ulint(
|
|
/*=============*/
|
|
byte* ptr, /* in: pointer where to write */
|
|
ulint val, /* in: value to write */
|
|
byte type, /* in: MLOG_1BYTE, MLOG_2BYTES, MLOG_4BYTES */
|
|
mtr_t* mtr); /* in: mini-transaction handle */
|
|
/************************************************************
|
|
Writes 8 bytes to a file page buffered in the buffer pool.
|
|
Writes the corresponding log record to the mini-transaction log. */
|
|
|
|
void
|
|
mlog_write_dulint(
|
|
/*==============*/
|
|
byte* ptr, /* in: pointer where to write */
|
|
dulint val, /* in: value to write */
|
|
mtr_t* mtr); /* in: mini-transaction handle */
|
|
/************************************************************
|
|
Writes a string to a file page buffered in the buffer pool. Writes the
|
|
corresponding log record to the mini-transaction log. */
|
|
|
|
void
|
|
mlog_write_string(
|
|
/*==============*/
|
|
byte* ptr, /* in: pointer where to write */
|
|
byte* str, /* in: string to write */
|
|
ulint len, /* in: string length */
|
|
mtr_t* mtr); /* in: mini-transaction handle */
|
|
/************************************************************
|
|
Writes initial part of a log record consisting of one-byte item
|
|
type and four-byte space and page numbers. */
|
|
|
|
void
|
|
mlog_write_initial_log_record(
|
|
/*==========================*/
|
|
byte* ptr, /* in: pointer to (inside) a buffer frame
|
|
holding the file page where modification
|
|
is made */
|
|
byte type, /* in: log item type: MLOG_1BYTE, ... */
|
|
mtr_t* mtr); /* in: mini-transaction handle */
|
|
/************************************************************
|
|
Writes a log record about an .ibd file create/delete/rename. */
|
|
UNIV_INLINE
|
|
byte*
|
|
mlog_write_initial_log_record_for_file_op(
|
|
/*======================================*/
|
|
/* out: new value of log_ptr */
|
|
ulint type, /* in: MLOG_FILE_CREATE, MLOG_FILE_DELETE, or
|
|
MLOG_FILE_RENAME */
|
|
ulint space_id,/* in: space id, if applicable */
|
|
ulint page_no,/* in: page number (not relevant currently) */
|
|
byte* log_ptr,/* in: pointer to mtr log which has been opened */
|
|
mtr_t* mtr); /* in: mtr */
|
|
/************************************************************
|
|
Catenates 1 - 4 bytes to the mtr log. */
|
|
UNIV_INLINE
|
|
void
|
|
mlog_catenate_ulint(
|
|
/*================*/
|
|
mtr_t* mtr, /* in: mtr */
|
|
ulint val, /* in: value to write */
|
|
ulint type); /* in: MLOG_1BYTE, MLOG_2BYTES, MLOG_4BYTES */
|
|
/************************************************************
|
|
Catenates n bytes to the mtr log. */
|
|
|
|
void
|
|
mlog_catenate_string(
|
|
/*=================*/
|
|
mtr_t* mtr, /* in: mtr */
|
|
byte* str, /* in: string to write */
|
|
ulint len); /* in: string length */
|
|
/************************************************************
|
|
Catenates a compressed ulint to mlog. */
|
|
UNIV_INLINE
|
|
void
|
|
mlog_catenate_ulint_compressed(
|
|
/*===========================*/
|
|
mtr_t* mtr, /* in: mtr */
|
|
ulint val); /* in: value to write */
|
|
/************************************************************
|
|
Catenates a compressed dulint to mlog. */
|
|
UNIV_INLINE
|
|
void
|
|
mlog_catenate_dulint_compressed(
|
|
/*============================*/
|
|
mtr_t* mtr, /* in: mtr */
|
|
dulint val); /* in: value to write */
|
|
/************************************************************
|
|
Opens a buffer to mlog. It must be closed with mlog_close. */
|
|
UNIV_INLINE
|
|
byte*
|
|
mlog_open(
|
|
/*======*/
|
|
/* out: buffer, NULL if log mode MTR_LOG_NONE */
|
|
mtr_t* mtr, /* in: mtr */
|
|
ulint size); /* in: buffer size in bytes */
|
|
/************************************************************
|
|
Closes a buffer opened to mlog. */
|
|
UNIV_INLINE
|
|
void
|
|
mlog_close(
|
|
/*=======*/
|
|
mtr_t* mtr, /* in: mtr */
|
|
byte* ptr); /* in: buffer space from ptr up was not used */
|
|
/************************************************************
|
|
Writes the initial part of a log record. */
|
|
UNIV_INLINE
|
|
byte*
|
|
mlog_write_initial_log_record_fast(
|
|
/*===============================*/
|
|
/* out: new value of log_ptr */
|
|
byte* ptr, /* in: pointer to (inside) a buffer frame holding the
|
|
file page where modification is made */
|
|
byte type, /* in: log item type: MLOG_1BYTE, ... */
|
|
byte* log_ptr,/* in: pointer to mtr log which has been opened */
|
|
mtr_t* mtr); /* in: mtr */
|
|
/************************************************************
|
|
Parses an initial log record written by mlog_write_initial_log_record. */
|
|
|
|
byte*
|
|
mlog_parse_initial_log_record(
|
|
/*==========================*/
|
|
/* out: parsed record end, NULL if not a complete
|
|
record */
|
|
byte* ptr, /* in: buffer */
|
|
byte* end_ptr,/* in: buffer end */
|
|
byte* type, /* out: log record type: MLOG_1BYTE, ... */
|
|
ulint* space, /* out: space id */
|
|
ulint* page_no);/* out: page number */
|
|
/************************************************************
|
|
Parses a log record written by mlog_write_ulint or mlog_write_dulint. */
|
|
|
|
byte*
|
|
mlog_parse_nbytes(
|
|
/*==============*/
|
|
/* out: parsed record end, NULL if not a complete
|
|
record */
|
|
ulint type, /* in: log record type: MLOG_1BYTE, ... */
|
|
byte* ptr, /* in: buffer */
|
|
byte* end_ptr,/* in: buffer end */
|
|
byte* page); /* in: page where to apply the log record, or NULL */
|
|
/************************************************************
|
|
Parses a log record written by mlog_write_string. */
|
|
|
|
byte*
|
|
mlog_parse_string(
|
|
/*==============*/
|
|
/* out: parsed record end, NULL if not a complete
|
|
record */
|
|
byte* ptr, /* in: buffer */
|
|
byte* end_ptr,/* in: buffer end */
|
|
byte* page); /* in: page where to apply the log record, or NULL */
|
|
|
|
|
|
/* Insert, update, and maybe other functions may use this value to define an
|
|
extra mlog buffer size for variable size data */
|
|
#define MLOG_BUF_MARGIN 256
|
|
|
|
#ifndef UNIV_NONINL
|
|
#include "mtr0log.ic"
|
|
#endif
|
|
|
|
#endif
|