Skip to content

fix: add http:// prefix to server address in schema requests - #362

Open
raled573343 wants to merge 1 commit into
apache:masterfrom
raled573343:fix-add-http-prefix
Open

fix: add http:// prefix to server address in schema requests#362
raled573343 wants to merge 1 commit into
apache:masterfrom
raled573343:fix-add-http-prefix

Conversation

@raled573343

@raled573343 raled573343 commented Sep 3, 2026

Copy link
Copy Markdown

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 as host:port without 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

  • In vermeer/apps/common/hugegraph_tools.go:
    • Updated testServerIsValid: URL construction now uses "http://%v/graphspaces/...".
    • Updated GetHugegraphSchema: URL construction now uses "http://%v/graphspaces/...".

Verifying these changes

  • Trivial rework / code cleanup without any test coverage. (No Need)
  • Already covered by existing tests, such as (please modify tests here).
  • Need tests and can be verified as follows.

Manual verification: after the fix, schema endpoint responds with HTTP 200.

Does this PR potentially affect the following parts?

  • Nope
  • Dependencies (add/update license info)
  • Modify configurations
  • The public API
  • Other affects (typed here)

Documentation Status

  • Doc - No Need

Signed-off-by: raled573343 <raled573343@users.noreply.github.com>

@imbajin imbajin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

⚠️ This prefixes only the request URL but returns the original 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants