fix: add http:// prefix to server address in schema requests - #362
fix: add http:// prefix to server address in schema requests#362raled573343 wants to merge 1 commit into
Conversation
Signed-off-by: raled573343 <raled573343@users.noreply.github.com>
imbajin
left a comment
There was a problem hiding this comment.
Blocking: yes. Summary: Schema discovery can pass while HugeGraph write-back still fails because the discovered address remains scheme-less. Evidence: the exact-head flow stores the return value of FindServerAddr in output.hugegraph_server, and HugegraphWriter concatenates it into write-back URLs; the new prefix is applied only to the probe and schema read.
| go func(addr string, ctx context.Context, cancel context.CancelFunc) { | ||
| defer wg.Done() | ||
| url := fmt.Sprintf("%v/graphspaces/%v/graphs/%v/schema?format=json", addr, hgSpace, hGraph) | ||
| url := fmt.Sprintf("http://%v/graphspaces/%v/graphs/%v/schema?format=json", addr, hgSpace, hGraph) |
There was a problem hiding this comment.
addr. FindServerAddr() stores that value in output.hugegraph_server (vermeer/apps/worker/compute_bl.go:518), and HugegraphWriter.Init() concatenates it into request URLs at vermeer/apps/graphio/hugegraph.go:568,591,633. With PD returning server:8080, the probe now succeeds as http://server:8080/... but write-back constructs server:8080/graphspaces/..., which http.NewRequest rejects because it has no valid HTTP scheme. The same unconditional prefixing turns a pre-schemed address into http://http://... or http://https://..., whereas the old code accepted such a base URL. Normalize the address once at discovery, preserve an existing http/https scheme, use the normalized base for both read and write paths, and add raw and pre-schemed coverage.
Purpose of the PR
This PR addresses the first issue described in #361: missing
http://prefix in schema request URLs. The PD service returns addresses ashost:portwithout a scheme, causing HTTP client failures. This change adds the required prefix.The second issue (
Can't construct Cardinality from code 0) is a separate problem on the Store side and is not resolved by this PR. It should be handled in a separate fix.Main Changes
vermeer/apps/common/hugegraph_tools.go:testServerIsValid: URL construction now uses"http://%v/graphspaces/...".GetHugegraphSchema: URL construction now uses"http://%v/graphspaces/...".Verifying these changes
Manual verification: after the fix, schema endpoint responds with HTTP 200.
Does this PR potentially affect the following parts?
Documentation Status
Doc - No Need