Skip to content

MDEV-40166 fix: Time functions, data reclaim scenarios and tests#5339

Merged
drrtuy merged 4 commits into
MariaDB:11.4from
drrtuy:bb-11.4-data-reclaim-time-and-tests
Jul 4, 2026
Merged

MDEV-40166 fix: Time functions, data reclaim scenarios and tests#5339
drrtuy merged 4 commits into
MariaDB:11.4from
drrtuy:bb-11.4-data-reclaim-time-and-tests

Conversation

@drrtuy

@drrtuy drrtuy commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Add MySQL-compatible time functions, storage v1.5.2, and secure run_in_duckdb()

What

Bundles several DuckDB storage-engine improvements: fills gaps in
MariaDB↔DuckDB time-function compatibility, upgrades the on-disk storage
format to unlock better compression, and hardens the run_in_duckdb() UDF.

Key changes

  • Time functions (duckdb_mysql_compat.cc, duckdb_manager.cc): 2-arg WEEK/YEARWEEK ported from MariaDB week logic, plus utc_time/utc_timestamp/utc_date, unix_timestamp, time_to_sec macros.
  • Storage format (duckdb_manager.cc): pin serialization_compatibility to v1.5.2 so new DBs use advanced column compression (e.g. DICT_FSST), shrinking file size.
  • Security (duckdb_udf.cc, ha_duckdb.cc): run_in_duckdb() now requires SUPER privilege and the new --duckdb-allow-run-in-duckdb sysvar.
  • Build: rename fiber_context.c.cpp.
  • Tests/docs: new duckdb_time_func, duckdb_time_func_unsupported, run_in_duckdb_access, space_reclaim tests + space-reclaim docs.

How to test

Run the DuckDB suite: mysql-test-run --suite=duckdb duckdb_time_func run_in_duckdb_access space_reclaim.

@drrtuy drrtuy changed the title fix: Time functions, data reclaim scenarios and tests MDEV-40166 fix: Time functions, data reclaim scenarios and tests Jul 4, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces several enhancements and compatibility fixes for the DuckDB storage engine integration. Key changes include adding access control to the run_in_duckdb() function (requiring the SUPER privilege and a new global system variable duckdb_allow_run_in_duckdb), pinning the default storage format version to v1.5.2 to leverage modern column compression, and implementing several MySQL-compatible date/time function overloads (WEEK, YEARWEEK, TO_DAYS, DAYOFWEEK, and WEEKDAY) to ensure consistent behavior during pushdown. Additionally, comprehensive documentation and tests for space reclamation and access control have been added. Feedback on the code changes highlights a potential bug in mc_calc_weekday where negative day numbers (e.g., for BC dates) can result in negative weekday values, leading to incorrect week calculations when cast to unsigned integers.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread storage/duckdb/runtime/duckdb_mysql_compat.cc
@drrtuy drrtuy force-pushed the bb-11.4-data-reclaim-time-and-tests branch from 0be7752 to 97d8312 Compare July 4, 2026 15:27
@drrtuy drrtuy merged commit 7a8776a into MariaDB:11.4 Jul 4, 2026
17 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant