1 parent
9b6f3c48e4
commit
032c05d6ce
1 file changed
+28
-5
@@ -5766,12 +5766,12 @@ fn mysql_statistics_expression_is_unsupported(error: &mysql_async::Error) -> boo
|
||||
match error {
|
||||
mysql_async::Error::Server(server_error) if server_error.code == 1054 => true,
|
||||
mysql_async::Error::Server(server_error)
|
||||
if server_error.code == 3009 && server_error.state.eq_ignore_ascii_case("HY000") =>
|
||||
if matches!(server_error.code, 3009 | 4518) && server_error.state.eq_ignore_ascii_case("HY000") =>
|
||||
{
|
||||
// PolarDB-X/DRDS wraps the unknown EXPRESSION column in TDDL error
|
||||
// 3009. Require the complete diagnostic so unrelated HY000 errors
|
||||
// (for example permissions or connectivity failures) are not retried
|
||||
// with a different metadata query.
|
||||
// PolarDB-X/DRDS wraps the unknown EXPRESSION column in optimizer
|
||||
// errors (4518/PXC and 3009/TDDL). Require the complete diagnostic
|
||||
// so unrelated HY000 errors (for example permissions or connectivity
|
||||
// failures) are not retried with a different metadata query.
|
||||
let message = server_error.message.to_ascii_lowercase();
|
||||
message.contains("column") && message.contains("expression") && message.contains("not found")
|
||||
}
|
||||
@@ -7766,6 +7766,29 @@ mod tests {
|
||||
assert!(!mysql_statistics_expression_is_unsupported(&wrong_state));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn mysql_index_metadata_accepts_polardbx_expression_error_only_with_matching_message() {
|
||||
let unsupported = mysql_async::Error::Server(mysql_async::ServerError {
|
||||
code: 4518,
|
||||
message: "[PXC-4518][ERR_VALIDATE] : Column 'EXPRESSION' not found in any table".to_string(),
|
||||
state: "HY000".to_string(),
|
||||
});
|
||||
let unrelated = mysql_async::Error::Server(mysql_async::ServerError {
|
||||
code: 4518,
|
||||
message: "[PXC-4518][ERR_VALIDATE] : Column 'INDEX_NAME' not found in any table".to_string(),
|
||||
state: "HY000".to_string(),
|
||||
});
|
||||
let wrong_state = mysql_async::Error::Server(mysql_async::ServerError {
|
||||
code: 4518,
|
||||
message: "[PXC-4518][ERR_VALIDATE] : Column 'EXPRESSION' not found in any table".to_string(),
|
||||
state: "42S22".to_string(),
|
||||
});
|
||||
|
||||
assert!(mysql_statistics_expression_is_unsupported(&unsupported));
|
||||
assert!(!mysql_statistics_expression_is_unsupported(&unrelated));
|
||||
assert!(!mysql_statistics_expression_is_unsupported(&wrong_state));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn mysql_group_concat_not_supported_error_retries_without_session_variable() {
|
||||
let error =
|
||||
|
||||
Reference in new issue
Block a user