|
| 1 | +# Functional Tests Failure Analysis - MariaDB 11.6.2 |
| 2 | + |
| 3 | +## Executive Summary |
| 4 | + |
| 5 | +**Date:** December 3, 2025 |
| 6 | +**Database:** MariaDB 11.6.2-MariaDB-ubu2404 |
| 7 | +**Test Duration:** 7.33 minutes |
| 8 | +**Total Tests:** 30,173 |
| 9 | +**Passed:** 19,760 (65.5%) |
| 10 | +**Failed:** 9,874 (32.7%) |
| 11 | +**Skipped:** 539 (1.8%) |
| 12 | + |
| 13 | +## Overview |
| 14 | + |
| 15 | +The functional test suite reveals significant compatibility issues between the EF Core provider and MariaDB 11.6.2. The failures are concentrated in specific areas related to SQL generation differences between MySQL and MariaDB. |
| 16 | + |
| 17 | +## Primary Failure Categories |
| 18 | + |
| 19 | +### 1. RETURNING Clause Compatibility Issues |
| 20 | +**Severity:** CRITICAL |
| 21 | +**Affected Tests:** ~8 direct failures, but RETURNING pattern appears 53,127 times in output |
| 22 | +**Root Cause:** MariaDB does not support the `RETURNING` clause in INSERT/UPDATE/DELETE statements in the same way as MySQL 8.0+ |
| 23 | + |
| 24 | +**Error Pattern:** |
| 25 | +``` |
| 26 | +MySqlConnector.MySqlException: You have an error in your SQL syntax; |
| 27 | +check the manual that corresponds to your MariaDB server version for |
| 28 | +the right syntax to use near 'RETURNING 1' or 'RETURNING 1;' |
| 29 | +``` |
| 30 | + |
| 31 | +**Affected Test Classes:** |
| 32 | +- TwoDatabasesMySqlTest (4 failures) |
| 33 | +- CompositeKeyEndToEndMySqlTest (3+ failures) |
| 34 | +- MySqlMigrationsSqlGeneratorTest (multiple failures) |
| 35 | + |
| 36 | +**Sample Failed Tests:** |
| 37 | +- `TwoDatabasesMySqlTest.Can_set_connection_string_in_interceptor` |
| 38 | +- `TwoDatabasesMySqlTest.Can_query_from_one_connection_string_and_save_changes_to_another` |
| 39 | +- `CompositeKeyEndToEndMySqlTest.Can_use_generated_values_in_composite_key_end_to_end` |
| 40 | + |
| 41 | +**Expected Behavior:** Tests expect SQL like: |
| 42 | +```sql |
| 43 | +UPDATE ... WHERE ... RETURNING 1; |
| 44 | +``` |
| 45 | + |
| 46 | +**Actual MariaDB Requirement:** Should use: |
| 47 | +```sql |
| 48 | +UPDATE ... WHERE ...; |
| 49 | +SELECT ROW_COUNT(); |
| 50 | +``` |
| 51 | + |
| 52 | +### 2. Type Mapping Issues (LEAST Function) |
| 53 | +**Severity:** HIGH |
| 54 | +**Affected Tests:** 32+ tests |
| 55 | +**Root Cause:** The LEAST() function expressions are not being properly mapped to SQL types in the query translator |
| 56 | + |
| 57 | +**Error Pattern:** |
| 58 | +``` |
| 59 | +InvalidOperationException: Expression 'LEAST(@p, 1)' in the SQL tree |
| 60 | +does not have a type mapping assigned. |
| 61 | +``` |
| 62 | + |
| 63 | +**Affected Test Classes:** |
| 64 | +- NorthwindStringIncludeQueryMySqlTest (2 failures) |
| 65 | +- NorthwindChangeTrackingQueryMySqlTest (2 failures) |
| 66 | +- NorthwindMiscellaneousQueryMySqlTest (multiple failures) |
| 67 | + |
| 68 | +**Sample Failed Tests:** |
| 69 | +- `NorthwindStringIncludeQueryMySqlTest.Multi_level_includes_are_applied_with_skip_take` |
| 70 | +- `NorthwindChangeTrackingQueryMySqlTest.Entity_range_does_not_revert_when_attached_dbContext` |
| 71 | +- `NorthwindMiscellaneousQueryMySqlTest.OrderBy_skip_take_take` |
| 72 | + |
| 73 | +### 3. SQL Generation Assertion Failures |
| 74 | +**Severity:** MEDIUM |
| 75 | +**Affected Tests:** 425+ tests |
| 76 | +**Root Cause:** Generated SQL differs from expected SQL, particularly with LIKE vs LEFT function usage |
| 77 | + |
| 78 | +**Error Pattern:** |
| 79 | +``` |
| 80 | +Assert.Equal() Failure: Strings differ |
| 81 | +Expected: ···"omers` AS `c`\nWHERE `c`.`CompanyName` LIKE"··· |
| 82 | +Actual: ···"omers` AS `c`\nWHERE LEFT(`c`.`CompanyName"··· |
| 83 | +``` |
| 84 | + |
| 85 | +**Affected Test Classes:** |
| 86 | +- NorthwindQueryFiltersQueryMySqlTest (2 failures) |
| 87 | +- MySqlMigrationsSqlGeneratorTest (multiple failures) |
| 88 | + |
| 89 | +**Sample Failed Tests:** |
| 90 | +- `NorthwindQueryFiltersQueryMySqlTest.Count_query` |
| 91 | +- `MySqlMigrationsSqlGeneratorTest.UpdateDataOperation_all_args_composite_multi` |
| 92 | + |
| 93 | +### 4. Graph Updates and Cascade Failures |
| 94 | +**Severity:** HIGH |
| 95 | +**Affected Tests:** 1,985 tests (20% of failures) |
| 96 | +**Root Cause:** Cascading operations and relationship updates likely hitting RETURNING clause issues |
| 97 | + |
| 98 | +**Affected Test Classes (by failure count):** |
| 99 | +- GraphUpdatesMySqlClientCascadeTest: 985 failures |
| 100 | +- GraphUpdatesMySqlClientNoActionTest: 820 failures |
| 101 | +- ProxyGraphUpdatesMySqlTest variants: 909 failures combined |
| 102 | + |
| 103 | +### 5. Query Translation Failures |
| 104 | +**Severity:** HIGH |
| 105 | +**Affected Tests:** 6,681 tests (67% of failures) |
| 106 | +**Root Cause:** Various query translation issues including type mapping and SQL generation |
| 107 | + |
| 108 | +**Affected Test Classes:** |
| 109 | +- Query.* (various Northwind query test classes): 6,681 failures |
| 110 | + |
| 111 | +### 6. Bulk Updates Failures |
| 112 | +**Severity:** MEDIUM |
| 113 | +**Affected Tests:** 94 tests |
| 114 | +**Root Cause:** Likely related to RETURNING clause and SQL generation differences |
| 115 | + |
| 116 | +### 7. Store-Generated Values Issues |
| 117 | +**Severity:** MEDIUM |
| 118 | +**Affected Tests:** 87 tests |
| 119 | +**Root Cause:** Issues with identity columns and generated values, possibly RETURNING-related |
| 120 | + |
| 121 | +**Affected Test Classes:** |
| 122 | +- StoreGeneratedMySqlTest: 87 failures |
| 123 | + |
| 124 | +## Test Classes with Most Failures (Top 20) |
| 125 | + |
| 126 | +| Rank | Test Class | Failure Count | % of Total Failures | |
| 127 | +|------|-----------|---------------|---------------------| |
| 128 | +| 1 | Query.* (various) | 6,681 | 67.7% | |
| 129 | +| 2 | GraphUpdatesMySqlClientCascadeTest | 985 | 10.0% | |
| 130 | +| 3 | GraphUpdatesMySqlClientNoActionTest | 820 | 8.3% | |
| 131 | +| 4 | ProxyGraphUpdatesMySqlTest+LazyLoading | 303 | 3.1% | |
| 132 | +| 5 | ProxyGraphUpdatesMySqlTest+ChangeTrackingAndLazyLoading | 303 | 3.1% | |
| 133 | +| 6 | ProxyGraphUpdatesMySqlTest+ChangeTracking | 303 | 3.1% | |
| 134 | +| 7 | BulkUpdates.* | 94 | 1.0% | |
| 135 | +| 8 | StoreGeneratedMySqlTest | 87 | 0.9% | |
| 136 | +| 9 | ManyToManyTrackingMySqlTest | 68 | 0.7% | |
| 137 | +| 10 | KeysWithConvertersMySqlTest | 47 | 0.5% | |
| 138 | +| 11 | MigrationsMySqlTest | 21 | 0.2% | |
| 139 | +| 12 | UpdatesMySqlTest | 20 | 0.2% | |
| 140 | +| 13 | Update.* | 20 | 0.2% | |
| 141 | +| 14 | OptimisticConcurrencyMySqlTest | 18 | 0.2% | |
| 142 | +| 15 | SaveChangesInterceptionMySqlTestBase+SaveChangesInterceptionWithDiagnosticsMySqlTest | 16 | 0.2% | |
| 143 | +| 16 | SaveChangesInterceptionMySqlTestBase+SaveChangesInterceptionMySqlTest | 16 | 0.2% | |
| 144 | +| 17 | FieldMappingMySqlTest | 12 | 0.1% | |
| 145 | +| 18 | Scaffolding.* | 9 | 0.1% | |
| 146 | +| 19 | MySqlMigrationsSqlGeneratorTest | 9 | 0.1% | |
| 147 | +| 20 | TableSplittingMySqlTest | 7 | 0.1% | |
| 148 | + |
| 149 | +**Total Unique Test Classes with Failures:** 35 |
| 150 | + |
| 151 | +## Error Distribution Analysis |
| 152 | + |
| 153 | +| Error Type | Occurrences | Primary Impact | |
| 154 | +|------------|-------------|----------------| |
| 155 | +| RETURNING clause references | 53,127 | SQL syntax errors | |
| 156 | +| Type mapping issues | 64 | Query translation failures | |
| 157 | +| DbUpdateException | 9,088 | Save operations | |
| 158 | +| InvalidOperationException | 231 | Query execution | |
| 159 | +| Assert.Equal failures | 425 | SQL generation validation | |
| 160 | +| Assert.False failures | 16 | Boolean assertions | |
| 161 | + |
| 162 | +## Recommended Actions |
| 163 | + |
| 164 | +### Priority 1 (CRITICAL): RETURNING Clause Support |
| 165 | +**Impact:** Affects thousands of tests and core functionality |
| 166 | +**Action:** Implement MariaDB-specific handling for operations that currently use RETURNING clause |
| 167 | +- Detect MariaDB server type |
| 168 | +- Use `SELECT ROW_COUNT()` or `LAST_INSERT_ID()` instead of RETURNING |
| 169 | +- Update MySqlUpdateSqlGenerator and related components |
| 170 | + |
| 171 | +### Priority 2 (HIGH): LEAST Function Type Mapping |
| 172 | +**Impact:** 32+ query tests failing |
| 173 | +**Action:** Add proper type mapping for LEAST() function expressions |
| 174 | +- Update MySqlQuerySqlGenerator |
| 175 | +- Register LEAST function with appropriate type mapper |
| 176 | + |
| 177 | +### Priority 3 (MEDIUM): SQL Generation Consistency |
| 178 | +**Impact:** 425+ assertion failures |
| 179 | +**Action:** Review and update SQL generation baselines for MariaDB |
| 180 | +- Update test expectations for MariaDB-specific SQL patterns |
| 181 | +- Ensure LIKE vs LEFT function usage is consistent |
| 182 | + |
| 183 | +### Priority 4 (MEDIUM): Graph Updates and Cascading |
| 184 | +**Impact:** ~2,000 tests |
| 185 | +**Action:** After fixing RETURNING clause, re-run graph update tests |
| 186 | +- Likely cascade from Priority 1 fix |
| 187 | + |
| 188 | +### Priority 5 (LOW): Query Translation Edge Cases |
| 189 | +**Impact:** Various query tests |
| 190 | +**Action:** Address remaining query translation issues after higher priorities |
| 191 | +- Review failed query tests individually |
| 192 | +- Update query translators as needed |
| 193 | + |
| 194 | +## Testing Recommendations |
| 195 | + |
| 196 | +1. **Incremental Testing:** Fix Priority 1 first, then re-run full suite to see cascade effects |
| 197 | +2. **Server Version Detection:** Ensure proper MariaDB vs MySQL detection in all code paths |
| 198 | +3. **Baseline Updates:** Update test baselines specifically for MariaDB compatibility |
| 199 | +4. **CI/CD:** Consider separate test runs for MySQL vs MariaDB to track compatibility |
| 200 | + |
| 201 | +## Technical Details |
| 202 | + |
| 203 | +### Environment |
| 204 | +- OS: Ubuntu (Linux) |
| 205 | +- .NET: 10.0.100 |
| 206 | +- Database: MariaDB 11.6.2-MariaDB-ubu2404 |
| 207 | +- Port: 3306 (localhost) |
| 208 | +- SQL Mode: STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |
| 209 | +- Max Connections: 512 |
| 210 | + |
| 211 | +### Test Execution |
| 212 | +- Configuration: Debug |
| 213 | +- Build Status: Successful |
| 214 | +- Test Framework: xUnit.net |
| 215 | +- Total Line Output: 971,916 lines |
| 216 | + |
| 217 | +## Conclusion |
| 218 | + |
| 219 | +The majority of functional test failures (>99%) can be traced to two primary root causes: |
| 220 | +1. **RETURNING clause incompatibility** between MySQL 8.0+ and MariaDB |
| 221 | +2. **Type mapping issues** with specific SQL functions like LEAST |
| 222 | + |
| 223 | +Addressing these two issues should resolve the vast majority of the 9,874 failing tests. The remaining failures are likely assertion mismatches that may resolve automatically or require baseline updates for MariaDB-specific SQL generation patterns. |
| 224 | + |
| 225 | +--- |
| 226 | +*Report Generated: December 3, 2025* |
| 227 | +*Analysis Tool: Custom bash scripts with grep/sed/awk* |
| 228 | +*Test Output Size: 971,916 lines* |
0 commit comments