summaryrefslogtreecommitdiff
path: root/innobase
diff options
context:
space:
mode:
authorunknown <serg@serg.mylan>2005-04-06 21:19:20 +0200
committerunknown <serg@serg.mylan>2005-04-06 21:19:20 +0200
commit3960c84f1202cf2e47427df1ca869a054a67f829 (patch)
treed7dfbdbb37dfe91906c38499758105cb11079399 /innobase
parent6f23625d4e70dd2977afcbbd7d12e5f09fe5684a (diff)
parentcde615c9cbff404b6a6c82a1ab7a6bcb8742b88e (diff)
downloadmariadb-git-3960c84f1202cf2e47427df1ca869a054a67f829.tar.gz
manually merged
Gluh's SESSION/GLOBAL for @variables fix in sql_yacc.yy and Bar's well_formed_len() changes in ndb code did not make it and should be re-applied manually BitKeeper/etc/logging_ok: auto-union include/m_ctype.h: Auto merged innobase/btr/btr0pcur.c: Auto merged innobase/include/btr0pcur.h: Auto merged innobase/include/os0file.h: Auto merged innobase/os/os0file.c: Auto merged innobase/row/row0sel.c: Auto merged innobase/srv/srv0start.c: Auto merged mysql-test/r/user_var.result: Auto merged mysql-test/t/user_var.test: Auto merged ndb/include/ndbapi/NdbTransaction.hpp: Auto merged ndb/src/ndbapi/NdbTransaction.cpp: Auto merged ndb/tools/desc.cpp: Auto merged strings/ctype-big5.c: Auto merged strings/ctype-mb.c: Auto merged strings/ctype-simple.c: Auto merged strings/ctype-sjis.c: Auto merged strings/ctype-ucs2.c: Auto merged strings/ctype-ujis.c: Auto merged BitKeeper/deleted/.del-NdbResultSet.cpp~84d192cf3f42600d: ul ndb/include/ndbapi/NdbScanOperation.hpp: ul ndb/src/ndbapi/NdbIndexOperation.cpp: ul ndb/src/ndbapi/NdbOperationDefine.cpp: ul ndb/src/ndbapi/NdbOperationSearch.cpp: ul ndb/src/ndbapi/NdbScanOperation.cpp: ul sql/field.cc: manually merged, because bk messed it up sql/sql_yacc.yy: merged
Diffstat (limited to 'innobase')
-rw-r--r--innobase/btr/btr0pcur.c10
-rw-r--r--innobase/include/btr0pcur.h4
-rw-r--r--innobase/include/btr0pcur.ic10
-rw-r--r--innobase/include/os0file.h2
-rw-r--r--innobase/os/os0file.c27
-rw-r--r--innobase/row/row0sel.c4
-rw-r--r--innobase/srv/srv0start.c5
7 files changed, 57 insertions, 5 deletions
diff --git a/innobase/btr/btr0pcur.c b/innobase/btr/btr0pcur.c
index ceaa4f41a18..74feff8653c 100644
--- a/innobase/btr/btr0pcur.c
+++ b/innobase/btr/btr0pcur.c
@@ -14,6 +14,7 @@ Created 2/23/1996 Heikki Tuuri
#include "ut0byte.h"
#include "rem0cmp.h"
+#include "trx0trx.h"
/******************************************************************
Allocates memory for a persistent cursor object and initializes the cursor. */
@@ -206,7 +207,14 @@ btr_pcur_restore_position(
ut_a(cursor->pos_state == BTR_PCUR_WAS_POSITIONED
|| cursor->pos_state == BTR_PCUR_IS_POSITIONED);
- ut_a(cursor->old_stored == BTR_PCUR_OLD_STORED);
+ if (cursor->old_stored != BTR_PCUR_OLD_STORED) {
+ ut_print_buf(stderr, (const byte*)cursor, sizeof(btr_pcur_t));
+ if (cursor->trx_if_known) {
+ trx_print(stderr, cursor->trx_if_known);
+ }
+
+ ut_a(0);
+ }
if (cursor->rel_pos == BTR_PCUR_AFTER_LAST_IN_TREE
|| cursor->rel_pos == BTR_PCUR_BEFORE_FIRST_IN_TREE) {
diff --git a/innobase/include/btr0pcur.h b/innobase/include/btr0pcur.h
index 6384222be51..eb3822aab7a 100644
--- a/innobase/include/btr0pcur.h
+++ b/innobase/include/btr0pcur.h
@@ -478,6 +478,10 @@ struct btr_pcur_struct{
BTR_PCUR_WAS_POSITIONED,
BTR_PCUR_NOT_POSITIONED */
ulint search_mode; /* PAGE_CUR_G, ... */
+ trx_t* trx_if_known; /* the transaction, if we know it;
+ otherwise this field is not defined;
+ can ONLY BE USED in error prints in
+ fatal assertion failures! */
/*-----------------------------*/
/* NOTE that the following fields may possess dynamically allocated
memory which should be freed if not needed anymore! */
diff --git a/innobase/include/btr0pcur.ic b/innobase/include/btr0pcur.ic
index b553a569bda..9a7d7867025 100644
--- a/innobase/include/btr0pcur.ic
+++ b/innobase/include/btr0pcur.ic
@@ -493,6 +493,8 @@ btr_pcur_open(
btr_cur_search_to_nth_level(index, 0, tuple, mode, latch_mode,
btr_cursor, 0, mtr);
cursor->pos_state = BTR_PCUR_IS_POSITIONED;
+
+ cursor->trx_if_known = NULL;
}
/******************************************************************
@@ -535,6 +537,8 @@ btr_pcur_open_with_no_init(
cursor->pos_state = BTR_PCUR_IS_POSITIONED;
cursor->old_stored = BTR_PCUR_OLD_NOT_STORED;
+
+ cursor->trx_if_known = NULL;
}
/*********************************************************************
@@ -568,6 +572,8 @@ btr_pcur_open_at_index_side(
pcur->pos_state = BTR_PCUR_IS_POSITIONED;
pcur->old_stored = BTR_PCUR_OLD_NOT_STORED;
+
+ pcur->trx_if_known = NULL;
}
/**************************************************************************
@@ -592,6 +598,8 @@ btr_pcur_open_at_rnd_pos(
btr_pcur_get_btr_cur(cursor), mtr);
cursor->pos_state = BTR_PCUR_IS_POSITIONED;
cursor->old_stored = BTR_PCUR_OLD_NOT_STORED;
+
+ cursor->trx_if_known = NULL;
}
/******************************************************************
@@ -617,4 +625,6 @@ btr_pcur_close(
cursor->latch_mode = BTR_NO_LATCHES;
cursor->pos_state = BTR_PCUR_NOT_POSITIONED;
+
+ cursor->trx_if_known = NULL;
}
diff --git a/innobase/include/os0file.h b/innobase/include/os0file.h
index 599e78bab48..f55c345537e 100644
--- a/innobase/include/os0file.h
+++ b/innobase/include/os0file.h
@@ -68,6 +68,8 @@ log. */
#define OS_FILE_OVERWRITE 53
#define OS_FILE_OPEN_RAW 54
#define OS_FILE_CREATE_PATH 55
+#define OS_FILE_OPEN_RETRY 56 /* for os_file_create() on
+ the first ibdata file */
#define OS_FILE_READ_ONLY 333
#define OS_FILE_READ_WRITE 444
diff --git a/innobase/os/os0file.c b/innobase/os/os0file.c
index eeba98a8ab2..9df26150160 100644
--- a/innobase/os/os0file.c
+++ b/innobase/os/os0file.c
@@ -413,8 +413,6 @@ os_file_lock(
"InnoDB: using the same InnoDB data or log files.\n");
}
- close(fd);
-
return(-1);
}
@@ -989,6 +987,7 @@ try_again:
} else if (access_type == OS_FILE_READ_WRITE
&& os_file_lock(file, name)) {
*success = FALSE;
+ close(file);
file = -1;
#endif
} else {
@@ -1101,6 +1100,7 @@ os_file_create_simple_no_error_handling(
} else if (access_type == OS_FILE_READ_WRITE
&& os_file_lock(file, name)) {
*success = FALSE;
+ close(file);
file = -1;
#endif
} else {
@@ -1152,7 +1152,8 @@ try_again:
if (create_mode == OS_FILE_OPEN_RAW) {
create_flag = OPEN_EXISTING;
share_mode = FILE_SHARE_WRITE;
- } else if (create_mode == OS_FILE_OPEN) {
+ } else if (create_mode == OS_FILE_OPEN
+ || create_mode == OS_FILE_OPEN_RETRY) {
create_flag = OPEN_EXISTING;
} else if (create_mode == OS_FILE_CREATE) {
create_flag = CREATE_NEW;
@@ -1243,7 +1244,8 @@ try_again:
try_again:
ut_a(name);
- if (create_mode == OS_FILE_OPEN || create_mode == OS_FILE_OPEN_RAW) {
+ if (create_mode == OS_FILE_OPEN || create_mode == OS_FILE_OPEN_RAW
+ || create_mode == OS_FILE_OPEN_RETRY) {
mode_str = "OPEN";
create_flag = O_RDWR;
} else if (create_mode == OS_FILE_CREATE) {
@@ -1316,6 +1318,23 @@ try_again:
} else if (create_mode != OS_FILE_OPEN_RAW
&& os_file_lock(file, name)) {
*success = FALSE;
+ if (create_mode == OS_FILE_OPEN_RETRY) {
+ int i;
+ ut_print_timestamp(stderr);
+ fputs(" InnoDB: Retrying to lock the first data file\n",
+ stderr);
+ for (i = 0; i < 100; i++) {
+ os_thread_sleep(1000000);
+ if (!os_file_lock(file, name)) {
+ *success = TRUE;
+ return(file);
+ }
+ }
+ ut_print_timestamp(stderr);
+ fputs(" InnoDB: Unable to open the first data file\n",
+ stderr);
+ }
+ close(file);
file = -1;
#endif
} else {
diff --git a/innobase/row/row0sel.c b/innobase/row/row0sel.c
index e3f31c116fa..96abbda8e64 100644
--- a/innobase/row/row0sel.c
+++ b/innobase/row/row0sel.c
@@ -2644,6 +2644,8 @@ row_sel_get_clust_rec_for_mysql(
clust_rec = btr_pcur_get_rec(prebuilt->clust_pcur);
+ prebuilt->clust_pcur->trx_if_known = trx;
+
/* Note: only if the search ends up on a non-infimum record is the
low_match value the real match to the search tuple */
@@ -3406,6 +3408,8 @@ shortcut_fails_too_big_rec:
btr_pcur_open_with_no_init(index, search_tuple, mode,
BTR_SEARCH_LEAF,
pcur, 0, &mtr);
+
+ pcur->trx_if_known = trx;
} else {
if (mode == PAGE_CUR_G) {
btr_pcur_open_at_index_side(TRUE, index,
diff --git a/innobase/srv/srv0start.c b/innobase/srv/srv0start.c
index c65b7d3e141..5bb7cfa7421 100644
--- a/innobase/srv/srv0start.c
+++ b/innobase/srv/srv0start.c
@@ -789,6 +789,11 @@ open_or_create_data_files(
files[i] = os_file_create(
name, OS_FILE_OPEN_RAW, OS_FILE_NORMAL,
OS_DATA_FILE, &ret);
+ } else if (i == 0) {
+ files[i] = os_file_create(
+ name, OS_FILE_OPEN_RETRY,
+ OS_FILE_NORMAL,
+ OS_DATA_FILE, &ret);
} else {
files[i] = os_file_create(
name, OS_FILE_OPEN, OS_FILE_NORMAL,