Update max_length field during fix_fields to ensure that the column
has the correct length during CREATE TABLE. st_collect now returns
a geometry type rather than a blob.
Creates new parent Item_sum_str for Item_func_group_concat and
Item_func_collect, migrating shared methods from each of those
latter classes to the former. Simultaneously, tighten up the
method scopes.
The commented=out tests are known to have different results on
different architectures due to floating-point tolerance calculations
being slightly different; higher tolerance answers for the same
geometries match.
The GIS function ST_Collect takes as input multiple geometries and
returns the aggregation of the distinct geometry arguments.
The resulting value type is choosen using the following policy:
- If all arguments are Point values, the result is a MultiPoint value.
- If all arguments are LineString values, the result is a
MultiLineString value.
- If all arguments are Polygon values, the result is a MultiPolygon
value.
- Otherwise, the result is a GeometryCollection value.
If there are multiple geometry arguments and those arguments are in the
same SRS, the return value is in that SRS. If those arguments are not
in the same SRS, an ER_GIS_DIFFERENT_SRIDS_AGGREGATION error occurs.
Author: StefanoPetrilli <stefanop_1999@hotmail.it>
Co-authored-by: Torje Digernes <torje.digernes@oracle.com>
Co-authored-by: Steinar H. Gunderson <steinar.gunderson@oracle.com>
The GIS function ST_Validate takes ad input a geometry and verifies that
- is compliant with the Well-Known Binary (WKB) format and Spatial
Reference System Identifier (SRID) syntax.
- is geometrically valid.
If the input is valid return it, else it returns NULL. The use case of
this function is to filter out invalid geometry data.
Author: StefanoPetrilli <stefanop_1999@hotmail.it>
Co-authored-by: Torje Digernes <torje.digernes@oracle.com>
Co-authored-by: Hans H Melby <hans.h.melby@oracle.com>
Co-authored-by: Jon Olav Hauglid <jon.hauglid@oracle.com>
Co-authored-by: Erlend Dahl <erlend.dahl@oracle.com>
Co-authored-by: Norvald H. Ryeng <norvald.ryeng@oracle.com>
Co-authored-by: David.Zhao <david.zhao@oracle.com>
Co-authored-by: Pavan <pavan.naik@oracle.com>
The GIS function ST_Simplify takes ad input a geometry and returns 1
if the argument is geometrically valid, 0 if the argument is not
geometrically valid.
Author: StefanoPetrilli <stefanop_1999@hotmail.it>
Co-authored-by: Ahmed Ibrahim <ahmed.ibr.hashim@gmail.com>
Co-authored-by: Jon Olav Hauglid <jon.hauglid@oracle.com>
Co-authored-by: Erlend Dahl <erlend.dahl@oracle.com>
Co-authored-by: Norvald H. Ryeng <norvald.ryeng@oracle.com>
Co-authored-by: Menelaos Karavelas <menelaos.karavelas@oracle.com>
Co-authored-by: David.Zhao <david.zhao@oracle.com>
Co-authored-by: Pavan <pavan.naik@oracle.com>
The GIS function ST_Simplify takes ad input a geometry and a double. It
applies the Ramer-Douglas-Peucker algorithm on the geometry and returns
the resulting geometry. The tests have been cherry-picked from the MySQL
implementation of this function to grant compatibility among the two
implementations.
Co-authored-by: David Zhao <david.zhao@oracle.com>
Co-authored-by: Pavan Naik <pavan.naik@oracle.com>
Co-authored-by: Norvald H. Ryeng <norvald.ryeng@oracle.com>
Co-authored-by: Erlend Dahl <erlend.dahl@oracle.com>
Co-authored-by: Jon Hauglid <jon.hauglid@oracle.com>
Co-authored-by: Hans H Melby <hans.h.melby@oracle.com>
Co-authored-by: Tor Didriksen <tor.didriksen@oracle.com>
The GIS function ST_Simplify takes ad input a geometry and returns 1
if the argument is geometrically valid, 0 if the argument is not
geometrically valid.
Author: StefanoPetrilli <stefanop_1999@hotmail.it>
Co-authored-by: Ahmed Ibrahim <ahmed.ibr.hashim@gmail.com>
Co-authored-by: Jon Olav Hauglid <jon.hauglid@oracle.com>
Co-authored-by: Erlend Dahl <erlend.dahl@oracle.com>
Co-authored-by: Norvald H. Ryeng <norvald.ryeng@oracle.com>
Co-authored-by: Menelaos Karavelas <menelaos.karavelas@oracle.com>
Co-authored-by: David.Zhao <david.zhao@oracle.com>
Co-authored-by: Pavan <pavan.naik@oracle.com>
The GIS function ST_PointFromGeoHash takes in input a geohash and
returns a point where the x is the longitude and the y is the latitude.
The latitude is returned as a numeric value in the interval [180, -180].
The longitude is returned as a numeric value in the interval [90, -90].
If the argument is NULL, the return value is NULL. If the argument is
invalid, an ER_GIS_INVALID_DATA is thrown.
Author: StefanoPetrilli <stefanop_1999@hotmail.it>
Co-authored-by: kevincheng2 <chengyf112@gmail.com>
Co-authored-by: Catalin Besleaga <catalin.besleaga@oracle.com>
Co-authored-by: Gleb Shchepa <gleb.shchepa@oracle.com>
Co-authored-by: Tatiana Azundris Nuernberg <tatjana.nuernberg@oracle.com>
Co-authored-by: Martin Hansson <martin.hansson@oracle.com>
Co-authored-by: Deepa Dixit <deepa.dixit@oracle.com>
Co-authored-by: Hans H Melby <hans.h.melby@oracle.com>
Co-authored-by: Jens Even Berg Blomsøy <jens.even.blomsoy@oracle.com>
Co-authored-by: Erlend Dahl <erlend.dahl@oracle.com>
Co-authored-by: Norvald H. Ryeng <norvald.ryeng@oracle.com>
Co-authored-by: BennyWang <benny.wang@oracle.com>
Co-authored-by: David.Zhao <david.zhao@oracle.com>
Co-authored-by: Erik Froseth <erik.froseth@oracle.com>
The GIS function ST_LongFromGeoHash takes in input a geohash and returns
its longitude.
The longitude is returned as a numeric value in the interval
[180, -180].
If the argument is NULL, the return value is NULL. If the argument is
invalid, an ER_GIS_INVALID_DATA is thrown.
Author: StefanoPetrilli <stefanop_1999@hotmail.it>
Co-authored-by: kevincheng2 <chengyf112@gmail.com>
Co-authored-by: Catalin Besleaga <catalin.besleaga@oracle.com>
Co-authored-by: Gleb Shchepa <gleb.shchepa@oracle.com>
Co-authored-by: Tatiana Azundris Nuernberg <tatjana.nuernberg@oracle.com>
Co-authored-by: Martin Hansson <martin.hansson@oracle.com>
Co-authored-by: Deepa Dixit <deepa.dixit@oracle.com>
Co-authored-by: Hans H Melby <hans.h.melby@oracle.com>
Co-authored-by: Jens Even Berg Blomsøy <jens.even.blomsoy@oracle.com>
Co-authored-by: Erlend Dahl <erlend.dahl@oracle.com>
Co-authored-by: Norvald H. Ryeng <norvald.ryeng@oracle.com>
Co-authored-by: BennyWang <benny.wang@oracle.com>
Co-authored-by: David.Zhao <david.zhao@oracle.com>
Co-authored-by: Erik Froseth <erik.froseth@oracle.com>
The GIS function ST_LatFromGeoHash takes in input a geohash and returns
its latitude.
The latitude is returned as a numeric value in the interval [90, -90].
If the argument is NULL, the return value is NULL. If the argument is
invalid, an ER_INCORRECT_TYPE is thrown.
Author: StefanoPetrilli <stefanop_1999@hotmail.it>
Co-authored-by: kevincheng2 <chengyf112@gmail.com>
Co-authored-by: Catalin Besleaga <catalin.besleaga@oracle.com>
Co-authored-by: Gleb Shchepa <gleb.shchepa@oracle.com>
Co-authored-by: Tatiana Azundris Nuernberg <tatjana.nuernberg@oracle.com>
Co-authored-by: Martin Hansson <martin.hansson@oracle.com>
Co-authored-by: Deepa Dixit <deepa.dixit@oracle.com>
Co-authored-by: Hans H Melby <hans.h.melby@oracle.com>
Co-authored-by: Jens Even Berg Blomsøy <jens.even.blomsoy@oracle.com>
Co-authored-by: Erlend Dahl <erlend.dahl@oracle.com>
Co-authored-by: Norvald H. Ryeng <norvald.ryeng@oracle.com>
Co-authored-by: BennyWang <benny.wang@oracle.com>
Co-authored-by: David.Zhao <david.zhao@oracle.com>
Co-authored-by: Erik Froseth <erik.froseth@oracle.com>
Returns 1 or 0 to indicate whether the minimum bounding rectangle of g1
is covered by the minimum bounding rectangle of g2. The tests have been
cherry-picked from the MySQL implementation of this function to grant
compatibility among the two implementations.
Co-authored-by: Erlend Dahl <erlend.dahl@oracle.com>
Co-authored-by: Norvald H. Ryeng <norvald.ryeng@oracle.com>
Co-authored-by: Martin Hansson <martin.hansson@oracle.com>
Co-authored-by: Erik Froseth <erik.froseth@oracle.com>
Co-authored-by: Hans H Melby <hans.h.melby@oracle.com>
Co-authored-by: Jens Even Berg Blomsøy <jens.even.blomosoy@oracle.com>
Co-authored-by: David Zhao <david.zhao@oracle.com>
Co-authored-by: BennyWang <benny.wang@oracle.com>
The function returns the geohash corresponding to the input values.
The GIS function ST_GeoHash takes as input:
(longitude, latitude, max_length), OR
(point, max_length)
The longitue parameter is a numeric value in the interval [180, -180],
the latitude is a numeric value in the interval [90, -90].
In the case of point, the x coordinate is treated as the latitude and
the y coordinate is treated as the latitude. Even in the case of a
point, the same constraints apply.
The max_length parameter is the upper limit on the resulting string
size and cannot exceed 100.
Author: StefanoPetrilli <stefanop_1999@hotmail.it>
Co-authored-by: kevincheng2 <chengyf112@gmail.com>
Co-authored-by: Catalin Besleaga <catalin.besleaga@oracle.com>
Co-authored-by: Gleb Shchepa <gleb.shchepa@oracle.com>
Co-authored-by: Tatiana Azundris Nuernberg <tatjana.nuernberg@oracle.com>
Co-authored-by: Martin Hansson <martin.hansson@oracle.com>
Co-authored-by: Deepa Dixit <deepa.dixit@oracle.com>
Co-authored-by: Hans H Melby <hans.h.melby@oracle.com>
Co-authored-by: Jens Even Berg Blomsøy <jens.even.blomsoy@oracle.com>
Co-authored-by: Erlend Dahl <erlend.dahl@oracle.com>
Co-authored-by: Norvald H. Ryeng <norvald.ryeng@oracle.com>
Co-authored-by: BennyWang <benny.wang@oracle.com>
Co-authored-by: David.Zhao <david.zhao@oracle.com>
Co-authored-by: Erik Froseth <erik.froseth@oracle.com>
This commit introduces an additional command line option to the mariadb
client.
--script-dir=<directory> will cause the `source` command to look for
files initially in CWD, then in <script-dir> if not found in CWD.
The test is killing and restarting the server very many times.
This may lead to timeouts on architectures or builds that lack
an SIMD based encryption implementation, such as IBM System Z (s390x)
or cmake -DWITH_MSAN=ON builds.
Problem - current coding standards explicitly discourages
use of int, char, short etc, and recommends fixed types instead.
This is overly pedantic. The real problem, and the only problem we have
with types concerning portability, the inappropriate use of `long` is
too easy to overlook.
Thus,un-deprecate the types that are portable, for all practical purpose
i.e int, short, long long. Warning that char might be unsigned, though,
all compilers have appropriate flags.
Yet, use strongly wording to deprecate long and ulong, those are the types
that create real portability problems.
stats_deinit(): Replaces dict_stats_deinit().
Deinitialize the statistics for persistent tables,
so that they will be reloaded or recalculated
on a subsequent ha_innobase::open().
ha_innobase::rename_table(): Invoke stats_deinit() so that the
subsequent ha_innobase::open() will reload the InnoDB persistent
statistics. That is, it will remain possible to have the InnoDB
persistent statistics reloaded by executing the following:
RENAME TABLE t TO tmp, tmp TO t;
dict_table_close(table): Replaced with table->release().
There will no longer be any logic that would attempt to ensure
that the InnoDB persistent statistics will be reloaded after
FLUSH TABLES has been executed. This also fixes the problem that
dict_table_t::stat_modified_counter would be frequently reset to 0,
whenever ha_innobase::open() is invoked after the table reference
count had dropped to 0.
dict_table_close(table, thd, mdl): Remove the parameter "dict_locked".
Do not try to invalidate the statistics.
ha_innobase::statistics_init(): Replaces dict_stats_init(table).
Reviewed by: Thirunarayanan Balathandayuthapani
innodb_stats_transient_sample_pages, innodb_stats_persistent_sample_pages:
Change the type to UNSIGNED, because the number of pages in a table
is limited to 32 bits by the InnoDB file format.
btr_get_size_and_reserved(), fseg_get_n_frag_pages(),
fseg_n_reserved_pages_low(), fseg_n_reserved_pages(): Return uint32_t.
The file format limits page numbers to 32 bits.
dict_table_t::stat: An Atomic_relaxed<uint32_t> that combines a
number of metadata fields.
innodb_copy_stat_flags(): Copy the statistics flags from
TABLE_SHARE or HA_CREATE_INFO.
dict_table_t::stats_initialized(), dict_table_t::stats_is_persistent():
Accessors to dict_table_t::stat.
Reviewed by: Thirunarayanan Balathandayuthapani
If a query has many OR-ed constructs which can use multiple indexes
(key1=1 AND key2=10) OR
(key1=2 AND key2=20) OR
(key1=3 AND key2=30) OR
...
The range optimizer would construct and then discard a lot of potential
index_merge plans. This process
1. is CPU-intensive
2. can hit the @@optimizer_max_sel_args limitation after which all
potential range or index_merge plans are discarded.
The fix is to apply a heuristic: if there is an OR clause with more than
MAX_OR_ELEMENTS_FOR_INDEX_MERGE=100 branches (hard-coded constant),
disallow construction of index_merge plans for the OR branches.
In the `check_join_cache_usage()` function there is a branching issue
where an accidental fall-through to BKA/BKAH buffers may occur, even
when the join_cache_level setting does not permit their use.
This patch corrects the condition to ensure that BKA/BKAH join caching
is only enabled when explicitly allowed by join_cache_level
Reviewer: Sergei Petrunia <sergey@mariadb.com>
* `get_master_version_and_clock()` de-duplicate label using fall-through
* `io_slave_killed()` & `check_io_slave_killed()`:
* reüse the result from the level lower
* add distinguishing docs
* `try_to_reconnect()`: extract `'` from `if`-`else`
* `handle_slave_io()`: Both `while`s have the same condition;
looks like the outer `while` can simply be an `if`.
* `connect_to_master()`:
* assume `mysql_errno()` is not 0 on connection error
* utilize 0’s falsiness in the loop
* extend docs
* `sql/sql_show.cc`: refactor SHOW ALL REPLICAS filter’s condition
* `sql/mysqld.cc`: init `master-retry-count` with `master_retry_count`
Reviewed-by: Kristian Nielsen <knielsen@knielsen-hq.org>
When the IO thread (re)connect to a primary,
no updates are available besides unique errors that cause the failure.
These new `Master_info` numbers supplement SHOW SLAVE STATUS’s (most-
recent) ‘Connecting’ state with statistics on (re)connect attempts:
* `Connects_Tried`: how many retries have been attempted so far
This was previously a local variable that only counted re-attempts;
it’s now meaningful even after the “Connecting” state concludes.
* `Master_Retry_Count` (from MDEV-25674): out of how many configured
Side-note: Some of the tests updated by this commit dump the entire
SHOW SLAVE STATUS, which might include non-deterministic entries.
Reviewed-by: Kristian Nielsen <knielsen@knielsen-hq.org>
Reviewed-by: Brandon Nesterenko <brandon.nesterenko@mariadb.com>
This new CHANGE MASTER TO field specifies the `--master-retry-count`
(global option: the number of Primary connection attempts)
for each multi-source replica; i.e, per-channel `performance_schema.`
`replication_connection_configuration.CONNECTION_RETRY_COUNT`.
`--master-retry-count` remains the default for new `CHANGE MASTER TO`s.
This new keyword and `master-info` entry
matches those of pre-‘REPLICATION SOURCE’ MySQL.
`try_to_reconnect()` wraps `safe_reconnect()` with logging, but the
latter already loops reconnection attempts up to `master_retry_count`
times with `mi->connect_retry`-msec sleeps inbetween.
This means `try_to_reconnect()` has been counting disconnects of the
replication session (since it doesn’t loop) while `safe_reconnect()`
was counting actual tries (which may be multiple per disconnect).
In practice, this outer counter’s only benefit was to override the edge
case `--master-retry-count=0` that the inner loop doesn’t cover with 1.
Writing the redo log resized will write uninitialized data. There is
a MEM_MAKE_DEFINED construct in the code to bless this however it was
correct on the initial length, but not the changed length.
The MEM_MAKE_DEFINED is moved earlier in the code where the length
contains the correct value.
Added caching of database directories that did not have a db.opt file.
This was common for older MariaDB installaiton or if a user created
a database with 'mkdir'.
Other things:
- Give a note "no db.opt file" if one uses SHOW CREATE DATABASE one
a database without a db.opt file.
This is for preparing MariaDB for catalogs.
mtr tests should in the future use MARIADB_TOPDIR or MARIADB_DATADIR
instead of '@@datadir'. This is especially true for replication tests
that access binlog files.
MARIADB_TOPDIR is the top directory where binary log and engine log files
resides.
MARIADB_DATADIR is the directory where the database/schema directories
resides.
MARIADB_TOPDIR is not depending on catalogs.
When catalogs is used MARIADB_DATADIR will point to the directory of the
current catalog. If catalogs is not used then
MARIAD_DATADIR=MARIADB_TOPDIR.
recv_sys_t::parse(): Allocate decrypt_buf also for storing==BACKUP
but limit its size to correspond to 1 byte of record payload.
Ensure that last_offset=0 for storing==BACKUP.
When parsing INIT_PAGE or FREE_PAGE, avoid an unnecessary
l.copy_if_needed() for storing!=YES.
When parsing EXTENDED in storing==BACKUP, properly invoke
l.copy_if_needed() on a large enough decrypt_buf.
When parsing WRITE, MEMMOVE, MEMSET in storing==BACKUP,
skip further validation (and potential overflow of the tiny decrypt_buf),
like we used to do before commit 46aaf328ce
(MDEV-35830).
Reviewed by: Debarun Banerjee