1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-09-13 21:21:50 +03:00
Commit Graph

1448 Commits

Author SHA1 Message Date
Daniel Black
5ba808d542 MCOL-6101: joblist library not linked against openssl libraries
Joblist uses the decrypt_password function which requires
the openssl libraries.

This should be linked explictly.
2025-07-18 12:14:39 +04:00
Leonid Fedorov
8eb7439f23 MCOL-6068: gcc15 fix 2025-07-04 15:56:05 +04:00
drrtuy
502546d8f1 fix(compilation): fix compilation with gcc 13.2.1 (#3069)
* bump-version

* fix compilation with gcc 13.2.1

---------

Co-authored-by: Leonid Fedorov <leonid.fedorov@mariadb.com>
Co-authored-by: Sergei Golubchik <serg@mariadb.com>
2024-08-29 14:27:52 +03:00
drrtuy
baae1f66a5 * fix(compilation): New warn AKA 3919c541 backport
* fix(compilation): `New warn` AKA 3919c541 backport

* chore: Bump version to 6.4.8-2
2024-04-24 14:33:13 +03:00
Sergei Petrunia
88295b01f5 Add ability to compile against MariaDB with new cost model
If MariaDB defines MARIADB_NEW_COST_MODEL, then ha_mcs::scan_time()
has a different signature.
2023-03-09 21:25:13 +00:00
Roman Nozdrin
96525d7c13 Merge pull request #2744 from mariadb-corporation/columnstore-6.4.7-1
Columnstore 6.4.7 1
2023-02-24 17:53:50 +00:00
Roman Nozdrin
b989238ff7 MCOL-5384 This commit replaces shared pointer to CSC with CSC ctor that is cleaned up leaving a scope
CSC default ctor was private b/c it must not allow to use CSC outside thread cache.
  However there are some places in the plugin code that need a standalone syscat that
  is cleaned up leaving the scope. The decision is to make the restriction mentioned
  organizational rather than syntactical.
2023-01-24 12:56:07 +00:00
Leonid Fedorov
26b641ac06 Connection resource cleaning by Karol Roslaniec 2023-01-23 18:06:03 +00:00
Roman Nozdrin
5719c835b4 MCOL-3561 This patch updates Connector code after MDEV-29988 2022-12-23 10:57:10 +00:00
Sergei Golubchik
d31b669995 fix C API includes
ColumnStore used to include server's mysql.h
but link all tools with libmariadb.so

There's no guarantee that this would work, even with workarounds
it had in dbcon/mysql/sm.cpp

Fix:
* tools (linked with libmariadb.so) *must* include libmariadb's mysql.h
* as a hack prevent service_thd_timezone.h from being loaded into tools,
  as it conflicts with libmariadb's mysql.h
* server plugin *must* include server's mysql.h
* also don't link every tool with libmariadb.so, link the helper library
  (liblibmysqlclient.so) that actually needs it, tools use this
  helper library, not libmariadb.so directly
2022-11-02 18:47:44 +01:00
Roman Nozdrin
fd9fe182d5 MCOL-5199 This patch solves the overal performance degradation introduced with a new way of char columns hashing
in aggregation code
The patch disables padding that forces hasher to calculate over the whole 2k buffer. This patch also moves hashing code
into the common place where it belongs.
2022-08-22 13:39:45 +00:00
Denis Khalikov
de1d1d4891 [MCOL-4778] Return if we have an error in push_down_init. (#2420) 2022-06-20 17:20:52 -04:00
Andrey Piskunov
eec85f1118 Welford algorithm for STD and VAR
Naive algorithm for calculating STD and VAR is subject to catastrophic
cancellation. A well-known Welford's algorithms is used instead.
2022-06-06 21:32:20 +03:00
Roman Nozdrin
54f9d8c931 Merge pull request #2393 from drrtuy/MCOL-4912-added-forgotten-functions
MCOL-4912 This patch adds some forgotten MDB functions
2022-05-30 16:00:21 +05:30
Roman Nozdrin
c01d8a1db7 MCOL-4912 This patch adds some forgotten MDB functions 2022-05-27 16:26:25 +00:00
Leonid Fedorov
78a071673f OpenSSL 3 support for Columnstore 2022-05-19 18:26:38 +03:00
benthompson15
0c2f6674a2 MCOL-5065: return values of getSystemReady/getSystemQueryReady should be > 0 (#2355) 2022-05-02 17:23:07 -05:00
Roman Nozdrin
ff7759f71e Revert "MCOL-5057 Revert "Merge pull request #2326 from drrtuy/MCOL-4912-dev6"" (#2350)
This reverts commit c6d4c2a102.

Co-authored-by: Roman Nozdrin <rnozdrin@mariadb.com>
2022-04-27 09:07:58 -05:00
David Hall
c6d4c2a102 MCOL-5057 Revert "Merge pull request #2326 from drrtuy/MCOL-4912-dev6"
This reverts commit 980ac4972f, reversing
changes made to 81e8764e49.
2022-04-19 11:32:34 -05:00
Roman Nozdrin
a5a3092202 MCOL-4912 This patch introduces Extent Map index to improve EM scaleability
EM scaleability project has two parts: phase1 and phase2.
        This is phase1 that brings EM index to speed up(from O(n) down
        to the speed of boost::unordered_map) EM lookups looking for
        <dbroot, oid, partition> tuple to turn it into LBID,
        e.g. most bulk insertion meta info operations.
        The basis is boost::shared_managed_object where EMIndex is
        stored. Whilst it is not debug-friendly it allows to put a
        nested structs into shmem. EMIndex has 3 tiers. Top down description:
        vector of dbroots, map of oids to partition vectors, partition
        vectors that have EM indices.
        Separate EM methods now queries index before they do EM run.
        EMIndex has a separate shmem file with the fixed id
        MCS-shm-00060001.
2022-03-30 14:52:02 +00:00
David.Hall
a848ea24d3 MCOL 4560a (#2302)
MCOL-4560 remove unused Columnstore.xml entries.
Also remove code that accesses those entries but does nothing with it.
2022-03-15 18:17:23 -04:00
Gagan Goel
1fc399451a 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-11 19:03:32 -05:00
Leonid Fedorov
7c808317dc clang format apply 2022-02-11 12:24:40 +00:00
David.Hall
509f005be7 Mcol 4841 dev6 Handle large joins without OOM (#2155)
* MCOL-4846 dev-6 Handle large join results
Use a loop to shrink the number of results reported per message to something manageable.

* MCOL-4841 small changes requested by review

* Add EXTRA threads to prioritythreadpool
prioritythreadpool is configured at startup with a fixed number of threads available. This is to prevent thread thrashing. Since most of the time, BPP job steps are short lived, and a rescheduling mechanism exist if no threads are available, this works to keep cpu wastage to a minimum.

However, if a query or queries consume all the threads in prioritythreadpool and then block (due to the consumer not consuming fast enough) we can run out of threads and no work will be done until some threads unblock. A new mechanism allows for EXTRA threads to be generated for the duration of the blocking action. These threads can act on new queries. When all blocking is completed, these threads will be released when idle.

* MCOL-4841 dev6 Reconcile with changes in develop-6

* MCOL-4841 Some format corrections

* MCOL-4841 dev clean up some things based on review

* MCOL-4841 dev 6 ExeMgr Crashes after large join
This commit fixes up memory accounting issues in ExeMgr

* MCOL-4841 remove LDI change
Opened MCOL-4968 to address the issue

* MCOL-4841 Add fMaxBPPSendQueue to ResourceManager
This causes the setting to be loaded at run time (requires restart to accept a change) BPPSendthread gets this in it's ctor
Also rolled back changes to TupleHashJoinStep::smallRunnerFcn() that used a local variable to count locally allocated memory, then added it into the global counter at function's end. Not counting the memory globally caused conversion to UM only join way later than it should. This resulted in MCOL-4971.

* MCOL-4841 make blockedThreads and extraThreads atomic
Also restore previous scope of locks in bppsendthread. There is some small chance the new scope could be incorrect, and the performance boost is negligible. Better safe than sorry.
2022-02-09 21:38:32 +03:00
Roman Nozdrin
345ccfb0f9 MCOL-4834 Supported compression methods docs clean-up (#2232)
Co-authored-by: Roman Nozdrin <rnozdrin@mariadb.com>
2022-02-02 12:44:18 -06:00
benthompson15
3274275070 MCOL-4946: decrypted password was getting replaced by raw value from xml config file. 2022-01-18 16:26:08 -06:00
Roman Nozdrin
501225ea8f Merge pull request #2208 from drrtuy/MCOL-4899-dev6
MCOL-4899 MCS now applies a correct collation running IN for characte…
2022-01-06 21:07:57 +03:00
Roman Nozdrin
fa31214eb1 MCOL-4899 MCS now applies a correct collation running IN for character data types 2022-01-05 11:59:11 +00:00
Gagan Goel
27785bfbb8 MCOL-4936 Disable binlog for DML statements.
DML statements executed on the primary node in a ColumnStore
cluster do not need to be written to the primary's binlog. This
is due to ColumnStore's distributed storage architecture.

With this patch, we disable writing to binlog when a DML statement
(INSERT/DELETE/UPDATE/LDI/INSERT..SELECT) is performed on a ColumnStore
table. HANDLER::external_lock() calls are used to
  1. Turn OFF the OPTION_BIN_LOG flag
  2. Turn ON the OPTION_BIN_TMP_LOG_OFF flag
in THD::variables.option_bits during a WRITE lock call.

THD::variables.option_bits is restored back to the original state
during the UNLOCK call in HANDLER::external_lock().

Further, isDMLStatement() function is added to reduce code verbosity
to check if a given statement is a DML statement.

Note that with this patch, not writing to primary's binlog means
DML replication from a ColumnStore cluster to another ColumnStore
cluster or to another foreign engine will not work.
2022-01-03 18:36:48 -05:00
Alexey Antipovsky
d9b582349d [MCOL-4944] Automatically enable stats collection
if it is enabled in the config
2021-12-21 11:23:52 +03:00
Roman Nozdrin
36352ee80e MCOL-4943 Moved SQL script call into columnstore-post-install 2021-12-18 03:53:15 +00:00
Roman Nozdrin
1ca54e8e41 MCOL-4871 Bar's patch to do proper extent elimination for short CHAR 2021-12-17 12:44:14 +00:00
Gagan Goel
1284b982f3 MCOL-4868 UPDATE on a ColumnStore table containing an IN-subquery
on a non-ColumnStore table does not work.

As part of MCOL-4617, we moved the in-to-exists predicate creation
and injection from the server into the engine. However, when query
with an IN Subquery contains a non-ColumnStore table, the server
still performs the in-to-exists predicate transformation for the
foreign engine table. This caused ColumnStore's execution plan to
contain incorrect WHERE predicates. As a fix, we call
mutate_optimizer_flags() for the WRITE lock, in addition to the READ
table lock. And in mutate_optimizer_flags(), we change the optimizer
flag from OPTIMIZER_SWITCH_IN_TO_EXISTS to OPTIMIZER_SWITCH_MATERIALIZATION.
2021-12-16 12:53:19 -05:00
Gagan Goel
ecc6c16c63 MCOL-4874 Crossengine JOIN involving a ColumnStore table and a
wide decimal column in a non-ColumnStore table throws an exception.

ROW::getSignedNullValue() method does not support wide decimal fields
yet. To fix this exception, we remove the call to this method from
CrossEngineStep::setField().
2021-12-08 16:46:53 -05:00
Gagan Goel
5e25c9d6e8 MCOL-4925 Suppress the warning message when a non-cached table is (#2163)
dropped with the insert cache enabled.
2021-12-06 11:26:05 -06:00
Roman Nozdrin
32d3a99d69 Merge pull request #2158 from denis0x0D/warnings-6
[MCOL-4849] Fix build warnings.
2021-11-26 07:47:12 +03:00
Denis Khalikov
5848ec69f7 [MCOL-4849] Fix build warnings. 2021-11-17 17:35:08 +03:00
Roman Nozdrin
aaaa7262ce MCOL-4920 Re-enables MDB to re-read Columnstore.xml if it was changed on disk (#2154)
Revert "Remove global lock from OAMCache"
This reverts commit 2aa5380d51.
2021-11-12 09:18:41 -06:00
Gagan Goel
cf8b2fcdd8 MCOL-4769 Fix cache bugs. (#2149)
* 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-10 16:57:49 -06:00
Denis Khalikov
4a8e7bf2fc [MCOL-4849] Parallelize the processing of the bytestream vector.
This patch changes the logic of the `receiveMultiPrimitiveMessages`
function in the following way:

1. We have only one aggregation thread which reads the data from Queue (which is populated
by messages from BPPs).
2. Processing of the received `bytestream vector` could be in parallel depends on the
type of `TupleBPS` operation (join, fe2, ...) and actual thread pool workload.

The motivation is to eliminate some amount of context switches.
2021-11-04 08:10:37 +03:00
Roman Nozdrin
dafb9c5dae This patch introduces support for scanning/filtering vectorized execution for numeric-based
data types TEXT, CHAR, VARCHAR, FLOAT and DOUBLE are not yet supported by vectorized path
This patch introduces an example for Google benchmarking suite to measure a perf diff
b/w legacy scan/filtering code and the templated version
2021-10-28 16:47:18 +00:00
Roman Nozdrin
7847312448 MCOL-4876 This patch enables continues buffer to be used by ColumnCommand and aligns BPP::blockData (#2119)
that in most cases was unaligned
2021-10-05 12:22:24 +03:00
Alexander Barkov
7019db6341 MCOL-4728 Query with unusual use of aggregate functions on ColumnStore table crashes MariaDB Server
After an AggreateColumn corresponding to SUM(1+1) is created,
it is pushed to the list:

    gwi.count_asterisk_list.push_back(ac)

Later, in getSelectPlan(), the expression SUM(1+1) was erroneously
treated as a constant:

  if (!hasNonSupportItem && !nonConstFunc(ifp) && !(parseInfo & AF_BIT) && tmpVec.size() == 0)
  {
     srcp.reset(buildReturnedColumn(item, gwi, gwi.fatalParseError));

This code freed the original AggregateColumn and replaced to a ConstantColumn.

But gwi.count_asterisk_list still pointer to the freed AggregateColumn().

The expression SUM(1+1) was treated as a constant because tmpVec
was empty due to a bug in this code:

                    // special handling for count(*). This should not be treated as constant.
                    if (isp->argument_count() == 1 &&
                            ( sfitempp[0]->type() == Item::CONST_ITEM &&
                                (sfitempp[0]->cmp_type() == INT_RESULT ||
                                 sfitempp[0]->cmp_type() == STRING_RESULT ||
                                 sfitempp[0]->cmp_type() == REAL_RESULT ||
                                 sfitempp[0]->cmp_type() == DECIMAL_RESULT)
                            )
                        )
                    {
                        field_vec.push_back((Item_field*)item); //dummy

Notice, it handles only aggregate functions with explicit literals
passed as an argument, while it does not handle constant expressions
such as 1+1.

Fix:

- Adding new classes ConstantColumnNull, ConstantColumnString,
  ConstantColumnNum, ConstantColumnUInt, ConstantColumnSInt,
  ConstantColumnReal, ValStrStdString, to reuse the code easier.

- Moving a part of the code from the case branch handling CONST_ITEM
  in buildReturnedColumn() into a new function
  newConstantColumnNotNullUsingValNativeNoTz(). This
  makes the code easier to read and to reuse in the future.

- Adding a new function newConstantColumnMaybeNullFromValStrNoTz().
  Removing dulplicate code from !!!four!!! places, using the new
  function instead.

- Adding a function isSupportedAggregateWithOneConstArg() to
  properly catch all constant expressions. Using the new function parse_item()
  in the code commented as "special handling for count(*)".
  Now it pushes all constant expressions to field_vec, not only
  explicit literals.

- Moving a part of the code from buildAggregateColumn()
  to a helper function processAggregateColumnConstArg().
  Using processAggregateColumnConstArg() in the CONST_ITEM
  and NULL_ITEM branches.

- Adding a new branch in buildReturnedColumn() handling FUNC_ITEM.
  If a function has constant arguments, a ConstantColumn() is
  immediately created, without going to
  buildArithmeticColumn()/buildFunctionColumn().

- Reusing isSupportedAggregateWithOneConstArg()
  and processAggregateColumnConstArg() in buildAggregateColumn().
  A new branch catches aggregate function has only one constant argument
  and immediately creates a single ConstantColumn without
  traversing to the argument sub-components.
2021-09-21 14:01:24 +04:00
Roman Nozdrin
eb78d1a604 MCOL-4809 The patch replaces legacy scanning/filtering code with a number of templates that
simplifies control flow removing needless expressions
2021-09-02 08:10:57 +00:00
Leonid Fedorov
ef09342d47 MCOL-4839: Fix clang build (#2102)
* Fix clang build

* Extern C returned to plugin_instance

Co-authored-by: Leonid Fedorov <l.fedorov@mail.corp.ru>
2021-08-23 15:58:56 -05:00
Leonid Fedorov
ea622eec93 Bugfixes from develop (#2095)
* MaxConcurrentTransactions were not cleared when config is wrong (#2093)

* Wrong concatenation in between predicate (#2092)

* We forgot to initilize longdoublenull value (#2091)

* WriteBatchFieldMariaDB m_type was wrong (#2090)

* moda returned local object pointer (#2089)

* Wrong power of 2 in esimator` (#2088)

* targetDbroot should be assined, not compared (#2087)

* obviously wrong bytesTx assignment (#2086)

* GetInterrupted returned bool instead of bool * (#2085)
2021-08-19 10:02:09 -05:00
benthompson15
f88914df28 MCOL-1356: Add convert_tz (#2096) 2021-08-19 09:59:46 -05:00
David Hall
0b17568ae2 MCOL-3741 dev6 Change IDB-xxxx error codes to MCS-xxxx 2021-08-10 12:05:33 -05:00
Gagan Goel
0c06aa1bd9 MCOL-4805 For functions in the plugin code that disable replication on the
slave threads, we now check for this condition early on in the function block.
2021-08-04 23:44:29 +00:00
David Hall
a202bda485 MCOL-4719 iterate into subquery looking for windowfunctions
When an outer query filter accesses an subquery column that contains an aggregate or a window function, certain optimizations can't be performed. We had been looking at the surface of the returned column. We now iterate into any functions or operations looking for aggregates and window functions.
2021-07-22 13:56:21 -05:00