1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-04-21 19:45:56 +03:00

61 Commits

Author SHA1 Message Date
Sergei Golubchik
fa8631c6cb match the rename in the handler rows_changed->rows_stats.updated 2024-08-06 18:18:37 +04:00
drrtuy
26f5f8fe5c
fix(plugin): this is to addres the original patch QA found in the original patch 2023-11-22 17:20:37 +03:00
Roman Nozdrin
6579180810 fix(plugin): MCOL-4740: This fixes update rows counter for multi-table update
For UPDATEs involving a single table, the server call to handler::direct_update_rows() is used to correctly set the count for the number of updated rows in the UPDATE statement.
However, for UPDATEs involving multi-tables, the server does not call handler::direct_update_rows(). This patch adds support to correctly report the number of updated rows to the client by setting
multi_update::updated and multi_update::found in handler::rnd_end().
2023-11-02 14:18:06 +00:00
Leonid Fedorov
3ce19abdae
Options to build with TSAN, UBSAN and skipping smoke (#2826) 2023-04-21 21:24:48 +03:00
Leonid Fedorov
2e1394149b
MCOL-5464: Fixes of bugs from ASAN warnings, part one (#2792)
* Fixes of bugs from ASAN warnings, part one

* MQC as static library, with nifty counter for global map and mutex

* Switch clang to 16

* link messageqcpp to execplan
2023-04-04 02:33:23 +03:00
Leonid Fedorov
56f2346083 Remove windows ifdefs 2023-03-02 15:59:42 +00:00
Gagan Goel
45a779f743 MDEV-25080 Implement ColumnStore-side changes for pushdown of SELECT_LEX_UNITs. 2023-02-27 06:38:31 -05:00
Gagan Goel
973e5024d8 MCOL-4957 Fix performance slowdown for processing TIMESTAMP columns.
Part 1:
 As part of MCOL-3776 to address synchronization issue while accessing
 the fTimeZone member of the Func class, mutex locks were added to the
 accessor and mutator methods. However, this slows down processing
 of TIMESTAMP columns in PrimProc significantly as all threads across
 all concurrently running queries would serialize on the mutex. This
 is because PrimProc only has a single global object for the functor
 class (class derived from Func in utils/funcexp/functor.h) for a given
 function name. To fix this problem:

   (1) We remove the fTimeZone as a member of the Func derived classes
   (hence removing the mutexes) and instead use the fOperationType
   member of the FunctionColumn class to propagate the timezone values
   down to the individual functor processing functions such as
   FunctionColumn::getStrVal(), FunctionColumn::getIntVal(), etc.

   (2) To achieve (1), a timezone member is added to the
   execplan::CalpontSystemCatalog::ColType class.

Part 2:
 Several functors in the Funcexp code call dataconvert::gmtSecToMySQLTime()
 and dataconvert::mySQLTimeToGmtSec() functions for conversion between seconds
 since unix epoch and broken-down representation. These functions in turn call
 the C library function localtime_r() which currently has a known bug of holding
 a global lock via a call to __tz_convert. This significantly reduces performance
 in multi-threaded applications where multiple threads concurrently call
 localtime_r(). More details on the bug:
   https://sourceware.org/bugzilla/show_bug.cgi?id=16145

 This bug in localtime_r() caused processing of the Functors in PrimProc to
 slowdown significantly since a query execution causes Functors code to be
 processed in a multi-threaded manner.

 As a fix, we remove the calls to localtime_r() from gmtSecToMySQLTime()
 and mySQLTimeToGmtSec() by performing the timezone-to-offset conversion
 (done in dataconvert::timeZoneToOffset()) during the execution plan
 creation in the plugin. Note that localtime_r() is only called when the
 time_zone system variable is set to "SYSTEM".

 This fix also required changing the timezone type from a std::string to
 a long across the system.
2022-02-14 14:12:27 -05:00
Leonid Fedorov
04752ec546 clang format apply 2022-01-21 16:43:49 +00:00
Gagan Goel
d91cab2ff5
MCOL-4925 Suppress the warning message when a non-cached table is (#2164)
dropped with the insert cache enabled.
2021-12-06 11:27:37 -06:00
Gagan Goel
affb2ae770
MCOL-4769 Fix cache bugs. (#2151)
* MCOL-4769 Do not replay INSERTs and LDIs on the replica nodes when
the write cache is enabled.

* MCOL-4769 If a table is created with the write cache disabled
(i.e. when columnstore_cache_inserts=OFF), make it accessible when
the cache feature is enabled (columnstore_cache_inserts=ON).
2021-11-22 14:20:50 -06:00
Denis Khalikov
c20015a7b2 MCOL-4713 Analyze table implementation. 2021-07-02 12:37:12 +03:00
Roman Nozdrin
abbe2ebbf6 Dynamic version numbering 2021-01-21 10:30:46 +00:00
Alexey Antipovsky
ede047f0fa Fix warnings on CentOS7 2020-11-17 15:03:10 +03:00
Alexey Antipovsky
83d3adf466 Fix method declarations to match the base class (-Woverloaded-virtual) 2020-11-17 15:03:10 +03:00
David Hall
78b188ada3 MCOL-4329 dev change gamma to stable 2020-10-29 12:29:10 -05:00
Gagan Goel
50a4fd9f39 MCOL-4285 For Insert...Select, pass the is_cache_insert=true
flag to ha_mcs_impl_start_bulk_insert.

An earlier commit to fix LDI under replication changed the call in
ha_mcs_cache::start_bulk_insert for a non-insert command from
parent::start_bulk_insert_from_cache to parent::start_bulk_insert.
This commit reverts that change for INSERT...SELECT operation.
2020-10-15 13:30:36 -04:00
Gagan Goel
0ee64db3e5 Disable cache_handler for system catalog tables. 2020-10-01 17:00:18 -04:00
Gagan Goel
a1ea633a19 MCOL-4282 Follow up version 2.
Mutate the optimizer flags for prepared statements in:
  1. ha_mcs::open
  2. ha_mcs::discover_check_version

This is done to ensure the optimizer flags are disabled before
JOIN::prepare() is called during "PREPARE stmt FROM ...".
2020-09-25 13:49:52 -04:00
Gagan Goel
234c2eb740 MCOL-4285 In replication, perform LDI on the slave directly
into the columnstore table, and not into the cache.

LDI performed on a master, comes in as a SQLCOM_END sql_command
on the slave, when binlog_format != STATEMENT. If the cache already
had some records, we were earlier flushing the cache for the LDI
on the slave. This patch detects whether we are in the slave
thread or not, if so, then we don't do a cache flush if
sql_command = SQLCOM_END.
2020-09-16 16:34:07 -04:00
Alexander Barkov
7f6ad16728 MCOL-4303 UPDATE..SET using another table is not updating
The change for MCOL-4264 erroneously added the "lock_type" member
to cal_connection_info, which is shared between multiple tables.
So some tables that were opened for write erroneously identified
themselves as read only.

Moving the member to ha_mcs instead.
2020-09-11 12:26:26 +04:00
Gagan Goel
929a15ea01 Use the HAVE_PSI_INTERFACE preprocessor guard to disable code
that does not compile if -DPLUGIN_PERFSCHEMA=NO cmake option is used.
2020-08-25 22:03:28 -04:00
Gagan Goel
b3ae9cf04e Use a session variable, columnstore_cache_flush_threshold,
to allow the user to set the threshold, instead of using a
hard coded value.
2020-08-18 18:01:40 -04:00
Gagan Goel
47f2291f9f Number of cached rows can be > CACHE_FLUSH_THRESHOLD (in case of batch inserts). 2020-08-18 18:01:40 -04:00
Gagan Goel
709290cc3d Port of commit: 1ff23d0cd70d576a0f4e512ce332cff348591d36
from server/columnstore_cache.

Commit message:

Fixed bug in free locks that caused rows in cache to not be properly flushed

Fixed by doing adding external_lock(F_UNLCK) in free_locks.
I also moved unlock of cache_handler to be after changing lock type of
cached tables to ensure that no one can use cached table while this is
happening (as cache table is locked with write lock).
I also fixed a wrong mutex order bug in ha_cache::flush_insert_cache()

Other things:
- Addded share::cached_rows to track inserted rows. This is only used
  for asserts to check the number of rows in the cache.
- Fixed wrong mysql_file_chsize() in case of repair
2020-08-18 18:01:40 -04:00
Gagan Goel
4afcba9520 Do not build the cache as a separate user-visible engine.
We are creating a new read-only system variable, columnstore_cache_inserts,
to enable/disable the cache. When this variable is set at server start up,
any table created with engine=columnstore will also create the corresponding
cache table in Aria engine for performing inserts.

It is important to note that a ColumnStore table created with this
option unset should not be queried when the server is restarted with
the option set, as this will most likely result in query failures.
2020-08-18 18:01:40 -04:00
Gagan Goel
86fb66365c 1. Set 1M as the threshold on the number of records to flush the cache.
2. Set 100k as the batch size when flushing records into ColumnStore, i.e.,
a flush of 1M records will be performed in 10 batches, each being 100k.

3. For INSERT ... SELECT on the cache, use the default insertion method of cpimport.
2020-08-18 18:01:40 -04:00
Gagan Goel
f5a8d228a0 Port of commit ba731bdc6a80e88d32e7440044b548c3e3edc591
from server/columnstore_cache

Commit message:

Fixed crashed bug on simple insert

Other things:
- Added test from columnstore team
- Fixed two reported bugs from columnstore team
- Call free_locks as part of start_trans() instead of get_status()
  to ensure that we have locks both for cached table and cache table
  before we try to free any.
- Store pointers to lock->get_status and lock->update_status for the
  cached table. Was needed by ha_tina in flush_insert_cache to make
  new insert rows visible for the SELECT that caused the flush
2020-08-18 18:01:40 -04:00
Gagan Goel
4ff4e9eb89 Re-enable the ColumnStore_Cache plugin. 2020-08-18 18:01:40 -04:00
Gagan Goel
cb2ddad308 Port of commit 0463e1f722d4d32526760c923e0092a380a9e634
from server/columnstore_cache.

Commit message:

Fixed bug in cache:

- The THR_LOCK org_lock must be stored in a shared structure so that all
  instances of a table can use it. Fixed by adding a ha_cache_share object
  that keeps track of this one.
- Fixed wrong test in get_status_and_flush_cache to detect in insert command
- Fixed in get_status_and_flush_cache that we always free the insert lock
  if we don't need it.
2020-08-18 18:01:40 -04:00
Roman Nozdrin
6b3c6e33c5 MCOL-4152 Reset cond_stack with ha_mcs::reset() call 2020-07-13 13:18:57 +00:00
Patrick LeBlanc
449a1bd229 Set our maturity level to gamma. 2020-07-07 11:12:34 -04:00
Sergei Golubchik
87055f42f6 make columnstore to load in enterprise
.cnf file overwriting plugin-maturity must be lexicographically
after mariadb-enterprise.cnf

also set the maturity correctly without relying on supermodule doing it
2020-07-07 11:10:54 -04:00
Gagan Goel
d37f4722e1 Disable the ColumnStore cache plugin. 2020-06-16 14:42:35 -04:00
Roman Nozdrin
3cfbda3ad3 Disable the Columnstore_cache engine w/o reverting it. 2020-06-16 12:33:20 +00:00
Gagan Goel
1a5c6910da Make changes based on feedback to PR #1254 for the cache. 2020-06-08 14:11:30 -04:00
Gagan Goel
1216f9fc70 For INSERT ... SELECT, don't use the is_cache_insert flag
when starting bulk insert. This will invoke cpimport for
the query instead of batch inserts mode. This is intentional
as batch inserts currently have an edge case mentioned in
MCOL-4037 that needs to be fixed.
2020-06-04 12:29:37 -04:00
Gagan Goel
dd9372c4e8 Fix INSERT ... SELECT on self.
For queries of the form:
  insert into cache1 select * from cache1;
We had a crash in the second call to get_status_and_flush_cache
due to cache->table being 0. This happened because for one of the
two ha_mcs_cache instances involved in this query, the call to
ha_mcs_cache::open was not setting cache_handler->file->lock.status_param.
The assignment to status_param was earlier protected by an if condition.
Solution is to remove that if condition in ha_mcs_cache::open.
2020-06-03 15:20:03 -04:00
Gagan Goel
c30d105c30 Use batch inserts for the cache flush. 2020-06-03 15:20:03 -04:00
Gagan Goel
e671b1d1e2 1. Some fixes to the cache interface code.
2. Set a Columnstore_cache table as a non-foreign engine table in isMCSTable().
2020-06-03 15:20:03 -04:00
Gagan Goel
43d5d511d7 Initial port of Monty's code of the ColumnStore cache. 2020-06-03 15:20:03 -04:00
Gagan Goel
01ff2652a6 MCOL-4023 Pushdown WHERE conditions for UPDATE/DELETE.
For certain queries, such as:
  update cs1 set i = 41 where i = 42 or (i is null and 42 is null);
the SELECT_LEX.where does not contain the required where conditions.
Server sends the where conditions in the call to cond_push(), so
we are storing them in a handler data member, condStack, and later
push them down to getSelectPlan() for UPDATES/DELETEs.
2020-06-01 11:03:42 -04:00
David Hall
225789e171 MCOL-3934 free memory from XML parse at shutdown 2020-04-10 13:33:16 -05:00
Gagan Goel
457ec0d483 Updates to plugin code based on recent changes in the server 10.5 branch. 2020-03-12 00:42:16 +00:00
Gagan Goel
b5373d227a MCOL-3777 Cleanup left-over values from a previously failed insert. 2020-03-05 02:26:58 +00:00
Patrick LeBlanc
03a2283bac Fixed a merge error. 2020-02-28 17:11:13 -05:00
Andrew Hutchings
9e588039d5 Merge pull request #1010 from tntnatbry/MCOL-3680
MCOL-3680 mysqld will abort if Columnstore.xml is missing.
Conflicts:
	dbcon/mysql/ha_mcs.cpp
2020-02-28 13:58:00 -05:00
Andrew Hutchings
a959aad92d MariaDB 10.5 Compatibility
Several changes have happened in MariaDB 10.5, most notably:

* Information Schema table definitions have changed
* More things use LEX_CSTRING

This fixes all the compile issues
2020-01-13 10:47:14 -08:00
Andrew Hutchings
bd592aa714
Merge pull request #984 from LinuxJedi/fix-engineid
MCOL-3673 Fix legacy db type
2019-12-20 07:44:14 +02:00
Patrick LeBlanc
b0248c665c Re-added commit 5eb050f3af30c with a one-char modification that fixes
an odd access denied error when running a select stmt.
2019-12-19 18:40:57 -05:00