Skip to content
This repository was archived by the owner on Feb 21, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion http_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Copy link
Member

Choose a reason for hiding this comment

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

Alternatively, you could have used .HeadersRegexp() and matched on any value, rather than on an empty value. But I guess if you're not using that value for anything it doesn't matter.
I don't have a strong opinion on whether adding a new endpoint is better.

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")
Expand Down
3 changes: 1 addition & 2 deletions sql3/planner/executionplanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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))
Expand Down