1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-10-30 07:25:34 +03:00

chore(tests): now RBO tests can run without --extern

This commit is contained in:
Leonid Fedorov
2025-09-01 16:07:42 +00:00
committed by drrtuy
parent 2e9900ea24
commit 1bcb1a0982
7 changed files with 146 additions and 11 deletions

View File

@@ -0,0 +1,3 @@
--skip-partition=0
--skip-sequence=0
--columnstore_innodb_queries_use_mcs=on

View File

@@ -0,0 +1,57 @@
CREATE USER IF NOT EXISTS'cejuser'@'localhost' IDENTIFIED BY 'Vagrant1|0000001';
GRANT ALL PRIVILEGES ON *.* TO 'cejuser'@'localhost';
FLUSH PRIVILEGES;
CREATE USER IF NOT EXISTS'cejuser'@'localhost' IDENTIFIED BY 'Vagrant1|0000001';
GRANT ALL PRIVILEGES ON *.* TO 'cejuser'@'localhost';
FLUSH PRIVILEGES;
DROP DATABASE IF EXISTS rbo_parallel_ces;
CREATE DATABASE rbo_parallel_ces;
USE rbo_parallel_ces;
SELECT calsettrace(1);
calsettrace(1)
0
CREATE TABLE Ti (col1 INT, col2 INT, col3 INT) ENGINE=InnoDB;
INSERT INTO Ti (col1, col2, col3)
SELECT seq, seq+1, seq+2 FROM (SELECT seq FROM seq_1_to_100) AS numbers;
SET @@histogram_size=10;
ANALYZE TABLE Ti PERSISTENT FOR ALL;
Table Op Msg_type Msg_text
rbo_parallel_ces.Ti analyze status Engine-independent statistics collected
rbo_parallel_ces.Ti analyze status OK
CREATE INDEX excellent_index ON Ti(col1);
SET @@columnstore_unstable_optimizer=ON;
SET @@optimizer_switch='derived_merge=off';
SET @@columnstore_ces_optimization_parallel_factor=5;
SELECT SUM(col1) FROM Ti;
SUM(col1)
5050
SET @orig_plan := mcsgetplan('original');
SET @opt_plan := mcsgetplan('optimized');
SET @rbo_rules := mcsgetplan('rules');
SET @uu_tail := SUBSTRING_INDEX(@orig_plan, '--- Union Unit ---', -1);
SET @unit_open := CONCAT(CHAR(10),' {',CHAR(10));
SELECT (CHAR_LENGTH(@uu_tail) - CHAR_LENGTH(REPLACE(@uu_tail, @unit_open, '')))/CHAR_LENGTH(@unit_open) AS unions_original;
unions_original
0.0000
SET @uu_tail := SUBSTRING_INDEX(@opt_plan, '--- Union Unit ---', -1);
SELECT (CHAR_LENGTH(@uu_tail) - CHAR_LENGTH(REPLACE(@uu_tail, @unit_open, '')))/CHAR_LENGTH(@unit_open) AS unions_optimized_5;
unions_optimized_5
5.0000
SELECT @rbo_rules LIKE '%parallel_ces%' AS rule_parallel_ces_applied;
rule_parallel_ces_applied
1
SET @@columnstore_ces_optimization_parallel_factor=15;
SELECT SUM(col1) FROM Ti;
SUM(col1)
5050
SET @opt_plan := mcsgetplan('optimized');
SET @uu_tail := SUBSTRING_INDEX(@opt_plan, '--- Union Unit ---', -1);
SELECT (CHAR_LENGTH(@uu_tail) - CHAR_LENGTH(REPLACE(@uu_tail, @unit_open, '')))/CHAR_LENGTH(@unit_open) AS unions_optimized_15;
unions_optimized_15
10.0000
SELECT calsettrace(0);
calsettrace(0)
1
DROP DATABASE rbo_parallel_ces;
REVOKE ALL PRIVILEGES ON *.* FROM 'cejuser'@'localhost';
DROP USER 'cejuser'@'localhost';

View File

