Skip to content

Commit 6686dfc

Browse files
committed
Merge 10.2 into 10.3
2 parents a80e410 + 52df804 commit 6686dfc

File tree

10 files changed

+150
-108
lines changed

10 files changed

+150
-108
lines changed

mysql-test/main/check.result

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,36 @@ connection default;
5252
UNLOCK TABLES;
5353
DROP TABLE t1;
5454
disconnect con1;
55+
#
56+
# MDEV-15338
57+
# Assertion `!table || (!table->read_set ||
58+
# bitmap_is_set(table->read_set, field_index))'
59+
# failed on dropping column with CHECK
60+
#
61+
CREATE TABLE t1 (a INT, b INT, CHECK (a>0)) ENGINE=MyISAM;
62+
INSERT INTO t1 VALUES (1,2),(3,4);
63+
ALTER TABLE t1 DROP COLUMN a;
64+
CREATE OR REPLACE TABLE t1 (a INT, b INT, CHECK (a>0)) ENGINE=MyISAM;
65+
ALTER TABLE t1 DROP COLUMN b;
66+
CREATE OR REPLACE TABLE t1 (a INT, b INT, c INT, CHECK (a+b>0)) ENGINE=MyISAM;
67+
ALTER TABLE t1 DROP COLUMN b;
68+
ERROR 42S22: Unknown column 'b' in 'CHECK'
69+
ALTER TABLE t1 DROP COLUMN a, DROP COLUMN b;
70+
CREATE OR REPLACE TABLE t1 (a INT, b INT, c INT, CHECK (a+b>0)) ENGINE=MyISAM;
71+
ALTER TABLE t1 DROP CONSTRAINT `CONSTRAINT_1`;
72+
SHOW CREATE TABLE t1;
73+
Table Create Table
74+
t1 CREATE TABLE `t1` (
75+
`a` int(11) DEFAULT NULL,
76+
`b` int(11) DEFAULT NULL,
77+
`c` int(11) DEFAULT NULL
78+
) ENGINE=MyISAM DEFAULT CHARSET=latin1
79+
CREATE OR REPLACE TABLE t1 (a INT, b INT, c INT, CHECK (a+b>0)) ENGINE=MyISAM;
80+
ALTER TABLE t1 DROP COLUMN b, DROP CONSTRAINT `CONSTRAINT_1`;
81+
SHOW CREATE TABLE t1;
82+
Table Create Table
83+
t1 CREATE TABLE `t1` (
84+
`a` int(11) DEFAULT NULL,
85+
`c` int(11) DEFAULT NULL
86+
) ENGINE=MyISAM DEFAULT CHARSET=latin1
87+
DROP TABLE t1;

mysql-test/main/check.test

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,27 @@ disconnect con1;
7979

8080
# Wait till we reached the initial number of concurrent sessions
8181
--source include/wait_until_count_sessions.inc
82+
83+
--echo #
84+
--echo # MDEV-15338
85+
--echo # Assertion `!table || (!table->read_set ||
86+
--echo # bitmap_is_set(table->read_set, field_index))'
87+
--echo # failed on dropping column with CHECK
88+
--echo #
89+
90+
CREATE TABLE t1 (a INT, b INT, CHECK (a>0)) ENGINE=MyISAM;
91+
INSERT INTO t1 VALUES (1,2),(3,4);
92+
ALTER TABLE t1 DROP COLUMN a;
93+
CREATE OR REPLACE TABLE t1 (a INT, b INT, CHECK (a>0)) ENGINE=MyISAM;
94+
ALTER TABLE t1 DROP COLUMN b;
95+
CREATE OR REPLACE TABLE t1 (a INT, b INT, c INT, CHECK (a+b>0)) ENGINE=MyISAM;
96+
--error ER_BAD_FIELD_ERROR
97+
ALTER TABLE t1 DROP COLUMN b;
98+
ALTER TABLE t1 DROP COLUMN a, DROP COLUMN b;
99+
CREATE OR REPLACE TABLE t1 (a INT, b INT, c INT, CHECK (a+b>0)) ENGINE=MyISAM;
100+
ALTER TABLE t1 DROP CONSTRAINT `CONSTRAINT_1`;
101+
SHOW CREATE TABLE t1;
102+
CREATE OR REPLACE TABLE t1 (a INT, b INT, c INT, CHECK (a+b>0)) ENGINE=MyISAM;
103+
ALTER TABLE t1 DROP COLUMN b, DROP CONSTRAINT `CONSTRAINT_1`;
104+
SHOW CREATE TABLE t1;
105+
DROP TABLE t1;

mysql-test/main/partition_open_files_limit.test

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
DROP TABLE IF EXISTS `t1`;
55
--enable_warnings
66

7+
call mtr.add_suppression("option 'table_open_cache'");
8+
call mtr.add_suppression("option 'max_connections'");
9+
10+
711
# On some platforms the lowest possible open_files_limit is too high...
812
let $max_open_files_limit= `SELECT @@open_files_limit > 511`;
913
if ($max_open_files_limit)

sql/sql_table.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10149,6 +10149,11 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to,
1014910149

1015010150
alter_table_manage_keys(to, from->file->indexes_are_disabled(), keys_onoff);
1015110151

10152+
/* Set read map for all fields in from table */
10153+
from->default_column_bitmaps();
10154+
bitmap_set_all(from->read_set);
10155+
from->file->column_bitmaps_signal();
10156+
1015210157
/* We can abort alter table for any table type */
1015310158
thd->abort_on_warning= !ignore && thd->is_strict_mode();
1015410159

storage/innobase/dict/dict0load.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2438,8 +2438,9 @@ dict_load_indexes(
24382438
&& static_cast<char>(*field)
24392439
== static_cast<char>(*TEMP_INDEX_PREFIX_STR)) {
24402440
/* Skip indexes whose name starts with
2441-
TEMP_INDEX_PREFIX, because they will
2442-
be dropped during crash recovery. */
2441+
TEMP_INDEX_PREFIX_STR, because they will
2442+
be dropped by row_merge_drop_temp_indexes()
2443+
during crash recovery. */
24432444
goto next_rec;
24442445
}
24452446
}

