Commit graph

1590 commits

Author SHA1 Message Date
Anel
b3e06ce3fd
MDEV-28533: CONNECT engine does not quote columns involved in WHERE clause (#2263) 2022-09-26 07:53:43 +01:00
Andrew Hutchings
66cd1c33f7
MDEV-25767 Fix CONNECT ODBC WHERE condition crash (#2243)
When an UPDATE or DELETE was executed with a WHERE condition it would
crash the MariaDB server. This is because the code expects the WHERE
condition to have generated a query string but it hasn't.

Also updates the ODBC test results for current MariaDB version.
2022-09-23 14:02:41 +01:00
Andrew Hutchings
65b4a2afb8
MDEV-29426 Fix memory leak in CONNECT JSON/BSON (#2255)
* MDEV-29426 Fix memory leak in CONNECT JSON/BSON

If information is being gathered on JSON/BSON tables we leak the heap
allocated to the table class. With this fix we close and cleanup
instead, just as we do for XML tables.
2022-09-19 13:25:45 +01:00
Alexander Barkov
f1544424de MDEV-29446 Change SHOW CREATE TABLE to display default collation 2022-09-12 22:10:39 +04:00
Oleksandr Byelkin
5ac528a91f Merge remote-tracking branch 'connect/10.3' into 10.3 2022-08-02 10:23:53 +02:00
Mikhail Chalov
19af1890b5 Use memory safe snprintf() in Connect Engine
This commit replaces sprintf(buf, ...) with
snprintf(buf, sizeof(buf), ...),
specifically in the "easy" cases where buf is allocated with a size
known at compile time.

The changes make sure we are not write outside array/string bounds which
will lead to undefined behaviour. In case the code is trying to write
outside bounds - safe version of functions simply cut the string
messages so we process this gracefully.

All new code of the whole pull request, including one or several files
that are either new files or modified ones, are contributed under the BSD-new
license.  I am contributing on behalf of my employer Amazon Web Services,
Inc.

bsonudf.cpp warnings cleanup by Daniel Black

Reviewer: Daniel Black
2022-07-26 16:28:59 +10:00
Brad Smith
e55c3dc33f Fix building Connect storage engine ioapi code on OpenBSD / NetBSD / DragonFly 2022-07-25 15:06:32 +10:00
Mathew Heard
b59bc629c8 MDEV-27766: connect engine; INSERT ignore option, was ignored
Test prior to this change:

CURRENT_TEST: connect.mysql
mysqltest: At line 485: query 'INSERT IGNORE INTO t3 VALUES (5),(10),(30)' failed: ER_GET_ERRMSG (1296): Got error 122 '(1062) Duplicate entry '10' for key 'PRIMARY' [INSERT INTO `t1` (`a`) VALUES (10)]' from CONNECT

So the ignore table option wasn't getting passed to the remove server.
Closes #2008
2022-06-10 11:36:59 +10:00
Mathew Heard
c4e87cb22c MDEV-9020: Connect issues ALTER TABLE DISABLE KEYS when inserting data
If the connecting user doesn't have alter table privilege this isn't
allowed.

This patch removes enable / disable key commands that should never have been here

Closes #2002
2022-05-27 11:15:07 +10:00
Oleksandr Byelkin
9614fde1aa Merge branch '10.2' into 10.3 2022-05-03 10:59:54 +02:00
Dmitry Shulga
bc7ba7afee MDEV-27758: Errors when building Connect engine on os x 11.6.2
Added checking for support of vfork by a platform where
building being done. Set HAVE_VFORK macros in case vfork()
system call is supported. Use vfork() system call if the
macros HAVE_VFORK is set, else use fork().
2022-04-22 18:47:19 +07:00
Oleksandr Byelkin
41a163ac5c Merge branch '10.2' into 10.3 2022-01-29 15:41:05 +01:00
Sergei Golubchik
8afcda9309 ASAN/valgrind errors in connect.misc test
accessing freed memory.
Before XMLCOL::WriteColumn() Tdbp->Clist gets assigned
a nodelist in

      Clist = RowNode->SelectNodes(g, Colname, Clist);

which is RowNode->Doc->Xop->nodesetval.

In XMLCOL::WriteColumn()

        ValNode = ColNode->SelectSingleNode(g, Xname, Vxnp);

calls LIBXMLDOC::GetNodeList() again, which frees the previous
XPath object Xop and replaces it with a new one.

In this case RowNode->Doc == ColNode->Doc, so Clist->Listp
points to a freed memory now.
2022-01-29 13:42:38 +01:00
Vladislav Vaintroub
2925d0f2ee MDEV-27612 Connect : check buffer sizes, fix string format errors 2022-01-26 09:38:22 +01:00
Oleksandr Byelkin
ebc77c6d17 Merge remote-tracking branch 'connect/10.2' into 10.2 2022-01-24 17:28:34 +01:00
Olivier Bertrand
e3b9efb330 Fix incompatibility SRCDEF && MEMORY=2 for ODBC JDBC tables 2022-01-06 18:14:21 +01:00
Marko Mäkelä
289721de9a Merge 10.2 into 10.3 2021-11-29 10:33:06 +02:00
Olivier Bertrand
c819a7a71e Fix MDEV-27055 (regression of MDEV-24493) 2021-11-26 12:07:23 +01:00
Alexey Bychko
fe065f8d90 MDEV-22522 RPM packages have meaningless summary/description
this patch moves cpack summury and description for optional packages
to the appropriate CMakeLists.txt files
2021-11-23 11:29:24 +07:00
Oleksandr Byelkin
2ddea602ce Merge branch '10.2' into 10.3 2021-10-28 12:41:27 +02:00
Oleksandr Byelkin
99c893586c Merge remote-tracking branch 'connect/10.2' into 10.2 2021-10-28 10:30:36 +02:00
Vicențiu Ciorbaru
a33c1082da Fix MIPS build failure: Handle unaligned buffers in connect's TYPBLK class
On MIPS platforms (and probably others) unaligned memory access results in a
bus error. In the connect storage engine, block data for some data formats is
stored packed in memory and the TYPBLK class is used to read values from it.
Since TYPBLK does not have special handling for this packed memory, it can
quite easily result in unaligned memory accesses.

The simple way to fix this is to perform all accesses to the main buffer
through memcpy. With GCC and optimizations turned on, this call to memcpy is
completely optimized away on architectures where unaligned accesses are ok
(like x86).

Contributors:
James Cowgill <jcowgill@debian.org>
2021-10-19 16:08:51 +03:00
Olivier Bertrand
94fb9d9377 Fix MDEV-24493 2021-10-15 12:20:33 +02:00
Marko Mäkelä
4a7dfda373 Merge 10.2 into 10.3 2021-10-13 11:38:21 +03:00
Sergei Krivonos
6f32b28be5 Xcode compatibility update 2021-10-12 18:10:56 -04:00
Vladislav Vaintroub
b112c9dfaa Fix Connect build with MSVC+Ninja 2021-09-11 18:32:07 +02:00
Olivier Bertrand
46fed496b6 Fix bson crash and mongo test 2021-07-31 11:20:09 +02:00
Olivier Bertrand
1d468ee040 Fix slow processing of pretty json files by BSON tables 2021-07-30 10:45:26 +02:00
Oleksandr Byelkin
83d7e4faf6 Merge branch '10.2' into 10.3 2021-07-29 13:51:02 +02:00
Sergei Golubchik
a32373b65a Merge remote-tracking branch 'connect/10.2' into 10.2 2021-07-27 18:25:42 +02:00
Olivier Bertrand
fc98a6d54a Fix compile error for centos 74 Modified taboccur.cpp 2021-07-24 18:31:59 +02:00
Olivier Bertrand
5049887c8d Replace Mongo2.jar and Mongo3.jar with ne versions 2021-07-24 18:24:20 +02:00
Olivier Bertrand
0f18135ec8 - Make user variable prefix recognized by IsArgJson and IsJson
modified:   storage/connect/bsonudf.cpp
  modified:   storage/connect/jsonudf.cpp

- Stringify option is now a ; separated list of columns
  modified:   storage/connect/json.cpp
  modified:   storage/connect/json.h
  modified:   storage/connect/mongo.h
  modified:   storage/connect/tabbson.cpp
  modified:   storage/connect/tabcmg.cpp
  modified:   storage/connect/tabcmg.h
  modified:   storage/connect/tabjmg.cpp
  modified:   storage/connect/tabjmg.h
  modified:   storage/connect/tabjson.cpp

- PrepareColist not a static function anymore (+ typo)
  modified:   storage/connect/taboccur.cpp

- JDVC: Recognize schema (database) from a wrapper server
  modified:   storage/connect/tabjdbc.cpp
2021-07-24 16:28:57 +02:00
Marko Mäkelä
b50ea90063 Merge 10.2 into 10.3 2021-07-22 18:57:54 +03:00
Heinz Wiesinger
751ebe44fd Add feature summary at the end of cmake.
This gives a short overview over found/missing dependencies as well
as enabled/disabled features.

Initial author Heinz Wiesinger <heinz@m2mobi.com>
Additions by Vicențiu Ciorbaru <vicentiu@mariadb.org>
* Report all plugins enabled via MYSQL_ADD_PLUGIN
* Simplify code. Eliminate duplication by making use of WITH_xxx
  variable values to set feature "ON" / "OFF" state.

Reviewed by: wlad@mariadb.com (code details) serg@mariadb.com (the idea)
2021-07-21 10:22:56 +03:00
Olivier Bertrand
1c4b917f0e Fix clang compile error in value.cpp 2021-06-25 18:35:26 +02:00
Olivier Bertrand
7863554e42 Fix clang compile error in tabjson and typo in tabbson.cpp 2021-06-25 12:54:34 +02:00
Olivier Bertrand
af7a0895ac Fix clang compile error in tabjson.cpp and tabbson.cpp 2021-06-25 12:30:10 +02:00
Olivier Bertrand
6239e2a4ec Fix clang compile error in tabjson.cpp and tabbson.cpp 2021-06-25 11:38:16 +02:00
Olivier Bertrand
5c5d60b897 Fix compile error in value.h and remove unused variables in ha_connect.cc 2021-06-25 01:15:51 +02:00
Olivier Bertrand
330b32ebd9 Fix clang compile error 2021-06-24 23:56:13 +02:00
Olivier Bertrand
ed70f76cf7 - Make function strz return null when LEX_STRING is null
modified:   storage/connect/ha_connect.cc

- Use NOTE instead of WARNING in connect_assisted_discovery
  This because MariaDB raise an error when doing so
  modified:   storage/connect/ha_connect.cc
  modified:   storage/connect/tabrest.cpp

- Make MONGO tables recognize STRINGIFY and JsonAllPath
  modified:   storage/connect/mongo.cpp
  modified:   storage/connect/mongo.h
  modified:   storage/connect/tabcmg.h
  modified:   storage/connect/tabjmg.cpp
  modified:   storage/connect/tabcmg.cpp
  modified:   storage/connect/tabjmg.h

- Fix OBJECT option for Pretty != 2 JSN and BSON tables
  Accept all syntaxes  for the OBJECT option
  modified:   storage/connect/tabbson.cpp
  modified:   storage/connect/tabjson.cpp

- Use my_snprintf in function xcurl (by vuvova)
  modified:   storage/connect/tabrest.cpp

- Format dates entered as integer when formatted
  modified:   storage/connect/value.cpp
  modified:   storage/connect/value.h
2021-06-24 00:46:12 +02:00
Olivier Bertrand
5f64276fb2 - Fix MDEV-25863 : Replace __WIN__ by _WIN32
modified:   storage/connect/array.cpp
  modified:   storage/connect/blkfil.cpp
  modified:   storage/connect/block.h
  modified:   storage/connect/bson.cpp
  modified:   storage/connect/cmgoconn.cpp
  modified:   storage/connect/colblk.cpp
  modified:   storage/connect/domdoc.cpp
  modified:   storage/connect/filamap.cpp
  modified:   storage/connect/filamdbf.cpp
  modified:   storage/connect/filamfix.cpp
  modified:   storage/connect/filamgz.cpp
  modified:   storage/connect/filamtxt.cpp
  modified:   storage/connect/filamvct.cpp
  modified:   storage/connect/filamzip.cpp
  modified:   storage/connect/filter.cpp
  modified:   storage/connect/filter.h
  modified:   storage/connect/fmdlex.c
  modified:   storage/connect/global.h
  modified:   storage/connect/ha_connect.cc
  modified:   storage/connect/javaconn.cpp
  modified:   storage/connect/javaconn.h
  modified:   storage/connect/jdbconn.cpp
  modified:   storage/connect/jmgfam.cpp
  modified:   storage/connect/json.cpp
  modified:   storage/connect/macutil.cpp
  modified:   storage/connect/macutil.h
  modified:   storage/connect/maputil.cpp
  modified:   storage/connect/mycat.cc
  modified:   storage/connect/myconn.cpp
  modified:   storage/connect/myconn.h
  modified:   storage/connect/myutil.cpp
  modified:   storage/connect/odbconn.cpp
  modified:   storage/connect/odbconn.h
  modified:   storage/connect/os.h
  modified:   storage/connect/osutil.c
  modified:   storage/connect/plgdbsem.h
  modified:   storage/connect/plgdbutl.cpp
  modified:   storage/connect/plugutil.cpp
  modified:   storage/connect/rcmsg.c
  modified:   storage/connect/reldef.cpp
  modified:   storage/connect/reldef.h
  modified:   storage/connect/tabdos.cpp
  modified:   storage/connect/tabext.cpp
  modified:   storage/connect/tabfix.cpp
  modified:   storage/connect/tabfmt.cpp
  modified:   storage/connect/tabjdbc.cpp
  modified:   storage/connect/tabmac.cpp
  modified:   storage/connect/tabmac.h
  modified:   storage/connect/tabmul.cpp
  modified:   storage/connect/tabmul.h
  modified:   storage/connect/tabmysql.cpp
  modified:   storage/connect/taboccur.cpp
  modified:   storage/connect/tabodbc.cpp
  modified:   storage/connect/tabpivot.cpp
  modified:   storage/connect/tabrest.cpp
  modified:   storage/connect/tabrest.h
  modified:   storage/connect/tabsys.cpp
  modified:   storage/connect/tabtbl.cpp
  modified:   storage/connect/tabutil.cpp
  modified:   storage/connect/tabvct.cpp
  modified:   storage/connect/tabwmi.cpp
  modified:   storage/connect/tabxcl.cpp
  modified:   storage/connect/tabxml.cpp
  modified:   storage/connect/valblk.cpp
  modified:   storage/connect/value.cpp
  modified:   storage/connect/xindex.cpp
  modified:   storage/connect/xindex.h

- Fix Date errors and SSL warnings
  modified:   storage/connect/mysql-test/connect/r/jdbc.result
  modified:   storage/connect/mysql-test/connect/r/jdbc_new.result
  modified:   storage/connect/mysql-test/connect/t/jdbc.test
  modified:   storage/connect/mysql-test/connect/t/jdbc_new.test

- Update java source files
  modified:   storage/connect/Mongo2Interface.java
  modified:   storage/connect/Mongo3Interface.java
  added:      storage/connect/Client2.java
  added:      storage/connect/Client3.java
  added:      storage/connect/TestInsert2.java
  added:      storage/connect/TestInsert3.java
2021-06-08 17:44:43 +02:00
Marko Mäkelä
6e9642beb2 Merge 10.2 into 10.3 2021-06-08 14:33:07 +03:00
Anel Husakovic
7eed97ed9f MDEV-25777: JAVA_INCLUDE_PATH and JAVA_INCLUDE_PATH2 not found with out of source configuration and Ninja generator
- As solution `PLUGIN_CONNECT=NO` use early check to disable plugin:
  Solution suggested by wlad@mariadb.com
- `JNI_FOUND` is a internal result variable and should be set with
cached library and header variables (like `JAVA_INCLUDE_PATH`) defined.
  * Note: wrapper cmake/FindJNI.cmake runs first time and cmake native Find<module> returns only cached variable, like `JAVA_INCLUDE_PATH`, results variable are not cached).

Reviewed by: serg@mariadb.com
2021-06-04 10:52:18 +02:00
Marko Mäkelä
950a220060 Merge 10.2 into 10.3 2021-06-01 08:40:59 +03:00
Sergei Golubchik
d06205ba37 CONNECT: use my_snprintf 2021-05-27 17:36:32 +02:00
Olivier Bertrand
be7e41db96 - Mongo defined columns
modified:   storage/connect/cmgoconn.cpp
    modified:   storage/connect/cmgoconn.h

- Change default array LIMIT from 10 to 50
    modified:   storage/connect/ha_connect.cc
    modified:   storage/connect/tabbson.cpp
    modified:   storage/connect/tabjson.cpp
    modified:   storage/connect/tabxml.cpp
2021-05-24 16:56:12 +02:00
Marko Mäkelä
1864a8ea93 Merge 10.2 into 10.3 2021-05-24 09:38:49 +03:00
Sergei Golubchik
d7321893d8 CONNECT: move jar files to /usr/share and include them in DEBs 2021-05-22 21:56:51 +02:00