Below is the list of changes that have just been committed into a local
5.0 repository of marko. When marko does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.1852 05/04/20 17:39:05 marko@stripped +6 -0
InnoDB: Make CHECK TABLE killable. (Bug #9730)
sql/ha_innodb.cc
1.194 05/04/20 17:38:56 marko@stripped +17 -0
Define trx_is_interrupted().
innobase/row/row0mysql.c
1.105 05/04/20 17:38:56 marko@stripped +15 -2
row_scan_and_check_index(): Check trx_is_interrupted() every 1,000
scanned rows.
row_check_table_for_mysql(): Check trx_is_interrupted()
for each index after btr_validate_tree().
innobase/include/trx0trx.h
1.46 05/04/20 17:38:56 marko@stripped +13 -0
Declare trx_is_interrupted().
innobase/include/btr0btr.h
1.14 05/04/20 17:38:56 marko@stripped +4 -1
Enclose btr_print_size() and btr_print_tree() in #ifdef UNIV_BTR_PRINT
Add trx_t* parameter to btr_validate_tree().
innobase/ibuf/ibuf0ibuf.c
1.38 05/04/20 17:38:56 marko@stripped +3 -1
Add trx_t* parameter to btr_validate_tree().
innobase/btr/btr0btr.c
1.39 05/04/20 17:38:56 marko@stripped +14 -5
Enclose btr_print_size() and btr_print_tree() in #ifdef UNIV_BTR_PRINT
Add trx_t* parameter to btr_validate_tree() and btr_validate_level().
btr_validate_level(): Call trx_is_interrupted() on each page.
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: marko
# Host: hundin.mysql.fi
# Root: /home/marko/mysql-5.0
--- 1.38/innobase/btr/btr0btr.c Thu Mar 10 15:15:59 2005
+++ 1.39/innobase/btr/btr0btr.c Wed Apr 20 17:38:56 2005
@@ -20,6 +20,7 @@
#include "rem0cmp.h"
#include "lock0lock.h"
#include "ibuf0ibuf.h"
+#include "trx0trx.h"
/*
Latching strategy of the InnoDB B-tree
@@ -2274,6 +2275,7 @@
ut_ad(btr_check_node_ptr(tree, merge_page, mtr));
}
+#ifdef UNIV_BTR_PRINT
/*****************************************************************
Prints size info of a B-tree. */
@@ -2407,8 +2409,9 @@
mtr_commit(&mtr);
- btr_validate_tree(tree);
+ btr_validate_tree(tree, NULL);
}
+#endif /* UNIV_BTR_PRINT */
/****************************************************************
Checks that the node pointer to a page is appropriate. */
@@ -2649,6 +2652,7 @@
/*===============*/
/* out: TRUE if ok */
dict_tree_t* tree, /* in: index tree */
+ trx_t* trx, /* in: transaction or NULL */
ulint level) /* in: level number */
{
ulint space;
@@ -2696,6 +2700,11 @@
/* Now we are on the desired level. Loop through the pages on that
level. */
loop:
+ if (trx_is_interrupted(trx)) {
+ mtr_commit(&mtr);
+ mem_heap_free(heap);
+ return(ret);
+ }
mem_heap_empty(heap);
offsets = offsets2 = NULL;
mtr_x_lock(dict_tree_get_lock(tree), &mtr);
@@ -2941,7 +2950,8 @@
btr_validate_tree(
/*==============*/
/* out: TRUE if ok */
- dict_tree_t* tree) /* in: tree */
+ dict_tree_t* tree, /* in: tree */
+ trx_t* trx) /* in: transaction or NULL */
{
mtr_t mtr;
page_t* root;
@@ -2954,9 +2964,8 @@
root = btr_root_get(tree, &mtr);
n = btr_page_get_level(root, &mtr);
- for (i = 0; i <= n; i++) {
-
- if (!btr_validate_level(tree, n - i)) {
+ for (i = 0; i <= n && !trx_is_interrupted(trx); i++) {
+ if (!btr_validate_level(tree, trx, n - i)) {
mtr_commit(&mtr);
--- 1.37/innobase/ibuf/ibuf0ibuf.c Mon Apr 18 15:12:21 2005
+++ 1.38/innobase/ibuf/ibuf0ibuf.c Wed Apr 20 17:38:56 2005
@@ -2969,7 +2969,9 @@
btr_pcur_commit_specify_mtr(pcur, mtr);
fputs("InnoDB: Validating insert buffer tree:\n", stderr);
- ut_a(btr_validate_tree(ibuf_data->index->tree));
+ if (!btr_validate_tree(ibuf_data->index->tree, NULL)) {
+ ut_error;
+ }
fprintf(stderr, "InnoDB: ibuf tree ok\n");
fflush(stderr);
--- 1.13/innobase/include/btr0btr.h Thu Dec 2 19:42:31 2004
+++ 1.14/innobase/include/btr0btr.h Wed Apr 20 17:38:56 2005
@@ -398,6 +398,7 @@
page_t* page, /* in: page to be freed, x-latched */
ulint level, /* in: page level */
mtr_t* mtr); /* in: mtr */
+#ifdef UNIV_BTR_PRINT
/*****************************************************************
Prints size info of a B-tree. */
@@ -414,6 +415,7 @@
dict_tree_t* tree, /* in: tree */
ulint width); /* in: print this many entries from start
and end */
+#endif /* UNIV_BTR_PRINT */
/****************************************************************
Checks the size and number of fields in a record based on the definition of
the index. */
@@ -434,7 +436,8 @@
btr_validate_tree(
/*==============*/
/* out: TRUE if ok */
- dict_tree_t* tree); /* in: tree */
+ dict_tree_t* tree, /* in: tree */
+ trx_t* trx); /* in: transaction or NULL */
#define BTR_N_LEAF_PAGES 1
#define BTR_TOTAL_SIZE 2
--- 1.45/innobase/include/trx0trx.h Tue Mar 22 17:11:28 2005
+++ 1.46/innobase/include/trx0trx.h Wed Apr 20 17:38:56 2005
@@ -312,6 +312,19 @@
FILE* f, /* in: output stream */
trx_t* trx); /* in: transaction */
+#ifndef UNIV_HOTBACKUP
+/**************************************************************************
+Determines if the currently running transaction has been interrupted. */
+
+ibool
+trx_is_interrupted(
+/*===============*/
+ /* out: TRUE if interrupted */
+ trx_t* trx); /* in: transaction */
+#else /* !UNIV_HOTBACKUP */
+#define trx_is_interrupted(trx) FALSE
+#endif /* !UNIV_HOTBACKUP */
+
/* Signal to a transaction */
struct trx_sig_struct{
--- 1.104/innobase/row/row0mysql.c Wed Apr 13 17:06:28 2005
+++ 1.105/innobase/row/row0mysql.c Wed Apr 20 17:38:56 2005
@@ -3880,6 +3880,7 @@
int cmp;
ibool contains_null;
ulint i;
+ ulint cnt;
mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_;
@@ -3902,11 +3903,19 @@
dtuple_set_n_fields(prebuilt->search_tuple, 0);
prebuilt->select_lock_type = LOCK_NONE;
+ cnt = 1000;
ret = row_search_for_mysql(buf, PAGE_CUR_G, prebuilt, 0, 0);
loop:
+ /* Check thd->killed every 1,000 scanned rows */
+ if (--cnt == 0) {
+ if (trx_is_interrupted(prebuilt->trx)) {
+ goto func_exit;
+ }
+ cnt = 1000;
+ }
if (ret != DB_SUCCESS) {
-
+ func_exit:
mem_free(buf);
mem_heap_free(heap);
@@ -4033,12 +4042,16 @@
ut_print_name(stderr, index->name);
putc('\n', stderr); */
- if (!btr_validate_tree(index->tree)) {
+ if (!btr_validate_tree(index->tree, prebuilt->trx)) {
ret = DB_ERROR;
} else {
if (!row_scan_and_check_index(prebuilt,
index, &n_rows)) {
ret = DB_ERROR;
+ }
+
+ if (trx_is_interrupted(prebuilt->trx)) {
+ break;
}
/* fprintf(stderr, "%lu entries in index %s\n", n_rows,
--- 1.193/sql/ha_innodb.cc Fri Apr 15 19:00:27 2005
+++ 1.194/sql/ha_innodb.cc Wed Apr 20 17:38:56 2005
@@ -997,6 +997,23 @@
}
/**************************************************************************
+Determines if the currently running transaction has been interrupted. */
+extern "C"
+ibool
+trx_is_interrupted(
+/*===============*/
+ /* out: TRUE if interrupted */
+ trx_t* trx) /* in: transaction */
+{
+ fprintf(stderr,
+ "trx_is_interrupted: %p %p %d\n",
+ trx, trx ? trx->mysql_thd : 0,
+ trx && trx->mysql_thd ? ((THD*) trx->mysql_thd)->killed : -1);
+
+ return(trx && trx->mysql_thd && ((THD*)
trx->mysql_thd)->killed);
+}
+
+/**************************************************************************
Obtain a pointer to the MySQL THD object, as in current_thd(). This
definition must match the one in sql/ha_innodb.cc! */
extern "C"
| Thread |
|---|
| • bk commit into 5.0 tree (marko:1.1852) BUG#9730 | Marko Mäkelä | 20 Apr |