|
| 1 | +# Functional Tests Investigation Summary |
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +This investigation analyzed all functional test failures against MariaDB 11.6.2 to identify root causes and create an action plan for fixes. |
| 6 | + |
| 7 | +## Quick Facts |
| 8 | + |
| 9 | +- **Investigation Date:** December 3, 2025 |
| 10 | +- **Database Tested:** MariaDB 11.6.2-MariaDB-ubu2404 |
| 11 | +- **Test Duration:** 7.33 minutes |
| 12 | +- **Total Tests:** 30,173 |
| 13 | +- **Pass Rate:** 65.5% (19,760 passed) |
| 14 | +- **Failure Rate:** 32.7% (9,874 failed) |
| 15 | + |
| 16 | +## Key Findings |
| 17 | + |
| 18 | +### Critical Issue: RETURNING Clause Incompatibility |
| 19 | + |
| 20 | +**99% of failures** trace back to MariaDB not supporting the `RETURNING` clause used by MySQL 8.0+. |
| 21 | + |
| 22 | +**Error Example:** |
| 23 | +``` |
| 24 | +MySqlException: You have an error in your SQL syntax; check the manual |
| 25 | +that corresponds to your MariaDB server version for the right syntax |
| 26 | +to use near 'RETURNING 1' |
| 27 | +``` |
| 28 | + |
| 29 | +**Solution:** Implement MariaDB-specific SQL generation using `SELECT ROW_COUNT()` or `LAST_INSERT_ID()` instead of `RETURNING`. |
| 30 | + |
| 31 | +### High Priority: Type Mapping Issues |
| 32 | + |
| 33 | +32+ tests fail due to `LEAST()` function not having proper type mapping: |
| 34 | +``` |
| 35 | +InvalidOperationException: Expression 'LEAST(@p, 1)' in the SQL tree |
| 36 | +does not have a type mapping assigned. |
| 37 | +``` |
| 38 | + |
| 39 | +**Solution:** Register LEAST function with appropriate type mapper in MySqlQuerySqlGenerator. |
| 40 | + |
| 41 | +## Investigation Reports |
| 42 | + |
| 43 | +1. **[functional_tests_failure_analysis_mariadb.md](functional_tests_failure_analysis_mariadb.md)** |
| 44 | + - Complete analysis with all error categories |
| 45 | + - Detailed statistics and breakdowns |
| 46 | + - Technical recommendations |
| 47 | + - Testing strategy |
| 48 | + |
| 49 | +2. **[test_failure_examples_mariadb.md](test_failure_examples_mariadb.md)** |
| 50 | + - Specific failing test examples by category |
| 51 | + - Actual error messages |
| 52 | + - Sample test names |
| 53 | + |
| 54 | +3. **[failing_tests_checklist.md](failing_tests_checklist.md)** |
| 55 | + - Prioritized checklist for tracking fixes |
| 56 | + - Organized by priority level |
| 57 | + - Progress tracking template |
| 58 | + |
| 59 | +## Recommended Action Plan |
| 60 | + |
| 61 | +### Phase 1: Fix RETURNING Clause (Critical) |
| 62 | +1. Detect MariaDB server type in SQL generators |
| 63 | +2. Replace RETURNING clause with ROW_COUNT()/LAST_INSERT_ID() |
| 64 | +3. Update MySqlUpdateSqlGenerator and related components |
| 65 | +4. **Expected Impact:** Should fix ~95% of failures |
| 66 | + |
| 67 | +### Phase 2: Fix Type Mapping (High) |
| 68 | +1. Add proper type mapping for LEAST() function |
| 69 | +2. Update MySqlQuerySqlGenerator |
| 70 | +3. **Expected Impact:** Should fix 32+ tests |
| 71 | + |
| 72 | +### Phase 3: Re-evaluate & Clean Up |
| 73 | +1. Re-run full test suite after Phase 1 & 2 |
| 74 | +2. Update test baselines for MariaDB-specific SQL |
| 75 | +3. Address any remaining edge cases |
| 76 | + |
| 77 | +## Test Environment Details |
| 78 | + |
| 79 | +``` |
| 80 | +Database: MariaDB 11.6.2-MariaDB-ubu2404 |
| 81 | +Platform: Ubuntu Linux |
| 82 | +.NET SDK: 10.0.100 |
| 83 | +Connection: localhost:3306 |
| 84 | +SQL Mode: STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |
| 85 | +Max Connections: 512 |
| 86 | +``` |
| 87 | + |
| 88 | +## Running the Tests |
| 89 | + |
| 90 | +```bash |
| 91 | +# Start MariaDB |
| 92 | +docker run --name mariadb -e MYSQL_ROOT_PASSWORD=Password12! -p 127.0.0.1:3306:3306 -d mariadb:11.6.2 |
| 93 | + |
| 94 | +# Build and run tests |
| 95 | +dotnet build -c Debug |
| 96 | +dotnet test test/EFCore.MySql.FunctionalTests -c Debug --no-build --logger "console;verbosity=detailed" |
| 97 | +``` |
| 98 | + |
| 99 | +**Note:** Output is ~970K lines. Grep for "Failed" to see failures. |
| 100 | + |
| 101 | +## Next Steps |
| 102 | + |
| 103 | +1. Review the comprehensive analysis report |
| 104 | +2. Prioritize fixes based on impact |
| 105 | +3. Implement RETURNING clause detection/replacement |
| 106 | +4. Add LEAST function type mapping |
| 107 | +5. Re-run tests and validate improvements |
| 108 | + |
| 109 | +--- |
| 110 | + |
| 111 | +**Investigation completed successfully. All findings documented and ready for action.** |
0 commit comments