Skip to content

Commit 73606a3

Browse files
committed
System Versioning 1.0 pre5 [closes #407]
Merge branch '10.3' into trunk Both field_visibility and VERS_HIDDEN_FLAG exist independently. TODO: VERS_HIDDEN_FLAG should be replaced with SYSTEM_INVISIBLE (or COMPLETELY_INVISIBLE?).
2 parents 2ae2876 + 2b67b7c commit 73606a3

File tree

91 files changed

+2662
-566
lines changed

Some content is hidden

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

91 files changed

+2662
-566
lines changed

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,3 +494,11 @@ UpgradeLog*.htm
494494

495495
# Microsoft Fakes
496496
FakesAssemblies/
497+
498+
compile_commands.json
499+
.clang-format
500+
.kscope/
501+
.vimrc
502+
.editorconfig
503+
.kateconfig
504+
*.kdev4

client/mysql_upgrade.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,8 @@ static struct my_option my_long_options[]=
166166
"server with which it was built/distributed.",
167167
&opt_version_check, &opt_version_check, 0,
168168
GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
169-
{"write-binlog", OPT_WRITE_BINLOG, "All commands including those, "
170-
"issued by mysqlcheck, are written to the binary log.",
169+
{"write-binlog", OPT_WRITE_BINLOG, "All commands including those "
170+
"issued by mysqlcheck are written to the binary log.",
171171
&opt_write_binlog, &opt_write_binlog, 0, GET_BOOL, NO_ARG,
172172
0, 0, 0, 0, 0, 0},
173173
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}

client/mysqldump.c

Lines changed: 47 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,11 @@ static my_bool verbose= 0, opt_no_create_info= 0, opt_no_data= 0, opt_no_data_m
115115
opt_events= 0, opt_comments_used= 0,
116116
opt_alltspcs=0, opt_notspcs= 0, opt_logging,
117117
opt_drop_trigger= 0 ;
118-
static my_bool insert_pat_inited= 0, debug_info_flag= 0, debug_check_flag= 0;
118+
static my_bool insert_pat_inited= 0, debug_info_flag= 0, debug_check_flag= 0,
119+
select_field_names_inited= 0;
119120
static ulong opt_max_allowed_packet, opt_net_buffer_length;
120121
static MYSQL mysql_connection,*mysql=0;
121-
static DYNAMIC_STRING insert_pat;
122+
static DYNAMIC_STRING insert_pat, select_field_names;
122123
static char *opt_password=0,*current_user=0,
123124
*current_host=0,*path=0,*fields_terminated=0,
124125
*lines_terminated=0, *enclosed=0, *opt_enclosed=0, *escaped=0,
@@ -1645,6 +1646,7 @@ static void free_resources()
16451646
dynstr_free(&extended_row);
16461647
dynstr_free(&dynamic_where);
16471648
dynstr_free(&insert_pat);
1649+
dynstr_free(&select_field_names);
16481650
if (defaults_argv)
16491651
free_defaults(defaults_argv);
16501652
mysql_library_end();
@@ -2740,7 +2742,13 @@ static uint get_table_structure(char *table, char *db, char *table_type,
27402742
else
27412743
dynstr_set_checked(&insert_pat, "");
27422744
}
2743-
2745+
if (!select_field_names_inited)
2746+
{
2747+
select_field_names_inited= 1;
2748+
init_dynamic_string_checked(&select_field_names, "", 1024, 1024);
2749+
}
2750+
else
2751+
dynstr_set_checked(&select_field_names, "");
27442752
insert_option= ((delayed && opt_ignore) ? " DELAYED IGNORE " :
27452753
delayed ? " DELAYED " : opt_ignore ? " IGNORE " : "");
27462754

@@ -2976,6 +2984,19 @@ static uint get_table_structure(char *table, char *db, char *table_type,
29762984
DBUG_RETURN(0);
29772985
}
29782986

2987+
while ((row= mysql_fetch_row(result)))
2988+
{
2989+
if (strlen(row[SHOW_EXTRA]) && strstr(row[SHOW_EXTRA],"INVISIBLE"))
2990+
complete_insert= 1;
2991+
if (init)
2992+
{
2993+
dynstr_append_checked(&select_field_names, ", ");
2994+
}
2995+
init=1;
2996+
dynstr_append_checked(&select_field_names,
2997+
quote_name(row[SHOW_FIELDNAME], name_buff, 0));
2998+
}
2999+
init=0;
29793000
/*
29803001
If write_data is true, then we build up insert statements for
29813002
the table's data. Note: in subsequent lines of code, this test
@@ -3003,19 +3024,8 @@ static uint get_table_structure(char *table, char *db, char *table_type,
30033024
}
30043025
}
30053026

3006-
while ((row= mysql_fetch_row(result)))
3007-
{
3008-
if (complete_insert)
3009-
{
3010-
if (init)
3011-
{
3012-
dynstr_append_checked(&insert_pat, ", ");
3013-
}
3014-
init=1;
3015-
dynstr_append_checked(&insert_pat,
3016-
quote_name(row[SHOW_FIELDNAME], name_buff, 0));
3017-
}
3018-
}
3027+
if (complete_insert)
3028+
dynstr_append_checked(&insert_pat, select_field_names.str);
30193029
num_fields= mysql_num_rows(result);
30203030
mysql_free_result(result);
30213031
}
@@ -3073,6 +3083,21 @@ static uint get_table_structure(char *table, char *db, char *table_type,
30733083
}
30743084
}
30753085

3086+
while ((row= mysql_fetch_row(result)))
3087+
{
3088+
if (strlen(row[SHOW_EXTRA]) && strstr(row[SHOW_EXTRA],"INVISIBLE"))
3089+
complete_insert= 1;
3090+
if (init)
3091+
{
3092+
dynstr_append_checked(&select_field_names, ", ");
3093+
}
3094+
dynstr_append_checked(&select_field_names,
3095+
quote_name(row[SHOW_FIELDNAME], name_buff, 0));
3096+
init=1;
3097+
}
3098+
init=0;
3099+
mysql_data_seek(result, 0);
3100+
30763101
while ((row= mysql_fetch_row(result)))
30773102
{
30783103
ulong *lengths= mysql_fetch_lengths(result);
@@ -3713,7 +3738,9 @@ static void dump_table(char *table, char *db)
37133738

37143739
/* now build the query string */
37153740

3716-
dynstr_append_checked(&query_string, "SELECT /*!40001 SQL_NO_CACHE */ * INTO OUTFILE '");
3741+
dynstr_append_checked(&query_string, "SELECT /*!40001 SQL_NO_CACHE */ ");
3742+
dynstr_append_checked(&query_string, select_field_names.str);
3743+
dynstr_append_checked(&query_string, " INTO OUTFILE '");
37173744
dynstr_append_checked(&query_string, filename);
37183745
dynstr_append_checked(&query_string, "'");
37193746

@@ -3762,7 +3789,9 @@ static void dump_table(char *table, char *db)
37623789
"\n--\n-- Dumping data for table %s\n--\n",
37633790
fix_for_comment(result_table));
37643791

