-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix performance when parsing GraphQL schema into AST which causes downtime on cache stampede #31879
Fix performance when parsing GraphQL schema into AST which causes downtime on cache stampede #31879
Commits on Jan 26, 2021
-
Configuration menu - View commit details
-
Copy full SHA for 51aab9d - Browse repository at this point
Copy the full SHA 51aab9dView commit details
Commits on Jan 28, 2021
-
Configuration menu - View commit details
-
Copy full SHA for 0672892 - Browse repository at this point
Copy the full SHA 0672892View commit details
Commits on May 10, 2021
-
Configuration menu - View commit details
-
Copy full SHA for 6772386 - Browse repository at this point
Copy the full SHA 6772386View commit details
Commits on May 13, 2021
-
Fix
Syntax Error: Expected Name found :
There was a bug with the enum placeholder ordering Input like the following ``` interface SomeInterface { product_type: String @doc(description: "The type of product, such as simple, configurable, etc.") } enum SomeEnum { } ``` would have placeholder logic ran against it and end up like ``` interface SomeInterface { product_type: String @doc(description: "The type of product, such as simple, configurable, etc.") } enum SomeEnum { placeholder_graphql_field: String } ``` This caused an error, something in the AST was trying to make it resolve against the word "Type" in the @doc description By fixing the enum so that it does not have `: String` in it the AST is generated successfully, we do this by replacing those empty enums first so that they cannot get caught by the empty type check
Configuration menu - View commit details
-
Copy full SHA for 15bad09 - Browse repository at this point
Copy the full SHA 15bad09View commit details -
WIP - Add proof of bug for union types
The newly supported union is the cause of this issue in the parseTypes function. The regex is finding the type of union CompanyStructureEntity but its also grabbing the item below it and including it as part of its schema content, which means CompanyStructureEntity contains the schema for itself as well as CompanyStructureItem , this means I never have a $knownTypes['CompanyStructureItem'] to work with which means it is a missing dependency. ``` <?php use Magento\Framework\App\Bootstrap; require __DIR__ . '/app/bootstrap.php'; $bootstrap = Bootstrap::create(BP, $_SERVER); $obj = $bootstrap->getObjectManager(); /** @var Magento\Framework\GraphQlSchemaStitching\GraphQlReader $graphqlReader */ $graphqlReader = $obj->get(Magento\Framework\GraphQlSchemaStitching\GraphQlReader::class); $reflector = new ReflectionObject($graphqlReader); $method = $reflector->getMethod('parseTypes'); $method->setAccessible(true); $broken = 'type IsCompanyEmailAvailableOutput @doc(description: "Contains the response of a company email validation query") { is_email_available: Boolean! @doc(description: "A value of `true` indicates the email address can be used to create a company") } union CompanyStructureEntity @typeResolver(class: "Magento\\CompanyGraphQl\\Model\\Resolver\\StructureEntityTypeResolver") = CompanyTeam | Customer type CompanyStructureItem @doc(description: "Defines an individual node in the company structure") { id: ID! @doc(description: "The unique ID for a `CompanyStructureItem` object") parent_id: ID @doc(description: "The ID of the parent item in the company hierarchy") entity: CompanyStructureEntity @doc(description: "A union of `CompanyTeam` and `Customer` objects") } type CompanyStructure @doc(description: "Contains an array of the individual nodes that comprise the company structure") { items: [CompanyStructureItem] @doc(description: "An array of elements in a company structure") }'; $result = $method->invoke($graphqlReader, $broken); echo "Got the following types" . PHP_EOL; echo implode(PHP_EOL, array_keys($result)) . PHP_EOL; echo "The values for the union actually contains CompanyStructureItem which is why the initial approach works any mine does not" . PHP_EOL; echo $result['CompanyStructureEntity'] . PHP_EOL; ```
Configuration menu - View commit details
-
Copy full SHA for cfcbcd8 - Browse repository at this point
Copy the full SHA cfcbcd8View commit details -
Configuration menu - View commit details
-
Copy full SHA for 075a261 - Browse repository at this point
Copy the full SHA 075a261View commit details
Commits on Aug 6, 2021
-
Based on feedback from magento#31879 (comment) @Bartlomiejsz > regarding first issue - with empty enum. It looks like the fix is to replace first matching group in both $typeDefinitionPattern variables: > > ([^\{]*) > with: > > ([^\{\}]*) > Then this regex will check if there is neither beginning or ending bracket in this place
Configuration menu - View commit details
-
Copy full SHA for 7223e89 - Browse repository at this point
Copy the full SHA 7223e89View commit details -
Configuration menu - View commit details
-
Copy full SHA for 53c5cf8 - Browse repository at this point
Copy the full SHA 53c5cf8View commit details
Commits on Aug 9, 2021
-
Configuration menu - View commit details
-
Copy full SHA for 91a5319 - Browse repository at this point
Copy the full SHA 91a5319View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2624d93 - Browse repository at this point
Copy the full SHA 2624d93View commit details -
Merge remote-tracking branch 'upstream/2.4-develop' into improve-grap…
…hql-stitching-perf
Configuration menu - View commit details
-
Copy full SHA for 416a593 - Browse repository at this point
Copy the full SHA 416a593View commit details
Commits on Aug 16, 2021
-
Merge remote-tracking branch 'upstream/2.4-develop' into improve-grap…
…hql-stitching-perf
Configuration menu - View commit details
-
Copy full SHA for afa8b04 - Browse repository at this point
Copy the full SHA afa8b04View commit details
Commits on Oct 1, 2021
-
Based on feedback magento#31879 (comment) from @Bartlomiejsz > regarding first issue - with empty enum. It looks like the fix is to replace first matching group in both $typeDefinitionPattern variables: > > ([^\{]*) > with: > > ([^\{\}]*) > Then this regex will check if there is neither beginning or ending bracket in this place
Configuration menu - View commit details
-
Copy full SHA for 8e8d364 - Browse repository at this point
Copy the full SHA 8e8d364View commit details -
Configuration menu - View commit details
-
Copy full SHA for 459cbbe - Browse repository at this point
Copy the full SHA 459cbbeView commit details
Commits on Oct 8, 2021
-
Merge remote-tracking branch 'upstream/2.4-develop' into improve-grap…
…hql-stitching-perf Conflicts: lib/internal/Magento/Framework/GraphQlSchemaStitching/GraphQlReader.php
Configuration menu - View commit details
-
Copy full SHA for 603963e - Browse repository at this point
Copy the full SHA 603963eView commit details
Commits on Oct 9, 2021
-
Update GraphQlReader, generalise union handling
This workaround handles a bug where parseTypes also contains the data from below it ``` union X = Y | Z type foo {} ``` Would return ```php [ 'x' => 'union X = Y | Z type foo {}' ] ``` instead of ```php [ 'x' => 'union X = Y | Z', 'foo' => 'type foo {}' ] ``` This workaround deals only with union types, so doesnt materially affect anything in most cases.
Configuration menu - View commit details
-
Copy full SHA for c36fb66 - Browse repository at this point
Copy the full SHA c36fb66View commit details -
Configuration menu - View commit details
-
Copy full SHA for 00ff074 - Browse repository at this point
Copy the full SHA 00ff074View commit details