Skip to content

Commit 993395b

Browse files
author
Sergei Golubchik
committed
5.6.20
1 parent 58b09cd commit 993395b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1102
-644
lines changed

CMakeLists.txt

Lines changed: 54 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ IF(NOT CMAKE_CROSSCOMPILING)
6666
long x;
6767
long y;
6868
long res;
69-
char c;
7069
7170
x = 10;
7271
y = 123;
@@ -87,6 +86,16 @@ IF(NOT CMAKE_CROSSCOMPILING)
8786
if (res != 123 + 10 || x != 123 + 10) {
8887
return(1);
8988
}
89+
return(0);
90+
}"
91+
HAVE_IB_GCC_ATOMIC_BUILTINS
92+
)
93+
CHECK_C_SOURCE_RUNS(
94+
"
95+
int main()
96+
{
97+
long res;
98+
char c;
9099
91100
c = 10;
92101
res = __sync_lock_test_and_set(&c, 123);
@@ -95,7 +104,7 @@ IF(NOT CMAKE_CROSSCOMPILING)
95104
}
96105
return(0);
97106
}"
98-
HAVE_IB_GCC_ATOMIC_BUILTINS
107+
HAVE_IB_GCC_ATOMIC_BUILTINS_BYTE
99108
)
100109
CHECK_C_SOURCE_RUNS(
101110
"#include<stdint.h>
@@ -117,16 +126,47 @@ IF(NOT CMAKE_CROSSCOMPILING)
117126
}"
118127
HAVE_IB_GCC_ATOMIC_BUILTINS_64
119128
)
129+
CHECK_C_SOURCE_RUNS(
130+
"#include<stdint.h>
131+
int main()
132+
{
133+
__sync_synchronize();
134+
return(0);
135+
}"
136+
HAVE_IB_GCC_SYNC_SYNCHRONISE
137+
)
138+
CHECK_C_SOURCE_RUNS(
139+
"#include<stdint.h>
140+
int main()
141+
{
142+
__atomic_thread_fence(__ATOMIC_ACQUIRE);
143+
__atomic_thread_fence(__ATOMIC_RELEASE);
144+
return(0);
145+
}"
146+
HAVE_IB_GCC_ATOMIC_THREAD_FENCE
147+
)
120148
ENDIF()
121149

122150
IF(HAVE_IB_GCC_ATOMIC_BUILTINS)
123151
ADD_DEFINITIONS(-DHAVE_IB_GCC_ATOMIC_BUILTINS=1)
124152
ENDIF()
125153

154+
IF(HAVE_IB_GCC_ATOMIC_BUILTINS_BYTE)
155+
ADD_DEFINITIONS(-DHAVE_IB_GCC_ATOMIC_BUILTINS_BYTE=1)
156+
ENDIF()
157+
126158
IF(HAVE_IB_GCC_ATOMIC_BUILTINS_64)
127159
ADD_DEFINITIONS(-DHAVE_IB_GCC_ATOMIC_BUILTINS_64=1)
128160
ENDIF()
129161