3765-
dynstr_append_checked(&query_string, "SELECT /*!40001 SQL_NO_CACHE */ * FROM ");
3792+
dynstr_append_checked(&query_string, "SELECT /*!40001 SQL_NO_CACHE */ ");
3793+
dynstr_append_checked(&query_string, select_field_names.str);
3794+
dynstr_append_checked(&query_string, " FROM ");
37663795
dynstr_append_checked(&query_string, result_table);
37673796

37683797
if (where)

include/ma_dyncol.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ typedef struct st_mysql_lex_string LEX_STRING;
6363
/* NO and OK is the same used just to show semantics */
6464
#define ER_DYNCOL_NO ER_DYNCOL_OK
6565

66+
#ifdef HAVE_CHARSET_utf8mb4
67+
#define DYNCOL_UTF (&my_charset_utf8mb4_general_ci)
68+
#else
69+
#define DYNCOL_UTF (&my_charset_utf8_general_ci)
70+
#endif
71+
6672
enum enum_dyncol_func_result
6773
{
6874
ER_DYNCOL_OK= 0,

include/my_base.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,8 @@ enum ha_base_keytype {
282282
This flag can be calculated -- it's based on key lengths comparison.
283283
*/
284284
#define HA_KEY_HAS_PART_KEY_SEG 65536
285-
285+
/* Internal Flag Can be calcaluted */
286+
#define HA_INVISIBLE_KEY 2<<18
286287
/* Automatic bits in key-flag */
287288

288289
#define HA_SPACE_PACK_USED 4 /* Test for if SPACE_PACK used */

include/mysql_com.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ enum enum_indicator_type
202202
#define VERS_UPDATE_UNVERSIONED_FLAG (1 << 29) /* column that doesn't support
203203
system versioning when table
204204
itself supports it*/
205-
#define HIDDEN_FLAG (1 << 31) /* hide from SELECT * */
205+
#define VERS_HIDDEN_FLAG (1 << 31) /* hide from SELECT * */
206206

207207
#define REFRESH_GRANT (1ULL << 0) /* Refresh grant tables */
208208
#define REFRESH_LOG (1ULL << 1) /* Start on new log file */

man/mysql_upgrade.1

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -691,8 +691,7 @@ it was built/distributed. Defaults to on; use \fB\-\-skip\-version\-check\fR to
691691
.sp
692692
Cause binary logging to be enabled while
693693
\fBmysql_upgrade\fR
694-
runs\&. This is the default behavior; to disable binary logging during the upgrade, use the inverse of this option (that is, start the program with
695-
\fB\-\-skip\-write\-binlog\fR)\&.
694+
runs\&.
696695
.RE
697696
.SH "COPYRIGHT"
698697
.br

mysql-test/include/kill_and_restart_mysqld.inc

Lines changed: 0 additions & 15 deletions
This file was deleted.

mysql-test/r/ctype_utf8.result

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10272,6 +10272,21 @@ DROP TABLE allbytes;
1027210272
SET sql_mode = DEFAULT;
1027310273
# End of ctype_backslash.inc
1027410274
#
10275+
# MDEV-12681 Wrong VIEW results for CHAR(0xDF USING latin1)
10276+
#
10277+
SET NAMES utf8;
10278+
SELECT CHAR(0xDF USING latin1);
10279+
CHAR(0xDF USING latin1)
10280+
ß
10281+
CREATE OR REPLACE VIEW v1 AS SELECT CHAR(0xDF USING latin1) AS c;
10282+
SHOW CREATE VIEW v1;
10283+
View Create View character_set_client collation_connection
10284+
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select char(0xdf using latin1) AS `c` utf8 utf8_general_ci
10285+
SELECT * FROM v1;
10286+
c
10287+
ß
10288+
DROP VIEW v1;
10289+
#
1027510290
# End of 10.0 tests
1027610291
#
1027710292
#

mysql-test/r/ctype_utf8mb4.result

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3430,6 +3430,32 @@ a b
34303430
a 😁 b a ? b
34313431
DROP TABLE t1;
34323432
#
3433+
# MDEV-8949: COLUMN_CREATE unicode name breakage
3434+
#
3435+
SET NAMES utf8mb4;
3436+
SELECT COLUMN_JSON(COLUMN_CREATE(_utf8mb4 0xF09F988E, 1));
3437+
COLUMN_JSON(COLUMN_CREATE(_utf8mb4 0xF09F988E, 1))
3438+
{"😎":1}
3439+
SELECT COLUMN_LIST(COLUMN_CREATE(_utf8mb4 0xF09F988E, 1));
3440+
COLUMN_LIST(COLUMN_CREATE(_utf8mb4 0xF09F988E, 1))
3441+
`😎`
3442+
SELECT COLUMN_GET(COLUMN_CREATE(_utf8mb4 0xF09F988E, 1), _utf8mb4 0xF09F988E
3443+
as int);
3444+
COLUMN_GET(COLUMN_CREATE(_utf8mb4 0xF09F988E, 1), _utf8mb4 0xF09F988E
3445+
as int)
3446+
1
3447+
CREATE TABLE t1 AS SELECT
3448+
COLUMN_LIST(COLUMN_CREATE('a',1)),
3449+
COLUMN_JSON(COLUMN_CREATE('b',1));
3450+
SHOW CREATE TABLE t1;
3451+
Table Create Table
3452+
t1 CREATE TABLE `t1` (
3453+
`COLUMN_LIST(COLUMN_CREATE('a',1))` longtext CHARACTER SET utf8mb4 DEFAULT NULL,
3454+
`COLUMN_JSON(COLUMN_CREATE('b',1))` longtext CHARACTER SET utf8mb4 DEFAULT NULL
3455+
) ENGINE=MyISAM DEFAULT CHARSET=latin1
3456+
DROP TABLE t1;
3457+
SET NAMES default;
3458+
#
34333459
# End of 10.0 tests
34343460
#
34353461
#

mysql-test/r/features.result

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Feature_delay_key_write 0
88
Feature_dynamic_columns 0
99
Feature_fulltext 0
1010
Feature_gis 0
11+
Feature_invisible_columns 0
1112
Feature_locale 0
1213
Feature_subquery 0
1314
Feature_timezone 0

mysql-test/r/func_str.result

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4734,6 +4734,27 @@ set global max_allowed_packet=default;
47344734
# End of 5.6 tests
47354735
#
47364736
#
4737+
# Start of 10.0 tests
4738+
#
4739+
#
4740+
# MDEV-12681 Wrong VIEW results for CHAR(0xDF USING latin1)
4741+
#
4742+
EXPLAIN EXTENDED SELECT CHAR(0xDF USING latin1);
4743+
id select_type table type possible_keys key key_len ref rows filtered Extra
4744+
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
4745+
Warnings:
4746+
Note 1003 select char(0xdf using latin1) AS `CHAR(0xDF USING latin1)`
4747+
EXPLAIN EXTENDED SELECT CHAR(0xDF USING `binary`);
4748+
id select_type table type possible_keys key key_len ref rows filtered Extra
4749+
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
4750+
Warnings:
4751+
Note 1003 select char(0xdf) AS `CHAR(0xDF USING ``binary``)`
4752+
EXPLAIN EXTENDED SELECT CHAR(0xDF);
4753+
id select_type table type possible_keys key key_len ref rows filtered Extra
4754+
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
4755+
Warnings:
4756+
Note 1003 select char(0xdf) AS `CHAR(0xDF)`
4757+
#
47374758
# Start of 10.1 tests
47384759
#
47394760
#
@@ -4843,6 +4864,12 @@ YQ== 61
48434864
Yq== 62
48444865
DROP TABLE t1;
48454866
#
4867+
# End of 10.1 tests
4868+
#
4869+
#
4870+
# Start of 10.3 tests
4871+
#
4872+
#
48464873
# MDEV-12685 Oracle-compatible function CHR()
48474874
#
48484875
select chr(65);
@@ -4859,12 +4886,6 @@ utf8 3 1
48594886
drop database mysqltest1;
48604887
use test;
48614888
#
4862-
# End of 10.1 tests
4863-
#
4864-
#
4865-
# Start of 10.3 tests
4866-
#
4867-
#
48684889
# MDEV-12592 Illegal mix of collations with the HEX function
48694890
#
48704891
SET NAMES utf8;

mysql-test/r/invisible_binlog.result

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
include/master-slave.inc
2+
[connection master]
3+
connection master;
4+
create table t1(a int , b int invisible);
5+
insert into t1 values(1);
6+
insert into t1(a,b) values(2,2);
7+
select a,b from t1;
8+
a b
9+
1 NULL
10+
2 2
11+
desc t1;
12+
Field Type Null Key Default Extra
13+
a int(11) YES NULL
14+
b int(11) YES NULL INVISIBLE
15+
create table t2(a int , b int invisible default 5);
16+
insert into t2 values(1);
17+
insert into t2(a,b) values(2,2);
18+
select a,b from t2;
19+
a b
20+
1 5
21+
2 2
22+
desc t2;
23+
Field Type Null Key Default Extra
24+
a int(11) YES NULL
25+
b int(11) YES 5 INVISIBLE
26+
connection slave;
27+
select * from t1;
28+
a
29+
1
30+
2
31+
select a,b from t1;
32+
a b
33+
1 NULL
34+
2 2
35+
desc t1;
36+
Field Type Null Key Default Extra
37+
a int(11) YES NULL
38+
b int(11) YES NULL INVISIBLE
39+
show create table t1;
40+
Table Create Table
41+
t1 CREATE TABLE `t1` (
42+
`a` int(11) DEFAULT NULL,
43+
`b` int(11) INVISIBLE DEFAULT NULL
44+
) ENGINE=MyISAM DEFAULT CHARSET=latin1
45+
select * from t2;
46+
a
47+
1
48+
2
49+
select a,b from t2;
50+
a b
51+
1 5
52+
2 2
53+
desc t2;
54+
Field Type Null Key Default Extra
55+
a int(11) YES NULL
56+
b int(11) YES 5 INVISIBLE
57+
show create table t2;
58+
Table Create Table
59+
t2 CREATE TABLE `t2` (
60+
`a` int(11) DEFAULT NULL,
61+
`b` int(11) INVISIBLE DEFAULT 5
62+
) ENGINE=MyISAM DEFAULT CHARSET=latin1
63+
connection master;
64+
drop table t1,t2;
65+
include/rpl_end.inc

0 commit comments

Comments
 (0)