incubator-hugegraph icon indicating copy to clipboard operation
incubator-hugegraph copied to clipboard

[Bug] Server upgraded from 1.7.0 with usePD=true reads an empty schema: meta cluster prefix 'hg-test' vs hardcoded 'hg'

Open SebastianGruza opened this issue 2 months ago • 0 comments

Bug Type (问题类型)

data / logic error

Before submit

  • [X] 我已经确认现有的 Issues 与 FAQ 中没有相同 / 重复问题 (I have confirmed and searched that there are no similar problems in the historical issue and documents)

Environment (环境信息)

  • Server Version: master 4f5202b8 (PD and store on master as well; the same happens with PD and stores left on 1.7.0)
  • Backend: HStore, 1 PD + 3 stores, usePD=true
  • Data written by the official apache-hugegraph-incubating-1.7.0 release

Expected & Actual behavior (期望与实际表现)

After swapping only the jars (lib/) to master on a 1.7.0 installation (config and data directories untouched) the server lists the graph and sees the raw data, but not the schema:

GET /graphs/hugegraph/schema/propertykeys   -> {"propertykeys": []}
g.V().count()                                -> 29
g.V().hasLabel('person').count()             -> Undefined vertex label: 'person'

On the same data 1.7.0 returns 13 property keys and 20 person vertices. With usePD=false the same swap works (HStore and RocksDB, every schema and data read identical to 1.7.0).

Root cause

The meta keys in PD are prefixed with HUGEGRAPH/<cluster>/…, and MetaManager.connect() binds the cluster name once per process: a later call with a different name is silently ignored. Two places supply the name: GraphManager from the cluster option of rest-server.properties (default hg-test), and StandardHugeGraph with the literal "hg". Whoever connects first wins:

  • 1.7.0: HugeRestServer.start() runs first; the GraphManager constructor with usePD=true calls loadMetaFromPD() → initMetaManager() → connect("hg-test"). The schema is written under HUGEGRAPH/hg-test/GRAPHSPACE/DEFAULT/hugegraph/SCHEMA/….
  • master: #3008 moved HugeGremlinServer.prepare() in front of HugeRestServer.start(). prepare() puts every file from conf/graphs into settings.graphs, TinkerPop opens the StandardHugeGraph, and it calls connect("hg") first. The configured cluster is ignored from then on; the server reads HUGEGRAPH/hg/…, which only holds the system schema it created itself at startup.

Key listing through KvClient.scanPrefix("HUGEGRAPH/") after the swap: 106 keys under hg-test/…/hugegraph (written by 1.7.0), 36 under hg/…/hugegraph (created by master at startup). Removing hugegraph.properties from conf/graphs does not help (the graph is not registered in the meta, the server then has no graph at all), and setting cluster=hg-test does not either (the literal wins regardless of the option).

How to reproduce

  1. 1.7.0, HStore, usePD=true and pd.peers in rest-server.properties; create a schema and some data.
  2. Stop, replace the server lib/ with master (PD and stores may stay on 1.7.0 or move to master, same result), start without init-store.
  3. GET /schema/propertykeys → empty list, g.V().hasLabel(...) → Undefined vertex label.

Scripts and logs from the lab run: https://github.com/SebastianGruza/hugegraph-validation/tree/master/results/upgrade-170-to-master. A fix is in the linked PR.

Vertex/Edge example (问题点 / 边数据举例)

No response

Schema [VertexLabel, EdgeLabel, IndexLabel] (元数据结构)

No response

SebastianGruza avatar Sep 18 '26 15:09 SebastianGruza