Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 7 additions & 19 deletions .github/workflows/mariadb-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ jobs:
uses: actions/cache@v4
with:
path: |
tidesdb-lib/build
/usr/local/lib/libtidesdb*
/usr/local/include/tidesdb*
C:/tidesdb
Expand Down Expand Up @@ -149,24 +148,12 @@ jobs:
echo "CMAKE_TOOLCHAIN_FILE=$env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" >> $env:GITHUB_ENV
echo "TIDESDB_ROOT=C:/tidesdb" >> $env:GITHUB_ENV

- name: Get latest MariaDB release tag
- name: Set MariaDB version
id: mariadb-release
shell: bash
env:
GH_TOKEN: ${{ github.token }}
run: |
for i in 1 2 3; do
LATEST_TAG=$(curl -s -H "Authorization: Bearer $GH_TOKEN" https://api.github.com/repos/MariaDB/server/releases/latest | jq -r '.tag_name')
if [ -n "$LATEST_TAG" ] && [ "$LATEST_TAG" != "null" ]; then
echo "tag=${LATEST_TAG}" >> $GITHUB_OUTPUT
echo "Latest MariaDB release: ${LATEST_TAG}"
exit 0
fi
echo "Attempt $i: Failed to get tag (got: $LATEST_TAG), retrying in 5s..."
sleep 5
done
echo "Failed to get MariaDB release tag after 3 attempts, using fallback"
echo "tag=mariadb-12.2.2" >> $GITHUB_OUTPUT
echo "tag=mariadb-12.1.2" >> $GITHUB_OUTPUT
echo "MariaDB version: mariadb-12.1.2"

- name: Clone MariaDB server
shell: bash
Expand All @@ -189,6 +176,7 @@ jobs:
- name: Install TidesDB library (Ubuntu)
if: runner.os == 'Linux'
run: |
rm -rf tidesdb-lib
for i in 1 2 3; do
if git clone --depth 1 https://github.com/tidesdb/tidesdb.git tidesdb-lib; then
break
Expand All @@ -212,6 +200,7 @@ jobs:
sudo xcode-select -s /Applications/Xcode_16.4.app/Contents/Developer
export SDKROOT=$(xcrun --show-sdk-path)

rm -rf tidesdb-lib
for i in 1 2 3; do
if git clone --depth 1 https://github.com/tidesdb/tidesdb.git tidesdb-lib; then
break
Expand All @@ -232,6 +221,7 @@ jobs:
if: runner.os == 'Windows'
shell: bash
run: |
rm -rf tidesdb-lib
for i in 1 2 3; do
if git clone --depth 1 https://github.com/tidesdb/tidesdb.git tidesdb-lib; then
break
Expand Down Expand Up @@ -281,7 +271,6 @@ jobs:
-DPLUGIN_COLUMNSTORE=NO \
-DPLUGIN_CONNECT=NO \
-DPLUGIN_OQGRAPH=NO \
-DPLUGIN_TOKUDB=NO \
-DPLUGIN_ARCHIVE=NO \
-DWITH_UNIT_TESTS=OFF \
-DCONC_WITH_UNITTEST=OFF \
Expand Down Expand Up @@ -321,7 +310,6 @@ jobs:
-DPLUGIN_SPIDER=NO \
-DPLUGIN_ROCKSDB=NO \
-DPLUGIN_OQGRAPH=NO \
-DPLUGIN_TOKUDB=NO \
-DPLUGIN_COLUMNSTORE=NO \
-DWITH_UNIT_TESTS=OFF \
-DCONC_WITH_UNITTEST=OFF \
Expand All @@ -342,7 +330,7 @@ jobs:
run: |
mkdir build
cd build
cmake .. -G "Visual Studio 17 2022" -A x64 -DPLUGIN_TIDESDB=DYNAMIC -DPLUGIN_ROCKSDB=NO -DPLUGIN_MROONGA=NO -DPLUGIN_SPIDER=NO -DPLUGIN_COLUMNSTORE=NO -DPLUGIN_CONNECT=NO -DWITH_UNIT_TESTS=OFF -DCMAKE_PREFIX_PATH="C:/tidesdb;%VCPKG_INSTALLATION_ROOT%/installed/x64-windows" -DCMAKE_INCLUDE_PATH="C:/tidesdb/include"
cmake .. -G "Visual Studio 17 2022" -A x64 -DPLUGIN_TIDESDB=DYNAMIC -DPLUGIN_ROCKSDB=NO -DPLUGIN_MROONGA=NO -DPLUGIN_SPIDER=NO -DPLUGIN_COLUMNSTORE=NO -DPLUGIN_CONNECT=NO -DPLUGIN_OQGRAPH=NO -DPLUGIN_ARCHIVE=NO -DWITH_UNIT_TESTS=OFF -DCMAKE_PREFIX_PATH="C:/tidesdb;%VCPKG_INSTALLATION_ROOT%/installed/x64-windows" -DCMAKE_INCLUDE_PATH="C:/tidesdb/include"
cmake --build . --config RelWithDebInfo --parallel

- name: Run TidesDB test suite (Linux)
Expand Down
39 changes: 32 additions & 7 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ TIDESQL

A pluggable write and space optimized storage engine for MariaDB using TidesDB.

The pluggable engine is tested and supported on MariaDB 11.x, 12.x.


INSTALLATION
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
Expand All @@ -17,12 +19,34 @@ The install script will build TidesDB and MariaDB from source.
You can specify the versions if you want. The script will install everything
and make TidesDB available as an engine to utilize.

To skip storage engines you don't need (saves build time and reduces warnings):

./install.sh --list-engines # see what can be skipped
./install.sh --skip-engines mroonga,rocksdb,connect,spider,oqgraph,columnstore

Skippable engines:
archive Archive storage engine (read-only row-format tables)
blackhole Blackhole engine (accepts writes, stores nothing)
columnstore MariaDB ColumnStore (columnar analytics engine)
connect CONNECT engine (access external data sources)
example Example storage engine (test/demo only)
federated Legacy Federated engine (MODULE_ONLY)
federatedx FederatedX engine (query remote MySQL/MariaDB tables)
mroonga Mroonga full-text search engine (requires Groonga)
oqgraph Open Query GRAPH engine (graph computation)
rocksdb MyRocks / RocksDB LSM-tree engine
sequence Sequence engine (virtual auto-increment sequences)
sphinx SphinxSE engine (Sphinx full-text search integration)
spider Spider engine (sharding / federation)

InnoDB, Aria, MyISAM, and CSV cannot be skipped (server depends on them).

Below are manual install instructions for those who want to configure everything
themselves, though with the install script you can modify configuration files
after the fact.

LINUX (Ubuntu/Debian)
---------------------
░░░░░░░░░░░░░░░░░░░░░░░░

1. Install dependencies:

Expand Down Expand Up @@ -61,7 +85,7 @@ LINUX (Ubuntu/Debian)


MACOS
-----
░░░░░░░░░░░░░░░░░░░░░░░░

1. Install dependencies:

Expand Down Expand Up @@ -119,7 +143,7 @@ MACOS


WINDOWS
-------
░░░░░░░░░░░░░░░░░░░░░░░░

1. Install prerequisites:

Expand Down Expand Up @@ -171,7 +195,7 @@ WINDOWS


ENABLE PLUGIN
-------------
░░░░░░░░░░░░░░░░░░░░░░░░

After building, enable the plugin in MariaDB:

Expand Down Expand Up @@ -213,7 +237,7 @@ TidesDB stores its data as a sibling of the MariaDB data directory:


SYSTEM VARIABLES (SET GLOBAL tidesdb_...)
-----------------------------------------
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

All are read-only (set at startup) unless noted otherwise.

Expand All @@ -232,7 +256,7 @@ reduce log volume.


TABLE OPTIONS (CREATE TABLE ... ENGINE=TidesDB <option>=<value>)
----------------------------------------------------------------
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

These are per-table options baked into the column family at creation time.
Changing them via ALTER TABLE only updates the .frm; it does not reconfigure
Expand Down Expand Up @@ -284,7 +308,7 @@ Encryption:


FIELD OPTIONS (per-column)
--------------------------
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

TTL Marks column as per-row TTL source (seconds)

Expand Down Expand Up @@ -326,6 +350,7 @@ Available tests:
tidesdb_json JSON querying + generated-column JSON path indexing
tidesdb_savepoint SQL SAVEPOINT / ROLLBACK TO / RELEASE SAVEPOINT
tidesdb_write_pressure oltp_write_only OOM reproduction (multi-connection)
...

Run with verbose output:

Expand Down
73 changes: 73 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
# --jobs N Parallel build jobs (default: auto-detected)
# --skip-deps Skip system dependency installation
# --skip-tidesdb Skip TidesDB library build (use if already installed)
# --skip-engines ENGINES Comma-separated list of storage engines to skip
# --list-engines List storage engines that can be skipped and exit
# --pgo Enable Profile-Guided Optimization (3-phase build)
# --help Show this help message
#
Expand All @@ -68,6 +70,8 @@
# ./install.sh --mariadb-version mariadb-12.1.2
# ./install.sh --skip-deps --skip-tidesdb
# ./install.sh --pgo # Full PGO build (instrument → train → optimize)
# ./install.sh --list-engines # Show which engines can be skipped
# ./install.sh --skip-engines mroonga,rocksdb,connect,spider,oqgraph,columnstore
# ─────────────────────────────────────────────────────────────────────────────
set -euo pipefail

Expand Down Expand Up @@ -160,6 +164,27 @@ JOBS="$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 4)"
SKIP_DEPS=false
SKIP_TIDESDB=false
PGO_ENABLED=false
SKIP_ENGINES=""

# ── Skippable storage engines ────────────────────────────────────────────────
# These are MariaDB storage engines that can safely be disabled to save build
# time and reduce compiler warnings. InnoDB, Aria, MyISAM, and CSV are NOT
# listed here because the server or mysql-test framework depends on them.
SKIPPABLE_ENGINES=(
"archive:Archive storage engine (read-only row-format tables)"
"blackhole:Blackhole engine (accepts writes, stores nothing)"
"columnstore:MariaDB ColumnStore (columnar analytics engine)"
"connect:CONNECT engine (access external data sources)"
"example:Example storage engine (test/demo only)"
"federated:Legacy Federated engine (MODULE_ONLY)"
"federatedx:FederatedX engine (query remote MySQL/MariaDB tables)"
"mroonga:Mroonga full-text search engine (requires Groonga)"
"oqgraph:Open Query GRAPH engine (graph computation)"
"rocksdb:MyRocks / RocksDB LSM-tree engine"
"sequence:Sequence engine (virtual auto-increment sequences)"
"sphinx:SphinxSE engine (Sphinx full-text search integration)"
"spider:Spider engine (sharding / federation)"
)

# ── Color helpers ───────────────────────────────────────────────────────────
RED='\033[0;31m'
Expand All @@ -180,6 +205,21 @@ usage() {
exit 0
}

list_engines() {
echo ""
echo -e "${CYAN}Skippable storage engines:${NC}"
echo -e "${CYAN}──────────────────────────────────────────────────────────${NC}"
for entry in "${SKIPPABLE_ENGINES[@]}"; do
local name="${entry%%:*}"
local desc="${entry#*:}"
printf " ${GREEN}%-14s${NC} %s\n" "$name" "$desc"
done
echo ""
echo -e "Usage: ${GREEN}--skip-engines mroonga,rocksdb,connect${NC}"
echo ""
exit 0
}

while [[ $# -gt 0 ]]; do
case "$1" in
--tidesdb-version) TIDESDB_VERSION="$2"; shift 2 ;;
Expand All @@ -190,6 +230,8 @@ while [[ $# -gt 0 ]]; do
--jobs) JOBS="$2"; shift 2 ;;
--skip-deps) SKIP_DEPS=true; shift ;;
--skip-tidesdb) SKIP_TIDESDB=true; shift ;;
--skip-engines) SKIP_ENGINES="$2"; shift 2 ;;
--list-engines) list_engines ;;
--pgo) PGO_ENABLED=true; shift ;;
--help|-h) usage ;;
*) die "Unknown option: $1 (try --help)" ;;
Expand Down Expand Up @@ -229,6 +271,9 @@ _cfg_row "Build directory : ${GREEN}${BUILD_DIR}${NC}"
_cfg_row "Parallel jobs : ${GREEN}${JOBS}${NC}"
_cfg_row "Detected OS : ${GREEN}${OS}${NC}"
_cfg_row "PGO build : ${GREEN}${PGO_ENABLED}${NC}"
if [[ -n "$SKIP_ENGINES" ]]; then
_cfg_row "Skip engines : ${YELLOW}${SKIP_ENGINES}${NC}"
fi
_cfg_row "TideSQL repo : ${GREEN}${SCRIPT_DIR}${NC}"
echo -e "${CYAN}╚$(printf '═%.0s' $(seq 1 68))╝${NC}"
echo ""
Expand Down Expand Up @@ -442,6 +487,16 @@ build_mariadb() {
-DWITH_UNIT_TESTS=OFF
)

