-
Notifications
You must be signed in to change notification settings - Fork 0
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
Mock exec plan 2 #71
base: master
Are you sure you want to change the base?
Mock exec plan 2 #71
Conversation
bbd5402
to
b1cfe40
Compare
=> G.OperationType | ||
-> Seq.Seq VQ.Field | ||
-> m GQLReqParsed | ||
fieldsToRequest = undefined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fill from RemoteJoins. Make sure variables are "unresolved". Discuss.
-- pure $ mergeResponses fieldResps | ||
pure $ head (toList fieldResps) | ||
where | ||
mergeResponses = undefined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fill from RemoteJoins
EP.RPQuery queryPlan -> do | ||
(tx, genSql) <- EQ.queryOpFromPlan usrVars queryVars queryPlan | ||
let queryOp = ExOpQuery tx (Just genSql) | ||
pure $ pure $ GQFieldResolvedHasura queryOp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
think about caching here
GQFieldPartialHasura (gCtx, field) -> do | ||
(queryTx, plan, genSql) <- | ||
getQueryOp gCtx sqlGenCtx userInfo (Seq.singleton field) | ||
traverse_ (addPlanToCache . EP.RPQuery) plan |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
think about caching here
forM fieldPlans $ \case | ||
GQFieldPartialHasura (gCtx, field) -> do | ||
(lqOp, plan) <- getSubsOp pgExecCtx gCtx sqlGenCtx userInfo field | ||
traverse_ (addPlanToCache . EP.RPSubs) plan |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
think about caching here
, HTTP.responseTimeout = HTTP.responseTimeoutMicro (timeout * 1000000) | ||
} | ||
|
||
liftIO $ logGraphqlQuery logger $ QueryLog q Nothing reqId | ||
-- liftIO $ logGraphqlQuery logger $ QueryLog q Nothing reqId |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move logging out of here to the call-site of execRemoteGQ
?
@@ -26,13 +27,17 @@ runGQ | |||
-> m (HttpResponse EncJSON) | |||
runGQ reqId userInfo reqHdrs req = do | |||
E.ExecutionCtx _ sqlGenCtx pgExecCtx planCache sc scVer _ enableAL <- ask | |||
execPlan <- E.getResolvedExecPlan pgExecCtx planCache | |||
fieldPlans <- E.getResolvedExecPlan pgExecCtx planCache | |||
userInfo sqlGenCtx enableAL sc scVer req |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
log everything here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but what about logging in runHasuraGQ
: https://github.com/tirumaraiselvan/graphql-engine/pull/71/files#diff-ee138319d8341444234c6af198a5ea0bR57?
Maybe log the request here and its "sql map" inside runHasuraGQ
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or we can log at the "begin" and log at the "end"
(mapM generateFieldPlan selSet) | ||
VQ.RSubscription field -> | ||
(GQExecPlanPartial G.OperationTypeMutation) <$> | ||
(mapM generateFieldPlan (Seq.singleton field)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't like this sequencing of a singleton but dunno what to do without complicating types.
enableAL sc scVer reqUnparsed = do | ||
planM <- liftIO $ EP.getPlan scVer (userRole userInfo) | ||
opNameM queryStr planCache | ||
-> m (Seq.Seq GQFieldResolvedPlan) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In RJ, this will change to GQFieldResolvedPlan
-> QExecPlan
(https://github.com/hasura/graphql-engine/blob/821c1c3525e36f462bedee96908646e43225c442/server/src-lib/Hasura/GraphQL/Execute.hs#L180)
where QExecPlan is type QExecPlan = ([QExecPlanUnresolved], GQFieldResolvedPlan)
(https://github.com/hasura/graphql-engine/blob/821c1c3525e36f462bedee96908646e43225c442/server/src-lib/Hasura/GraphQL/Execute.hs#L95)
Might be a good idea to rename QExecPlan -> GQFieldPlan
and QExecPlanUnresolved -> GQRemoteRelUnresolvedPlan
case opType of | ||
G.OperationTypeQuery -> | ||
forM fieldPlans $ \case | ||
GQFieldPartialHasura (gCtx, field) -> do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Introduce remoteRel plans from RJ here: https://github.com/hasura/graphql-engine/blob/821c1c3525e36f462bedee96908646e43225c442/server/src-lib/Hasura/GraphQL/Execute.hs#L214
e9fffe1
to
3f3d327
Compare
GV.RQuery selSet -> | ||
runInTx $ encJFromJValue <$> traverse (explainField userInfo gCtx sqlGenCtx) (toList selSet) | ||
GV.RMutation _ -> | ||
E.GQExecPlanPartial opType fieldPlans <- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think Explain is that ugly anymore because of the new GQExecPlanPartial
structure!
GQFieldPartialHasura (gCtx, field) -> do | ||
(queryTx, plan, genSql) <- | ||
getQueryOp gCtx sqlGenCtx userInfo (Seq.singleton field) | ||
-- traverse_ (addPlanToCache . EP.RPQuery) plan |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how to cache?
forM fieldPlans $ \case | ||
GQFieldPartialHasura (gCtx, field) -> do | ||
(lqOp, plan) <- getSubsOp pgExecCtx gCtx sqlGenCtx userInfo field | ||
-- traverse_ (addPlanToCache . EP.RPSubs) plan |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how to cache? Might not be a problem here because subscriptions are always single field.
* ci: add hlint escape hatch Co-authored-by: Antoine Leblanc <[email protected]> GITHUB_PR_NUMBER: 6164 GITHUB_PR_URL: hasura#6164 * Applied changes to new workflow files. * Add missing label trigger for lint worklow Co-authored-by: Antoine Leblanc <[email protected]> GitOrigin-RevId: 3e22c30
mock exec plan 2