Commit graph

178583 commits

Author SHA1 Message Date
Vladislav Vaintroub
dc93ce8dea Windows : Fix truncation warnings in sql/ 2017-10-10 06:19:50 +00:00
Vladislav Vaintroub
fa7a1a57d9 Windows : small optimization in os_is_sparse_file_supported()
Use GetFileInformationByHandleEx with FileAttributeTagInfo to query whether
the file is sparse. This saves 1 syscall, as GetFileInformationByHandle()
would additionally query volume info.
2017-10-10 06:19:50 +00:00
Vladislav Vaintroub
ff2d9e125f MDEV-13941 followup.
Try to fix fragmentation (unsparse files), for pre-existing
installations.

Unsparse the innodb file, when it needs to be extended, unless compression
is used. For Win7/2008R2 unsparse  does not work (as documented in MSDN),
therefore for sparse files in older Windows, file extension will be done
via writing zeroes at the end of file.
2017-10-10 06:19:50 +00:00
Vladislav Vaintroub
fe18e6b064 MDEV-13822 mariabackup incremental prepare incorrectly sets file size.
MDEV-13310 Preparing an incremental backup twice can corrupt data
2017-10-10 06:19:50 +00:00
Vladislav Vaintroub
b731a5bcf2 Innodb : Refactor os_file_set_size() to be compatible 10.1
The last parameter to this function is now,"bool is_sparse", like in 10.1
rather than the  unused/useless "bool is_readonly", merged from MySQL 5.7

Like in 10.1, this function now supports sparse files, and efficient
platform specific mechanisms for file extension

os_file_set_size() is now consistenly used in all places where
innodb files are extended.
2017-10-10 06:19:50 +00:00
sjaakola
0b5a5258ab MW-416 DDL replication moved after acl checking
galera_events test shows a regression with the original fix for MW-416
Reason was that Events::drop_event() can be called also from inside event
execution, and there we have a speacial treatment for event, which executes
"DROP EVENT" statement, and runs TOI replication inside the event processing body.
This resulted in executing WSREP_TO_ISOLATION two times for such DROP EVENT statement.
Fix is to call WSREP_TO_ISOLATION_BEGIN only in Events::drop_event()
2017-10-10 08:37:44 +03:00
sjaakola
70c23321de MW-416
Changed return code for replicatio error to TRUE.
This is aligned with native mysql convention to return TRUE (defined to 1) or FALSE (defined to 0) from a bool function.
This is wrong, but follows the mysql conventiosn, at least...
2017-10-10 08:37:44 +03:00
sjaakola
1841ef1c54 MW-416
Moved TOI replication to happen after ACL checking for commands:
SQLCOM_CREATE_EVENT
SQLCOM_ALTER_EVENT
SQLCOM_DROP_EVENT
SQLCOM_CREATE_VIEW
SQLCOM_CREATE_TRIGGER
SQLCOM_DROP_TRIGGER
SQLCOM_INSTALL_PLUGIN
SQLCOM_UNINSTALL_PLUGIN
2017-10-10 08:37:44 +03:00
Marko Mäkelä
e1d9a23797 MDEV-14023 10.1 InnoDB tables with virtual columns cannot be accessed in 10.2
MariaDB 10.1 introduced non-indexed virtual columns for InnoDB tables.
When MySQL 5.7 introduced virtual columns in InnoDB tables, it also
introduced the table SYS_VIRTUAL that stores metadata on virtual
columns. This table does not initially exist in data files that were
imported from 10.1. So, we do not always have virtual column metadata
inside InnoDB.

dict_index_contains_col_or_prefix(): In the clustered index records,
all non-virtual columns are present and no virtual columns are present.

ha_innobase::build_template(): In the clustered index, do not
include virtual columns in the query template. The SQL layer is
supposed to compute the virtual column values when needed.
2017-10-09 15:05:17 +03:00
Marko Mäkelä
3edd007cea btr_free_root(): Relax a too strict debug assertion
When btr_create() invokes btr_free_root() after running out of space,
fseg_create() would have acquired an SX-latch on the root page, not
an X-latch. Relax the debug assertion in btr_free_root() accordingly.

