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
5dc19b9c
Commit
5dc19b9c
authored
Oct 12, 2011
by
Marko Mäkelä
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql-5.1 to mysql-5.5.
parents
b7a4918f
6d590649
Changes
16
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
276 additions
and
424 deletions
+276
-424
storage/innobase/btr/btr0cur.c
storage/innobase/btr/btr0cur.c
+1
-1
storage/innobase/btr/btr0sea.c
storage/innobase/btr/btr0sea.c
+151
-124
storage/innobase/buf/buf0buf.c
storage/innobase/buf/buf0buf.c
+27
-123
storage/innobase/buf/buf0lru.c
storage/innobase/buf/buf0lru.c
+3
-3
storage/innobase/ha/ha0ha.c
storage/innobase/ha/ha0ha.c
+23
-46
storage/innobase/handler/ha_innodb.cc
storage/innobase/handler/ha_innodb.cc
+0
-1
storage/innobase/ibuf/ibuf0ibuf.c
storage/innobase/ibuf/ibuf0ibuf.c
+1
-1
storage/innobase/include/btr0sea.h
storage/innobase/include/btr0sea.h
+3
-31
storage/innobase/include/btr0types.h
storage/innobase/include/btr0types.h
+24
-1
storage/innobase/include/buf0buf.h
storage/innobase/include/buf0buf.h
+17
-27
storage/innobase/include/ha0ha.h
storage/innobase/include/ha0ha.h
+8
-15
storage/innobase/include/ha0ha.ic
storage/innobase/include/ha0ha.ic
+18
-36
storage/innobase/include/row0upd.ic
storage/innobase/include/row0upd.ic
+0
-1
storage/innobase/include/sync0sync.h
storage/innobase/include/sync0sync.h
+0
-1
storage/innobase/page/page0page.c
storage/innobase/page/page0page.c
+0
-12
storage/innobase/sync/sync0sync.c
storage/innobase/sync/sync0sync.c
+0
-1
No files found.
storage/innobase/btr/btr0cur.c
View file @
5dc19b9c
...
...
@@ -1895,7 +1895,7 @@ btr_cur_update_in_place(
was_delete_marked
=
rec_get_deleted_flag
(
rec
,
page_is_comp
(
buf_block_get_frame
(
block
)));
is_hashed
=
block
->
is_hashed
;
is_hashed
=
(
block
->
index
!=
NULL
)
;
if
(
is_hashed
)
{
/* TO DO: Can we skip this if none of the fields
...
...
storage/innobase/btr/btr0sea.c
View file @
5dc19b9c
This diff is collapsed.
Click to expand it.
storage/innobase/buf/buf0buf.c
View file @
5dc19b9c
...
...
@@ -873,8 +873,6 @@ buf_block_init(
block
->
check_index_page_at_flush
=
FALSE
;
block
->
index
=
NULL
;
block
->
is_hashed
=
FALSE
;
#ifdef UNIV_DEBUG
block
->
page
.
in_page_hash
=
FALSE
;
block
->
page
.
in_zip_hash
=
FALSE
;
...
...
@@ -1279,108 +1277,47 @@ buf_pool_free(
}
/********************************************************************//**
Drops adaptive hash index for a buffer pool instance. */
static
void
buf_pool_drop_hash_index_instance
(
/*==============================*/
buf_pool_t
*
buf_pool
,
/*!< in: buffer pool instance */
ibool
*
released_search_latch
)
/*!< out: flag for signalling
whether the search latch was
released */
{
buf_chunk_t
*
chunks
=
buf_pool
->
chunks
;
buf_chunk_t
*
chunk
=
chunks
+
buf_pool
->
n_chunks
;
while
(
--
chunk
>=
chunks
)
{
ulint
i
;
buf_block_t
*
block
=
chunk
->
blocks
;
for
(
i
=
chunk
->
size
;
i
--
;
block
++
)
{
/* block->is_hashed cannot be modified
when we have an x-latch on btr_search_latch;
see the comment in buf0buf.h */
if
(
!
block
->
is_hashed
)
{
continue
;
}
/* To follow the latching order, we
have to release btr_search_latch
before acquiring block->latch. */
rw_lock_x_unlock
(
&
btr_search_latch
);
/* When we release the search latch,
we must rescan all blocks, because
some may become hashed again. */
*
released_search_latch
=
TRUE
;
rw_lock_x_lock
(
&
block
->
lock
);
/* This should be guaranteed by the
callers, which will be holding
btr_search_enabled_mutex. */
ut_ad
(
!
btr_search_enabled
);
/* Because we did not buffer-fix the
block by calling buf_block_get_gen(),
it is possible that the block has been
allocated for some other use after
btr_search_latch was released above.
We do not care which file page the
block is mapped to. All we want to do
is to drop any hash entries referring
to the page. */
/* It is possible that
block->page.state != BUF_FILE_PAGE.
Even that does not matter, because
btr_search_drop_page_hash_index() will
check block->is_hashed before doing
anything. block->is_hashed can only
be set on uncompressed file pages. */
btr_search_drop_page_hash_index
(
block
);
rw_lock_x_unlock
(
&
block
->
lock
);
rw_lock_x_lock
(
&
btr_search_latch
);
ut_ad
(
!
btr_search_enabled
);
}
}
}
/********************************************************************//**
Drops the adaptive hash index. To prevent a livelock, this function
is only to be called while holding btr_search_latch and while
btr_search_enabled == FALSE. */
Clears the adaptive hash index on all pages in the buffer pool. */
UNIV_INTERN
void
buf_pool_
drop
_hash_index
(
void
)
/*==========================*/
buf_pool_
clear
_hash_index
(
void
)
/*==========================
=
*/
{
ibool
released_search_latch
;
ulint
p
;
#ifdef UNIV_SYNC_DEBUG
ut_ad
(
rw_lock_own
(
&
btr_search_latch
,
RW_LOCK_EX
));
#endif
/* UNIV_SYNC_DEBUG */
ut_ad
(
!
btr_search_enabled
);
do
{
ulint
i
;
for
(
p
=
0
;
p
<
srv_buf_pool_instances
;
p
++
)
{
buf_pool_t
*
buf_pool
=
buf_pool_from_array
(
p
);
buf_chunk_t
*
chunks
=
buf_pool
->
chunks
;
buf_chunk_t
*
chunk
=
chunks
+
buf_pool
->
n_chunks
;
released_search_latch
=
FALSE
;
while
(
--
chunk
>=
chunks
)
{
buf_block_t
*
block
=
chunk
->
blocks
;
ulint
i
=
chunk
->
size
;
for
(
i
=
0
;
i
<
srv_buf_pool_instances
;
i
++
)
{
buf_pool_t
*
buf_pool
;
for
(;
i
--
;
block
++
)
{
dict_index_t
*
index
=
block
->
index
;
buf_pool
=
buf_pool_from_array
(
i
);
/* We can set block->index = NULL
when we have an x-latch on btr_search_latch;
see the comment in buf0buf.h */
buf_pool_drop_hash_index_instance
(
buf_pool
,
&
released_search_latch
);
}
if
(
!
index
)
{
/* Not hashed */
continue
;
}
}
while
(
released_search_latch
);
block
->
index
=
NULL
;
# if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
block
->
n_pointers
=
0
;
# endif
/* UNIV_AHI_DEBUG || UNIV_DEBUG */
}
}
}
}
/********************************************************************//**
...
...
@@ -1740,38 +1677,6 @@ buf_reset_check_index_page_at_flush(
buf_pool_mutex_exit
(
buf_pool
);
}
/********************************************************************//**
Returns the current state of is_hashed of a page. FALSE if the page is
not in the pool. NOTE that this operation does not fix the page in the
pool if it is found there.
@return TRUE if page hash index is built in search system */
UNIV_INTERN
ibool
buf_page_peek_if_search_hashed
(
/*===========================*/
ulint
space
,
/*!< in: space id */
ulint
offset
)
/*!< in: page number */
{
buf_block_t
*
block
;
ibool
is_hashed
;
buf_pool_t
*
buf_pool
=
buf_pool_get
(
space
,
offset
);
buf_pool_mutex_enter
(
buf_pool
);
block
=
(
buf_block_t
*
)
buf_page_hash_get
(
buf_pool
,
space
,
offset
);
if
(
!
block
||
buf_block_get_state
(
block
)
!=
BUF_BLOCK_FILE_PAGE
)
{
is_hashed
=
FALSE
;
}
else
{
ut_ad
(
!
buf_pool_watch_is_sentinel
(
buf_pool
,
&
block
->
page
));
is_hashed
=
block
->
is_hashed
;
}
buf_pool_mutex_exit
(
buf_pool
);
return
(
is_hashed
);
}
#if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG
/********************************************************************//**
Sets file_page_was_freed TRUE if the page is found in the buffer pool.
...
...
@@ -1981,7 +1886,6 @@ buf_block_init_low(
block
->
index
=
NULL
;
block
->
n_hash_helps
=
0
;
block
->
is_hashed
=
FALSE
;
block
->
n_fields
=
1
;
block
->
n_bytes
=
0
;
block
->
left_side
=
TRUE
;
...
...
storage/innobase/buf/buf0lru.c
View file @
5dc19b9c
...
...
@@ -273,7 +273,7 @@ buf_LRU_drop_page_hash_for_tablespace(
mutex_enter
(
&
((
buf_block_t
*
)
bpage
)
->
mutex
);
is_fixed
=
bpage
->
buf_fix_count
>
0
||
!
((
buf_block_t
*
)
bpage
)
->
i
s_hashed
;
||
!
((
buf_block_t
*
)
bpage
)
->
i
ndex
;
mutex_exit
(
&
((
buf_block_t
*
)
bpage
)
->
mutex
);
if
(
is_fixed
)
{
...
...
@@ -405,7 +405,7 @@ buf_LRU_invalidate_tablespace_buf_pool_instance(
if
(
buf_page_get_state
(
bpage
)
!=
BUF_BLOCK_FILE_PAGE
)
{
/* This is a compressed-only block
descriptor. Do nothing. */
}
else
if
(((
buf_block_t
*
)
bpage
)
->
i
s_hashed
)
{
}
else
if
(((
buf_block_t
*
)
bpage
)
->
i
ndex
)
{
ulint
page_no
;
ulint
zip_size
;
...
...
@@ -417,7 +417,7 @@ buf_LRU_invalidate_tablespace_buf_pool_instance(
mutex_exit
(
block_mutex
);
/* Note that the following call will acquire
an
S-latch on the page
*/
an
d release an X-latch on the page.
*/
btr_search_drop_page_hash_when_freed
(
id
,
zip_size
,
page_no
);
...
...
storage/innobase/ha/ha0ha.c
View file @
5dc19b9c
/*****************************************************************************
Copyright (c) 1994, 20
09, Innobase Oy
. All Rights Reserved.
Copyright (c) 1994, 20
11, Oracle and/or its affiliates
. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
...
...
@@ -88,40 +88,6 @@ ha_create_func(
return
(
table
);
}
/*************************************************************//**
Empties a hash table and frees the memory heaps. */
UNIV_INTERN
void
ha_clear
(
/*=====*/
hash_table_t
*
table
)
/*!< in, own: hash table */
{
ulint
i
;
ulint
n
;
ut_ad
(
table
);
ut_ad
(
table
->
magic_n
==
HASH_TABLE_MAGIC_N
);
#ifdef UNIV_SYNC_DEBUG
ut_ad
(
rw_lock_own
(
&
btr_search_latch
,
RW_LOCK_EXCLUSIVE
));
#endif
/* UNIV_SYNC_DEBUG */
#ifndef UNIV_HOTBACKUP
/* Free the memory heaps. */
n
=
table
->
n_mutexes
;
for
(
i
=
0
;
i
<
n
;
i
++
)
{
mem_heap_free
(
table
->
heaps
[
i
]);
}
#endif
/* !UNIV_HOTBACKUP */
/* Clear the hash table. */
n
=
hash_get_n_cells
(
table
);
for
(
i
=
0
;
i
<
n
;
i
++
)
{
hash_get_nth_cell
(
table
,
i
)
->
node
=
NULL
;
}
}
/*************************************************************//**
Inserts an entry into a hash table. If an entry with the same fold number
is found, its node is updated to point to the new data, and no new node
...
...
@@ -140,7 +106,7 @@ ha_insert_for_fold_func(
#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
buf_block_t
*
block
,
/*!< in: buffer block containing the data */
#endif
/* UNIV_AHI_DEBUG || UNIV_DEBUG */
void
*
data
)
/*!< in: data, must not be NULL */
const
rec_t
*
data
)
/*!< in: data, must not be NULL */
{
hash_cell_t
*
cell
;
ha_node_t
*
node
;
...
...
@@ -153,7 +119,11 @@ ha_insert_for_fold_func(
#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
ut_a
(
block
->
frame
==
page_align
(
data
));
#endif
/* UNIV_AHI_DEBUG || UNIV_DEBUG */
#ifdef UNIV_SYNC_DEBUG
ut_ad
(
rw_lock_own
(
&
btr_search_latch
,
RW_LOCK_EX
));
#endif
/* UNIV_SYNC_DEBUG */
ASSERT_HASH_MUTEX_OWN
(
table
,
fold
);
ut_ad
(
btr_search_enabled
);
hash
=
hash_calc_hash
(
fold
,
table
);
...
...
@@ -173,7 +143,6 @@ ha_insert_for_fold_func(
prev_block
->
n_pointers
--
;
block
->
n_pointers
++
;
}
ut_ad
(
!
btr_search_fully_disabled
);
# endif
/* !UNIV_HOTBACKUP */
prev_node
->
block
=
block
;
...
...
@@ -186,13 +155,6 @@ ha_insert_for_fold_func(
prev_node
=
prev_node
->
next
;
}
/* We are in the process of disabling hash index, do not add
new chain node */
if
(
!
btr_search_enabled
)
{
ut_ad
(
!
btr_search_fully_disabled
);
return
(
TRUE
);
}
/* We have to allocate a new chain node */
node
=
mem_heap_alloc
(
hash_get_heap
(
table
,
fold
),
sizeof
(
ha_node_t
));
...
...
@@ -250,6 +212,10 @@ ha_delete_hash_node(
{
ut_ad
(
table
);
ut_ad
(
table
->
magic_n
==
HASH_TABLE_MAGIC_N
);
#ifdef UNIV_SYNC_DEBUG
ut_ad
(
rw_lock_own
(
&
btr_search_latch
,
RW_LOCK_EX
));
#endif
/* UNIV_SYNC_DEBUG */
ut_ad
(
btr_search_enabled
);
#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
# ifndef UNIV_HOTBACKUP
if
(
table
->
adaptive
)
{
...
...
@@ -272,11 +238,11 @@ ha_search_and_update_if_found_func(
/*===============================*/
hash_table_t
*
table
,
/*!< in/out: hash table */
ulint
fold
,
/*!< in: folded value of the searched data */
void
*
data
,
/*!< in: pointer to the data */
const
rec_t
*
data
,
/*!< in: pointer to the data */
#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
buf_block_t
*
new_block
,
/*!< in: block containing new_data */
#endif
/* UNIV_AHI_DEBUG || UNIV_DEBUG */
void
*
new_data
)
/*!< in: new pointer to the data */
const
rec_t
*
new_data
)
/*!< in: new pointer to the data */
{
ha_node_t
*
node
;
...
...
@@ -286,6 +252,13 @@ ha_search_and_update_if_found_func(
#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
ut_a
(
new_block
->
frame
==
page_align
(
new_data
));
#endif
/* UNIV_AHI_DEBUG || UNIV_DEBUG */
#ifdef UNIV_SYNC_DEBUG
ut_ad
(
rw_lock_own
(
&
btr_search_latch
,
RW_LOCK_EX
));
#endif
/* UNIV_SYNC_DEBUG */
if
(
!
btr_search_enabled
)
{
return
;
}
node
=
ha_search_with_data
(
table
,
fold
,
data
);
...
...
@@ -322,6 +295,10 @@ ha_remove_all_nodes_to_page(
ut_ad
(
table
);
ut_ad
(
table
->
magic_n
==
HASH_TABLE_MAGIC_N
);
ASSERT_HASH_MUTEX_OWN
(
table
,
fold
);
#ifdef UNIV_SYNC_DEBUG
ut_ad
(
rw_lock_own
(
&
btr_search_latch
,
RW_LOCK_EX
));
#endif
/* UNIV_SYNC_DEBUG */
ut_ad
(
btr_search_enabled
);
node
=
ha_chain_get_first
(
table
,
fold
);
...
...
storage/innobase/handler/ha_innodb.cc
View file @
5dc19b9c
...
...
@@ -2583,7 +2583,6 @@ innobase_init(
/* Get the current high water mark format. */
innobase_file_format_max
=
(
char
*
)
trx_sys_file_format_max_get
();
btr_search_fully_disabled
=
(
!
btr_search_enabled
);
DBUG_RETURN
(
FALSE
);
error:
DBUG_RETURN
(
TRUE
);
...
...
storage/innobase/ibuf/ibuf0ibuf.c
View file @
5dc19b9c
...
...
@@ -3955,7 +3955,7 @@ ibuf_insert_to_index_page(
ut_ad
(
ibuf_inside
(
mtr
));
ut_ad
(
dtuple_check_typed
(
entry
));
ut_ad
(
!
buf_block_align
(
page
)
->
i
s_hashed
);
ut_ad
(
!
buf_block_align
(
page
)
->
i
ndex
);
if
(
UNIV_UNLIKELY
(
dict_table_is_comp
(
index
->
table
)
!=
(
ibool
)
!!
page_is_comp
(
page
)))
{
...
...
storage/innobase/include/btr0sea.h
View file @
5dc19b9c
/*****************************************************************************
Copyright (c) 1996, 20
09, Innobase Oy
. All Rights Reserved.
Copyright (c) 1996, 20
11, Oracle and/or its affiliates
. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
...
...
@@ -141,8 +141,8 @@ btr_search_drop_page_hash_index(
for which we know that
block->buf_fix_count == 0 */
/********************************************************************//**
Drops a p
age hash index when a page is freed from a fseg to the file system.
Drops possible hash index if the page happens to be in the buffer pool
. */
Drops a p
ossible page hash index when a page is evicted from the buffer pool
or freed in a file segment
. */
UNIV_INTERN
void
btr_search_drop_page_hash_when_freed
(
...
...
@@ -192,16 +192,6 @@ btr_search_validate(void);
# define btr_search_validate() TRUE
#endif
/* defined UNIV_AHI_DEBUG || defined UNIV_DEBUG */
/** Flag: has the search system been enabled?
Protected by btr_search_latch and btr_search_enabled_mutex. */
extern
char
btr_search_enabled
;
/** Flag: whether the search system has completed its disabling process,
It is set to TRUE right after buf_pool_drop_hash_index() in
btr_search_disable(), indicating hash index entries are cleaned up.
Protected by btr_search_latch and btr_search_enabled_mutex. */
extern
ibool
btr_search_fully_disabled
;
/** The search info struct in an index */
struct
btr_search_struct
{
ulint
ref_count
;
/*!< Number of blocks in this index tree
...
...
@@ -270,24 +260,6 @@ struct btr_search_sys_struct{
/** The adaptive hash index */
extern
btr_search_sys_t
*
btr_search_sys
;
/** @brief The latch protecting the adaptive search system
This latch protects the
(1) hash index;
(2) columns of a record to which we have a pointer in the hash index;
but does NOT protect:
(3) next record offset field in a record;
(4) next or previous records on the same page.
Bear in mind (3) and (4) when using the hash index.
*/
extern
rw_lock_t
*
btr_search_latch_temp
;
/** The latch protecting the adaptive search system */
#define btr_search_latch (*btr_search_latch_temp)
#ifdef UNIV_SEARCH_PERF_STAT
/** Number of successful adaptive hash index lookups */
extern
ulint
btr_search_n_succ
;
...
...
storage/innobase/include/btr0types.h
View file @
5dc19b9c
/*****************************************************************************
Copyright (c) 1996, 20
09, Innobase Oy
. All Rights Reserved.
Copyright (c) 1996, 20
11, Oracle and/or its affiliates
. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
...
...
@@ -30,6 +30,7 @@ Created 2/17/1996 Heikki Tuuri
#include "rem0types.h"
#include "page0types.h"
#include "sync0rw.h"
/** Persistent cursor */
typedef
struct
btr_pcur_struct
btr_pcur_t
;
...
...
@@ -38,6 +39,28 @@ typedef struct btr_cur_struct btr_cur_t;
/** B-tree search information for the adaptive hash index */
typedef
struct
btr_search_struct
btr_search_t
;
/** @brief The latch protecting the adaptive search system
This latch protects the
(1) hash index;
(2) columns of a record to which we have a pointer in the hash index;
but does NOT protect:
(3) next record offset field in a record;
(4) next or previous records on the same page.
Bear in mind (3) and (4) when using the hash index.
*/
extern
rw_lock_t
*
btr_search_latch_temp
;
/** The latch protecting the adaptive search system */
#define btr_search_latch (*btr_search_latch_temp)
/** Flag: has the search system been enabled?
Protected by btr_search_latch. */
extern
char
btr_search_enabled
;
#ifdef UNIV_BLOB_DEBUG
# include "buf0types.h"
/** An index->blobs entry for keeping track of off-page column references */
...
...
storage/innobase/include/buf0buf.h
View file @
5dc19b9c
...
...
@@ -229,13 +229,11 @@ buf_pool_free(
ulint
n_instances
);
/*!< in: numbere of instances to free */
/********************************************************************//**
Drops the adaptive hash index. To prevent a livelock, this function
is only to be called while holding btr_search_latch and while
btr_search_enabled == FALSE. */
Clears the adaptive hash index on all pages in the buffer pool. */
UNIV_INTERN
void
buf_pool_
drop
_hash_index
(
void
);
/*==========================*/
buf_pool_
clear
_hash_index
(
void
);
/*==========================
=
*/
/********************************************************************//**
Relocate a buffer control block. Relocates the block on the LRU list
...
...
@@ -568,17 +566,6 @@ buf_page_peek_if_too_old(
/*=====================*/
const
buf_page_t
*
bpage
);
/*!< in: block to make younger */
/********************************************************************//**
Returns the current state of is_hashed of a page. FALSE if the page is
not in the pool. NOTE that this operation does not fix the page in the
pool if it is found there.
@return TRUE if page hash index is built in search system */
UNIV_INTERN
ibool
buf_page_peek_if_search_hashed
(
/*===========================*/
ulint
space
,
/*!< in: space id */
ulint
offset
);
/*!< in: page number */
/********************************************************************//**
Gets the youngest modification log sequence number for a frame.
Returns zero if not file page or no modification occurred yet.
@return newest modification to page */
...
...
@@ -1526,13 +1513,16 @@ struct buf_block_struct{
/* @} */
/** @name Hash search fields
These
6
fields may only be modified when we have
These
5
fields may only be modified when we have
an x-latch on btr_search_latch AND
- we are holding an s-latch or x-latch on buf_block_struct::lock or
- we know that buf_block_struct::buf_fix_count == 0.
An exception to this is when we init or create a page
in the buffer pool in buf0buf.c. */
in the buffer pool in buf0buf.c.
Another exception is that assigning block->index = NULL
is allowed whenever holding an x-latch on btr_search_latch. */
/* @{ */
...
...
@@ -1541,20 +1531,20 @@ struct buf_block_struct{
pointers in the adaptive hash index
pointing to this frame */
#endif
/* UNIV_AHI_DEBUG || UNIV_DEBUG */
unsigned
is_hashed
:
1
;
/*!< TRUE if hash index has
already been built on this
page; note that it does not
guarantee that the index is
complete, though: there may
have been hash collisions,
record deletions, etc. */
unsigned
curr_n_fields
:
10
;
/*!< prefix length for hash indexing:
number of full fields */
unsigned
curr_n_bytes
:
15
;
/*!< number of bytes in hash
indexing */
unsigned
curr_left_side
:
1
;
/*!< TRUE or FALSE in hash indexing */
dict_index_t
*
index
;
/*!< Index for which the adaptive
hash index has been created. */
dict_index_t
*
index
;
/*!< Index for which the
adaptive hash index has been
created, or NULL if the page
does not exist in the
index. Note that it does not
guarantee that the index is
complete, though: there may
have been hash collisions,
record deletions, etc. */
/* @} */
# ifdef UNIV_SYNC_DEBUG
/** @name Debug fields */
...
...
storage/innobase/include/ha0ha.h
View file @
5dc19b9c
/*****************************************************************************
Copyright (c) 1994, 20
09, Innobase Oy
. All Rights Reserved.
Copyright (c) 1994, 20
11, Oracle and/or its affiliates
. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
...
...
@@ -31,13 +31,14 @@ Created 8/18/1994 Heikki Tuuri
#include "hash0hash.h"
#include "page0types.h"
#include "buf0types.h"
#include "rem0types.h"
/*************************************************************//**
Looks for an element in a hash table.
@return pointer to the data of the first hash table node in chain
having the fold number, NULL if not found */
UNIV_INLINE
void
*
const
rec_t
*
ha_search_and_get_data
(
/*===================*/
hash_table_t
*
table
,
/*!< in: hash table */
...
...
@@ -51,11 +52,11 @@ ha_search_and_update_if_found_func(
/*===============================*/
hash_table_t
*
table
,
/*!< in/out: hash table */
ulint
fold
,
/*!< in: folded value of the searched data */
void
*
data
,
/*!< in: pointer to the data */
const
rec_t
*
data
,
/*!< in: pointer to the data */
#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
buf_block_t
*
new_block
,
/*!< in: block containing new_data */
#endif
/* UNIV_AHI_DEBUG || UNIV_DEBUG */
void
*
new_data
);
/*!< in: new pointer to the data */
const
rec_t
*
new_data
);
/*!< in: new pointer to the data */
#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
/** Looks for an element when we know the pointer to the data and
...
...
@@ -113,14 +114,6 @@ chosen to be a slightly bigger prime number.
# define ha_create(n_c,n_m,level) ha_create_func(n_c,n_m)
#endif
/* UNIV_SYNC_DEBUG */
/*************************************************************//**
Empties a hash table and frees the memory heaps. */
UNIV_INTERN
void
ha_clear
(
/*=====*/
hash_table_t
*
table
);
/*!< in, own: hash table */
/*************************************************************//**
Inserts an entry into a hash table. If an entry with the same fold number
is found, its node is updated to point to the new data, and no new node
...
...
@@ -138,7 +131,7 @@ ha_insert_for_fold_func(
#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
buf_block_t
*
block
,
/*!< in: buffer block containing the data */
#endif
/* UNIV_AHI_DEBUG || UNIV_DEBUG */
void
*
data
);
/*!< in: data, must not be NULL */
const
rec_t
*
data
);
/*!< in: data, must not be NULL */
#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
/**
...
...
@@ -174,7 +167,7 @@ ha_search_and_delete_if_found(
/*==========================*/
hash_table_t
*
table
,
/*!< in: hash table */
ulint
fold
,
/*!< in: folded value of the searched data */
void
*
data
);
/*!< in: pointer to the data */
const
rec_t
*
data
);
/*!< in: pointer to the data */
#ifndef UNIV_HOTBACKUP
/*****************************************************************//**
Removes from the chain determined by fold all nodes whose data pointer
...
...
@@ -217,7 +210,7 @@ struct ha_node_struct {
#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
buf_block_t
*
block
;
/*!< buffer block containing the data, or NULL */
#endif
/* UNIV_AHI_DEBUG || UNIV_DEBUG */
void
*
data
;
/*!< pointer to the data */
const
rec_t
*
data
;
/*!< pointer to the data */
ulint
fold
;
/*!< fold value for the data */
};
...
...
storage/innobase/include/ha0ha.ic
View file @
5dc19b9c
/*****************************************************************************
Copyright (c) 1994, 20
09, Innobase Oy
. All Rights Reserved.
Copyright (c) 1994, 20
11, Oracle and/or its affiliates
. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
...
...
@@ -25,6 +25,7 @@ Created 8/18/1994 Heikki Tuuri
#include "ut0rnd.h"
#include "mem0mem.h"
#include "btr0types.h"
/***********************************************************//**
Deletes a hash node. */
...
...
@@ -39,10 +40,10 @@ ha_delete_hash_node(
Gets a hash node data.
@return pointer to the data */
UNIV_INLINE
void
*
const rec_t
*
ha_node_get_data(
/*=============*/
ha_node_t* node) /*!< in: hash chain node */
const
ha_node_t* node) /*!< in: hash chain node */
{
return(node->data);
}
...
...
@@ -57,7 +58,7 @@ ha_node_set_data_func(
#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
buf_block_t* block, /*!< in: buffer block containing the data */
#endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
void*
data) /*!< in: pointer to the data */
const rec_t*
data) /*!< in: pointer to the data */
{
#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
node->block = block;
...
...
@@ -105,41 +106,12 @@ ha_chain_get_first(
hash_get_nth_cell(table, hash_calc_hash(fold, table))->node);
}
/*************************************************************//**
Looks for an element in a hash table.
@return pointer to the first hash table node in chain having the fold
number, NULL if not found */
UNIV_INLINE
ha_node_t*
ha_search(
/*======*/
hash_table_t* table, /*!< in: hash table */
ulint fold) /*!< in: folded value of the searched data */
{
ha_node_t* node;
ASSERT_HASH_MUTEX_OWN(table, fold);
node = ha_chain_get_first(table, fold);
while (node) {
if (node->fold == fold) {
return(node);
}
node = ha_chain_get_next(node);
}
return(NULL);
}
/*************************************************************//**
Looks for an element in a hash table.
@return pointer to the data of the first hash table node in chain
having the fold number, NULL if not found */
UNIV_INLINE
void
*
const rec_t
*
ha_search_and_get_data(
/*===================*/
hash_table_t* table, /*!< in: hash table */
...
...
@@ -148,6 +120,10 @@ ha_search_and_get_data(
ha_node_t* node;
ASSERT_HASH_MUTEX_OWN(table, fold);
#ifdef UNIV_SYNC_DEBUG
ut_ad(rw_lock_own(&btr_search_latch, RW_LOCK_SHARED));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(btr_search_enabled);
node = ha_chain_get_first(table, fold);
...
...
@@ -172,12 +148,14 @@ ha_search_with_data(
/*================*/
hash_table_t* table, /*!< in: hash table */
ulint fold, /*!< in: folded value of the searched data */
void*
data) /*!< in: pointer to the data */
const rec_t*
data) /*!< in: pointer to the data */
{
ha_node_t* node;
ASSERT_HASH_MUTEX_OWN(table, fold);
ut_ad(btr_search_enabled);
node = ha_chain_get_first(table, fold);
while (node) {
...
...
@@ -202,11 +180,15 @@ ha_search_and_delete_if_found(
/*==========================*/
hash_table_t* table, /*!< in: hash table */
ulint fold, /*!< in: folded value of the searched data */
void*
data) /*!< in: pointer to the data */
const rec_t*
data) /*!< in: pointer to the data */
{
ha_node_t* node;
ASSERT_HASH_MUTEX_OWN(table, fold);
#ifdef UNIV_SYNC_DEBUG
ut_ad(rw_lock_own(&btr_search_latch, RW_LOCK_EX));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(btr_search_enabled);
node = ha_search_with_data(table, fold, data);
...
...
storage/innobase/include/row0upd.ic
View file @
5dc19b9c
...
...
@@ -28,7 +28,6 @@ Created 12/27/1996 Heikki Tuuri
# include "trx0trx.h"
# include "trx0undo.h"
# include "row0row.h"
# include "btr0sea.h"
#endif /* !UNIV_HOTBACKUP */
#include "page0zip.h"
...
...
storage/innobase/include/sync0sync.h
View file @
5dc19b9c
...
...
@@ -670,7 +670,6 @@ or row lock! */
#define SYNC_LOG_FLUSH_ORDER 147
#define SYNC_RECV 168
#define SYNC_WORK_QUEUE 162
#define SYNC_SEARCH_SYS_CONF 161
/* for assigning btr_search_enabled */
#define SYNC_SEARCH_SYS 160
/* NOTE that if we have a memory
heap that can be extended to the
buffer pool, its logical level is
...
...
storage/innobase/page/page0page.c
View file @
5dc19b9c
...
...
@@ -215,12 +215,6 @@ page_set_max_trx_id(
{
page_t
*
page
=
buf_block_get_frame
(
block
);
#ifndef UNIV_HOTBACKUP
const
ibool
is_hashed
=
block
->
is_hashed
;
if
(
is_hashed
)
{
rw_lock_x_lock
(
&
btr_search_latch
);
}
ut_ad
(
!
mtr
||
mtr_memo_contains
(
mtr
,
block
,
MTR_MEMO_PAGE_X_FIX
));
#endif
/* !UNIV_HOTBACKUP */
...
...
@@ -241,12 +235,6 @@ page_set_max_trx_id(
}
else
{
mach_write_to_8
(
page
+
(
PAGE_HEADER
+
PAGE_MAX_TRX_ID
),
trx_id
);
}
#ifndef UNIV_HOTBACKUP
if
(
is_hashed
)
{
rw_lock_x_unlock
(
&
btr_search_latch
);
}
#endif
/* !UNIV_HOTBACKUP */
}
/************************************************************//**
...
...
storage/innobase/sync/sync0sync.c
View file @
5dc19b9c
...
...
@@ -1213,7 +1213,6 @@ sync_thread_add_level(
case
SYNC_FILE_FORMAT_TAG
:
case
SYNC_DOUBLEWRITE
:
case
SYNC_SEARCH_SYS
:
case
SYNC_SEARCH_SYS_CONF
:
case
SYNC_TRX_LOCK_HEAP
:
case
SYNC_KERNEL
:
case
SYNC_IBUF_BITMAP_MUTEX
:
...
...
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