Commit graph

184878 commits

Author SHA1 Message Date
Teemu Ollakka
7ae685d032 Fixed replaying bugs found with multimaster load
The replayer did not signal replaying waiters. Added
mysql_cond_broadcast() after replaying is over.

Assertion on client error failed after replay attempt failed due
to certification failure. At this point the transaction does not
go through client state, so the client error cannot be overridden.
Assign ER_LOCK_DEADLOCK to thd directly instead.

Use timed cond wait when waiting for replayers to finish and
check if the transaction has been BF aborted during the wait.
2019-02-19 17:09:19 +02:00
Jan Lindström
48554fe2db MDEV-18632: wsrep_is_wsrep_xid: Conditional jump or move depends on uninitialised value
Transaction XID is not initialized before transaction is started.
2019-02-19 16:12:00 +02:00
Igor Babaev
2a935329bc Merge branch '10.4' into bb-10.4-mdev7486 2019-02-19 05:12:56 -08:00
mkaruza
ddc983394d Fix for galera_3nodes.galera_gtid_2_cluster
Temporary disable WSREP while executing RESET MASTER. In situation when 2 nodes are both master/slave first stop slave on both and than reset master.
Enforce stricter causality check with wsrep_sync_wait.
2019-02-19 14:25:01 +02:00
mkaruza
baed6632fd Fix for galera_3nodes.galera_garbd
Check for garbd executable on different paths. If not found terminate test.
2019-02-19 14:25:01 +02:00
Igor Babaev
2e73c56120 Merge branch '10.4' into bb-10.4-mdev7486 2019-02-19 03:18:17 -08:00
Igor Babaev
8283d7d2c0 MDEV-7486: Condition pushdown from HAVING into WHERE
Optimized the code that removed multiple equalities pushed from HAVING
into WHERE. Now this removal is postponed until all multiple equalities
are eliminated in substitute_for_best_equal_field().
2019-02-19 02:45:24 -08:00
Vicențiu Ciorbaru
764429271d Implement avg_frequency unsmoothed jacknife estimator
When sampling data through ANALYZE TABLE, use the estimator to get a
better estimation of avg_frequency instead of just using the raw sampled data.
2019-02-19 12:01:21 +02:00
Vicențiu Ciorbaru
f0773b7842 Introduce analyze_sample_percentage variable
The variable controls the amount of sampling analyze table performs.

If ANALYZE table with histogram collection is too slow, one can reduce the
time taken by setting analyze_sample_percentage to a lower value of the
total number of rows.
Setting it to 0 will use a formula to compute how many rows to sample:

The number of rows collected is capped to a minimum of 50000 and
increases logarithmically with a coffecient of 4096. The coffecient is
chosen so that we expect an error of less than 3% in our estimations
according to the paper:
"Random Sampling for Histogram Construction: How much is enough?”
– Surajit Chaudhuri, Rajeev Motwani, Vivek Narasayya, ACM SIGMOD, 1998.

The drawback of sampling is that avg_frequency number is computed
imprecisely and will yeild a smaller number than the real one.
2019-02-19 12:01:21 +02:00
Vicențiu Ciorbaru
47f15ea73c Simplify column data adding method
The add method does not need to provide the row order number. It was
only used to detect if the minimum/maximum value was populated once or not, so
as to force an update for the first encounter of a value.
2019-02-19 12:01:21 +02:00
Vladislav Vaintroub
3dc6f0410b MDEV-15693 Stop packaging data directory into ZIPs
Remove CMake INSTALL command for COMPONENT DataFiles.

mysql_install_db.exe will calculate default datadir, so that it can be
called without any parameters.
2019-02-19 10:12:08 +01:00
Varun Gupta
2e6d8fcc17 MDEV-18551: New defaults for eq_range_index_dive_limit
The value for eq_range_index_dive_limit is increased to 200.
2019-02-19 14:27:24 +05:30
Varun Gupta
d6db6df995 MDEV-17903: New optimizer defaults: change optimize_join_buffer_size to be ON
optimize_join_buffer_size is switched ON.
2019-02-19 14:27:24 +05:30
Galina Shalygina
7fe1ca7ed6 Merge branch '10.4' into bb-10.4-mdev7486 2019-02-19 11:00:39 +03:00
Vladislav Vaintroub
f2f0c20044 MDEV-18439 Windows builds should have core_file=1 by default 2019-02-19 08:12:56 +01:00
Igor Babaev
4de3fd4ea2 MDEV-7486: Cosmetic changes
- Removed dead code
- Renamed a function
- Removed a parameter that not needed.
- Corrected comments
2019-02-18 22:11:25 -08:00
Teemu Ollakka
4baab8697a MDEV-18587 Don't reject DDLs if streaming replication is on
The check for streaming replication logging format in
THD::decide_logging_format() did the check also for DDLs running
in TOI mode. This caused DROP DATABASE to fail if streaming
replication was enabled.