(In this case, SX-latch and X-latch are equivalent. During the CREATE
operation there should be MDL_EXCLUSIVE and dict_operation_lock X-latch
preventing concurrent access to the index. Normally the purpose of the
SX-latch is to allow concurrent reads of the root page while certain
fields in the root page are updated in place.)
2017-10-09 14:08:46 +03:00
Vladislav Vaintroub
da05d0276a merge 10.1->10.2
Some innobase/xtrabackup changes around  from 10.1 are null merged
, in partucular using os_set_file_size to extend tablespaces in server
or mariabackup.
They require non-trivial amount of additional  work in 10.2, due to
innobase differences between 10.1 and 10.2
2017-10-07 17:43:26 +00:00
Alexey Botchkov
ea4e8bab32 MDEV-12705 10.1.18-MariaDB-1~jessie - mysqld got signal 11.
Space for the next operation wasn't reserved in
        Item_func_spatial_relate::val_str()
2017-10-07 14:24:49 +04:00
Vladislav Vaintroub
01e656a685 Merge branch 'bb-10.1-wlad' into 10.1 2017-10-07 08:46:37 +00:00
Vladislav Vaintroub
bb3f4fbb59 MDEV-13310 Preparing an incremental backup twice can corrupt data
Remove .delta file after it was successfully applied
2017-10-07 08:30:20 +00:00
Vladislav Vaintroub
8d1fb47e1d MDEV-13798 - fix incorrect alignment of the buffer in incremental backup
This incorrect alignment can later lead to memcpy over buffer boundaries,
and to a crash.
2017-10-07 08:30:20 +00:00
Vladislav Vaintroub
0f8295d7d5 MDEV-13822 mariabackup incremental prepare incorrectly sets file size.
Fix incremental prepare to change file size while applying
delta file, if delta file contains page 0 with the new size.
2017-10-07 08:30:20 +00:00
Vladislav Vaintroub
420798a81a Refactor os_file_set_size to extend already existing files.
Change fil_space_extend_must_retry() to use this function.
2017-10-07 08:30:20 +00:00
Marko Mäkelä
f9b50c0657 MDEV-13512 buf_flush_update_zip_checksum() corrupts SPATIAL INDEX in ROW_FORMAT=COMPRESSED tables
In MariaDB Server 10.1, this problem manifests itself only as
a debug assertion failure in page_zip_decompress() when an insert
requires a page to be decompressed.

In MariaDB 10.1, the encryption of InnoDB data files repurposes the
previously unused field FILE_FLUSH_LSN for an encryption key version.
This field was only used in the first page of each file of the system
tablespace. For ROW_FORMAT=COMPRESSED tables, the field was always
written as 0 until encryption was implemented.

There is no bug in the encryption, because the buffer pool blocks will
not be written to files. Instead, copies of the blocks will be encrypted.
In these encrypted copies, the key version field will be updated before
the buffer is written to the file. The field in the buffer pool is
basically garbage that does not really matter.

Already in MariaDB 10.0, the memset() calls to reset this unused field
in buf_flush_update_zip_checksum() and buf_flush_write_block_low()
are unnecessary, because fsp_init_file_page_low() would guarantee that
the field is always 0 in the buffer pool (unless 10.1 encryption is
used).

Removing the unnecessary memset() calls makes page_zip_decompress()
happy and will prevent a SPATIAL INDEX corruption bug in
MariaDB Server 10.2. In MySQL 5.7.5, as part of WL#6968, the same
field was repurposed for an R-tree split sequence number (SSN) and
these memset() were removed. (Because of the repurposing, MariaDB
encryption is not available for tables that contain SPATIAL INDEX.)
2017-10-06 17:51:29 +03:00
Alexander Barkov
a659291e85 MDEV-11586 UNION of FLOAT type results in erroneous precision
Fixing the asymmetry in the array field_types_merge_rules[][]
which caused data loss when mixing FLOAT + BIGINT in UNIONs
or hybrid functions:

1. FLOAT  + INT    = DOUBLE
2. FLOAT  + BIGINT = FLOAT
3. INT    + FLOAT  = DOUBLE
4. BIGINT + FLOAT  = DOUBLE

