Skip to content

Conversation

@aidanharan
Copy link
Contributor

@aidanharan aidanharan commented Apr 21, 2021

The test EagerLoadingTooManyIdsTest#test_eager_loading_too_many_ids is failing on the CI with error:

ActiveRecord::StatementInvalid: TinyTds::Error: The query processor ran out of internal resources and could not produce a query plan. This is a rare event and only expected for extremely complex queries or queries that reference a very large number of tables or partitions. Please simplify the query. If you believe you have received this message in error, contact Customer Support Services for more information.

This happens if the SQL Server database is unable to handle the large number of values in the IN clause when generating the query plan. This is a known issue with SQL Server (see https://www.mssqltips.com/sqlservertip/5279/sql-server-error-query-processor-ran-out-of-internal-resources-and-could-not-produce-a-query-plan/).

I have found that the test passes if the database compatibility level is 100/110/120 but fails if it's 130/140. I was going to skip the test based on the compatibility level however "it is possible to generate this error during execution due to limitation of server resources like memory, etc" (https://www.mssqltips.com/sqlservertip/5279/sql-server-error-query-processor-ran-out-of-internal-resources-and-could-not-produce-a-query-plan/).

The issue, when it happens, is with the database instance and not the SQL Server adapter. So by skipping the test
only when the query plan generation fails we can do our best to catch any genuine errors while ignoring a known
SQL Server issue.

@aidanharan aidanharan force-pushed the coerce-eager-loading-compatibility-level branch from 1a37f52 to 1293af6 Compare April 22, 2021 08:33
@aidanharan
Copy link
Contributor Author

Closing in favor of #909

@aidanharan aidanharan closed this Apr 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant