(fb-1903) - Fix SQL Fanout error (#2248)

* added some debug code

* added more logging

* do sql fanout on dedicated endpoint
This commit is contained in:
Pat Okeeffe 2023-02-14 10:54:15 -06:00 committed by GitHub
parent 87011e4294
commit 3dcc55203f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 3 deletions

View file

@ -549,7 +549,7 @@ func newRouter(handler *Handler) http.Handler {
router.HandleFunc("/sql", handler.chkAuthZ(handler.handlePostSQL, authz.Admin)).Methods("POST").Name("PostSQL")
}
// internal endpoint
router.HandleFunc("/sql", handler.chkAuthZ(handler.handlePostSQLPlanOperator, authz.Admin)).Headers("X-FeatureBase-Plan-Operator", "").Methods("POST").Name("PostSQLPlanOperator")
router.HandleFunc("/sql-exec-graph", handler.chkAuthZ(handler.handlePostSQLPlanOperator, authz.Admin)).Methods("POST").Name("PostSQLPlanOperator")
router.HandleFunc("/query-history", handler.chkAuthZ(handler.handleGetPastQueries, authz.Admin)).Methods("GET").Name("GetPastQueries")
router.HandleFunc("/version", handler.handleGetVersion).Methods("GET").Name("GetVersion")

View file

@ -324,7 +324,7 @@ func (e *ExecutionPlanner) remotePlanExec(ctx context.Context, addr string, op t
}
// Create HTTP request.
u := fmt.Sprintf("%s/sql", addr)
u := fmt.Sprintf("%s/sql-exec-graph", addr)
req, err := http.NewRequest("POST", u, bytes.NewReader(b))
if err != nil {
return nil, errors.Wrap(err, "creating request")
@ -337,7 +337,6 @@ func (e *ExecutionPlanner) remotePlanExec(ctx context.Context, addr string, op t
req.Header.Set("Content-Type", "application/octet-stream")
req.Header.Set("Accept", "application/octet-stream")
req.Header.Set("User-Agent", "pilosa/"+e.systemAPI.Version())
req.Header.Set("X-FeatureBase-Plan-Operator", fmt.Sprintf("%T", op))
// Execute request against the host.
resp, err := http.DefaultClient.Do(req.WithContext(ctx))