Home - Waterfall Grid T-Grid Console Builders Recent Builds Buildslaves Changesources - JSON API - About

Console View


Categories: connectors experimental galera main
Legend:   Passed Failed Warnings Failed Again Running Exception Offline No data

connectors experimental galera main
Rucha Deodhar
MDEV-41765: Assertion m_sp == m_thd->spcont->m_sp failed in
Item_splocal::this_item / SIGSEGV in Item_splocal::get_rcontext on
SIGNAL ... SET MESSAGE_TEXT = NEW in trigger

Analysis
When using Item_trigger_row in a null-checking or scalar string context
it resulted in fall back on Item_splocal functions, causing a crash or
improper evaluation.

Fix
Implemented Item_trigger_row::is_null() to correctly evaluate nullness
across constituent fields following standard row semantics.
Added Item_trigger_row::val_str() to delegate to the underlying field
when cols() == 1 or throw an ER_OPERAND_COLUMNS error for
multi-column rows.
sjaakola
MDEV-42383 sporadic hangs with galera_sr.mysql-wsrep#215 test

The test pauses the only node_1 applier at sync.wsrep_apply_cb while
it applies the node_2 writeset, and expects the conflicting node_1
fragment to fail certification. At the same time, Galera delivers
a COMMIT_CUT action after about every 128 committed transactions.
It has only a local seqno and must pass the local monitor by an applier.
When it was delivered between the node_2 writeset and the node_1 fragment,
the paused applier could not process it, and the fragment waited in the
local monitor until wait_condition timed out.

Configuring two applier threads for node_1 fixes this deadlock, the second
applier processes the COMMIT_CUT while the first one is paused.
Vladislav Vaintroub
merge 10.11 to 11.4
Rucha Deodhar
MDEV-41831: SET NEW = (SELECT ...) in a BEFORE INSERT trigger fails with
ER_OPERAND_COLUMNS (1241) on a single-column table
Rucha Deodhar
MDEV-40130: SIGSEGV in Field_iterator_table::set_table at sql/table.h:3350

Analysis:
The if...else block in sp_head::add_instr_core() checks for existence of
items in m_cur_instr_trig_row_items. Since we also have elements in
m_cur_instr_trig_field_items, the block where we check for
m_cur_instr_trig_row_items and populate m_trg_table_row gets skipped
entirely. Additionally the missing iterate_trigger_row_and_run_func
over m_trg_table_row does not setup table and trigger values either.
This eventually causes crash while setting table for field iterator
during trigger execution. This patch also fixes the list-transfer logic in
sp_head::add_instr_core() to prevent row items from being dropped and
adds a corresponding create-time setup_field() loop in
Table_triggers_list::create_trigger() to ensure trigger row items are
properly initialized.

Fix:
Check for m_cur_instr_trig_row_items exclusively. Also added
iterate_trigger_row_and_run_func over m_trg_table_row to set up the table
and over relevant values correctly.
Vladislav Vaintroub
MDEV-42338 follow-up: fix build with OpenSSL 4.1.0 and clang

Update libmariadb to a version that treats OpenSSL headers as system
headers and keeps OPENSSL_API_COMPAT at 1.1.0 in openssl.c.

The mysql and mysqltest clients don't use anything from violite.h, which
was their only source of OpenSSL headers. Remove the include and the
OpenSSL include directory from client/CMakeLists.txt, so no OpenSSL
header is compiled in these clients as a regular include.

mysql.cc got <sys/ioctl.h> from violite.h (through my_net.h) for
window_resize(); include it directly.

Assisted-by: Claude:claude-sonnet-5-5
Rucha Deodhar
MDEV-40124: Assertion `m_sp == m_thd->spcont->m_sp' failed virtual
Item *Item_splocal::this_item(), UBSAN : member call on null pointer of
type 'Sp_rcontext_handler' in sql/item.cc

Analysis:
Comparing trigger row objects (IF NEW = OLD) calls cmp_row_type(),
which uses element_index(i). Item_trigger_row was missing its own
element_index() override, falling back to Item_splocal's version
and crashing/asserting on local context lookup.

Fix:
Override element_index(i) in Item_trigger_row to return
m_fields.elem(i) directly.
Rucha Deodhar
MDEV-41814: Assertion `argp[arg_no]->fixed()' failed in
sp_head::execute_function