storage/innobase/handler/handler0alter.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8890,7 +8890,7 @@ commit_cache_norebuild(
88908890
(after renaming the indexes), so that in the
88918891
event of a crash, crash recovery will drop the
88928892
indexes, because it drops all indexes whose
8893-
names start with TEMP_INDEX_PREFIX. Once we
8893+
names start with TEMP_INDEX_PREFIX_STR. Once we
88948894
have started dropping an index tree, there is
88958895
no way to roll it back. */
88968896

storage/innobase/handler/i_s.cc

Lines changed: 75 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -256,60 +256,13 @@ field_store_string(
256256
const char* str) /*!< in: NUL-terminated utf-8 string,
257257
or NULL */
258258
{
259-
int ret;
260-
261-
if (str != NULL) {
262-
263-
ret = field->store(str, static_cast<uint>(strlen(str)),
264-
system_charset_info);
265-
field->set_notnull();
266-
} else {
267-
268-
ret = 0; /* success */
259+
if (!str) {
269260
field->set_null();
270-
}
271-
272-
return(ret);
273-
}
274-
275-
/*******************************************************************//**
276-
Store the name of an index in a MYSQL_TYPE_VARCHAR field.
277-
Handles the names of incomplete secondary indexes.
278-
@return 0 on success */
279-
static
280-
int
281-
field_store_index_name(
282-
/*===================*/
283-
Field* field, /*!< in/out: target field for
284-
storage */
285-
const char* index_name) /*!< in: NUL-terminated utf-8
286-
index name, possibly starting with
287-
TEMP_INDEX_PREFIX */
288-
{
289-
int ret;
290-
291-
ut_ad(index_name != NULL);
292-
ut_ad(field->real_type() == MYSQL_TYPE_VARCHAR ||
293-
field->real_type() == MYSQL_TYPE_NULL);
294-
295-
/* Since TEMP_INDEX_PREFIX is not a valid UTF8, we need to convert
296-
it to something else. */
297-
if (*index_name == *TEMP_INDEX_PREFIX_STR) {
298-
char buf[NAME_LEN + 1];
299-
buf[0] = '?';
300-
memcpy(buf + 1, index_name + 1, strlen(index_name));
301-
ret = field->store(
302-
buf, static_cast<uint>(strlen(buf)),
303-
system_charset_info);
304-
} else {
305-
ret = field->store(
306-
index_name, static_cast<uint>(strlen(index_name)),
307-
system_charset_info);
261+
return 0;
308262
}
309263

310264
field->set_notnull();
311-
312-
return(ret);
265+
return field->store(str, uint(strlen(str)), system_charset_info);
313266
}
314267

315268
/*******************************************************************//**
@@ -932,12 +885,8 @@ fill_innodb_locks_from_cache(
932885
buf, uint(bufend - buf), system_charset_info));
933886

934887
/* lock_index */
935-
if (row->lock_index != NULL) {
936-
OK(field_store_index_name(fields[IDX_LOCK_INDEX],
937-
row->lock_index));
938-
} else {
939-
fields[IDX_LOCK_INDEX]->set_null();
940-
}
888+
OK(field_store_string(fields[IDX_LOCK_INDEX],
889+
row->lock_index));
941890

942891
/* lock_space */
943892
OK(field_store_ulint(fields[IDX_LOCK_SPACE],
@@ -1711,7 +1660,6 @@ i_s_cmp_per_index_fill_low(
17111660

17121661
for (iter = snap.begin(), i = 0; iter != snap.end(); iter++, i++) {
17131662

1714-
char name[192];
17151663
dict_index_t* index = dict_index_find_on_id_low(iter->first);
17161664

17171665
if (index != NULL) {
@@ -1722,47 +1670,49 @@ i_s_cmp_per_index_fill_low(
17221670
db_utf8, sizeof(db_utf8),
17231671
table_utf8, sizeof(table_utf8));
17241672

1725-
field_store_string(fields[IDX_DATABASE_NAME], db_utf8);
1726-
field_store_string(fields[IDX_TABLE_NAME], table_utf8);
1727-
field_store_index_name(fields[IDX_INDEX_NAME],
1728-
index->name);
1673+
status = field_store_string(fields[IDX_DATABASE_NAME],
1674+
db_utf8)
1675+
|| field_store_string(fields[IDX_TABLE_NAME],
1676+
table_utf8)
1677+
|| field_store_string(fields[IDX_INDEX_NAME],
1678+
index->name);
17291679
} else {
17301680
/* index not found */
1731-
snprintf(name, sizeof(name),
1732-
"index_id:" IB_ID_FMT, iter->first);
1733-
field_store_string(fields[IDX_DATABASE_NAME],
1734-
"unknown");
1735-
field_store_string(fields[IDX_TABLE_NAME],
1736-
"unknown");
1737-
field_store_string(fields[IDX_INDEX_NAME],
1738-
name);
1681+
char name[MY_INT64_NUM_DECIMAL_DIGITS
1682+
+ sizeof "index_id: "];
1683+
fields[IDX_DATABASE_NAME]->set_null();
1684+
fields[IDX_TABLE_NAME]->set_null();
1685+
fields[IDX_INDEX_NAME]->set_notnull();
1686+
status = fields[IDX_INDEX_NAME]->store(
1687+
name,
1688+
uint(snprintf(name, sizeof name,
1689+
"index_id: " IB_ID_FMT,
1690+
iter->first)),
1691+
system_charset_info);
17391692
}
17401693

1741-
fields[IDX_COMPRESS_OPS]->store(
1742-
iter->second.compressed, true);
1743-
1744-
fields[IDX_COMPRESS_OPS_OK]->store(
1745-
iter->second.compressed_ok, true);
1746-
1747-
fields[IDX_COMPRESS_TIME]->store(
1748-
iter->second.compressed_usec / 1000000, true);
1749-
1750-
fields[IDX_UNCOMPRESS_OPS]->store(
1751-
iter->second.decompressed, true);
1752-
1753-
fields[IDX_UNCOMPRESS_TIME]->store(
1754-
iter->second.decompressed_usec / 1000000, true);
1755-
1756-
if (schema_table_store_record(thd, table)) {
1694+
if (status
1695+
|| fields[IDX_COMPRESS_OPS]->store(
1696+
iter->second.compressed, true)
1697+
|| fields[IDX_COMPRESS_OPS_OK]->store(
1698+
iter->second.compressed_ok, true)
1699+
|| fields[IDX_COMPRESS_TIME]->store(
1700+
iter->second.compressed_usec / 1000000, true)
1701+
|| fields[IDX_UNCOMPRESS_OPS]->store(
1702+
iter->second.decompressed, true)
1703+
|| fields[IDX_UNCOMPRESS_TIME]->store(
1704+
iter->second.decompressed_usec / 1000000, true)
1705+
|| schema_table_store_record(thd, table)) {
17571706
status = 1;
17581707
break;
17591708
}
17601709
/* Release and reacquire the dict mutex to allow other
17611710
threads to proceed. This could eventually result in the
17621711
contents of INFORMATION_SCHEMA.innodb_cmp_per_index being
17631712
inconsistent, but it is an acceptable compromise. */
1764-
if (i % 1000 == 0) {
1713+
if (i == 1000) {
17651714
mutex_exit(&dict_sys->mutex);
1715+
i = 0;
17661716
mutex_enter(&dict_sys->mutex);
17671717
}
17681718
}
@@ -4914,9 +4864,11 @@ i_s_innodb_buffer_page_fill(
49144864

49154865
mutex_enter(&dict_sys->mutex);
49164866

4917-
if (const dict_index_t* index =
4918-
dict_index_get_if_in_cache_low(
4919-
page_info->index_id)) {
4867+
const dict_index_t* index =
4868+
dict_index_get_if_in_cache_low(
4869+
page_info->index_id);
4870+
4871+
if (index) {
49204872
table_name_end = innobase_convert_name(
49214873
table_name, sizeof(table_name),
49224874
index->table->name.m_name,
@@ -4929,17 +4881,22 @@ i_s_innodb_buffer_page_fill(
49294881
table_name_end
49304882
- table_name),
49314883
system_charset_info)
4932-
|| field_store_index_name(
4933-
fields
4934-
[IDX_BUFFER_PAGE_INDEX_NAME],
4935-
index->name);
4884+
|| fields[IDX_BUFFER_PAGE_INDEX_NAME]
4885+
->store(index->name,
4886+
uint(strlen(index->name)),
4887+
system_charset_info);
49364888
}
49374889

49384890
mutex_exit(&dict_sys->mutex);
49394891

49404892
OK(ret);
49414893

4942-
fields[IDX_BUFFER_PAGE_TABLE_NAME]->set_notnull();
4894+
if (index) {
4895+
fields[IDX_BUFFER_PAGE_TABLE_NAME]
4896+
->set_notnull();
4897+
fields[IDX_BUFFER_PAGE_INDEX_NAME]
4898+
->set_notnull();
4899+
}
49434900
}
49444901

49454902
OK(fields[IDX_BUFFER_PAGE_NUM_RECS]->store(
@@ -5630,9 +5587,11 @@ i_s_innodb_buf_page_lru_fill(
56305587

56315588
mutex_enter(&dict_sys->mutex);
56325589

5633-
if (const dict_index_t* index =
5634-
dict_index_get_if_in_cache_low(
5635-
page_info->index_id)) {
5590+
const dict_index_t* index =
5591+
dict_index_get_if_in_cache_low(
5592+
page_info->index_id);
5593+
5594+
if (index) {
56365595
table_name_end = innobase_convert_name(
56375596
table_name, sizeof(table_name),
56385597
index->table->name.m_name,
@@ -5645,17 +5604,22 @@ i_s_innodb_buf_page_lru_fill(
56455604
table_name_end
56465605
- table_name),
56475606
system_charset_info)
5648-
|| field_store_index_name(
5649-
fields
5650-
[IDX_BUF_LRU_PAGE_INDEX_NAME],
5651-
index->name);
5607+
|| fields[IDX_BUF_LRU_PAGE_INDEX_NAME]
5608+
->store(index->name,
5609+
uint(strlen(index->name)),
5610+
system_charset_info);
56525611
}
56535612

56545613
mutex_exit(&dict_sys->mutex);
56555614

56565615
OK(ret);
56575616

5658-
fields[IDX_BUF_LRU_PAGE_TABLE_NAME]->set_notnull();
5617+
if (index) {
5618+
fields[IDX_BUF_LRU_PAGE_TABLE_NAME]
5619+
->set_notnull();
5620+
fields[IDX_BUF_LRU_PAGE_INDEX_NAME]
5621+
->set_notnull();
5622+
}
56595623
}
56605624

56615625
OK(fields[IDX_BUF_LRU_PAGE_NUM_RECS]->store(
@@ -6601,7 +6565,15 @@ i_s_dict_fill_sys_indexes(
66016565

66026566
fields = table_to_fill->field;
66036567

6604-
OK(field_store_index_name(fields[SYS_INDEX_NAME], index->name));
6568+
if (*index->name == *TEMP_INDEX_PREFIX_STR) {
6569+
/* Since TEMP_INDEX_PREFIX_STR is not valid UTF-8, we
6570+
need to convert it to something else. */
6571+
*const_cast<char*>(index->name()) = '?';
6572+
}
6573+
6574+
OK(fields[SYS_INDEX_NAME]->store(index->name,
6575+
uint(strlen(index->name)),
6576+
system_charset_info));
66056577

66066578
OK(fields[SYS_INDEX_ID]->store(longlong(index->id), true));
66076579

storage/rocksdb/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ IF(HAVE_SCHED_GETCPU)
1919
ADD_DEFINITIONS(-DHAVE_SCHED_GETCPU=1 -DROCKSDB_SCHED_GETCPU_PRESENT)
2020
ENDIF()
2121

22+
IF(WITH_VALGRIND)
23+
ADD_DEFINITIONS(-DROCKSDB_VALGRIND_RUN=1)
24+
ENDIF()
2225

2326
# We've had our builders hang during the build process. This prevents MariaRocks
2427
# to be built on 32 bit intel OS kernels.

storage/rocksdb/mysql-test/rocksdb/r/issue255.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ pk
4646
127
4747
SHOW TABLE STATUS LIKE 't1';
4848
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary
49-
t1 ROCKSDB 10 Fixed 2 15 30 0 0 0 127 NULL NULL NULL latin1_swedish_ci NULL 0 N
49+
t1 ROCKSDB # Fixed 2 # # # # # 127 NULL NULL NULL latin1_swedish_ci NULL 0 N
5050
INSERT INTO t1 VALUES ();
5151
ERROR 23000: Duplicate entry '127' for key 'PRIMARY'
5252
SELECT * FROM t1;

0 commit comments

Comments
 (0)