162+
IF(HAVE_IB_GCC_SYNC_SYNCHRONISE)
163+
ADD_DEFINITIONS(-DHAVE_IB_GCC_SYNC_SYNCHRONISE=1)
164+
ENDIF()
165+
166+
IF(HAVE_IB_GCC_ATOMIC_THREAD_FENCE)
167+
ADD_DEFINITIONS(-DHAVE_IB_GCC_ATOMIC_THREAD_FENCE=1)
168+
ENDIF()
169+
130170
# either define HAVE_IB_ATOMIC_PTHREAD_T_GCC or not
131171
IF(NOT CMAKE_CROSSCOMPILING)
132172
CHECK_C_SOURCE_RUNS(
@@ -208,10 +248,21 @@ IF(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
208248
return(0);
209249
}
210250
" HAVE_IB_ATOMIC_PTHREAD_T_SOLARIS)
251+
CHECK_C_SOURCE_COMPILES(
252+
"#include <mbarrier.h>
253+
int main() {
254+
__machine_r_barrier();
255+
__machine_w_barrier();
256+
return(0);
257+
}"
258+
HAVE_IB_MACHINE_BARRIER_SOLARIS)
211259
ENDIF()
212260
IF(HAVE_IB_ATOMIC_PTHREAD_T_SOLARIS)
213261
ADD_DEFINITIONS(-DHAVE_IB_ATOMIC_PTHREAD_T_SOLARIS=1)
214262
ENDIF()
263+
IF(HAVE_IB_MACHINE_BARRIER_SOLARIS)
264+
ADD_DEFINITIONS(-DHAVE_IB_MACHINE_BARRIER_SOLARIS=1)
265+
ENDIF()
215266
ENDIF()
216267

217268

@@ -229,6 +280,7 @@ ENDIF()
229280

230281
IF(MSVC)
231282
ADD_DEFINITIONS(-DHAVE_WINDOWS_ATOMICS)
283+
ADD_DEFINITIONS(-DHAVE_WINDOWS_MM_FENCE)
232284
ENDIF()
233285

234286

api/api0api.cc

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*****************************************************************************
22
3-
Copyright (c) 2008, 2013, Oracle and/or its affiliates. All Rights Reserved.
3+
Copyright (c) 2008, 2014, Oracle and/or its affiliates. All Rights Reserved.
44
55
This program is free software; you can redistribute it and/or modify it under
66
the terms of the GNU General Public License as published by the Free Software
@@ -2044,6 +2044,8 @@ ib_cursor_delete_row(
20442044
const rec_t* rec;
20452045
ib_bool_t page_format;
20462046
mtr_t mtr;
2047+
rec_t* copy = NULL;
2048+
byte ptr[UNIV_PAGE_SIZE_MAX];
20472049

20482050
page_format = static_cast<ib_bool_t>(
20492051
dict_table_is_comp(index->table));
@@ -2052,16 +2054,27 @@ ib_cursor_delete_row(
20522054

20532055
if (btr_pcur_restore_position(
20542056
BTR_SEARCH_LEAF, pcur, &mtr)) {
2057+
mem_heap_t* heap = NULL;
2058+
ulint offsets_[REC_OFFS_NORMAL_SIZE];
2059+
ulint* offsets = offsets_;
2060+
2061+
rec_offs_init(offsets_);
20552062

20562063
rec = btr_pcur_get_rec(pcur);
2057-
} else {
2058-
rec = NULL;
2064+
2065+
/* Since mtr will be commited, the rec
2066+
will not be protected. Make a copy of
2067+
the rec. */
2068+
offsets = rec_get_offsets(
2069+
rec, index, offsets, ULINT_UNDEFINED, &heap);
2070+
ut_ad(rec_offs_size(offsets) < UNIV_PAGE_SIZE_MAX);
2071+
copy = rec_copy(ptr, rec, offsets);
20592072
}
20602073

20612074
mtr_commit(&mtr);
20622075

2063-
if (rec && !rec_get_deleted_flag(rec, page_format)) {
2064-
err = ib_delete_row(cursor, pcur, rec);
2076+
if (copy && !rec_get_deleted_flag(copy, page_format)) {
2077+
err = ib_delete_row(cursor, pcur, copy);
20652078
} else {
20662079
err = DB_RECORD_NOT_FOUND;
20672080
}

btr/btr0cur.cc

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2556,6 +2556,31 @@ btr_cur_pessimistic_update(
25562556
ut_ad(flags & BTR_KEEP_POS_FLAG);
25572557
}
25582558

2559+
if (big_rec_vec) {
2560+
const ulint redo_10p = srv_log_file_size * UNIV_PAGE_SIZE / 10;
2561+
ulint total_blob_len = 0;
2562+
2563+
/* Calculate the total number of bytes for blob data */
2564+
for (ulint i = 0; i < big_rec_vec->n_fields; i++) {
2565+
total_blob_len += big_rec_vec->fields[i].len;
2566+
}
2567+
2568+
if (total_blob_len > redo_10p) {
2569+
ib_logf(IB_LOG_LEVEL_ERROR, "The total blob data"
2570+
" length (" ULINTPF ") is greater than"
2571+
" 10%% of the redo log file size (" UINT64PF
2572+
"). Please increase innodb_log_file_size.",
2573+
total_blob_len, srv_log_file_size);
2574+
if (n_reserved > 0) {
2575+
fil_space_release_free_extents(
2576+
index->space, n_reserved);
2577+
}
2578+
2579+
err = DB_TOO_BIG_RECORD;
2580+
goto err_exit;
2581+
}
2582+
}
2583+
25592584
/* Store state of explicit locks on rec on the page infimum record,
25602585
before deleting rec. The page infimum acts as a dummy carrier of the
25612586
locks, taking care also of lock releases, before we can move the locks
@@ -4377,6 +4402,7 @@ btr_store_big_rec_extern_fields(
43774402
buf_block_t** freed_pages = NULL;
43784403
ulint n_freed_pages = 0;
43794404
dberr_t error = DB_SUCCESS;
4405+
ulint total_blob_len = 0;
43804406

43814407
ut_ad(rec_offs_validate(rec, index, offsets));
43824408
ut_ad(rec_offs_any_extern(offsets));
@@ -4396,6 +4422,23 @@ btr_store_big_rec_extern_fields(
43964422
rec_page_no = buf_block_get_page_no(rec_block);
43974423
ut_a(fil_page_get_type(page_align(rec)) == FIL_PAGE_INDEX);
43984424

4425+
const ulint redo_10p = (srv_log_file_size * UNIV_PAGE_SIZE / 10);
4426+
4427+
/* Calculate the total number of bytes for blob data */
4428+
for (ulint i = 0; i < big_rec_vec->n_fields; i++) {
4429+
total_blob_len += big_rec_vec->fields[i].len;
4430+
}
4431+
4432+
if (total_blob_len > redo_10p) {
4433+
ut_ad(op == BTR_STORE_INSERT);
4434+
ib_logf(IB_LOG_LEVEL_ERROR, "The total blob data length"
4435+
" (" ULINTPF ") is greater than 10%% of the"
4436+
" redo log file size (" UINT64PF "). Please"
4437+
" increase innodb_log_file_size.",
4438+
total_blob_len, srv_log_file_size);
4439+
return(DB_TOO_BIG_RECORD);
4440+
}
4441+
43994442
if (page_zip) {
44004443
int err;
44014444

buf/buf0buf.cc

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2882,12 +2882,6 @@ buf_page_get_gen(
28822882

28832883
ut_ad(buf_block_get_state(fix_block) == BUF_BLOCK_FILE_PAGE);
28842884

2885-
#if UNIV_WORD_SIZE == 4
2886-
/* On 32-bit systems, there is no padding in buf_page_t. On
2887-
other systems, Valgrind could complain about uninitialized pad
2888-
bytes. */
2889-
UNIV_MEM_ASSERT_RW(&fix_block->page, sizeof(fix_block->page));
2890-
#endif
28912885
#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
28922886

28932887
if ((mode == BUF_GET_IF_IN_POOL || mode == BUF_GET_IF_IN_POOL_OR_WATCH)
@@ -5401,7 +5395,7 @@ buf_get_free_list_len(void)
54015395

54025396
#else /* !UNIV_HOTBACKUP */
54035397
/********************************************************************//**
5404-
Inits a page to the buffer buf_pool, for use in ibbackup --restore. */
5398+
Inits a page to the buffer buf_pool, for use in mysqlbackup --restore. */
54055399
UNIV_INTERN
54065400
void
54075401
buf_page_init_for_backup_restore(

buf/buf0lru.cc

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1818,13 +1818,6 @@ buf_LRU_free_page(
18181818
rw_lock_x_lock(hash_lock);
18191819
mutex_enter(block_mutex);
18201820

1821-
#if UNIV_WORD_SIZE == 4
1822-
/* On 32-bit systems, there is no padding in buf_page_t. On
1823-
other systems, Valgrind could complain about uninitialized pad
1824-
bytes. */
1825-
UNIV_MEM_ASSERT_RW(bpage, sizeof *bpage);
1826-
#endif
1827-
18281821
if (!buf_page_can_relocate(bpage)) {
18291822

18301823
/* Do not free buffer fixed or I/O-fixed blocks. */
@@ -1862,12 +1855,6 @@ buf_LRU_free_page(
18621855
ut_ad(buf_page_in_file(bpage));
18631856
ut_ad(bpage->in_LRU_list);
18641857
ut_ad(!bpage->in_flush_list == !bpage->oldest_modification);
1865-
#if UNIV_WORD_SIZE == 4
1866-
/* On 32-bit systems, there is no padding in buf_page_t. On
1867-
other systems, Valgrind could complain about uninitialized pad
1868-
bytes. */
1869-
UNIV_MEM_ASSERT_RW(bpage, sizeof *bpage);
1870-
#endif
18711858

18721859
#ifdef UNIV_DEBUG
18731860
if (buf_debug_prints) {
@@ -1940,13 +1927,6 @@ buf_LRU_free_page(
19401927

19411928
ut_ad(prev_b->in_LRU_list);
19421929
ut_ad(buf_page_in_file(prev_b));
1943-
#if UNIV_WORD_SIZE == 4
1944-
/* On 32-bit systems, there is no
1945-
padding in buf_page_t. On other
1946-
systems, Valgrind could complain about
1947-
uninitialized pad bytes. */
1948-
UNIV_MEM_ASSERT_RW(prev_b, sizeof *prev_b);
1949-
#endif
19501930
UT_LIST_INSERT_AFTER(LRU, buf_pool->LRU,
19511931
prev_b, b);
19521932

@@ -2172,13 +2152,6 @@ buf_LRU_block_remove_hashed(
21722152
ut_a(buf_page_get_io_fix(bpage) == BUF_IO_NONE);
21732153
ut_a(bpage->buf_fix_count == 0);
21742154

2175-
#if UNIV_WORD_SIZE == 4
2176-
/* On 32-bit systems, there is no padding in
2177-
buf_page_t. On other systems, Valgrind could complain
2178-
about uninitialized pad bytes. */
2179-
UNIV_MEM_ASSERT_RW(bpage, sizeof *bpage);
2180-
#endif
2181-
21822155
buf_LRU_remove_block(bpage);
21832156

21842157
buf_pool->freed_page_clock += 1;

dict/dict0crea.cc

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*****************************************************************************
22
3-
Copyright (c) 1996, 2013, Oracle and/or its affiliates. All Rights Reserved.
3+
Copyright (c) 1996, 2014, Oracle and/or its affiliates. All Rights Reserved.
44
55
This program is free software; you can redistribute it and/or modify it under
66
the terms of the GNU General Public License as published by the Free Software
@@ -1611,26 +1611,25 @@ dict_create_add_foreign_to_dictionary(
16111611
return(error);
16121612
}
16131613

1614-
/********************************************************************//**
1615-
Adds foreign key definitions to data dictionary tables in the database.
1616-
@return error code or DB_SUCCESS */
1614+
/** Adds the given set of foreign key objects to the dictionary tables
1615+
in the database. This function does not modify the dictionary cache. The
1616+
caller must ensure that all foreign key objects contain a valid constraint
1617+
name in foreign->id.
1618+
@param[in] local_fk_set set of foreign key objects, to be added to
1619+
the dictionary tables
1620+
@param[in] table table to which the foreign key objects in
1621+
local_fk_set belong to
1622+
@param[in,out] trx transaction
1623+
@return error code or DB_SUCCESS */
16171624
UNIV_INTERN
16181625
dberr_t
16191626
dict_create_add_foreigns_to_dictionary(
16201627
/*===================================*/
1621-
ulint start_id,/*!< in: if we are actually doing ALTER TABLE
1622-
ADD CONSTRAINT, we want to generate constraint
1623-
numbers which are bigger than in the table so
1624-
far; we number the constraints from
1625-
start_id + 1 up; start_id should be set to 0 if
1626-
we are creating a new table, or if the table
1627-
so far has no constraints for which the name
1628-
was generated here */
1629-
dict_table_t* table, /*!< in: table */
1630-
trx_t* trx) /*!< in: transaction */
1628+
const dict_foreign_set& local_fk_set,
1629+
const dict_table_t* table,
1630+
trx_t* trx)
16311631
{
16321632
dict_foreign_t* foreign;
1633-
ulint number = start_id + 1;
16341633
dberr_t error;
16351634

16361635
ut_ad(mutex_own(&(dict_sys->mutex)));
@@ -1643,17 +1642,12 @@ dict_create_add_foreigns_to_dictionary(
16431642
return(DB_ERROR);
16441643
}
16451644

1646-
for (foreign = UT_LIST_GET_FIRST(table->foreign_list);
1647-
foreign;
1648-
foreign = UT_LIST_GET_NEXT(foreign_list, foreign)) {
1645+
for (dict_foreign_set::const_iterator it = local_fk_set.begin();
1646+
it != local_fk_set.end();
1647+
++it) {
16491648

1650-
error = dict_create_add_foreign_id(&number, table->name,
1651-
foreign);
1652-
1653-
if (error != DB_SUCCESS) {
1654-
1655-
return(error);
1656-
}
1649+
foreign = *it;
1650+
ut_ad(foreign->id != NULL);
16571651

16581652
error = dict_create_add_foreign_to_dictionary(table->name,
16591653
foreign, trx);

0 commit comments

Comments
 (0)