Analysis:
Passing OLD or NEW trigger rows as function arguments caused an assertion
failure (arg->fixed()) because Item_trigger_row::fix_fields() could return
early. This left the trigger row item in an unfixed state without setting
the item_base_t::FIXED flag.

Fix:
Restructured fix_fields() to return result and set the base_flags as needed.
Rucha Deodhar
MDEV-42385: Wrong result for whole-row OLD in trigger on table with virtual columns

Analysis:
Evaluating whole-row OLD = (...) in a trigger on a table with virtual
columns returned NULL, alongside a CASE row-expression mismatch. Only
settable NEW/OLD columns were marked in the read set, while
sp_rcontext::set_case_expr() tried to store a row expression in a scalar
CASE holder.

Fix:
Reject row expressions in CASE with ER_OPERAND_COLUMNS. Avoid storing row
expressions in the scalar CASE expression holder.
Marko Mäkelä
Merge 10.11 into 11.4
Rucha Deodhar
MDEV-41812: Columns named old/new of other tables are resolved as the
OLD/NEW row inside trigger bodies, giving ER_TRG_NO_SUCH_ROW_IN_TRG and
ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION

Analysis:
Inside the trigger's BEGIN...END block, impossible fields are not checked
and the mechanism directly falls on checking whether it is new or old
reference.

Fix:
Check whether the fields are impossible and only then resolve the context
of new and old.
Samarth Deshpande
MDEV-21780 event_scheduler system variable's usage message doesn't mention the possible value "ORIGINAL"

ORIGINAL resets the event scheduler to the state the server was
started with, which is different from DEFAULT (always OFF). Add it
to the usage message of event_scheduler and re-record the results
that print it.
Hemant Dangi
MDEV-42446: Galera test failure on galera_sst_mariabackup_plugin_dir

Issue:
MDEV-41158 made the joiner require a per-transfer auth secret
unconditionally. This test (MDEV-42091) forges the SST wire protocol
by hand and predates that change, so the joiner now rejects its
payload with "Donor does not know my secret!" before mariadb-backup
--prepare ever runs.

Solution:
This test is about plugin_dir trust, not donor auth, so tell the
joiner to skip the secret requirement instead of forging that
unrelated protocol too, via sst-mariabackup-allow-unauthenticated-donor.
Rucha Deodhar
MDEV-41815: SIGSEGV in Item_trigger_row::cleanup on FLUSH TABLES after a
trigger runs DECLARE ROW TYPE OF cursor DEFAULT NEW
Vladislav Vaintroub
update C/C
Vladislav Vaintroub
update C/C
Rucha Deodhar
MDEV-41767: Wrong result for row comparison of trigger NEW/OLD:
NEW = OLD returns 1 after a column change, OLD = (1,2,3) returns 0

Analysis:
Multi-argument row comparisons returned incorrect results because all
column comparators evaluated the exact same column value.
Item_trigger_row::addr(i) returned the address of a single shared member
variable (m_last_item_ptr) making all columns to evaluate against
the final field.

Fix:
Added an m_item_array member to Item_trigger_row to hold unique pointers
for each field. Populated the array during populate_with_trigger_fields().
Updated addr(i) to return pointer for each column index.
Rucha Deodhar
MDEV-41825: SIGSEGV in THD::sp_fix_func_item when a ROW variable's
DEFAULT is an EXISTS subquery

Analysis:
The check blocked non-ROW_RESULT subselects with single field. This
eventually resulted in crash in absence of fields in the virtual_tmp_table.

Fix:
Disallow single-field subselect whose result type is non-row result and
throw error.
Vladislav Vaintroub
MDEV-42338 Treat system library headers as SYSTEM includes