@@ -1,8 +1,32 @@
--source ../include/have_columnstore.inc
--source include/have_innodb.inc
--source ../include/functions.inc
--source ../include/cross_engine.inc
# -------------------------------------------------------------- #
# Enable cross engine join
# Configure user and password in Columnstore.xml file
# -------------------------------------------------------------- #
--exec /usr/bin/mcsSetConfig CrossEngineSupport User 'cejuser'
--exec /usr/bin/mcsSetConfig CrossEngineSupport Password 'Vagrant1|0000001'
--exec $MCS_MCSSETCONFIG CrossEngineSupport Port $MASTER_MYPORT
# -------------------------------------------------------------- #
# Create corresponding in the server
# -------------------------------------------------------------- #
--disable_warnings
CREATE USER IF NOT EXISTS'cejuser'@'localhost' IDENTIFIED BY 'Vagrant1|0000001';
--enable_warnings
GRANT ALL PRIVILEGES ON *.* TO 'cejuser'@'localhost';
FLUSH PRIVILEGES;
--disable_warnings
DROP DATABASE IF EXISTS rbo_parallel_ces;
--enable_warnings
@@ -69,3 +93,4 @@ SELECT calsettrace(0);
DROP DATABASE rbo_parallel_ces;
--source ../include/drop_functions.inc
--source ../include/drop_cross_engine.inc

View File

@@ -0,0 +1,29 @@
package My::Suite::ColumnStore;
@ISA = qw(My::Suite);
my $mcs_bin_dir_compiled=$::bindir . '/storage/columnstore/columnstore/bin';
my $mcs_ins_dir_installed=$::bindir . '/bin';
if (-d $mcs_bin_dir_compiled)
{
$ENV{MCS_MCSSETCONFIG}=$mcs_bin_dir_compiled . "/mcsSetConfig";
$ENV{MCS_CPIMPORT}=$mcs_bin_dir_compiled . "/cpimport";
$ENV{MCS_SYSCATALOG_MYSQL_SQL}=$::mysqld_variables{'basedir'} . "/storage/columnstore/columnstore/dbcon/mysql/syscatalog_mysql.sql";
}
elsif (-d $mcs_ins_dir_installed)
{
$ENV{MCS_MCSSETCONFIG}=$mcs_ins_dir_installed . "/mcsSetConfig";
$ENV{MCS_CPIMPORT}=$mcs_ins_dir_installed . "/cpimport";
$ENV{MCS_SYSCATALOG_MYSQL_SQL}=$::mysqld_variables{'basedir'} . "/share/columnstore/syscatalog_mysql.sql";
}
sub is_default { 0 }
sub start_test {
# we should guard this for --force-restart flag condition.
my ($self, $tinfo)= @_;
My::Suite::start_test(@_);
}
bless { };

View File

@@ -4,6 +4,8 @@
# -------------------------------------------------------------- #
--exec /usr/bin/mcsSetConfig CrossEngineSupport User 'cejuser'
--exec /usr/bin/mcsSetConfig CrossEngineSupport Password 'Vagrant1|0000001'
--exec $MCS_MCSSETCONFIG CrossEngineSupport Port $MASTER_MYPORT
# -------------------------------------------------------------- #
# Create corresponding in the server
# -------------------------------------------------------------- #

View File

@@ -0,0 +1,2 @@
REVOKE ALL PRIVILEGES ON *.* FROM 'cejuser'@'localhost';
DROP USER 'cejuser'@'localhost';

View File

