Skip to content

MDEV-39196: SELECT from information schema fails when FederatedX loses underlying table#4876

Open
itzanway wants to merge 1 commit intoMariaDB:10.11from
itzanway:fix-mdev-39196
Open

MDEV-39196: SELECT from information schema fails when FederatedX loses underlying table#4876
itzanway wants to merge 1 commit intoMariaDB:10.11from
itzanway:fix-mdev-39196

Conversation

@itzanway
Copy link
Copy Markdown
Contributor

Description

This PR resolves MDEV-39196 by fixing a bug where SELECT queries from INFORMATION_SCHEMA fail completely when a FederatedX underlying remote table is unreachable.

As noted in the issue, the storage engine was previously passing a hard error back to the SQL layer without specifying the guilty local table name, breaking the query and making debugging very difficult.

Implementation Details

  • Error Downgrade: Modified ha_federatedx::info() in storage/federatedx/ha_federatedx.cc to catch remote connection and missing table errors, downgrading them from fatal errors to warnings using push_warning_printf.
  • Contextual Warning: Injected the local table name (share->table_name) into the warning message so users can easily identify exactly which FederatedX table is inaccessible.
  • Graceful Continuation: Reset error_code = 0; after pushing the warning, allowing the INFORMATION_SCHEMA loop to finish scanning the remaining tables in the database instead of aborting.

Testing

  • Added a specific MTR test case (federatedx_mdev39196.test and .result) to the federated suite to simulate a dropped remote table and verify that the query succeeds while pushing the correct warning.
  • Relying on Buildbot CI to verify cross-platform compilation and ensure no regressions on older build environments.

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Mar 27, 2026

CLA assistant check
All committers have signed the CLA.

@itzanway itzanway force-pushed the fix-mdev-39196 branch 2 times, most recently from 5aa46fe to 6041c66 Compare March 27, 2026 20:37
@gkodinov gkodinov added the External Contribution All PRs from entities outside of MariaDB Foundation, Corporation, Codership agreements. label Mar 30, 2026
Copy link
Copy Markdown
Member

@gkodinov gkodinov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution! This is a preliminary review.

Please rebase to 10.11. 10.6 is almost out of the door and only "critical" bugs go into it.

Comment thread mysql-test/suite/federated/federatedx_mdev39196.test
Comment thread mysql-test/suite/federated/federatedx_mdev39196.test Outdated
Comment thread mysql-test/suite/federated/federatedx_mdev39196.test Outdated
Comment thread mysql-test/suite/federated/federatedx_mdev39196.test Outdated
Comment thread mysql-test/suite/federated/federatedx_mdev39196.test Outdated
Comment thread mysql-test/suite/federated/federatedx_mdev39196.test Outdated
@itzanway itzanway changed the base branch from 10.6 to 10.11 April 1, 2026 12:51
@itzanway
Copy link
Copy Markdown
Contributor Author

itzanway commented Apr 1, 2026

Hi @gkodinov, thanks for the review! I've updated the PR with the requested changes:

Rebased the branch to target 10.11.

Updated the .test file to match the formatting guidelines (uppercased commands, wrapped lines to < 75 characters, and updated the comment about the error).

Added the missing .result file. Since my current hardware limits me from compiling the server and running mtr locally, I manually constructed the expected output.

I've pushed these as a single amended commit. Let me know if anything else is needed!

Copy link
Copy Markdown
Member

@gkodinov gkodinov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for your efforts so far.
Please stay tuned for the final review.

Copy link
Copy Markdown
Member

@gkodinov gkodinov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missed the test failures. please fix as suggested

Comment thread mysql-test/suite/federated/federatedx_mdev39196.test Outdated
@gkodinov gkodinov self-assigned this Apr 7, 2026
@itzanway
Copy link
Copy Markdown
Contributor Author

itzanway commented Apr 7, 2026

Hi @gkodinov,

Thanks for catching that! I've made the requested updates:

Added --source include/not_embedded.inc to fix the embedded test failures.

Added the MDEV header to the top of the .test file.

Updated the .result file to reflect the new --echo output.

I have amended these changes and force-pushed them as a single commit.

@itzanway itzanway requested a review from gkodinov April 7, 2026 17:44
Copy link
Copy Markdown
Member

@gkodinov gkodinov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some more tests are failing in the federated suite. Please fix:

federated.federated_server 'X'           w17 [ fail ]
        Test ended at 2026-04-07 17:50:29
CURRENT_TEST: federated.federated_server
mysqltest: At line 243: query 'select * from federated.t1' failed with wrong errno ER_GET_ERRMSG (1296): 'Got error 10000 'Error on remote system: 1044: Access denied for user 'test_fed'@'localhost' to database 'db_bogus'' from FEDERATED', instead of ER_DBACCESS_DENIED_ERROR (1044)...

@itzanway itzanway force-pushed the fix-mdev-39196 branch 3 times, most recently from 03992bd to 0be6930 Compare April 22, 2026 19:25
@grooverdan
Copy link
Copy Markdown
Member

moving from #4976:

On the CI failures: The two required failures (amd64-ubuntu-2204-debug-ps, amd64-windows-packages) are both caused by federated.federated and federated.federatedx_mdev39196, which are failing consistently across unrelated branches (refs/pull/4876/head, refs/pull/4939/head, bb-10.11-midenok).

federatedx_mdev39196 is only added by this PR so it can't fail on other branches. PR #4939 and bb-10.11-midenok are the same - an no federated.* failures from this year.

These are not regressions from this change. Could you confirm whether these reproduce on the 11.8 base independently and waive them if so?

11.8 federated errors aren't the same (MDEV-36387). They aren't there.

Tip - use mtr --record federated.federatedx_mdev39196 to create result file. Check it afterward too. I was getting differnent results and I don't know why:

@@ -34,13 +34,13 @@
 WHERE TABLE_SCHEMA = 'federated'
     AND TABLE_NAME = 't1';
 TABLE_NAME	TABLE_ROWS
-t1	NULL
+t1	1
 Warnings:
-Warning	1430	: 0 : 
+Warning	1430	FederatedX: Table 't1' is inaccessible: 1146 : Remote table does not exist
 # Warning must be present.
 SHOW WARNINGS;
 Level	Code	Message
-Warning	1430	: 0 : 
+Warning	1430	FederatedX: Table 't1' is inaccessible: 1146 : Remote table does not exist
 # Cleanup.

Change the federated test too. Your info change impacts more than just information _schema.

--- a/mysql-test/suite/federated/federated.test
+++ b/mysql-test/suite/federated/federated.test
@@ -17,7 +17,7 @@ create table t1 (a int);
 --replace_result $MASTER_MYPORT MASTER_PORT
 eval create table fed (a int) engine=Federated CONNECTION='mysql://root@127.0.0.1:$MASTER_MYPORT/test/t1';
 drop table t1;
---error 1146,1431
+--error ER_FOREIGN_DATA_SOURCE_DOESNT_EXIST,ER_GET_ERRMSG
 select * from fed;
 drop table fed;
 

…s underlying table

When a remote table is unavailable, FederatedX was passing a hard error back to the SQL layer, causing INFORMATION_SCHEMA queries to abort entirely.

This patch intercepts the remote error in ha_federatedx::info, downgrades it to a warning using push_warning_printf, and includes the local table name in the warning message so the user knows which table is inaccessible.

Signed-off-by: Anway Durge <124391429+itzanway@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

External Contribution All PRs from entities outside of MariaDB Foundation, Corporation, Codership agreements.

Development

Successfully merging this pull request may close these issues.

4 participants