summaryrefslogtreecommitdiff
path: root/innobase
diff options
context:
space:
mode:
authorheikki@work.mysql.com <>2002-09-04 18:53:48 +0200
committerheikki@work.mysql.com <>2002-09-04 18:53:48 +0200
commita16f3360aa48d2b5e1a90525599e91ab5f84695e (patch)
treeef3cb267c01475b0d1b8c2385ecee59dcd84b7f4 /innobase
parent516cc0bd61e033c7068fa10a24cac4c71bc2490a (diff)
downloadmariadb-git-a16f3360aa48d2b5e1a90525599e91ab5f84695e.tar.gz
btr0btr.c Add more documentation about B-tree latching
ha_innodb.cc Remove gaps in auto-inc in multi-row inserts, more space for foreign key listings in SHOW TABLE STATUS, move resetting of active_trx to amore logical place dict0dict.h Remove gaps from auto-inc sequence if errors in multi-row insert dict0dict.c Remove gaps from auto-inc sequence if errors in multi-row insert
Diffstat (limited to 'innobase')
-rw-r--r--innobase/btr/btr0btr.c19
-rw-r--r--innobase/dict/dict0dict.c21
-rw-r--r--innobase/include/dict0dict.h10
3 files changed, 28 insertions, 22 deletions
diff --git a/innobase/btr/btr0btr.c b/innobase/btr/btr0btr.c
index 38d97785832..7a7678b2dcf 100644
--- a/innobase/btr/btr0btr.c
+++ b/innobase/btr/btr0btr.c
@@ -22,6 +22,25 @@ Created 6/2/1994 Heikki Tuuri
#include "ibuf0ibuf.h"
/*
+Latching strategy of the InnoDB B-tree
+--------------------------------------
+A tree latch protects all non-leaf nodes of the tree. Each node of a tree
+also has a latch of its own.
+
+A B-tree operation normally first acquires an S-latch on the tree. It
+searches down the tree and releases the tree latch when it has the
+leaf node latch. To save CPU time we do not acquire any latch on
+non-leaf nodes of the tree during a search, those pages are only bufferfixed.
+
+If an operation needs to restructure the tree, it acquires an X-latch on
+the tree before searching to a leaf node. If it needs, for example, to
+split a leaf,
+(1) InnoDB decides the split point in the leaf,
+(2) allocates a new page,
+(3) inserts the appropriate node pointer to the first non-leaf level,
+(4) releases the tree X-latch,
+(5) and then moves records from the leaf to the new allocated page.
+
Node pointers
-------------
Leaf pages of a B-tree contain the index records stored in the
diff --git a/innobase/dict/dict0dict.c b/innobase/dict/dict0dict.c
index 85199b90a5a..7bf85557cde 100644
--- a/innobase/dict/dict0dict.c
+++ b/innobase/dict/dict0dict.c
@@ -308,29 +308,18 @@ dict_table_autoinc_get(
}
/************************************************************************
-Reads the autoinc counter value, 0 if not yet initialized. Does not
-increment the counter. */
+Decrements the autoinc counter value by 1. */
-ib_longlong
-dict_table_autoinc_read(
-/*====================*/
- /* out: value of the counter */
+void
+dict_table_autoinc_decrement(
+/*=========================*/
dict_table_t* table) /* in: table */
{
- ib_longlong value;
-
mutex_enter(&(table->autoinc_mutex));
- if (!table->autoinc_inited) {
-
- value = 0;
- } else {
- value = table->autoinc;
- }
+ table->autoinc = table->autoinc - 1;
mutex_exit(&(table->autoinc_mutex));
-
- return(value);
}
/************************************************************************
diff --git a/innobase/include/dict0dict.h b/innobase/include/dict0dict.h
index 832654d2666..bf393210763 100644
--- a/innobase/include/dict0dict.h
+++ b/innobase/include/dict0dict.h
@@ -114,13 +114,11 @@ dict_table_autoinc_get(
/* out: value for a new row, or 0 */
dict_table_t* table); /* in: table */
/************************************************************************
-Reads the autoinc counter value, 0 if not yet initialized. Does not
-increment the counter. */
+Decrements the autoinc counter value by 1. */
-ib_longlong
-dict_table_autoinc_read(
-/*====================*/
- /* out: value of the counter */
+void
+dict_table_autoinc_decrement(
+/*=========================*/
dict_table_t* table); /* in: table */
/************************************************************************
Peeks the autoinc counter value, 0 if not yet initialized. Does not