Added check for THD wsrep execution mode and perform the check
only if the THD is in local processing mode (i.e. not TOI).

Added galera_sr_create_drop test to verify that CREATE/DROP
statements pass even if streaming replication is on.
2019-02-19 07:58:03 +02:00
Galina Shalygina
9741930490 MDEV-18636 The test case for bug mdev-16765 crashes the server
in the tree bb-10.4-mdev7486

The crash was caused because of the similar problem as in mdev-16765:
Item_cond::excl_dep_on_group_fields_for_having_pushdown() was missing.
2019-02-19 01:05:56 +03:00
Galina Shalygina
d25af33116 MDEV-18635 The test case for bug mdev-16727 crashes the server
in the tree bb-10.4-mdev7486

The crash was caused because after merge of bb-10.4-mdev7486 and
10.4 branches changes for mdev-16727 were missing.
2019-02-18 23:27:11 +03:00
Galina Shalygina
e4f1094c50 MDEV-7468 Fix for crash caused by connect.json_udf test
It was allowed to push UDF functions and that caused a crash.
To fix it it was forbidden to push UDF functions from HAVING into WHERE.
2019-02-18 20:37:23 +03:00
Marko Mäkelä
75c6fce5a3 MDEV-18627: Tighten an assertion added in MDEV-18596
innobase_instant_try(): Assert that the column length of fixed-length
columns is not changing.
2019-02-18 18:49:34 +02:00
Marko Mäkelä
2c74799d64 MDEV-18627 Wrong result after instant size change of integer
If we instantly change the size of a fixed-length field
and treat it as kind-of variable-length, then we will need
conversions between old column values and new ones.

I tried adding such a conversion to row_build(), but then I
noticed that more conversions would be needed, because
old values still appeared in a freshly rebuilt secondary index,
causing a mismatch when trying to search with the correct
longer value that was converted in my provisional fix to row_build().

So, we will revert the essential part of
MDEV-15563: Instant ROW_FORMAT=REDUNDANT column extension
(commit 22feb179ae), but not
remove any tests.
2019-02-18 18:30:01 +02:00
Teemu Ollakka
f0b65102b2 MDEV-18585 Avoid excessive Annotate_rows_log_events in binlog
Make sure that the Annotate_rows_log_events is written into
binlog only for the first fragment of the current statement.
Also avoid flusing pending rows event when calculating bytes
generated by the transaction.

Added and recorded a test which verifies that the binlog
contains only one Annotate_rows_log_event per statement
with various SR settings. Recrded mysql-wsrep-features#136
which produced different output with excession log events
suppressed.
2019-02-18 15:04:38 +02:00
Marko Mäkelä
33fd3998d2 MDEV-18596 Crash in row_mysql_store_col_in_innobase_format() on MODIFY/ADD column
innobase_build_col_map_add(): Do not assume that old_field->pack_length()
equals to field->pack_length(). Fix submitted by Aleksey Midenkov.

innobase_instant_try(): Assert that the column length of fixed-length
NOT NULL columns is only changing for ROW_FORMAT=REDUNDANT.
2019-02-18 14:22:01 +02:00
Varun Gupta
9cb55143ac Minor cleanup in the optimizer trace code.
More test coverage added for the optimizer trace.
2019-02-18 17:11:20 +05:30
Daniele Sciascia
7d2138d4a4 MTR tests for galera sync wait up to 2019-02-18 12:54:42 +02:00
Sergei Petrunia
3f154943db MDEV-18608: Defaults for 10.4: histogram size should be set
Followup: update test results
2019-02-18 13:37:57 +03:00
Sergei Petrunia
15a77a1a2c MDEV-18608: Defaults for 10.4: histogram size should be set
Change the defaults:

-histogram_size=0
+histogram_size=254

-histogram_type=SINGLE_PREC_HB
+histogram_type=DOUBLE_PREC_HB

Adjust the testcases:
- Some have ignorable changes in EXPLAIN outputs and
  more counter increments due to EITS table reads.
- Testcases that meaningfully depend on the old defaults
  are changed to use the old values.