# Disable skipped engines
if [[ -n "$SKIP_ENGINES" ]]; then
IFS=',' read -ra _engines <<< "$SKIP_ENGINES"
for _eng in "${_engines[@]}"; do
_eng="$(echo "$_eng" | tr -d ' ' | tr '[:lower:]' '[:upper:]')"
cmake_args+=("-DPLUGIN_${_eng}=NO")
info "Skipping storage engine: ${_eng}"
done
fi

case "$OS" in
macos)
local sdk_root cc cxx
Expand Down Expand Up @@ -722,6 +777,15 @@ pgo_instrument() {

export TIDESDB_ROOT="${TIDESDB_PREFIX}"

# Disable skipped engines
if [[ -n "$SKIP_ENGINES" ]]; then
IFS=',' read -ra _engines <<< "$SKIP_ENGINES"
for _eng in "${_engines[@]}"; do
_eng="$(echo "$_eng" | tr -d ' ' | tr '[:lower:]' '[:upper:]')"
cmake_args+=("-DPLUGIN_${_eng}=NO")
done
fi

case "$OS" in
macos)
local sdk_root cc cxx
Expand Down Expand Up @@ -805,6 +869,15 @@ pgo_optimize() {

export TIDESDB_ROOT="${TIDESDB_PREFIX}"

# Disable skipped engines
if [[ -n "$SKIP_ENGINES" ]]; then
IFS=',' read -ra _engines <<< "$SKIP_ENGINES"
for _eng in "${_engines[@]}"; do
_eng="$(echo "$_eng" | tr -d ' ' | tr '[:lower:]' '[:upper:]')"
cmake_args+=("-DPLUGIN_${_eng}=NO")
done
fi

case "$OS" in
macos)
local sdk_root cc cxx
Expand Down
48 changes: 48 additions & 0 deletions mysql-test/suite/tidesdb/r/tidesdb_alter_crash.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#
# Issue #70: ALTER TABLE sometimes crashes MariaDB
# The crash was caused by unbounded read-set growth during
# ALTER TABLE's copy-phase scan under REPEATABLE_READ.
#
CREATE TABLE t_alt70 (
a INT AUTO_INCREMENT PRIMARY KEY,
b INT
) ENGINE=TidesDB;
INSERT INTO t_alt70 (a, b) VALUES (DEFAULT, 10), (DEFAULT, 20), (DEFAULT, 30);
# Double the rows repeatedly to get ~100K rows
INSERT INTO t_alt70 (b) SELECT b FROM t_alt70;
INSERT INTO t_alt70 (b) SELECT b FROM t_alt70;
INSERT INTO t_alt70 (b) SELECT b FROM t_alt70;
INSERT INTO t_alt70 (b) SELECT b FROM t_alt70;
INSERT INTO t_alt70 (b) SELECT b FROM t_alt70;
INSERT INTO t_alt70 (b) SELECT b FROM t_alt70;
INSERT INTO t_alt70 (b) SELECT b FROM t_alt70;
INSERT INTO t_alt70 (b) SELECT b FROM t_alt70;
INSERT INTO t_alt70 (b) SELECT b FROM t_alt70;
INSERT INTO t_alt70 (b) SELECT b FROM t_alt70;
INSERT INTO t_alt70 (b) SELECT b FROM t_alt70;
INSERT INTO t_alt70 (b) SELECT b FROM t_alt70;
INSERT INTO t_alt70 (b) SELECT b FROM t_alt70;
INSERT INTO t_alt70 (b) SELECT b FROM t_alt70;
INSERT INTO t_alt70 (b) SELECT b FROM t_alt70;
SELECT COUNT(*) FROM t_alt70;
COUNT(*)
98304
# Switch to autocommit=0 so transactions use REPEATABLE_READ
# (this is the scenario that triggered the crash)
SET autocommit=0;
# These ALTER TABLE statements reproduce the original bug sequence
ALTER TABLE t_alt70 ADD PRIMARY KEY (a);
ERROR 42000: Multiple primary key defined
ALTER TABLE t_alt70 DROP PRIMARY KEY;
ERROR 42000: Incorrect table definition; there can be only one auto column and it must be defined as a key
# This copy-based ALTER TABLE scans ~100K rows; before the fix
# it would crash in tidesdb_txn_add_to_read_set due to unbounded
# read-set growth under REPEATABLE_READ.
ALTER TABLE t_alt70 DROP PRIMARY KEY, CHANGE a a INT;
SELECT COUNT(*) FROM t_alt70;
COUNT(*)
98304
SET autocommit=1;
DROP TABLE t_alt70;
#
# Done.
Loading
Loading