Now FLOAT + BIGINT (as in #2) also produces DOUBLE, like the cases #1,#3,#4 do.
2017-10-06 13:29:29 +04:00
Alexey Botchkov
3557de68d1 MDEV-12312 JSON_CONTAINS_PATH does not detect invalid path and returns
TRUE.

        Let's make empty brackets to be the syntax error in the JSON
        paths.
2017-10-06 10:01:35 +04:00
Alexey Botchkov
a3ba8c3660 MDEV-13703 Illegal mix of collations for operation 'json_object' on
using JSON_UNQUOTE as an argument.

        The coercibility and repertoire should be set properly for the
        JSON_UNQUOTE.
2017-10-06 09:28:33 +04:00
Marko Mäkelä
41e581b30b ha_innobase::open(): Simplify a consistency check 2017-10-06 06:52:30 +03:00
Alexey Botchkov
f1a20ec396 MDEV-12311 Insufficient check for argument validity in JSON functions.
Check validity to the end of the JSON in the json_length
        function.
2017-10-05 23:46:25 +04:00
Alexey Botchkov
1f6ada8da8 MDEV-13306 JSON_CONTAINS returns wrong value.
The 'value' state should be saved to be compared against the
        next array item.
2017-10-05 23:23:39 +04:00
Vladislav Vaintroub
0373e05a59 Refactor os_file_set_size() so it can be used to extend existing file,
not just for creating new files.

Use os_file_set_size() in fil_space_extend_must_retry()
2017-10-05 18:38:29 +00:00
Alexander Barkov
1cfaafafee MDEV-13242 Wrong results for queries with row constructors and information_schema 2017-10-05 13:41:16 +04:00
Sergei Golubchik
08c493c62a Merge branch '10.1' into 10.2 2017-10-04 18:36:58 +02:00
Sergei Golubchik
8898c1614d cleanup: remove test include file, clarify the comment 2017-10-04 18:36:30 +02:00
Sergei Golubchik
a62ebf2590 cppcheck harmless warnings
MDEV-13953 mariadb-10.2.9/storage/innobase/row/row0import.cc:3602: possible cut'n'paste error ?
MDEV-13955 mariadb-10.2.9/sql/log_event.cc:7671: possible wrong operator ?
2017-10-04 18:36:30 +02:00
Sergei Golubchik
ebda6e958f enable MongoDB support in CONNECT 2017-10-04 18:36:30 +02:00
Marko Mäkelä
6ca35c1428 Replace a non-ASCII character in a comment 2017-10-04 08:07:41 +03:00
Vladislav Vaintroub
8d413c32dc Fix several truncation and formatting warnings. 2017-10-03 19:43:43 +00:00
Vladislav Vaintroub
4732767981 Fix Windows warnings : fix server_audit not to use my_win_open and Co
functions.

There is no reason to export IO this functionality from server, if it can
be easily implemented with CRT.

Note: for the sake of compatibility, we do not use _open() on Windows,
but open file with CreateFile, with FILE_SHARE_DELETE flag,
so it can be renamed or deleted when open. Also atomic append flag is used.
2017-10-03 19:42:16 +00:00
Vladislav Vaintroub
35a4591e12 Update C/C
Fixes some warnings.
2017-10-03 19:38:28 +00:00
Marko Mäkelä
b716231238 MDEV-13901 Assertion `!space->stop_new_ops' failed in TRUNCATE TABLE with many indexes
fil_space_extend_must_retry(): If the table is being truncated,
do not call fil_flush_low(). The operation is covered by the
truncate log. File extension during TRUNCATE only occurs
if there are many indexes on the table. With smaller innodb_page_size,
the file extension occurs already with fewer indexes on the table.
2017-10-03 20:14:18 +03:00
Sergei Petrunia
ebc2f0dad3 Avoid using HA_POS_ERROR constant when passing around values of type double.
This is error-prone and causes warnings on Windows
2017-10-03 16:23:39 +03:00
Jan Lindström
325e071c11 Merge pull request #457 from smtalk/10.2
wrep_sst_common and wsrep_sst_xtrabackup-v2 bugfixes to read sst parameters from configs
2017-10-03 15:52:27 +03:00
Marko Mäkelä
770231f355 Remove dict_disable_redo_if_temporary()
The function dict_disable_redo_if_temporary() was supposed to
disable redo logging for temporary tables. It was invoked
unnecessarily for two read-only operations:
row_undo_search_clust_to_pcur() and
dict_stats_update_transient_for_index().

When a table is not temporary and not in the system tablespace,
the tablespace should be flagged for MLOG_FILE_NAME logging.
We do not need this overhead for temporary tables. Therefore,
either mtr_t::set_log_mode() or mtr_t::set_named_space() should
be invoked.

dict_table_t::is_temporary(): Determine if a table is temporary.

dict_table_is_temporary(): Redefined as a macro wrapper for
dict_table_t::is_temporary().

dict_disable_redo_if_temporary(): Remove.
2017-10-03 11:37:38 +03:00
Marko Mäkelä
387bdf07ae Remove MYSQL_REPLACE_TRX_IN_THD
The method handlerton::replace_native_transaction_in_thd was added
into MySQL 5.7 in WL#6860, Binlogging XA-prepared transaction.
In MariaDB we do not have that change yet.
2017-10-02 12:51:01 +03:00
Marko Mäkelä
cc3057fde7 Remove dict_table_t::big_rows
The field dict_table_t::big_rows was only used for determining if
the adaptive hash index should be used when the internal InnoDB SQL
parser is used. That parser is only used for modifying the InnoDB
data dictionary, updating persistent tables, and for fulltext indexes.
2017-10-02 11:43:30 +03:00
sachin
bcda03b4fa MDEV-13950 mysqld_safe could not start Galera node after upgrade ...
This is regression caused by patch of mdev-10767.

1st problem :- mktmp is invoked without '-t' or specifing tmp directory.
2nd problem :- Since eval_log_error redirect stderr to stdout  '2>' will
return nothing. and hence $wr_logfile will be empty.

Patch Credit:- Andrii Nikitin
2017-10-02 14:07:22 +05:30
Marko Mäkelä
d6f857ddbc Remove a constant parameter commit=false 2017-10-02 11:27:53 +03:00
Marko Mäkelä
3c4cff3357 Merge 10.1 into 10.2 2017-10-02 11:16:53 +03:00
Marko Mäkelä
ac0b5a2e79 Merge 10.0 into 10.1 2017-10-02 10:45:55 +03:00
Marko Mäkelä
de4a00d4f7 Merge 5.5 into 10.0 2017-10-02 10:42:55 +03:00
Marko Mäkelä
028d253dd7 MDEV-13980 InnoDB fails to discard record lock when discarding an index page
btr_cur_pessimistic_delete(): Discard a possible record lock also in
the case when the record was the only one in the page. Failure to
do this would corrupt the record lock data structures in a partial
rollback (ROLLBACK TO SAVEPOINT or rolling back a row operation due
to some error, such as a duplicate key in a unique secondary index).
2017-10-02 10:38:35 +03:00
Marko Mäkelä
76953c0e45 Remove remaining InnoDB references to the TABLESPACE keyword
MySQL 5.7 allows the creation of InnoDB tables in a user-created
tablespace, but MariaDB does not. Remove the remaining references.

This is a non-functional change.
2017-10-02 10:03:47 +03:00
Martynas Bendorius
36ef89c999 wrep_sst_common: Setting "-c ''" for my_print_defaults just takes no values from config at all. $MY_PRINT_DEFAULTS is already set at the top of the script to have --defaults-file and --defaults-extra-file. If WSREP_SST_OPT_CONF if set to "--defaults-file=/etc/my.cnf --defaults-extra-file=/etc/my.extra.cnf", then "my_print_defaults -c "" --defaults-file=/etc/my.cnf" succeeds, but if WSREP_SST_OPT_CONF is empty - no default values are taken at all.
wsrep_sst_xtrabackup-v2: innobackupex does not support --defaults-extra-file, so ${WSREP_SST_OPT_CONF} cannot be used as an argument, it has been changed to ${WSREP_SST_OPT_DEFAULT}. Removed --defaults-file= from INNOMOVE line, because WSREP_SST_OPT_CONF already includes it (INNOBACKUP was fine, INNOMOVE - not).
2017-10-01 15:50:25 +02:00
Vladislav Vaintroub
157d130a87 Fix some conversion warnings. 2017-09-30 09:26:58 +00:00
Vladislav Vaintroub
298c56cd6a Fix "ib::fatal::~fatal': destructor never returns, potential memory leak"
warning
2017-09-29 18:15:57 +00:00