2019-02-18 13:37:57 +03:00
Marko Mäkelä
19c6a7bbd7 MDEV-15564: Fix a memory leak 2019-02-18 11:44:20 +02:00
Marko Mäkelä
a12d0d5a56 MDEV-18609 Assertion !is_string || (*af)->charset() == cf->charset failed
The Create_field::charset can contain garbage for columns
that the SQL layer does not consider as being string columns.
InnoDB considers BIT a string column for historical reasons
(and backward compatibility with old persistent InnoDB metadata),
and therefore it checked the charset.

The Field::charset() consistently is my_charset_bin for BIT,
so we can trust that one.
2019-02-18 11:44:20 +02:00
Marko Mäkelä
869ce67f59 Disable unused function 2019-02-18 11:44:20 +02:00
Marko Mäkelä
2bd7f32980 MDEV-16188: Remove redundant !this ||
Fix clang warning: 'this' pointer cannot be null in well-defined C++ code;
pointer may be assumed to always convert to true

The only caller of TABLE::best_range_rowid_filter_for_partial_join()
already seems to be assuming that s->table != NULL.
2019-02-18 11:44:20 +02:00
mkaruza
54ffc4996a MDEV-18588 Segfault during SST on joiner with bin-log, no bin-log-index
When node is JOINER and bin-log is enabled but bin-log-index is not set in configuration, we use NULL pointer which causes segfault. 
Fixed by checking for NULL pointer before using variable.
2019-02-18 11:05:40 +02:00
Galina Shalygina
7a77b221f1 MDEV-7486: Condition pushdown from HAVING into WHERE
Condition can be pushed from the HAVING clause into the WHERE clause
if it depends only on the fields that are used in the GROUP BY list
or depends on the fields that are equal to grouping fields.
Aggregate functions can't be pushed down.

How the pushdown is performed on the example:

SELECT t1.a,MAX(t1.b)
FROM t1
GROUP BY t1.a
HAVING (t1.a>2) AND (MAX(c)>12);

=>

SELECT t1.a,MAX(t1.b)
FROM t1
WHERE (t1.a>2)
GROUP BY t1.a
HAVING (MAX(c)>12);

The implementation scheme:

1. Extract the most restrictive condition cond from the HAVING clause of
   the select that depends only on the fields that are used in the GROUP BY
   list of the select (directly or indirectly through equalities)
2. Save cond as a condition that can be pushed into the WHERE clause
   of the select
3. Remove cond from the HAVING clause if it is possible

The optimization is implemented in the function
st_select_lex::pushdown_from_having_into_where().

New test file having_cond_pushdown.test is created.
2019-02-17 23:38:44 -08:00
Vladislav Vaintroub
3220227794 MDEV-18578 build aws sdk for all plugins to use 2019-02-18 07:52:13 +01:00
Teemu Ollakka
3be9982f6a MDEV-18571 Fix wsrep PS protocol crash
Calls to wsrep_after_statement() were missing on PS protocol
codepath. Added calls after mysqld_stmt_execute() and
mysqld_stmt_bulk_execute().
2019-02-18 08:26:20 +02:00
Teemu Ollakka
b4c75f685b MDEV-18480 Backwards compatibility in log_view()
Galera versions below 4.x do not generate unique sequence number
for view events. Take this into account when writing the SE checkpoint
to avoid debug assertion in InnoDB.
2019-02-18 08:26:20 +02:00
Daniele Sciascia
9b8fc089bd MDEV-18198 Fix MTR test galera_sr.galera_sr_table_contents
* Created new binlog-header file
* Fixed warning on SELECT INTO DUMPFILE
* Re-recorded the test result
2019-02-18 08:25:57 +02:00
Marko Mäkelä
790b6f5ae2 MDEV-18598: Wrong results after instant integer conversions
Field_str::is_equal(): Do not allow instant conversions between
BIT (which is stored big-endian) and integer types (which can
be stored big-endian or little-endian, depending on storage engine).

