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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
0893c298
Commit
0893c298
authored
Nov 21, 2012
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Percona-Server-5.5.28-rel29.1.tar.gz
parent
96d3a797
Changes
25
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
2447 additions
and
255 deletions
+2447
-255
btr/btr0btr.c
btr/btr0btr.c
+15
-6
btr/btr0cur.c
btr/btr0cur.c
+22
-17
btr/btr0pcur.c
btr/btr0pcur.c
+31
-36
buf/buf0buf.c
buf/buf0buf.c
+8
-14
buf/buf0lru.c
buf/buf0lru.c
+1
-1
buf/buf0rea.c
buf/buf0rea.c
+2
-2
handler/ha_innodb.cc
handler/ha_innodb.cc
+228
-105
handler/i_s.cc
handler/i_s.cc
+1852
-2
handler/i_s.h
handler/i_s.h
+3
-0
ibuf/ibuf0ibuf.c
ibuf/ibuf0ibuf.c
+12
-5
include/buf0buf.h
include/buf0buf.h
+32
-2
include/buf0buf.ic
include/buf0buf.ic
+19
-0
include/fil0fil.h
include/fil0fil.h
+2
-0
include/log0log.h
include/log0log.h
+3
-0
include/os0proc.h
include/os0proc.h
+2
-1
include/srv0srv.h
include/srv0srv.h
+1
-0
include/trx0sys.h
include/trx0sys.h
+15
-1
os/os0proc.c
os/os0proc.c
+55
-3
page/page0page.c
page/page0page.c
+11
-10
row/row0ins.c
row/row0ins.c
+8
-1
row/row0merge.c
row/row0merge.c
+15
-1
srv/srv0srv.c
srv/srv0srv.c
+2
-0
srv/srv0start.c
srv/srv0start.c
+2
-1
trx/trx0sys.c
trx/trx0sys.c
+87
-45
trx/trx0trx.c
trx/trx0trx.c
+19
-2
No files found.
btr/btr0btr.c
View file @
0893c298
...
...
@@ -1891,6 +1891,7 @@ btr_root_raise_and_insert(
root
=
btr_cur_get_page
(
cursor
);
root_block
=
btr_cur_get_block
(
cursor
);
root_page_zip
=
buf_block_get_page_zip
(
root_block
);
ut_ad
(
page_get_n_recs
(
root
)
>
0
);
#ifdef UNIV_ZIP_DEBUG
ut_a
(
!
root_page_zip
||
page_zip_validate
(
root_page_zip
,
root
));
#endif
/* UNIV_ZIP_DEBUG */
...
...
@@ -2371,12 +2372,20 @@ btr_insert_on_non_leaf_level_func(
BTR_CONT_MODIFY_TREE
,
&
cursor
,
0
,
file
,
line
,
mtr
);
err
=
btr_cur_pessimistic_insert
(
BTR_NO_LOCKING_FLAG
|
BTR_KEEP_SYS_FLAG
|
BTR_NO_UNDO_LOG_FLAG
,
&
cursor
,
tuple
,
&
rec
,
&
dummy_big_rec
,
0
,
NULL
,
mtr
);
ut_a
(
err
==
DB_SUCCESS
);
ut_ad
(
cursor
.
flag
==
BTR_CUR_BINARY
);
err
=
btr_cur_optimistic_insert
(
BTR_NO_LOCKING_FLAG
|
BTR_KEEP_SYS_FLAG
|
BTR_NO_UNDO_LOG_FLAG
,
&
cursor
,
tuple
,
&
rec
,
&
dummy_big_rec
,
0
,
NULL
,
mtr
);
if
(
err
==
DB_FAIL
)
{
err
=
btr_cur_pessimistic_insert
(
BTR_NO_LOCKING_FLAG
|
BTR_KEEP_SYS_FLAG
|
BTR_NO_UNDO_LOG_FLAG
,
&
cursor
,
tuple
,
&
rec
,
&
dummy_big_rec
,
0
,
NULL
,
mtr
);
ut_a
(
err
==
DB_SUCCESS
);
}
}
/**************************************************************//**
...
...
btr/btr0cur.c
View file @
0893c298
...
...
@@ -1412,7 +1412,12 @@ fail_err:
if
(
UNIV_UNLIKELY
(
reorg
))
{
ut_a
(
zip_size
);
ut_a
(
*
rec
);
/* It's possible for rec to be NULL if the
page is compressed. This is because a
reorganized page may become incompressible. */
if
(
!*
rec
)
{
goto
fail
;
}
}
}
...
...
@@ -1548,20 +1553,9 @@ btr_cur_pessimistic_insert(
ut_ad
((
thr
&&
thr_get_trx
(
thr
)
->
fake_changes
)
||
mtr_memo_contains
(
mtr
,
btr_cur_get_block
(
cursor
),
MTR_MEMO_PAGE_X_FIX
));
/* Try first an optimistic insert; reset the cursor flag: we do not
assume anything of how it was positioned */
cursor
->
flag
=
BTR_CUR_BINARY
;
err
=
btr_cur_optimistic_insert
(
flags
,
cursor
,
entry
,
rec
,
big_rec
,
n_ext
,
thr
,
mtr
);
if
(
err
!=
DB_FAIL
)
{
return
(
err
);
}
/* Retry with a pessimistic insert. Check locks and write to undo log,
if specified */
/* Check locks and write to undo log, if specified */
err
=
btr_cur_ins_lock_and_undo
(
flags
,
cursor
,
entry
,
thr
,
mtr
,
&
dummy_inh
);
...
...
@@ -2188,8 +2182,12 @@ any_extern:
goto
err_exit
;
}
max_size
=
old_rec_size
+
page_get_max_insert_size_after_reorganize
(
page
,
1
);
/* We do not attempt to reorganize if the page is compressed.
This is because the page may fail to compress after reorganization. */
max_size
=
page_zip
?
page_get_max_insert_size
(
page
,
1
)
:
(
old_rec_size
+
page_get_max_insert_size_after_reorganize
(
page
,
1
));
if
(
!
(((
max_size
>=
BTR_CUR_PAGE_REORGANIZE_LIMIT
)
&&
(
max_size
>=
new_rec_size
))
...
...
@@ -2559,7 +2557,12 @@ make_external:
err
=
DB_SUCCESS
;
goto
return_after_reservations
;
}
else
{
ut_a
(
optim_err
!=
DB_UNDERFLOW
);
/* If the page is compressed and it initially
compresses very well, and there is a subsequent insert
of a badly-compressing record, it is possible for
btr_cur_optimistic_update() to return DB_UNDERFLOW and
btr_cur_insert_if_possible() to return FALSE. */
ut_a
(
page_zip
||
optim_err
!=
DB_UNDERFLOW
);
/* Out of space: reset the free bits. */
if
(
!
dict_index_is_clust
(
index
)
...
...
@@ -2588,7 +2591,9 @@ make_external:
was_first
=
page_cur_is_before_first
(
page_cursor
);
/* Lock checks and undo logging were already performed by
btr_cur_upd_lock_and_undo(). */
btr_cur_upd_lock_and_undo(). We do not try
btr_cur_optimistic_insert() because
btr_cur_insert_if_possible() already failed above. */
err
=
btr_cur_pessimistic_insert
(
BTR_NO_UNDO_LOG_FLAG
|
BTR_NO_LOCKING_FLAG
...
...
btr/btr0pcur.c
View file @
0893c298
...
...
@@ -354,44 +354,39 @@ btr_pcur_restore_position_func(
/* Restore the old search mode */
cursor
->
search_mode
=
old_mode
;
if
(
btr_pcur_is_on_user_rec
(
cursor
))
{
switch
(
cursor
->
rel_pos
)
{
case
BTR_PCUR_ON
:
if
(
!
cmp_dtuple_rec
(
tuple
,
btr_pcur_get_rec
(
cursor
),
rec_get_offsets
(
btr_pcur_get_rec
(
cursor
),
index
,
NULL
,
ULINT_UNDEFINED
,
&
heap
)))
{
/* We have to store the NEW value for
the modify clock, since the cursor can
now be on a different page! But we can
retain the value of old_rec */
cursor
->
block_when_stored
=
btr_pcur_get_block
(
cursor
);
cursor
->
modify_clock
=
buf_block_get_modify_clock
(
cursor
->
block_when_stored
);
cursor
->
old_stored
=
BTR_PCUR_OLD_STORED
;
mem_heap_free
(
heap
);
return
(
TRUE
);
}
break
;
case
BTR_PCUR_BEFORE
:
page_cur_move_to_next
(
btr_pcur_get_page_cur
(
cursor
));
break
;
case
BTR_PCUR_AFTER
:
page_cur_move_to_prev
(
btr_pcur_get_page_cur
(
cursor
));
break
;
switch
(
cursor
->
rel_pos
)
{
case
BTR_PCUR_ON
:
if
(
btr_pcur_is_on_user_rec
(
cursor
)
&&
!
cmp_dtuple_rec
(
tuple
,
btr_pcur_get_rec
(
cursor
),
rec_get_offsets
(
btr_pcur_get_rec
(
cursor
),
index
,
NULL
,
ULINT_UNDEFINED
,
&
heap
)))
{
/* We have to store the NEW value for
the modify clock, since the cursor can
now be on a different page! But we can
retain the value of old_rec */
cursor
->
block_when_stored
=
btr_pcur_get_block
(
cursor
);
cursor
->
modify_clock
=
buf_block_get_modify_clock
(
cursor
->
block_when_stored
);
cursor
->
old_stored
=
BTR_PCUR_OLD_STORED
;
mem_heap_free
(
heap
);
return
(
TRUE
);
}
#ifdef UNIV_DEBUG
default:
ut_error
;
/* fall through */
case
BTR_PCUR_BEFORE
:
case
BTR_PCUR_AFTER
:
break
;
default:
ut_error
;
#endif
/* UNIV_DEBUG */
}
}
mem_heap_free
(
heap
);
...
...
buf/buf0buf.c
View file @
0893c298
...
...
@@ -336,15 +336,6 @@ be effective only if PFS_GROUP_BUFFER_SYNC is defined. */
# endif
/* !PFS_SKIP_BUFFER_MUTEX_RWLOCK */
#endif
/* UNIV_PFS_MUTEX || UNIV_PFS_RWLOCK */
/** A chunk of buffers. The buffer pool is allocated in chunks. (moved to buf0buf.h)*/
//struct buf_chunk_struct{
// ulint mem_size; /*!< allocated size of the chunk */
// ulint size; /*!< size of frames[] and blocks[] */
// void* mem; /*!< pointer to the memory area which
// was allocated for the frames */
// buf_block_t* blocks; /*!< array of buffer control blocks */
//};
/********************************************************************//**
Gets the smallest oldest_modification lsn for any page in the pool. Returns
zero if all modified pages have been flushed to disk.
...
...
@@ -1028,7 +1019,8 @@ buf_chunk_init(
/*===========*/
buf_pool_t
*
buf_pool
,
/*!< in: buffer pool instance */
buf_chunk_t
*
chunk
,
/*!< out: chunk of buffers */
ulint
mem_size
)
/*!< in: requested size in bytes */
ulint
mem_size
,
/*!< in: requested size in bytes */
ibool
populate
)
/*!< in: virtual page preallocation */
{
buf_block_t
*
block
;
byte
*
frame
;
...
...
@@ -1044,7 +1036,7 @@ buf_chunk_init(
+
(
UNIV_PAGE_SIZE
-
1
),
UNIV_PAGE_SIZE
);
chunk
->
mem_size
=
mem_size
;
chunk
->
mem
=
os_mem_alloc_large
(
&
chunk
->
mem_size
);
chunk
->
mem
=
os_mem_alloc_large
(
&
chunk
->
mem_size
,
populate
);
if
(
UNIV_UNLIKELY
(
chunk
->
mem
==
NULL
))
{
...
...
@@ -1254,6 +1246,7 @@ buf_pool_init_instance(
/*===================*/
buf_pool_t
*
buf_pool
,
/*!< in: buffer pool instance */
ulint
buf_pool_size
,
/*!< in: size in bytes */
ibool
populate
,
/*!< in: virtual page preallocation */
ulint
instance_no
)
/*!< in: id of the instance */
{
ulint
i
;
...
...
@@ -1286,7 +1279,7 @@ buf_pool_init_instance(
UT_LIST_INIT
(
buf_pool
->
free
);
if
(
!
buf_chunk_init
(
buf_pool
,
chunk
,
buf_pool_size
))
{
if
(
!
buf_chunk_init
(
buf_pool
,
chunk
,
buf_pool_size
,
populate
))
{
mem_free
(
chunk
);
mem_free
(
buf_pool
);
...
...
@@ -1381,6 +1374,7 @@ ulint
buf_pool_init
(
/*==========*/
ulint
total_size
,
/*!< in: size of the total pool in bytes */
ibool
populate
,
/*!< in: virtual page preallocation */
ulint
n_instances
)
/*!< in: number of instances */
{
ulint
i
;
...
...
@@ -1398,7 +1392,7 @@ buf_pool_init(
for
(
i
=
0
;
i
<
n_instances
;
i
++
)
{
buf_pool_t
*
ptr
=
&
buf_pool_ptr
[
i
];
if
(
buf_pool_init_instance
(
ptr
,
size
,
i
)
!=
DB_SUCCESS
)
{
if
(
buf_pool_init_instance
(
ptr
,
size
,
populate
,
i
)
!=
DB_SUCCESS
)
{
/* Free all the instances created so far. */
buf_pool_free
(
i
);
...
...
@@ -4973,7 +4967,7 @@ buf_stats_aggregate_pool_info(
Collect buffer pool stats information for a buffer pool. Also
record aggregated stats if there are more than one buffer pool
in the server */
static
UNIV_INTERN
void
buf_stats_get_pool_info
(
/*====================*/
...
...
buf/buf0lru.c
View file @
0893c298
...
...
@@ -2384,7 +2384,7 @@ buf_LRU_free_one_page(
#endif
mutex_t
*
block_mutex
=
buf_page_get_mutex
(
bpage
);
ut_ad
(
buf_pool_mutex_own
(
buf_pool
));
ut_ad
(
mutex_own
(
&
buf_pool
->
LRU_list_mutex
));
ut_ad
(
mutex_own
(
block_mutex
));
if
(
buf_LRU_block_remove_hashed_page
(
bpage
,
TRUE
)
...
...
buf/buf0rea.c
View file @
0893c298
...
...
@@ -64,7 +64,7 @@ buf_read_page_handle_error(
==
BUF_BLOCK_FILE_PAGE
);
/* First unfix and release lock on the bpage */
buf_pool_mutex_enter
(
buf_pool
);
mutex_enter
(
&
buf_pool
->
LRU_list_mutex
);
mutex_enter
(
buf_page_get_mutex
(
bpage
));
ut_ad
(
buf_page_get_io_fix
(
bpage
)
==
BUF_IO_READ
);
ut_ad
(
bpage
->
buf_fix_count
==
0
);
...
...
@@ -85,7 +85,7 @@ buf_read_page_handle_error(
buf_pool
->
n_pend_reads
--
;
mutex_exit
(
buf_page_get_mutex
(
bpage
));
buf_pool_mutex_exit
(
buf_pool
);
mutex_exit
(
&
buf_pool
->
LRU_list_mutex
);
}
/********************************************************************//**
...
...
handler/ha_innodb.cc
View file @
0893c298
This diff is collapsed.
Click to expand it.
handler/i_s.cc
View file @
0893c298
This diff is collapsed.
Click to expand it.
handler/i_s.h
View file @
0893c298
...
...
@@ -52,5 +52,8 @@ extern struct st_mysql_plugin i_s_innodb_buffer_pool_pages;
extern
struct
st_mysql_plugin
i_s_innodb_buffer_pool_pages_index
;
extern
struct
st_mysql_plugin
i_s_innodb_buffer_pool_pages_blob
;
extern
struct
st_mysql_plugin
i_s_innodb_changed_pages
;
extern
struct
st_mysql_plugin
i_s_innodb_buffer_page
;
extern
struct
st_mysql_plugin
i_s_innodb_buffer_page_lru
;
extern
struct
st_mysql_plugin
i_s_innodb_buffer_stats
;;
#endif
/* i_s_h */
ibuf/ibuf0ibuf.c
View file @
0893c298
...
...
@@ -3650,11 +3650,18 @@ bitmap_fail:
root
=
ibuf_tree_root_get
(
&
mtr
);
err
=
btr_cur_pessimistic_insert
(
BTR_NO_LOCKING_FLAG
|
BTR_NO_UNDO_LOG_FLAG
,
cursor
,
ibuf_entry
,
&
ins_rec
,
&
dummy_big_rec
,
0
,
thr
,
&
mtr
);
err
=
btr_cur_optimistic_insert
(
BTR_NO_LOCKING_FLAG
|
BTR_NO_UNDO_LOG_FLAG
,
cursor
,
ibuf_entry
,
&
ins_rec
,
&
dummy_big_rec
,
0
,
thr
,
&
mtr
);
if
(
err
==
DB_FAIL
)
{
err
=
btr_cur_pessimistic_insert
(
BTR_NO_LOCKING_FLAG
|
BTR_NO_UNDO_LOG_FLAG
,
cursor
,
ibuf_entry
,
&
ins_rec
,
&
dummy_big_rec
,
0
,
thr
,
&
mtr
);
}
mutex_exit
(
&
ibuf_pessimistic_insert_mutex
);
ibuf_size_update
(
root
,
&
mtr
);
mutex_exit
(
&
ibuf_mutex
);
...
...
include/buf0buf.h
View file @
0893c298
...
...
@@ -68,7 +68,10 @@ Created 11/5/1995 Heikki Tuuri
position of the block. */
/* @} */
#define MAX_BUFFER_POOLS 64
/*!< The maximum number of buffer
#define MAX_BUFFER_POOLS_BITS 6
/*!< Number of bits to representing
a buffer pool ID */
#define MAX_BUFFER_POOLS (1 << MAX_BUFFER_POOLS_BITS)
/*!< The maximum number of buffer
pools that can be defined */
#define BUF_POOL_WATCH_SIZE 1
/*!< Maximum number of concurrent
...
...
@@ -233,6 +236,7 @@ ulint
buf_pool_init
(
/*=========*/
ulint
size
,
/*!< in: Size of the total pool in bytes */
ibool
populate
,
/*!< in: Force virtual page preallocation */
ulint
n_instances
);
/*!< in: Number of instances */
/********************************************************************//**
Frees the buffer pool at shutdown. This must not be invoked before
...
...
@@ -778,6 +782,18 @@ void
buf_print_io
(
/*=========*/
FILE
*
file
);
/*!< in: file where to print */
/*******************************************************************//**
Collect buffer pool stats information for a buffer pool. Also
record aggregated stats if there are more than one buffer pool
in the server */
UNIV_INTERN
void
buf_stats_get_pool_info
(
/*====================*/
buf_pool_t
*
buf_pool
,
/*!< in: buffer pool */
ulint
pool_id
,
/*!< in: buffer pool ID */
buf_pool_info_t
*
all_pool_info
);
/*!< in/out: buffer pool info
to fill */
/*********************************************************************//**
Returns the ratio in percents of modified pages in the buffer pool /
database pages in the buffer pool.
...
...
@@ -1362,12 +1378,25 @@ void
buf_get_total_stat
(
/*===============*/
buf_pool_stat_t
*
tot_stat
);
/*!< out: buffer pool stats */
/*********************************************************************//**
Get the nth chunk's buffer block in the specified buffer pool.
@return the nth chunk's buffer block. */
UNIV_INLINE
buf_block_t
*
buf_get_nth_chunk_block
(
/*====================*/
const
buf_pool_t
*
buf_pool
,
/*!< in: buffer pool instance */
ulint
n
,
/*!< in: nth chunk in the buffer pool */
ulint
*
chunk_size
);
/*!< in: chunk size */
#endif
/* !UNIV_HOTBACKUP */
/** The common buffer control block structure
for compressed and uncompressed frames */
/** Number of bits used for buffer page states. */
#define BUF_PAGE_STATE_BITS 3
struct
buf_page_struct
{
/** @name General fields
None of these bit-fields must be modified without holding
...
...
@@ -1382,7 +1411,8 @@ struct buf_page_struct{
unsigned
offset
:
32
;
/*!< page number; also protected
by buf_pool->mutex. */
unsigned
state
:
3
;
/*!< state of the control block; also
unsigned
state
:
BUF_PAGE_STATE_BITS
;
/*!< state of the control block; also
protected by buf_pool->mutex.
State transitions from
BUF_BLOCK_READY_FOR_USE to
...
...
include/buf0buf.ic
View file @
0893c298
...
...
@@ -36,6 +36,8 @@ Created 11/5/1995 Heikki Tuuri
#include "buf0lru.h"
#include "buf0rea.h"
#include "srv0srv.h"
#include "buf0types.h"
/*********************************************************************//**
Gets the current size of buffer buf_pool in bytes.
@return size in bytes */
...
...
@@ -1354,4 +1356,21 @@ buf_pool_page_hash_x_unlock_all(void)
rw_lock_x_unlock(&buf_pool->page_hash_latch);
}
}
/*********************************************************************//**
Get the nth chunk's buffer block in the specified buffer pool.
@return the nth chunk's buffer block. */
UNIV_INLINE
buf_block_t*
buf_get_nth_chunk_block(
/*====================*/
const buf_pool_t* buf_pool, /*!< in: buffer pool instance */
ulint n, /*!< in: nth chunk in the buffer pool */
ulint* chunk_size) /*!< in: chunk size */
{
const buf_chunk_t* chunk;
chunk = buf_pool->chunks + n;
*chunk_size = chunk->size;
return(chunk->blocks);
}
#endif /* !UNIV_HOTBACKUP */
include/fil0fil.h
View file @
0893c298
...
...
@@ -144,6 +144,8 @@ extern fil_addr_t fil_addr_null;
#define FIL_PAGE_TYPE_BLOB 10
/*!< Uncompressed BLOB page */
#define FIL_PAGE_TYPE_ZBLOB 11
/*!< First compressed BLOB page */
#define FIL_PAGE_TYPE_ZBLOB2 12
/*!< Subsequent compressed BLOB page */
#define FIL_PAGE_TYPE_LAST FIL_PAGE_TYPE_ZBLOB2
/*!< Last page type */
/* @} */
/** Space types @{ */
...
...
include/log0log.h
View file @
0893c298
...
...
@@ -41,6 +41,9 @@ Created 12/9/1995 Heikki Tuuri
#include "sync0rw.h"
#endif
/* !UNIV_HOTBACKUP */
/* Type used for all log sequence number storage and arithmetics */
typedef
ib_uint64_t
lsn_t
;
/** Redo log buffer */
typedef
struct
log_struct
log_t
;
/** Redo log group */
...
...
include/os0proc.h
View file @
0893c298
...
...
@@ -58,7 +58,8 @@ UNIV_INTERN
void
*
os_mem_alloc_large
(
/*===============*/
ulint
*
n
);
/*!< in/out: number of bytes */
ulint
*
n
,
/*!< in/out: number of bytes */
ibool
populate
);
/*!< in: virtual page preallocation */
/****************************************************************//**
Frees large pages memory. */
UNIV_INTERN
...
...
include/srv0srv.h
View file @
0893c298
...
...
@@ -179,6 +179,7 @@ extern my_bool srv_use_sys_malloc;
extern
ibool
srv_use_sys_malloc
;
#endif
/* UNIV_HOTBACKUP */
extern
ulint
srv_buf_pool_size
;
/*!< requested size in bytes */
extern
my_bool
srv_buf_pool_populate
;
/*!< virtual page preallocation */
extern
ulint
srv_buf_pool_instances
;
/*!< requested number of buffer pool instances */
extern
ulint
srv_buf_pool_old_size
;
/*!< previously requested size */
extern
ulint
srv_buf_pool_curr_size
;
/*!< current size in bytes */
...
...
include/trx0sys.h
View file @
0893c298
...
...
@@ -342,6 +342,14 @@ void
trx_sys_print_mysql_binlog_offset
(
void
);
/*===================================*/
/*****************************************************************//**
Prints to stderr the MySQL master log offset info in the trx system header
COMMIT set of fields if the magic number shows it valid and stores it
in global variables. */
UNIV_INTERN
void
trx_sys_print_committed_mysql_master_log_pos
(
void
);
/*==============================================*/
/*****************************************************************//**
Prints to stderr the MySQL master log offset info in the trx system header if
the magic number shows it valid. */
UNIV_INTERN
...
...
@@ -534,10 +542,16 @@ We must remember this limit in order to keep file compatibility. */
//# error "UNIV_PAGE_SIZE < 4096"
//#endif
/** The offset of the MySQL replication info in the trx system header;
this contains the same fields as TRX_SYS_MYSQL_LOG_INFO below */
this contains the same fields as TRX_SYS_MYSQL_LOG_INFO below. These are
written at prepare time and are the main copy. */
#define TRX_SYS_MYSQL_MASTER_LOG_INFO (UNIV_PAGE_SIZE - 2000)
#define TRX_SYS_MYSQL_RELAY_LOG_INFO (UNIV_PAGE_SIZE - 1500)
/** The copy of the above which is made at transaction COMMIT time. If binlog
crash recovery rollbacks a PREPAREd transaction, they are copied back. */
#define TRX_SYS_COMMIT_MASTER_LOG_INFO (UNIV_PAGE_SIZE - 3000)
#define TRX_SYS_COMMIT_RELAY_LOG_INFO (UNIV_PAGE_SIZE - 2500)
/** The offset of the MySQL binlog offset info in the trx system header */
#define TRX_SYS_MYSQL_LOG_INFO (UNIV_PAGE_SIZE - 1000)
#define TRX_SYS_MYSQL_LOG_MAGIC_N_FLD 0
/*!< magic number which is
...
...
os/os0proc.c
View file @
0893c298
...
...
@@ -32,6 +32,12 @@ Created 9/30/1995 Heikki Tuuri
#include "ut0mem.h"
#include "ut0byte.h"
/* Linux release version */
#if defined(UNIV_LINUX) && defined(_GNU_SOURCE)
#include <string.h>
/* strverscmp() */
#include <sys/utsname.h>
/* uname() */
#endif
/* FreeBSD for example has only MAP_ANON, Linux has MAP_ANONYMOUS and
MAP_ANON but MAP_ANON is marked as deprecated */
#if defined(MAP_ANONYMOUS)
...
...
@@ -40,6 +46,13 @@ MAP_ANON but MAP_ANON is marked as deprecated */
#define OS_MAP_ANON MAP_ANON
#endif
/* Linux's MAP_POPULATE */
#if defined(MAP_POPULATE)
#define OS_MAP_POPULATE MAP_POPULATE
#else
#define OS_MAP_POPULATE 0
#endif
UNIV_INTERN
ibool
os_use_large_pages
;
/* Large page size. This may be a boot-time option on some platforms */
UNIV_INTERN
ulint
os_large_page_size
;
...
...
@@ -62,6 +75,24 @@ os_proc_get_number(void)
#endif
}
/****************************************************************//**
Retrieve and compare operating system release.
@return TRUE if the OS release is equal to, or later than release. */
UNIV_INTERN
ibool
os_compare_release
(
/*===============*/
const
char
*
release
/*!< in: OS release */
__attribute__
((
unused
)))
{
#if defined(UNIV_LINUX) && defined(_GNU_SOURCE)
struct
utsname
name
;
return
uname
(
&
name
)
==
0
&&
strverscmp
(
name
.
release
,
release
)
>=
0
;
#else
return
0
;
#endif
}
/****************************************************************//**
Allocates large pages memory.
@return allocated memory */
...
...
@@ -69,7 +100,8 @@ UNIV_INTERN
void
*
os_mem_alloc_large
(
/*===============*/
ulint
*
n
)
/*!< in/out: number of bytes */
ulint
*
n
,
/*!< in/out: number of bytes */
ibool
populate
)
/*!< in: virtual page preallocation */
{
void
*
ptr
;
ulint
size
;
...
...
@@ -155,12 +187,13 @@ skip:
ut_ad
(
ut_is_2pow
(
size
));
size
=
*
n
=
ut_2pow_round
(
*
n
+
(
size
-
1
),
size
);
ptr
=
mmap
(
NULL
,
size
,
PROT_READ
|
PROT_WRITE
,
MAP_PRIVATE
|
OS_MAP_ANON
,
-
1
,
0
);
MAP_PRIVATE
|
OS_MAP_ANON
|
(
populate
?
OS_MAP_POPULATE
:
0
),
-
1
,
0
);
if
(
UNIV_UNLIKELY
(
ptr
==
(
void
*
)
-
1
))
{
fprintf
(
stderr
,
"InnoDB: mmap(%lu bytes) failed;"
" errno %lu
\n
"
,
(
ulong
)
size
,
(
ulong
)
errno
);
ptr
=
NULL
;
return
(
NULL
)
;
}
else
{
os_fast_mutex_lock
(
&
ut_list_mutex
);
ut_total_allocated_memory
+=
size
;
...
...
@@ -168,6 +201,25 @@ skip:
UNIV_MEM_ALLOC
(
ptr
,
size
);
}
#endif
#if OS_MAP_ANON && OS_MAP_POPULATE
/* MAP_POPULATE is only supported for private mappings
since Linux 2.6.23. */
populate
=
populate
&&
!
os_compare_release
(
"2.6.23"
);
if
(
populate
)
{
fprintf
(
stderr
,
"InnoDB: Warning: mmap(MAP_POPULATE) "
"is not supported for private mappings. "
"Forcing preallocation by faulting in pages.
\n
"
);
}
#endif
/* Initialize the entire buffer to force the allocation
of physical memory page frames. */
if
(
populate
)
{
memset
(
ptr
,
'\0'
,
size
);
}
return
(
ptr
);
}
...
...
page/page0page.c
View file @
0893c298
...
...
@@ -781,12 +781,18 @@ page_copy_rec_list_start(
if
(
UNIV_LIKELY_NULL
(
new_page_zip
))
{
mtr_set_log_mode
(
mtr
,
log_mode
);
DBUG_EXECUTE_IF
(
"page_copy_rec_list_start_compress_fail"
,
goto
zip_reorganize
;);
if
(
UNIV_UNLIKELY
(
!
page_zip_compress
(
new_page_zip
,
new_page
,
index
,
mtr
)))
{
ulint
ret_pos
;
#ifndef DBUG_OFF
zip_reorganize:
#endif
/* DBUG_OFF */
/* Before trying to reorganize the page,
store the number of preceding records on the page. */
ulint
ret_pos
=
page_rec_get_n_recs_before
(
ret
);
ret_pos
=
page_rec_get_n_recs_before
(
ret
);
/* Before copying, "ret" was the predecessor
of the predefined supremum record. If it was
the predefined infimum record, then it would
...
...
@@ -807,15 +813,10 @@ page_copy_rec_list_start(
btr_blob_dbg_add
(
new_page
,
index
,
"copy_start_reorg_fail"
);
return
(
NULL
);
}
else
{
/* The page was reorganized:
Seek to ret_pos. */
ret
=
new_page
+
PAGE_NEW_INFIMUM
;
do
{
ret
=
rec_get_next_ptr
(
ret
,
TRUE
);
}
while
(
--
ret_pos
);
}
/* The page was reorganized: Seek to ret_pos. */
ret
=
page_rec_get_nth
(
new_page
,
ret_pos
);
}
}
...
...
row/row0ins.c
View file @
0893c298
...
...
@@ -2181,9 +2181,16 @@ row_ins_index_entry_low(
goto
function_exit
;
}
err
=
btr_cur_pessimistic_insert
(
err
=
btr_cur_optimistic_insert
(
0
,
&
cursor
,
entry
,
&
insert_rec
,
&
big_rec
,
n_ext
,
thr
,
&
mtr
);
if
(
err
==
DB_FAIL
)
{
err
=
btr_cur_pessimistic_insert
(
0
,
&
cursor
,
entry
,
&
insert_rec
,
&
big_rec
,
n_ext
,
thr
,
&
mtr
);
}
}
}
...
...
row/row0merge.c
View file @
0893c298
...
...
@@ -1254,11 +1254,25 @@ row_merge_read_clustered_index(
goto
err_exit
;
}
/* Store the cursor position on the last user
record on the page. */
btr_pcur_move_to_prev_on_page
(
&
pcur
);
/* Leaf pages must never be empty, unless
this is the only page in the index tree. */
ut_ad
(
btr_pcur_is_on_user_rec
(
&
pcur
)
||
buf_block_get_page_no
(
btr_pcur_get_block
(
&
pcur
))
==
clust_index
->
page
);
btr_pcur_store_position
(
&
pcur
,
&
mtr
);
mtr_commit
(
&
mtr
);
mtr_start
(
&
mtr
);
/* Restore position on the record, or its
predecessor if the record was purged
meanwhile. */
btr_pcur_restore_position
(
BTR_SEARCH_LEAF
,
&
pcur
,
&
mtr
);
/* Move to the successor of the original record. */
has_next
=
btr_pcur_move_to_next_user_rec
(
&
pcur
,
&
mtr
);
}
...
...
@@ -2720,7 +2734,7 @@ row_merge_build_indexes(
merge_files
=
mem_alloc
(
n_indexes
*
sizeof
*
merge_files
);
block_size
=
3
*
merge_sort_block_size
;
block_mem
=
os_mem_alloc_large
(
&
block_size
);
block_mem
=
os_mem_alloc_large
(
&
block_size
,
FALSE
);
for
(
i
=
0
;
i
<
UT_ARR_SIZE
(
block
);
i
++
)
{
block
[
i
]
=
(
row_merge_block_t
)
((
byte
*
)
block_mem
+
...
...
srv/srv0srv.c
View file @
0893c298
...
...
@@ -232,6 +232,8 @@ UNIV_INTERN const byte* srv_latin1_ordering;
UNIV_INTERN
my_bool
srv_use_sys_malloc
=
TRUE
;
/* requested size in kilobytes */
UNIV_INTERN
ulint
srv_buf_pool_size
=
ULINT_MAX
;
/* force virtual page preallocation (prefault) */
UNIV_INTERN
my_bool
srv_buf_pool_populate
=
FALSE
;
/* requested number of buffer pool instances */
UNIV_INTERN
ulint
srv_buf_pool_instances
=
1
;
/* previously requested size */
...
...
srv/srv0start.c
View file @
0893c298
...
...
@@ -1540,7 +1540,8 @@ innobase_start_or_create_for_mysql(void)
((
double
)
srv_buf_pool_size
)
/
(
1024
*
1024
));
}
err
=
buf_pool_init
(
srv_buf_pool_size
,
srv_buf_pool_instances
);
err
=
buf_pool_init
(
srv_buf_pool_size
,
(
ibool
)
srv_buf_pool_populate
,
srv_buf_pool_instances
);
ut_print_timestamp
(
stderr
);
fprintf
(
stderr
,
...
...
trx/trx0sys.c
View file @
0893c298
...
...
@@ -959,8 +959,31 @@ trx_sys_print_mysql_binlog_offset(void)
}
/*****************************************************************//**
Prints to stderr the MySQL master log offset info in the trx system header if
the magic number shows it valid. */
Reads the log coordinates at the given offset in the trx sys header. */
static
void
trx_sys_read_log_pos
(
/*=================*/
const
trx_sysf_t
*
sys_header
,
/*!< in: the trx sys header */
uint
header_offset
,
/*!< in: coord offset in the
header */
char
*
log_fn
,
/*!< out: the log file name */
ib_int64_t
*
log_pos
)
/*!< out: the log poistion */
{
ut_memcpy
(
log_fn
,
sys_header
+
header_offset
+
TRX_SYS_MYSQL_LOG_NAME
,
TRX_SYS_MYSQL_MASTER_LOG_NAME_LEN
);
*
log_pos
=
(((
ib_int64_t
)
mach_read_from_4
(
sys_header
+
header_offset
+
TRX_SYS_MYSQL_LOG_OFFSET_HIGH
))
<<
32
)
+
mach_read_from_4
(
sys_header
+
header_offset
+
TRX_SYS_MYSQL_LOG_OFFSET_LOW
);
}
/*****************************************************************//**
Prints to stderr the MySQL master log offset info in the trx system header
PREPARE set of fields if the magic number shows it valid and stores it
in global variables. */
UNIV_INTERN
void
trx_sys_print_mysql_master_log_pos
(
void
)
...
...
@@ -982,60 +1005,79 @@ trx_sys_print_mysql_master_log_pos(void)
return
;
}
/* Copy the master log position info to global variables we can
use in ha_innobase.cc to initialize glob_mi to right values */
trx_sys_read_log_pos
(
sys_header
,
TRX_SYS_MYSQL_MASTER_LOG_INFO
,
trx_sys_mysql_master_log_name
,
&
trx_sys_mysql_master_log_pos
);
trx_sys_read_log_pos
(
sys_header
,
TRX_SYS_MYSQL_RELAY_LOG_INFO
,
trx_sys_mysql_relay_log_name
,
&
trx_sys_mysql_relay_log_pos
);
mtr_commit
(
&
mtr
);
fprintf
(
stderr
,
"InnoDB: In a MySQL replication slave the last"
" master binlog file
\n
"
"InnoDB: position %lu %lu, file name %s
\n
"
,
(
ulong
)
mach_read_from_4
(
sys_header
+
TRX_SYS_MYSQL_MASTER_LOG_INFO
+
TRX_SYS_MYSQL_LOG_OFFSET_HIGH
),
(
ulong
)
mach_read_from_4
(
sys_header
+
TRX_SYS_MYSQL_MASTER_LOG_INFO
+
TRX_SYS_MYSQL_LOG_OFFSET_LOW
),
sys_header
+
TRX_SYS_MYSQL_MASTER_LOG_INFO
+
TRX_SYS_MYSQL_LOG_NAME
);
"InnoDB: position %llu, file name %s
\n
"
,
trx_sys_mysql_master_log_pos
,
trx_sys_mysql_master_log_name
);
fprintf
(
stderr
,
"InnoDB: and relay log file
\n
"
"InnoDB: position %lu %lu, file name %s
\n
"
,
(
ulong
)
mach_read_from_4
(
sys_header
+
TRX_SYS_MYSQL_RELAY_LOG_INFO
+
TRX_SYS_MYSQL_LOG_OFFSET_HIGH
),
(
ulong
)
mach_read_from_4
(
sys_header
+
TRX_SYS_MYSQL_RELAY_LOG_INFO
+
TRX_SYS_MYSQL_LOG_OFFSET_LOW
),
sys_header
+
TRX_SYS_MYSQL_RELAY_LOG_INFO
+
TRX_SYS_MYSQL_LOG_NAME
);
"InnoDB: position %llu, file name %s
\n
"
,
trx_sys_mysql_relay_log_pos
,
trx_sys_mysql_relay_log_name
);
}
/* Copy the master log position info to global variables we can
use in ha_innobase.cc to initialize glob_mi to right values */
/*****************************************************************//**
Prints to stderr the MySQL master log offset info in the trx system header
COMMIT set of fields if the magic number shows it valid and stores it
in global variables. */
UNIV_INTERN
void
trx_sys_print_committed_mysql_master_log_pos
(
void
)
/*==============================================*/
{
trx_sysf_t
*
sys_header
;
mtr_t
mtr
;
ut_memcpy
(
trx_sys_mysql_master_log_name
,
sys_header
+
TRX_SYS_MYSQL_MASTER_LOG_INFO
+
TRX_SYS_MYSQL_LOG_NAME
,
TRX_SYS_MYSQL_MASTER_LOG_NAME_LEN
);
mtr_start
(
&
mtr
);
trx_sys_mysql_master_log_pos
=
(((
ib_int64_t
)
mach_read_from_4
(
sys_header
+
TRX_SYS_MYSQL_MASTER_LOG_INFO
+
TRX_SYS_MYSQL_LOG_OFFSET_HIGH
))
<<
32
)
+
((
ib_int64_t
)
mach_read_from_4
(
sys_header
+
TRX_SYS_MYSQL_MASTER_LOG_INFO
+
TRX_SYS_MYSQL_LOG_OFFSET_LOW
));
ut_memcpy
(
trx_sys_mysql_relay_log_name
,
sys_header
+
TRX_SYS_MYSQL_RELAY_LOG_INFO
+
TRX_SYS_MYSQL_LOG_NAME
,
TRX_SYS_MYSQL_MASTER_LOG_NAME_LEN
);
sys_header
=
trx_sysf_get
(
&
mtr
);
if
(
mach_read_from_4
(
sys_header
+
TRX_SYS_COMMIT_MASTER_LOG_INFO
+
TRX_SYS_MYSQL_LOG_MAGIC_N_FLD
)
!=
TRX_SYS_MYSQL_LOG_MAGIC_N
)
{
mtr_commit
(
&
mtr
);
return
;
}
/* Copy the master log position info to global variables we can
use in ha_innobase.cc to initialize glob_mi to right values */
trx_sys_read_log_pos
(
sys_header
,
TRX_SYS_COMMIT_MASTER_LOG_INFO
,
trx_sys_mysql_master_log_name
,
&
trx_sys_mysql_master_log_pos
);
trx_sys_read_log_pos
(
sys_header
,
TRX_SYS_COMMIT_RELAY_LOG_INFO
,
trx_sys_mysql_relay_log_name
,
&
trx_sys_mysql_relay_log_pos
);
trx_sys_mysql_relay_log_pos
=
(((
ib_int64_t
)
mach_read_from_4
(
sys_header
+
TRX_SYS_MYSQL_RELAY_LOG_INFO
+
TRX_SYS_MYSQL_LOG_OFFSET_HIGH
))
<<
32
)
+
((
ib_int64_t
)
mach_read_from_4
(
sys_header
+
TRX_SYS_MYSQL_RELAY_LOG_INFO
+
TRX_SYS_MYSQL_LOG_OFFSET_LOW
));
mtr_commit
(
&
mtr
);
fprintf
(
stderr
,
"InnoDB: In a MySQL replication slave the last"
" master binlog file
\n
"
"InnoDB: position %llu, file name %s
\n
"
,
trx_sys_mysql_master_log_pos
,
trx_sys_mysql_master_log_name
);
fprintf
(
stderr
,
"InnoDB: and relay log file
\n
"
"InnoDB: position %llu, file name %s
\n
"
,
trx_sys_mysql_relay_log_pos
,
trx_sys_mysql_relay_log_name
);
}
/****************************************************************//**
...
...
trx/trx0trx.c
View file @
0893c298
...
...
@@ -939,13 +939,13 @@ trx_write_serialisation_history(
sys_header
,
trx
->
mysql_relay_log_file_name
,
trx
->
mysql_relay_log_pos
,
TRX_SYS_
MYSQL
_RELAY_LOG_INFO
,
&
mtr
);
TRX_SYS_
COMMIT
_RELAY_LOG_INFO
,
&
mtr
);
trx_sys_update_mysql_binlog_offset
(
sys_header
,
trx
->
mysql_master_log_file_name
,
trx
->
mysql_master_log_pos
,
TRX_SYS_
MYSQL
_MASTER_LOG_INFO
,
&
mtr
);
TRX_SYS_
COMMIT
_MASTER_LOG_INFO
,
&
mtr
);
trx
->
mysql_master_log_file_name
=
""
;
}
...
...
@@ -2051,6 +2051,23 @@ trx_prepare_off_kernel(
mutex_exit
(
&
(
rseg
->
mutex
));
if
(
trx
->
mysql_master_log_file_name
[
0
]
!=
'\0'
)
{
/* This database server is a MySQL replication slave */
trx_sysf_t
*
sys_header
=
trx_sysf_get
(
&
mtr
);
trx_sys_update_mysql_binlog_offset
(
sys_header
,
trx
->
mysql_relay_log_file_name
,
trx
->
mysql_relay_log_pos
,
TRX_SYS_MYSQL_RELAY_LOG_INFO
,
&
mtr
);
trx_sys_update_mysql_binlog_offset
(
sys_header
,
trx
->
mysql_master_log_file_name
,
trx
->
mysql_master_log_pos
,
TRX_SYS_MYSQL_MASTER_LOG_INFO
,
&
mtr
);
trx
->
mysql_master_log_file_name
=
""
;
}
/*--------------*/
mtr_commit
(
&
mtr
);
/* This mtr commit makes the
transaction prepared in the file-based
...
...
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