Mark include directories for system OpenSSL and system pcre2 as SYSTEM
so that warnings from their headers are not promoted to errors under
-Werror. Bundled library headers are left as regular includes.

System zlib already gets SYSTEM treatment because ZLIB::ZLIB is an
IMPORTED target (CMake marks imported target includes as SYSTEM by
default).

Assisted-by: Claude:claude-opus-4-6
Rucha Deodhar
MDEV-41826: Crash in Table_triggers_list::mark_fields_used on INSERT after
trigger re-parse fails with unknown column
Rucha Deodhar
MDEV-41760: SIGSEGV in Field_iterator_table::set_table on re-prepare of
trigger SET NEW = (subquery) after DDL on referenced table

Analysis
Item_trigger_row items were not having proper setup and list tracking, so
they were not getting saved or restored during expression re-parsing.
So when table alteration happened the row items lost their correct table
resulting in assertion failure.

Fix
Added setup function and tracking lists for row items to properly handle
and re-bind items.
Rabari9999
MDEV-42357 Slave fails to uncompress small compressed row events

row_log_event_uncompress() rejected a compressed row event when its
column count was larger than the event length in bytes ("width >
src_len"). The two are different units: the column bitmap takes only
(width + 7) / 8 bytes, so a valid event of a wide table can be shorter
than its column count, for example a mostly-zero row of a 100-column
table compresses to about 70 bytes. The slave IO thread then stopped
with "Uncompress the compressed binlog failed" (error 1595). The check
was added by MDEV-41732. mysqlbinlog was not affected, as it passes
UINT_MAX32 as src_len.

Compare the width with the bits available in the rest of the event
instead. That rejects only widths whose bitmap cannot fit, which the
bm_size checks that follow would reject as well, and it still keeps
(width + 7) / 8 and 2*bm_size from overflowing.

Analysis and test case by the reporter of MDEV-42357.
Rucha Deodhar
Addressing review comments from Dmitry + self review
Rucha Deodhar
MDEV-41983: SIGSEGV in Item_cache_row::store on CASE NEW WHEN in a trigger

Analysis:
Running CASE NEW WHEN ... in a trigger on a single-column table crashed the
server with a SIGSEGV in Item_cache_row::store. Even with one column,
NEW is a row rather than a scalar value, while sp_rcontext::set_case_expr()
attempted to store it in a scalar CASE expression holder.

Fix:
Reject the non-scalar NEW row expression in CASE with ER_OPERAND_COLUMNS.
Prevent sp_rcontext::set_case_expr() from storing the row in a scalar CASE
holder.
Rucha Deodhar
MDEV-41827: SIGSEGV in Item_trigger_row::cleanup on condition pushdown of
row = NEW into derived table in trigger

Analysis:
During query cleanup, Query_arena::free_items() called delete_self() on
Item_trigger_row. Since trigger row items are allocated on a MEM_ROOT,
explicit heap deletion caused memory corruption and a segmentation fault.

Fix:
Override Item_trigger_row::delete_delf() to just return to prevent double
deletion.
Rucha Deodhar
MDEV-40490: SET NEW = (row subquery) in a trigger silently assigns NULL
to all columns and skips the single-row check

Analysis:
Assigning a multi-column subquery in a row trigger was resulting in NULL
values because the Item_cache objects wrapped around the columns weren't
being evaluated yet.

Fix:
Calling bring_value() on the RHS item forces the subquery to run and
populate those caches properly before we try to assign them, fixing the
silent data loss.
Rucha Deodhar
MDEV-41766: Assertion marked_for_read() failed in Field_long::val_int on
row comparison of NEW/OLD in AFTER trigger

Analysis:
Whole-row trigger comparisons (NEW = OLD) evaluate constituent fields
without registering them in the table's read bitmap. This causes a
marked_for_read() assertion crash when reading field values during
trigger execution.

Fix:
Call register_field_in_read_map() on each field to ensure proper read map
marking when fixing fields.
Vladislav Vaintroub
merge 10.11 to 11.4

# Conflicts:
# storage/connect/CMakeLists.txt
# storage/rocksdb/mysql-test/rocksdb/t/mariadb_port_fixes.test
Vladislav Vaintroub
MDEV-37996 CMake: MariaDB:: targets for bundled-or-system libraries

Stop overwriting the standard find_package() result variables (ZLIB_FOUND,
ZLIB_LIBRARIES, ZLIB_INCLUDE_DIR(S), ...), this breaks vcpkg.

Provide namespaced INTERFACE targets that point at either the bundled or
the system library and carry their include directories (and, for SSL, the
compile definitions)

  MariaDB::zlib, MariaDB::OpenSSL, MariaDB::pcre2-8, MariaDB::pcre2-posix,
  MariaDB::fmt, MariaDB::readline

Link these consistently instead of the scattered ${*_LIBRARIES} and
${*_INCLUDE_DIR(S)} variables sprinkled across the tree.

Bundled pcre2-posix depends on pcre2-8 so the static link order is correct
for consumers that link only posix.

wolfssl carries its own usage requirements (HAVE_WOLFSSL,
WOLFSSL_USER_SETTINGS); MariaDB::OpenSSL keeps only HAVE_OPENSSL.

Update libmariadb to 3.3 (47a31a98): handles MariaDB::zlib as a submodule.
Rucha Deodhar
MDEV-40127: Server hangs when setting NEW=OLD on a multi-row table

In a BEFORE trigger, SET NEW = OLD on a table with several rows could
make the server hang, because assigning one trigger row to another read
the columns through a stateful iterator that was never reset between
executions.

Analysis:
Item_trigger_row::addr(i) fetched the i-th column with a shared list
iterator (m_fields_iterator/index) to avoid O(n^2) elem(i) calls. The
iterator state survived across executions and was not rewound when
m_fields was rebuilt, so on re-execution it walked stale or looping
state. m_fields itself also kept the old fields instead of being
cleared.

Fix:
- Remove the iterator-based get_element_at_index_or_next() and make
  addr(i) return m_fields.elem(i) directly.
- Add Item_trigger_row::cleanup() that cleans up the fields and empties
  m_fields, so each execution starts from a clean state.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Rucha Deodhar
MDEV-41761: SIGSEGV in sp_head::bind_input_param when trigger passes
NEW/OLD row as OUT parameter to CALL

Analysis:
When passing Item_trigger_row trigger (NEW) to an OUT parameter,
bind_input_param called get_item_splocal(). Because it returned a valid
pointer, the engine attempted to access rcontext_handler(), which is null
for trigger rows, causing a segmentation fault.

Fix:
Overriding get_item_splocal() in Item_trigger_row to return nullptr ensures
the engine safely skips the invalid context handler lookup, preventing
the crash.
bsrikanth-mariadb
MDEV-38303: Stop scan early when aggregate HAVING cannot become true

For a query without GROUP BY, such as

  SELECT COUNT(*) FROM t1 HAVING COUNT(*) < 10

the whole table was read even after the count reached 10 and the
condition could no longer be true.

Add Item_sum::having_false_is_final(op, c), which tells whether a
HAVING condition "aggregate op constant", once false, stays false as
more rows are added. Item_sum_count implements it for COUNT(..) < c,
COUNT(..) <= c and COUNT(..) = 0. Other aggregates return false, so
they are read in full as before.

JOIN::setup_having_stop_conds() collects such AND-parts of HAVING in a
List at the end of JOIN::make_aggr_tables_info(), in the optimizer.
An error there is returned to the caller. end_send_group() checks the
conditions after each row and returns NESTED_LOOP_QUERY_LIMIT, the same
way LIMIT stops a scan, once one is false. The end-of-records step
still runs, so HAVING is checked on the final state.

Only used when it is safe:
- implicit grouping, with no temporary table, ROLLUP, window functions,
  PROCEDURE, optimized-away GROUP BY or correlated HAVING
- COUNT(DISTINCT) is excluded, as its value is known only at the end
- the comparison must be numeric. COUNT compared with a DATE is not
  monotonic, so it is not used
- the constant must be a non-NULL literal or a bound PS parameter. A
  <cache> item, such as an expression with a user variable (@v + 0) or
  a folded 5 + 5, is filled on its first read, which the shortcut would
  move to the first row. A user variable changed by a stored function
  during the scan would give a wrong result.
- a NULL result does not stop the scan

Like LIMIT, stopping early means the remaining rows are not read, so
errors and side effects from them no longer happen.

The code is in the new file sql/opt_having_shortcut.cc. Since the
decision is made at optimization time, it is also reported:
- EXPLAIN FORMAT=JSON shows "having_shortcut": true
- tabular EXPLAIN shows "Using having short-cut" in the Extra column
  of the first table
- the optimizer trace has a "having_shortcut" object with the
  stop_conditions

The plan only says the scan may stop. The tests also cover queries where
the plan shows the shortcut, but the scan is not stopped, or is stopped
late.
Vladislav Vaintroub
merge 11.4 to 11.8

# Conflicts:
# extra/CMakeLists.txt
# extra/wolfssl/CMakeLists.txt
sjaakola
MDEV-42420 Use two applier threads in tests that pause the applier

Galera periodically delivers a COMMIT_CUT action. It has only a local
seqno and must pass the local monitor in an applier thread. Tests that
paused the only applier of a node, and then waited for a local
transaction on that node to certify or reach a later sync point, could
hang until timeout when a COMMIT_CUT was ordered before the local
transaction. These hangs are sporadic because a COMMIT_CUT comes only
about every 128 transactions.

Fix the affected tests in the same way as galera_sr.mysql-wsrep#215:
set wsrep_slave_threads = 2 on the paused node for the duration of the
test, so the second applier can process the COMMIT_CUT. At the end,
restore the original value and run a DDL from the other node. The
extra applier exits only after it applies a writeset, and that DDL
brings the applier count back down before the next test.

Fixed tests:
  galera.MDEV-29512
  galera.galera_MDEV-29512
  galera.MW-292
  galera.galera_as_slave_replay
  galera.galera_ddl_fk_conflict
  galera.galera_insert_bulk
  galera.galera_savepoint_replay
  galera.galera_sequences_bf_kill
  galera.galera_sequences_bf_kill_sr
  galera.galera_slave_replay
  galera.galera_sp_bf_abort
  galera.galera_transaction_replay
  galera.mysql-wsrep-bugs-607
  galera_sr.MDEV-25717
  galera_sr.galera_sr_bf_abort

In galera.MW-292, also replace the 3 second sleep and the
TIMEDIFF(SYSDATE(), NOW()) < 2 check with two consecutive NOW(6)
reads. A stuck timestamp returns the same value in both, so the test
no longer needs to wait.

Assisted By: Claude Opus 5.5
Aleksey Midenkov
MDEV-20266 rocksdb.mariadb_port_fixes fails in BB about twice a day

The EXPLAIN of MDEV-14563 test case sporadically shows ALL instead of
range:

  -1 SIMPLE t2 range a a 32 NULL # Using where
  +1 SIMPLE t2 ALL a NULL NULL NULL # Using where

The two rows of t1 and t2 are still in the memtable when EXPLAIN runs.
ha_rocksdb::info() takes stats.records and records_in_range() takes
the range estimate from GetApproximateMemTableStats(), which counts
skiplist nodes of random height. The memtable of the default column
family also holds the data of the tests run before on the same server.
So both estimates vary between runs, and when the range estimate is
not less than stats.records, the optimizer prefers the table scan.

The fix flushes the memtable and runs ANALYZE TABLE before each
EXPLAIN, like index_merge_rocksdb.test does. Then the estimates come
from the SST file statistics. Both statements are hidden from the
result, so the result file is unchanged.