Skip to content

Commit

Permalink
Merge bb-10.2-ext into 10.3
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-m committed Dec 6, 2017
2 parents a34b976 + ce07676 commit 976f6fb
Show file tree
Hide file tree
Showing 36 changed files with 1,060 additions and 823 deletions.
56 changes: 36 additions & 20 deletions extra/resolve_stack_dump.c
Expand Up @@ -192,7 +192,7 @@ static my_long_addr_t read_addr(char** buf)
while((c = hex_val(*p++)) != HEX_INVALID)
addr = (addr << 4) + c;

*buf = p;
*buf= p-1;
return addr;
}

Expand All @@ -203,6 +203,7 @@ static int init_sym_entry(SYM_ENTRY* se, char* buf)

if (!se->addr)
return -1;
buf++;
while (my_isspace(&my_charset_latin1,*buf++))
/* empty */;

Expand Down Expand Up @@ -281,32 +282,47 @@ static SYM_ENTRY* resolve_addr(uchar* addr, SYM_ENTRY* se)
}


/*
Resolve anything that starts with [0x or (+0x or start of line and 0x
Skip '_end' as this is an indication of a wrong symbol (stack?)
*/

static void do_resolve()
{
char buf[1024], *p;
while (fgets(buf, sizeof(buf), fp_dump))
{
/* skip bracket */
p= (p= strchr(buf, '[')) ? p+1 : buf;
/* skip space */
while (my_isspace(&my_charset_latin1,*p))
++p;

if (*p++ == '0' && *p++ == 'x')
for (p= buf ; *p ; p++)
{
SYM_ENTRY se ;
uchar* addr = (uchar*)read_addr(&p);
if (resolve_addr(addr, &se))
fprintf(fp_out, "%p %s + %d\n", addr, se.symbol,
(int) (addr - se.addr));
int found= 0;
if (p[0] == '[' && p[1] == '0' && p[2] == 'x')
found= 3;
if (p[0] == '(' && p[1] == '+' && p[2] == '0' && p[3] == 'x')
found= 4;

/* For stdin */
if (p == buf && p[0] == '0' && p[1] == 'x')
found= 2;

if (found)
{
SYM_ENTRY se ;
uchar *addr;
char *tmp= p + found;
addr= (uchar*)read_addr(&tmp);
if (resolve_addr(addr, &se) && strcmp(se.symbol, "_end"))
{
fprintf(fp_out, "%c%p %s + %d", *p, addr, se.symbol,
(int) (addr - se.addr));
p= tmp-1;
}
else
{
fputc(*p, stdout);
}
}
else
fprintf(fp_out, "%p (?)\n", addr);

}
else
{
fputs(buf, fp_out);
continue;
fputc(*p, stdout);
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions mysql-test/extra/rpl_tests/rpl_log.test
Expand Up @@ -65,6 +65,8 @@ flush logs;
# To make it predictable, we do a useless update now, but which has the
# interest of making the slave catch both rotate events.

let $skip_checkpoint_events=1;

eval create table t3 (a int)ENGINE=$engine_type;

# Sync slave and force it to start on another binary log
Expand Down
11 changes: 10 additions & 1 deletion mysql-test/include/filter_file.inc
Expand Up @@ -53,6 +53,9 @@
#
# $rpl_debug
# If set, verbose debug info is printed.
#
# $filter_script
# If set, rows matching this regexp will be filtered out

--let $include_filename= filter_file.inc
--source include/begin_include_file.inc
Expand All @@ -67,10 +70,12 @@ if ($rpl_debug)

--let _FF_PRE_SCRIPT= $pre_script
--let _FF_SCRIPT= $script
--let _FF_FILTER_SCRIPT= $filter_script
--let _FF_INPUT_FILE= $input_file
--let _FF_OUTPUT_FILE= $output_file
--let _FF_SELECT_COLUMNS= $select_columns
--let _FF_DEBUG= $rpl_debug

if (!$output_file)
{
--let _FF_OUTPUT_FILE= $input_file
Expand All @@ -79,6 +84,7 @@ perl;
my $pre_script = $ENV{'_FF_PRE_SCRIPT'};
$pre_script =~ s/DOLLAR/\$/g;
my $script = $ENV{'_FF_SCRIPT'};
my $filter_script = $ENV{'_FF_FILTER_SCRIPT'};
$script =~ s/DOLLAR/\$/g;
my $input_file = $ENV{'_FF_INPUT_FILE'};
my $output_file = $ENV{'_FF_OUTPUT_FILE'};
Expand Down Expand Up @@ -123,7 +129,10 @@ perl;
{
' . $script . '
}
$filtered_contents .= $_."\n";
if (!$filter_script || ! m/$filter_script/)
{
$filtered_contents .= $_."\n";
}
}
close FILE or die "Error closing $input_file: $!";
open FILE, "> $output_file" or die "Error opening $output_file: $!";
Expand Down
8 changes: 1 addition & 7 deletions mysql-test/include/show_binlog_events.inc
Expand Up @@ -7,7 +7,7 @@
# [--let $binlog_file= [<FILENAME> | LAST]]
# [--let $binlog_start= <POSITION> ]
# [--let $binlog_limit= 1, 3 ]
# [--let $keep_gtid_events= 1]
# [--let $skip_checkpoint_events= 1]
# --source include/show_binlog_events.inc
#
# Parameters:
Expand All @@ -26,12 +26,6 @@
# Limit for the 'LIMIT' clause of SHOW BINLOG EVENTS, i.e.:
# $binlog_limit= 3 -- print three events
# $binlog_limit= 4, 3 -- skip four events, print the three next events
#
# $keep_gtid_events
# By default, Gtid_log_event and Previous_gtid_log_event are
# filtered out, so that the output is independent of whether GTIDs
# are enabled or not. If this flag is set, events are kept but
# the actual GTID values are masked out.

--let $include_filename= show_binlog_events.inc
--source include/begin_include_file.inc
Expand Down
7 changes: 7 additions & 0 deletions mysql-test/include/show_events.inc
Expand Up @@ -104,8 +104,15 @@ let $script=
s{DOLLARmysqltest_vardir}{MYSQLTEST_VARDIR}g;
||
--let $pre_script= my DOLLARmysqltest_vardir = DOLLARENV{'MYSQLTEST_VARDIR'};

--delimiter ;

if ($skip_checkpoint_events)
{
let $filter_script=Binlog_checkpoint;
}


#--let $select_columns= 1 3 6
--let $input_file= $output_file
--source include/filter_file.inc
Expand Down
127 changes: 127 additions & 0 deletions mysql-test/suite/gcol/r/innodb_virtual_stats.result
@@ -0,0 +1,127 @@
CREATE TABLE t (
a INT,
b INT,
c INT GENERATED ALWAYS AS(a+b),
d INT GENERATED ALWAYS AS(a+b+b),
KEY idxa (a),
KEY vidxcd (c, d)
) ENGINE=INNODB STATS_PERSISTENT=1 STATS_AUTO_RECALC=1;
INSERT INTO t (a,b) VALUES (1, 2);
SELECT index_name, stat_name, stat_description
FROM mysql.innodb_index_stats
WHERE database_name = 'test' AND table_name = 't';
index_name stat_name stat_description
GEN_CLUST_INDEX n_diff_pfx01 DB_ROW_ID
GEN_CLUST_INDEX n_leaf_pages Number of leaf pages in the index
GEN_CLUST_INDEX size Number of pages in the index
idxa n_diff_pfx01 a
idxa n_diff_pfx02 a,DB_ROW_ID
idxa n_leaf_pages Number of leaf pages in the index
idxa size Number of pages in the index
vidxcd n_diff_pfx01 c
vidxcd n_diff_pfx02 c,d
vidxcd n_diff_pfx03 c,d,DB_ROW_ID
vidxcd n_leaf_pages Number of leaf pages in the index
vidxcd size Number of pages in the index
ALTER TABLE t ADD COLUMN e INT GENERATED ALWAYS AS(a+a+b), ADD INDEX idxb (b), ALGORITHM=INPLACE;
SELECT index_name, stat_name, stat_description
FROM mysql.innodb_index_stats
WHERE database_name = 'test' AND table_name = 't';
index_name stat_name stat_description
GEN_CLUST_INDEX n_diff_pfx01 DB_ROW_ID
GEN_CLUST_INDEX n_leaf_pages Number of leaf pages in the index
GEN_CLUST_INDEX size Number of pages in the index
idxa n_diff_pfx01 a
idxa n_diff_pfx02 a,DB_ROW_ID
idxa n_leaf_pages Number of leaf pages in the index
idxa size Number of pages in the index
idxb n_diff_pfx01 b
idxb n_diff_pfx02 b,DB_ROW_ID
idxb n_leaf_pages Number of leaf pages in the index
idxb size Number of pages in the index
vidxcd n_diff_pfx01 c
vidxcd n_diff_pfx02 c,d
vidxcd n_diff_pfx03 c,d,DB_ROW_ID
vidxcd n_leaf_pages Number of leaf pages in the index
vidxcd size Number of pages in the index
ALTER TABLE t DROP COLUMN c, DROP INDEX idxa, ALGORITHM=INPLACE;
SELECT index_name, stat_name, stat_description
FROM mysql.innodb_index_stats
WHERE database_name = 'test' AND table_name = 't';
index_name stat_name stat_description
GEN_CLUST_INDEX n_diff_pfx01 DB_ROW_ID
GEN_CLUST_INDEX n_leaf_pages Number of leaf pages in the index
GEN_CLUST_INDEX size Number of pages in the index
idxb n_diff_pfx01 b
idxb n_diff_pfx02 b,DB_ROW_ID
idxb n_leaf_pages Number of leaf pages in the index
idxb size Number of pages in the index
vidxcd n_diff_pfx01 d
vidxcd n_diff_pfx02 d,DB_ROW_ID
vidxcd n_leaf_pages Number of leaf pages in the index
vidxcd size Number of pages in the index
ALTER TABLE t ADD INDEX vidxe (e), ALGORITHM=INPLACE;
SELECT index_name, stat_name, stat_description
FROM mysql.innodb_index_stats
WHERE database_name = 'test' AND table_name = 't';
index_name stat_name stat_description
GEN_CLUST_INDEX n_diff_pfx01 DB_ROW_ID
GEN_CLUST_INDEX n_leaf_pages Number of leaf pages in the index
GEN_CLUST_INDEX size Number of pages in the index
idxb n_diff_pfx01 b
idxb n_diff_pfx02 b,DB_ROW_ID
idxb n_leaf_pages Number of leaf pages in the index
idxb size Number of pages in the index
vidxcd n_diff_pfx01 d
vidxcd n_diff_pfx02 d,DB_ROW_ID
vidxcd n_leaf_pages Number of leaf pages in the index
vidxcd size Number of pages in the index
vidxe n_diff_pfx01 e
vidxe n_diff_pfx02 e,DB_ROW_ID
vidxe n_leaf_pages Number of leaf pages in the index
vidxe size Number of pages in the index
ALTER TABLE t ADD COLUMN f INT GENERATED ALWAYS AS(a + a), ADD INDEX vidxf (f), ALGORITHM=INPLACE;
SELECT index_name, stat_name, stat_description
FROM mysql.innodb_index_stats
WHERE database_name = 'test' AND table_name = 't';
index_name stat_name stat_description
GEN_CLUST_INDEX n_diff_pfx01 DB_ROW_ID
GEN_CLUST_INDEX n_leaf_pages Number of leaf pages in the index
GEN_CLUST_INDEX size Number of pages in the index
idxb n_diff_pfx01 b
idxb n_diff_pfx02 b,DB_ROW_ID
idxb n_leaf_pages Number of leaf pages in the index
idxb size Number of pages in the index
vidxcd n_diff_pfx01 d
vidxcd n_diff_pfx02 d,DB_ROW_ID
vidxcd n_leaf_pages Number of leaf pages in the index
vidxcd size Number of pages in the index
vidxe n_diff_pfx01 e
vidxe n_diff_pfx02 e,DB_ROW_ID
vidxe n_leaf_pages Number of leaf pages in the index
vidxe size Number of pages in the index
vidxf n_diff_pfx01 f
vidxf n_diff_pfx02 f,DB_ROW_ID
vidxf n_leaf_pages Number of leaf pages in the index
vidxf size Number of pages in the index
ALTER TABLE t DROP INDEX vidxcd;
SELECT index_name, stat_name, stat_description
FROM mysql.innodb_index_stats
WHERE database_name = 'test' AND table_name = 't';
index_name stat_name stat_description
GEN_CLUST_INDEX n_diff_pfx01 DB_ROW_ID
GEN_CLUST_INDEX n_leaf_pages Number of leaf pages in the index
GEN_CLUST_INDEX size Number of pages in the index
idxb n_diff_pfx01 b
idxb n_diff_pfx02 b,DB_ROW_ID
idxb n_leaf_pages Number of leaf pages in the index
idxb size Number of pages in the index
vidxe n_diff_pfx01 e
vidxe n_diff_pfx02 e,DB_ROW_ID
vidxe n_leaf_pages Number of leaf pages in the index
vidxe size Number of pages in the index
vidxf n_diff_pfx01 f
vidxf n_diff_pfx02 f,DB_ROW_ID
vidxf n_leaf_pages Number of leaf pages in the index
vidxf size Number of pages in the index
DROP TABLE t;
52 changes: 52 additions & 0 deletions mysql-test/suite/gcol/t/innodb_virtual_stats.test
@@ -0,0 +1,52 @@
--source include/have_innodb.inc

#
# BUG#22469660 INNODB DOESN'T UPDATE INDEX STATS WHEN ADDING OR DROPPING VIRTUAL COLUMN
#

CREATE TABLE t (
a INT,
b INT,
c INT GENERATED ALWAYS AS(a+b),
d INT GENERATED ALWAYS AS(a+b+b),
KEY idxa (a),
KEY vidxcd (c, d)
) ENGINE=INNODB STATS_PERSISTENT=1 STATS_AUTO_RECALC=1;

INSERT INTO t (a,b) VALUES (1, 2);

SELECT index_name, stat_name, stat_description
FROM mysql.innodb_index_stats
WHERE database_name = 'test' AND table_name = 't';

ALTER TABLE t ADD COLUMN e INT GENERATED ALWAYS AS(a+a+b), ADD INDEX idxb (b), ALGORITHM=INPLACE;

SELECT index_name, stat_name, stat_description
FROM mysql.innodb_index_stats
WHERE database_name = 'test' AND table_name = 't';

ALTER TABLE t DROP COLUMN c, DROP INDEX idxa, ALGORITHM=INPLACE;

SELECT index_name, stat_name, stat_description
FROM mysql.innodb_index_stats
WHERE database_name = 'test' AND table_name = 't';

ALTER TABLE t ADD INDEX vidxe (e), ALGORITHM=INPLACE;

SELECT index_name, stat_name, stat_description
FROM mysql.innodb_index_stats
WHERE database_name = 'test' AND table_name = 't';

ALTER TABLE t ADD COLUMN f INT GENERATED ALWAYS AS(a + a), ADD INDEX vidxf (f), ALGORITHM=INPLACE;

SELECT index_name, stat_name, stat_description
FROM mysql.innodb_index_stats
WHERE database_name = 'test' AND table_name = 't';

ALTER TABLE t DROP INDEX vidxcd;

SELECT index_name, stat_name, stat_description
FROM mysql.innodb_index_stats
WHERE database_name = 'test' AND table_name = 't';

DROP TABLE t;
12 changes: 12 additions & 0 deletions mysql-test/suite/innodb/r/innodb_stats_debug.result
@@ -0,0 +1,12 @@
call mtr.add_suppression("InnoDB: Cannot save (table|index) statistics for table `test`\\.`t1`.*: Persistent statistics do not exist");
CREATE TABLE t1 (a INT, KEY(a)) ENGINE=INNODB STATS_PERSISTENT=1;
SET @save_debug= @@SESSION.debug_dbug;
SET debug_dbug= '+d,stats_index_error';
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status Operation failed
SET debug_dbug= @save_debug;
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status OK
DROP TABLE t1;
3 changes: 1 addition & 2 deletions mysql-test/suite/innodb/r/truncate_restart.result
@@ -1,6 +1,5 @@
call mtr.add_suppression("InnoDB: Cannot save table statistics for table `test`\\.`t1`: Persistent statistics do not exist");
SET GLOBAL innodb_stats_persistent= ON;
CREATE TABLE t1 (t TEXT) ENGINE=InnoDB;
CREATE TABLE t1 (t TEXT) ENGINE=InnoDB STATS_PERSISTENT=1;
connect con1,localhost,root,,test;
SET DEBUG_SYNC='ib_trunc_table_trunc_completing SIGNAL committed WAIT_FOR ever';
TRUNCATE TABLE t1;
Expand Down
13 changes: 13 additions & 0 deletions mysql-test/suite/innodb/t/innodb_stats_debug.test
@@ -0,0 +1,13 @@
--source include/have_innodb.inc
--source include/have_debug.inc

call mtr.add_suppression("InnoDB: Cannot save (table|index) statistics for table `test`\\.`t1`.*: Persistent statistics do not exist");

CREATE TABLE t1 (a INT, KEY(a)) ENGINE=INNODB STATS_PERSISTENT=1;
SET @save_debug= @@SESSION.debug_dbug;
SET debug_dbug= '+d,stats_index_error';
ANALYZE TABLE t1;
SET debug_dbug= @save_debug;
ANALYZE TABLE t1;

DROP TABLE t1;
2 changes: 1 addition & 1 deletion mysql-test/suite/innodb/t/innodb_stats_drop_locked.test
Expand Up @@ -57,5 +57,5 @@ SELECT table_name FROM mysql.innodb_index_stats
WHERE table_name='innodb_stats_drop_locked';

--disable_query_log
call mtr.add_suppression("Unable to delete statistics for table test.innodb_stats_drop_locked: Lock wait timeout. They can be deleted later using DELETE FROM mysql.innodb_index_stats WHERE database_name");
call mtr.add_suppression("Unable to delete statistics for table test\\.innodb_stats_drop_locked: Lock wait");
--enable_query_log

0 comments on commit 976f6fb

Please sign in to comment.