row_sel_field_store_in_mysql_format_func(): Properly extend
narrower integer and DATA_FIXBINARY values to the current format.
DATA_FIXBINARY was incorrectly padded with 0x20 instead of 0.
2019-02-17 01:05:31 +02:00
Marko Mäkelä
e9e47889c8 Merge 10.3 into 10.4 2019-02-16 12:34:41 +02:00
Marko Mäkelä
df51dc28f5 Fix tests for innodb_checksum_algorithm=strict_crc32
In tests that directly write InnoDB data file pages,
compute the innodb_checksum_algorithm=crc32 checksums,
instead of writing the 0xdeadbeef value used by
innodb_checksum_algorithm=none. In this way, these tests
will not cause failures when executing
./mtr --mysqld=--loose-innodb-checksum-algorithm=strict_crc32
2019-02-16 12:06:52 +02:00
Sergei Golubchik
28f18aa7a6 Merge branch '10.4' into bb-10.4-mdev16188 2019-02-15 20:31:58 +01:00
Igor Babaev
a44f2c3ee8 Merge branch '10.4' into bb-10.4-mdev16188 2019-02-15 07:48:18 -08:00
Alexander Barkov
62c0ac2da6 A cleanup for MDEV-13916 Enforce check constraint on JSON type
1. Renaming Type_handler_json to Type_handler_json_longtext
   There will be other JSON handlers soon, e.g. Type_handler_json_varchar.

2. Making the code more symmetric for data types:

- Adding a new virtual method
  Type_handler::Column_definition_validate_check_constraint()
- Moving JSON-specific code from sql_yacc.yy to
  Type_handler_json_longtext::Column_definition_validate_check_constraint()

3. Adding new files sql_type_json.cc and sql_type_json.h
   and moving Type_handler+JSON related code into these files.
2019-02-15 19:46:58 +04:00
Vladislav Vaintroub
568dd5293c MDEV-18592 Warning if temp-file (with "#sql-" prefix) is missing during prepare 2019-02-15 16:15:26 +01:00
Marko Mäkelä
e1af460146 MDEV-18579 Assertion !ctx->online || num_fts_index == 0
instant_alter_column_possible(): Add the other MDEV-17459 work-around
condition. The existence of fulltext indexes only prevents instant
DROP COLUMN or changing the order of columns. Other forms of instant
ALTER TABLE are no problem.

Before commit 4e7ee166a9 that merged
the MDEV-18295 fix from 10.3, the work-around of MDEV-17459 in
instant_alter_column_possible() was categorically refusing any
ALGORITHM=INSTANT if any FULLTEXT INDEX was present. After that commit,
a related condition was only present in prepare_inplace_alter_table_dict()
but not in the other callers of instant_alter_column_possible().
2019-02-15 13:56:04 +02:00
Marko Mäkelä
2b921845ac Merge 10.3 into 10.4 2019-02-15 12:30:43 +02:00
Jan Lindström
dcaabf07fd MDEV-18109: Galera 4: run galera_sr test suite
Fix some of the galera_sr suite test failures.
Remove tests that are not going to be run because required
feature is not supported.

	modified:   mysql-test/suite/galera_sr/disabled.def
	deleted:    mysql-test/suite/galera_sr/r/GCF-574.result
	modified:   mysql-test/suite/galera_sr/r/galera_sr_cc_slave.result
	modified:   mysql-test/suite/galera_sr/r/galera_sr_kill_all_norecovery.result
	modified:   mysql-test/suite/galera_sr/r/galera_sr_load_data.result
	deleted:    mysql-test/suite/galera_sr/r/galera_sr_sbr.result
	modified:   mysql-test/suite/galera_sr/r/mysql-wsrep-features#148.result
	deleted:    mysql-test/suite/galera_sr/r/mysql-wsrep-features#29.result
	deleted:    mysql-test/suite/galera_sr/t/GCF-574.test
	modified:   mysql-test/suite/galera_sr/t/galera_sr_cc_slave.test
	modified:   mysql-test/suite/galera_sr/t/galera_sr_kill_all_norecovery.cnf
	modified:   mysql-test/suite/galera_sr/t/galera_sr_kill_all_norecovery.test
	modified:   mysql-test/suite/galera_sr/t/galera_sr_load_data.test
	deleted:    mysql-test/suite/galera_sr/t/galera_sr_sbr.test
	modified:   mysql-test/suite/galera_sr/t/mysql-wsrep-features#148.test
	deleted:    mysql-test/suite/galera_sr/t/mysql-wsrep-features#29.test
2019-02-15 09:33:49 +02:00
Igor Babaev
294b8c426f Merge branch '10.4' into bb-10.4-mdev16188 2019-02-14 22:42:56 -08:00
Marko Mäkelä
e17fc72940 MDEV-15564: Fix bool/ibool type mismatch
dtype_is_string_type(), dtype_is_binary_string_type(),
dtype_is_non_binary_string_type(): Define as inline functions that
return bool, not ibool.
2019-02-15 08:15:46 +02:00