@@ -1,11 +1,9 @@
#!/bin/bash
SCRIPT_LOCATION=$(dirname "$0")
COLUMNSTORE_SOURCE_PATH=$(realpath $SCRIPT_LOCATION/../../)
MARIADB_SOURCE_PATH=$(realpath $SCRIPT_LOCATION/../../../../../)
VERSION_GREATER_THAN_10=$(mariadb -N -s -e 'SELECT (sys.version_major(), sys.version_minor(), sys.version_patch()) >= (11, 4, 0);')
SERVERNAME="mysql"
@@ -13,7 +11,6 @@ if [[ $VERSION_GREATER_THAN_10 == '1' ]]; then
SERVERNAME="mariadb"
fi
COLUMNSTORE_MTR_SOURCE=$(realpath $COLUMNSTORE_SOURCE_PATH/mysql-test/columnstore)
INSTALLED_MTR_PATH="/usr/share/${SERVERNAME}/${SERVERNAME}-test/"
PATCHNAME=$(realpath $SCRIPT_LOCATION)/mtr_warn.patch
@@ -21,21 +18,28 @@ CURRENT_DIR=$(pwd)
source $COLUMNSTORE_SOURCE_PATH/build/utils.sh
optparse.define short=s long=suite desc="whole suite to run" variable=SUITE_NAME
optparse.define short=t long=test_full_name desc="Testname with suite as like bugfixes.mcol-4899" variable=TEST_FULL_NAME default=""
optparse.define short=f long=full desc="Run full MTR" variable=RUN_FULL default=false value=true
optparse.define short=r long=record desc="Record the result" variable=RECORD default=false value=true
optparse.define short=e long=no-extern desc="Run without --extern" variable=EXTERN default=true value=false
optparse.define short=e long=no-extern desc="Run with --extern" variable=EXTERN default=false value=true
source $(optparse.build)
# Detect if the user explicitly specified -e/--no-extern
EXTERN_SPECIFIED=false
for arg in "$@"; do
if [[ "$arg" == "-e" || "$arg" == "--no-extern" ]]; then
EXTERN_SPECIFIED=true
break
fi
done
mariadb -e "create database if not exists test;"
SOCKET=$(mariadb -e "show variables like 'socket';" | grep socket | cut -f2)
export ASAN_OPTIONS=abort_on_error=1:disable_coredump=0,print_stats=false,detect_odr_violation=0,check_initialization_order=1,detect_stack_use_after_return=1,atexit=false,log_path=/core/asan.hz
# needed when run MTR tests locally, see mariadb-test-run.pl:417, mtr functions
# are added to the database mtr only when --extern is not specified
@@ -69,21 +73,36 @@ if [[ -n $TEST_FULL_NAME ]]; then
TEST_NAME="${TEST_FULL_NAME#*.}"
fi
run_suite() {
ls /core >$CURRENT_DIR/mtr.$1.cores-before
if [[ $EXTERN == true ]]; then
# Decide effective extern per suite:
# - If user explicitly set --extern (-e), honor it for all suites
# - If not specified, force no extern for basic, bugfixes, and future suites
EXTERN_EFFECTIVE=$EXTERN
if [[ $EXTERN_SPECIFIED == false ]]; then
case "$1" in
basic | bugfixes | future)
EXTERN_EFFECTIVE=false
;;
esac
fi
if [[ $EXTERN_EFFECTIVE == true ]]; then
EXTERN_FLAG="--extern=socket=${SOCKET}"
else
EXTERN_FLAG=""
EXTERN_FLAG="--mysqld=--plugin-load-add=ha_columnstore"
fi
if [[ $RECORD == true ]]; then
RECORD_FLAG="--record"
warn "Test results are RECORDED"
else
RECORD_FLAG=""
fi
message "Running suite $SUITE_NAME with test $TEST_NAME and --extern=${EXTERN_EFFECTIVE}"
./mtr --force $EXTERN_FLAG $RECORD_FLAG --max-test-fail=0 --testcase-timeout=60 --suite=columnstore/$1 $2 | tee $CURRENT_DIR/mtr.$1.log 2>&1
# dump analyses.
systemctl stop mariadb
@@ -96,7 +115,6 @@ run_suite() {
add_mtr_warn_functions
if [[ $RUN_FULL == true ]]; then
message "Running FULL MTR"
run_suite basic
@@ -109,7 +127,6 @@ if [[ $RUN_FULL == true ]]; then
run_suite oracle
run_suite 1pmonly
else
message "Running suite $SUITE_NAME with test $TEST_NAME"
run_suite $SUITE_NAME $TEST_NAME
fi