summaryrefslogtreecommitdiff
path: root/innobase
diff options
context:
space:
mode:
authorunknown <monty@hundin.mysql.fi>2001-12-13 20:54:20 +0200
committerunknown <monty@hundin.mysql.fi>2001-12-13 20:54:20 +0200
commit6e31c2ca7d7881d26c86c29e8abd0e1528d6613b (patch)
tree053b9c4d48bf88ba54d5cf728bfebadb38d1a548 /innobase
parent9385d3aba530562b1ddcecedeb6dd61cd3d63d96 (diff)
parentb554ef6b10db3d6640935cafe0d7ebaf8034ae13 (diff)
downloadmariadb-git-6e31c2ca7d7881d26c86c29e8abd0e1528d6613b.tar.gz
merge
innobase/btr/btr0cur.c: Auto merged innobase/dict/dict0dict.c: Auto merged innobase/sync/sync0arr.c: Auto merged sql/mysqld.cc: Auto merged sql/table.cc: Auto merged sql/unireg.cc: Auto merged Docs/manual.texi: Merge
Diffstat (limited to 'innobase')
-rw-r--r--innobase/btr/btr0cur.c67
-rw-r--r--innobase/dict/dict0dict.c14
-rw-r--r--innobase/include/ut0byte.h20
-rw-r--r--innobase/sync/sync0arr.c2
-rw-r--r--innobase/ut/ut0byte.c43
5 files changed, 140 insertions, 6 deletions
diff --git a/innobase/btr/btr0cur.c b/innobase/btr/btr0cur.c
index 7d80f6d5c64..9f3d02525d8 100644
--- a/innobase/btr/btr0cur.c
+++ b/innobase/btr/btr0cur.c
@@ -85,6 +85,15 @@ btr_rec_free_updated_extern_fields(
inherited fields */
mtr_t* mtr); /* in: mini-transaction handle which contains
an X-latch to record page and to the tree */
+/***************************************************************
+Gets the externally stored size of a record, in units of a database page. */
+static
+ulint
+btr_rec_get_externally_stored_len(
+/*==============================*/
+ /* out: externally stored part, in units of a
+ database page */
+ rec_t* rec); /* in: record */
/*==================== B-TREE SEARCH =========================*/
@@ -2540,6 +2549,7 @@ btr_estimate_number_of_different_key_vals(
ulint matched_bytes;
ulint* n_diff;
ulint not_empty_flag = 0;
+ ulint total_external_size = 0;
ulint i;
ulint j;
mtr_t mtr;
@@ -2586,10 +2596,15 @@ btr_estimate_number_of_different_key_vals(
for (j = matched_fields + 1; j <= n_cols; j++) {
n_diff[j]++;
}
-
+
+ total_external_size +=
+ btr_rec_get_externally_stored_len(rec);
+
rec = page_rec_get_next(rec);
}
+ total_external_size +=
+ btr_rec_get_externally_stored_len(rec);
mtr_commit(&mtr);
}
@@ -2597,12 +2612,18 @@ btr_estimate_number_of_different_key_vals(
BTR_KEY_VAL_ESTIMATE_N_PAGES leaf pages, we can estimate how many
there will be in index->stat_n_leaf_pages */
+ /* We must take into account that our sample actually represents
+ also the pages used for external storage of fields (those pages are
+ included in index->stat_n_leaf_pages) */
+
for (j = 0; j <= n_cols; j++) {
index->stat_n_diff_key_vals[j] =
(n_diff[j] * index->stat_n_leaf_pages
+ BTR_KEY_VAL_ESTIMATE_N_PAGES - 1
+ + total_external_size
+ not_empty_flag)
- / BTR_KEY_VAL_ESTIMATE_N_PAGES;
+ / (BTR_KEY_VAL_ESTIMATE_N_PAGES
+ + total_external_size);
}
mem_free(n_diff);
@@ -2610,6 +2631,48 @@ btr_estimate_number_of_different_key_vals(
/*================== EXTERNAL STORAGE OF BIG FIELDS ===================*/
+/***************************************************************
+Gets the externally stored size of a record, in units of a database page. */
+static
+ulint
+btr_rec_get_externally_stored_len(
+/*==============================*/
+ /* out: externally stored part, in units of a
+ database page */
+ rec_t* rec) /* in: record */
+{
+ ulint n_fields;
+ byte* data;
+ ulint local_len;
+ ulint extern_len;
+ ulint total_extern_len = 0;
+ ulint i;
+
+ if (rec_get_data_size(rec) <= REC_1BYTE_OFFS_LIMIT) {
+
+ return(0);
+ }
+
+ n_fields = rec_get_n_fields(rec);
+
+ for (i = 0; i < n_fields; i++) {
+ if (rec_get_nth_field_extern_bit(rec, i)) {
+
+ data = rec_get_nth_field(rec, i, &local_len);
+
+ local_len -= BTR_EXTERN_FIELD_REF_SIZE;
+
+ extern_len = mach_read_from_4(data + local_len
+ + BTR_EXTERN_LEN + 4);
+
+ total_extern_len += ut_calc_align(extern_len,
+ UNIV_PAGE_SIZE);
+ }
+ }
+
+ return(total_extern_len / UNIV_PAGE_SIZE);
+}
+
/***********************************************************************
Sets the ownership bit of an externally stored field in a record. */
static
diff --git a/innobase/dict/dict0dict.c b/innobase/dict/dict0dict.c
index 4b503a3dc49..e68e815f0c9 100644
--- a/innobase/dict/dict0dict.c
+++ b/innobase/dict/dict0dict.c
@@ -1765,9 +1765,8 @@ dict_scan_col(
col = dict_table_get_nth_col(table, i);
if (ut_strlen(col->name) == (ulint)(ptr - old_ptr)
- && 0 == ut_memcmp(col->name, old_ptr,
+ && 0 == ut_cmp_in_lower_case(col->name, old_ptr,
(ulint)(ptr - old_ptr))) {
-
/* Found */
*success = TRUE;
@@ -1831,11 +1830,20 @@ dict_scan_table_name(
break;
}
}
-
+#ifdef __WIN__
+ ut_cpy_in_lower_case(second_table_name + i, old_ptr,
+ ptr - old_ptr);
+#else
ut_memcpy(second_table_name + i, old_ptr, ptr - old_ptr);
+#endif
second_table_name[i + (ptr - old_ptr)] = '\0';
} else {
+#ifdef __WIN__
+ ut_cpy_in_lower_case(second_table_name, old_ptr,
+ ptr - old_ptr);
+#else
ut_memcpy(second_table_name, old_ptr, ptr - old_ptr);
+#endif
second_table_name[dot_ptr - old_ptr] = '/';
second_table_name[ptr - old_ptr] = '\0';
}
diff --git a/innobase/include/ut0byte.h b/innobase/include/ut0byte.h
index 77795ee0708..b45f2160392 100644
--- a/innobase/include/ut0byte.h
+++ b/innobase/include/ut0byte.h
@@ -220,6 +220,26 @@ ut_bit_set_nth(
ulint a, /* in: ulint */
ulint n, /* in: nth bit requested */
ibool val); /* in: value for the bit to set */
+/****************************************************************
+Copies a string to a memory location, setting characters to lower case. */
+
+void
+ut_cpy_in_lower_case(
+/*=================*/
+ char* dest, /* in: destination */
+ char* source, /* in: source */
+ ulint len); /* in: string length */
+/****************************************************************
+Compares two strings when converted to lower case. */
+
+int
+ut_cmp_in_lower_case(
+/*=================*/
+ /* out: -1, 0, 1 if str1 < str2, str1 == str2,
+ str1 > str2, respectively */
+ char* str1, /* in: string1 */
+ char* str2, /* in: string2 */
+ ulint len); /* in: length of both strings */
#ifndef UNIV_NONINL
diff --git a/innobase/sync/sync0arr.c b/innobase/sync/sync0arr.c
index 66d711671dd..573829fcef8 100644
--- a/innobase/sync/sync0arr.c
+++ b/innobase/sync/sync0arr.c
@@ -905,7 +905,7 @@ sync_array_print_long_waits(void)
cell = sync_array_get_nth_cell(sync_primary_wait_array, i);
if (cell->wait_object != NULL
- && difftime(time(NULL), cell->reservation_time) > 120) {
+ && difftime(time(NULL), cell->reservation_time) > 240) {
fprintf(stderr,
"InnoDB: Warning: a long semaphore wait:\n");
diff --git a/innobase/ut/ut0byte.c b/innobase/ut/ut0byte.c
index fa0d904a6a7..02bdf2065ee 100644
--- a/innobase/ut/ut0byte.c
+++ b/innobase/ut/ut0byte.c
@@ -30,3 +30,46 @@ ut_dulint_sort(dulint* arr, dulint* aux_arr, ulint low, ulint high)
ut_dulint_cmp);
}
+/****************************************************************
+Copies a string to a memory location, setting characters to lower case. */
+
+void
+ut_cpy_in_lower_case(
+/*=================*/
+ char* dest, /* in: destination */
+ char* source,/* in: source */
+ ulint len) /* in: string length */
+{
+ ulint i;
+
+ for (i = 0; i < len; i++) {
+ dest[i] = tolower(source[i]);
+ }
+}
+
+/****************************************************************
+Compares two strings when converted to lower case. */
+
+int
+ut_cmp_in_lower_case(
+/*=================*/
+ /* out: -1, 0, 1 if str1 < str2, str1 == str2,
+ str1 > str2, respectively */
+ char* str1, /* in: string1 */
+ char* str2, /* in: string2 */
+ ulint len) /* in: length of both strings */
+{
+ ulint i;
+
+ for (i = 0; i < len; i++) {
+ if (tolower(str1[i]) < tolower(str2[i])) {
+ return(-1);
+ }
+
+ if (tolower(str1[i]) > tolower(str2[i])) {
+ return(1);
+ }
+ }
+
+ return(0);
+}