Track HStore core-test exclusions and property codec mismatch
Problem
PR #3008 exposed 22 historically excluded HStore core-test cases after the Maven backend property was propagated to every Surefire execution. Scoping that property back to the API-test execution fixes the PR regression, but it does not resolve the underlying HStore defects or the legacy test guards.
The exclusions were introduced by d36e05ece8554fee73ba332147560930b3eba234 as temporary HStore skips. Their conditions use Assume.assumeTrue(isHstore) despite saying skip this test for hstore. Before PR #3008, the core-test JVM did not receive the backend property, so these tests were skipped because the value was null. A global property exposed 21 failures/errors and reduced skipped tests from 42 to 20.
Historical evidence:
- Passing baseline: https://github.com/apache/hugegraph/actions/runs/29094884977
- First exposing run: https://github.com/apache/hugegraph/actions/runs/29097183435
- Latest repeated failure: https://github.com/apache/hugegraph/actions/runs/29105710720
Confirmed technical issues
- HStore operator-sinking property decoding expects a self-describing byte containing
(cardinality << 6) | dataType, while the Server binary writer stores the raw property value. Store-side filtering can therefore decode the first value byte as invalidCardinality code 0orDataType code 43. - Core-test schema cleanup uses asynchronous deletion with a fixed 100 ms wait, allowing schema tasks and cache-clear events to cross test boundaries.
HstoreSessionsImpl.clear()does not remove the graph frominfoInitializedGraph, so delete and recreate lifecycle state is incomplete.- HStore feature flags claim support for several OLAP, scan, range, and paging capabilities whose excluded tests currently fail.
- RamTable is explicitly unsupported by HStore; those tests should remain clearly and correctly excluded.
Required work
- [ ] Define an HStore-specific, versioned property codec for operator sinking without changing the RocksDB binary format.
- [ ] Define backward-read or migration behavior for existing HStore data.
- [ ] Make schema cleanup wait for task completion and verify schema/index/cache convergence.
- [ ] Fix the HStore graph clear and recreate lifecycle, including
infoInitializedGraph. - [ ] Correct the legacy HStore test guards and align them with feature flags.
- [ ] Re-enable supported OLAP, scan, range, paging, and multi-graph tests.
- [ ] Keep only explicitly unsupported tests, such as RamTable, skipped with an accurate reason.
Acceptance criteria
- HStore property filtering covers SINGLE/LIST/SET cardinalities and all supported data types for vertices and edges.
- Sort-key prefix/range/paging tests pass both individually and in the complete CoreTestSuite.
- Multi-graph schema isolation passes.
- Repeated clear and recreate tests pass for at least 50 iterations without cross-test tasks or stale initialization state.
- Existing data compatibility or migration is documented and tested.
- The HStore core suite receives an explicit backend value and passes with only intentional unsupported cases skipped.
hello can i take up this issue?
hello can i take up this issue?
@kjswaruph sure, after this PR merged (soon) https://github.com/apache/hugegraph/pull/3096
follow it to continue (remember plan & review first)
Hey @imbajin as #3096 has been merged here is my proposed plan
- Use infoInitializedGraph.remove(this.graphName) in HstoreSessionsimpl.clear() to remove the graph from infoInitializedGraph to fix hstore lifecycle
- Update test guard rails to use the assumeFalse instead of assumeTrue so unsupported tests are skipped on HStore
- Tests which are not supported by Hstore like Ramtable will be excluded
- Replace the fixed Thread.sleep(100) cleanup wait with a stronger check that schema and cache cleanup have actually completed.
- Add a Hstore specific codec for operator sinking so property metadata is decoded consistently. Fixing this mismatch should make the supported OLAP,scan, etc tests pass without changing RocksDB binary format
Please review and let me know if this plan is good to proceed or if you like to add any changes or improvements.
@imbajin @kjswaruph — reproducer and two additional findings for item 1 (operator-sinking property codec), since this blocks every sort-key prefix/range query on 1.7.0 with HStore.
Minimal reproducer
Fresh graph, 3 property keys, 1 vertex label, 1 edge label with sort_keys: [asset, epoch], 2 vertices, 3 edges. Full script (REST + Gremlin, ~100 lines): https://gist.github.com/SebastianGruza/616f81e915f00f08c4be3dc447ca77c7
Property amount (DOUBLE) is created first on purpose, so it has the lowest property-key id and is the first value the store parser reads.
| # | g.V('a').outE('flow') + |
Server path | 1.7.0 result |
|---|---|---|---|
| 1 | no condition | prefix scan | OK, 3 edges |
| 2 | has('asset','ETC').has('epoch',100) — equality on all sort keys |
IdPrefixQuery → HstoreTable.queryByPrefix |
OK, 1 edge |
| 3 | has('epoch',100) — not a sort-key prefix |
filtered in server memory | OK, 2 edges |
| 4 | has('asset','ETC') — equality on sort-key prefix only |
IdRangeQuery → HstoreTable.queryByRange |
Can't construct Cardinality from code 0 |
| 5 | has('asset','ETC').has('epoch', gte(150)) |
IdRangeQuery → queryByRange |
Unsupported data type UNKNOWN |
| 6 | has('asset','ETC').has('epoch', gte(201)) — range matches no row |
IdRangeQuery → queryByRange |
OK, 0 edges (no row reaches parseEdge) |
Same results via GET /graph/edges?vertex_id=…&properties=… and via POST /gremlin.
The two messages (and the DataType code 43 mentioned above) are just the first byte of the first property value read as (cardinality << 6) | dataType:
| first row in key range | amount |
IEEE-754 | byte | >> 6 |
& 0x3F |
error |
|---|---|---|---|---|---|---|
#4 → (ETC,100) |
1.5 | 3FF8… |
0x3F |
0 (invalid) | — | Cardinality from code 0 |
#5 → (ETC,200) |
2.5 | 4004… |
0x40 |
1 (SINGLE) | 0 → UNKNOWN |
Unsupported data type UNKNOWN |
Finding 1 — only queryByRange pushes the query; a one-line interim mitigation exists
Core already strips all user-prop conditions before the query reaches the backend (HugeVertexStep.constructEdgesQuery / GraphTransaction.optimizeQuery → resetUserpropConditions()), and constructShardConditions produces an eq on SORT_VALUES only for full equality on all sort keys; a prefix-only equality or any range becomes a gte/lt pair → IdRangeQuery.
In hugegraph-hstore/.../HstoreTable.java (1.7.0):
queryByPrefix(~L497) callsprepareConditionQuery(originQuery), which returnsnullwhen there are no user-prop conditions → nothing is pushed →FilterIterator.of(it, null)→ works.queryByRange(~L636–648) sendscq.bytes()unconditionally wheneveroriginQueryis aConditionQuery. The remaining conditions are sysprops only (owner vertex, direction, label, sort values), all already enforced bykeyFrom/keyTo, so the store has nothing to filter and just crashes decoding the row. Query 6 above confirms the key range does the pruning: empty range → no row parsed → no crash.
Making queryByRange use the same prepareConditionQuery check as queryByPrefix unblocks sort-key prefix/range queries on 1.7.x immediately, with no on-disk format change and no store-side change — the proper versioned codec can land independently. I'm happy to open a PR for that if you consider it an acceptable interim mitigation (or I can fold it into whatever kjswaruph is preparing).
Finding 2 — the property codec is not the only mismatch on the sinking path
To see what happens after the decoding is fixed, we patched property decoding locally in a test store (read cardinality/type from the PropertyKey instead of the header byte — note this only "works" because the pushed conditions never touch property values; with graph == null the store's PropertyKey stub defaults to TEXT/SINGLE, so it is not a real fix). FilterIterator then stopped crashing but returned empty results, because of two further core-vs-struct mismatches:
Condition$RelationType.EQcompares ahugegraph-structId(from the parsed edge) with ahugegraph-coreLongId(from the deserializedConditionQuery) forLABEL/SUB_LABEL—Objects.equalsisfalseacross the two classes, so every row is filtered out.Condition$RelationType.compare()has noComparablepath, so string sort values (SORT_VALUES gte/lt) cannot be compared.
So the acceptance criterion "sort-key prefix/range/paging tests pass" will need the Id equality and comparison contract between hugegraph-core and hugegraph-struct addressed as well, not only the property codec. The codec alone turns a crash into silently empty results, which is worse.
@imbajin @kjswaruph — since there has been no activity here for ~6 weeks, I'd like to help move this forward. @kjswaruph, if you are still on it, happy to coordinate — just say so.
PR for the interim mitigation is up: #3184. It applies the same prepareConditionQuery guard in HstoreTable.queryByRange that queryByPrefix already has (reproducer and analysis in my comment above), with unit tests for the guard and for the copy-not-mutate change. No on-disk or store-side change; unblocks all sort-key prefix/range queries on 1.7.x and master. One thing I changed in both prepare* call sites: they used to mutate the origin query via resetConditions, which core still uses for its own filtering after the scan returns — the PR clones instead.
For the versioned sinking codec I'd like to write a short design note before any code, covering: (a) a versioned pushed-query blob carrying schema hints (propertyKeyId → (cardinality, dataType) for all keys of the label, so the store can skip over values it isn't filtering on) with fallback to server-side filtering when the store doesn't understand the version (rolling upgrades); (b) the Id equality contract across hugegraph-core/hugegraph-struct (normalize to long/string at the boundary); (c) a Comparable path in Condition.RelationType.compare — the gap exists on both sides, the server just never exercised it. As shown above, the codec alone turns the crash into silently empty results, so (a)–(c) need to land together for the acceptance criteria to hold. I'll post the note here for review unless you'd prefer a separate issue.
The test-guard flip and the clear/recreate lifecycle (#3141) I'm leaving with @kjswaruph; happy to help review or take either if nobody else picks them up.
@SebastianGruza @imbajin @kjswaruph A coordination note on #2994, #3182, #3184, and the already merged #3140:
These changes are not duplicates, and I don't see an immediate textual merge conflict at their current heads. However, they modify related stages of the HStore query pipeline and should be tested together.
- #2994 changes the upstream query semantics. Its updates to
ConditionQuery,GraphTransaction,BinarySerializer, andHstoreStoredetermine howLABELconditions are resolved, whether sort-key optimization is applicable, and whether an edge query becomes anIdPrefixQuery, anIdRangeQuery, or falls back to local filtering. - #3184 changes the next boundary: once a range query reaches
HstoreTable.queryByRange(), it decides whether the remainingConditionQueryshould be serialized and pushed to the Store. It also copies the query instead of mutating the original because Core may still need the original conditions for result filtering. - #3182 changes Core-side result filtering and cache eligibility for flattened and post-filtered queries.
- #3140, which is already contained in the base used by #3182 and #3184, handles global ordering and page-cursor correctness for range-index scans across HStore partitions.
The semantic dependency between #2994 and #3184 seems particularly important. #3184 assumes that Core and the serializers have already transformed the query into the expected range form and that the conditions reaching HstoreTable can be classified correctly as user properties or system properties. #2994 changes exactly how those upstream decisions are made.
There is also some potentially confusing history here: #2994 contains earlier commits related to HStore range ordering, but its current diff no longer changes HstoreTable; the active ordered range-scan implementation is represented by the already merged #3140. The remaining relationship between #2994 and #3184 is therefore primarily semantic rather than duplicate implementation.
Before merging either open PR, it would be useful to test a combined branch covering(apparently already covered by CI):
- #3184's six sort-key prefix/range reproducer cases;
- #2994's single-label, multi-label, conflicting-label,
IN, and non-equality label cases, especially those combined with edge sort keys; - #3182's flattened
within()and post-filtering cases with both cache hits and misses; - #3140's cross-partition limit, offset, and page-cursor ordering cases.
It may be worth cross-linking #2994, #3182, and #3184 in their descriptions and agreeing on a merge/rebase order so that the final combined behavior is validated rather than validating each branch only against the current master.
@contrueCT — we ran exactly that combined-branch test, as a black-box, cross-backend suite: the same REST/Gremlin queries against two servers built from the same tree, HStore (PD + 3 store nodes) vs RocksDB, compared as sets of element ids rather than counts. Server = master 98477f0 + #3184 1072872 + #3182 acbee167 + #2994 5cb9a519 (no merge conflicts; #3182 has since been merged, so this equals today's master + #2994 + #3184). Same run on plain master 98477f0 as the baseline.
| Your item | Section | Cases | master 98477f0 |
combined |
|---|---|---|---|---|
| 1. #3184 sort-key prefix/range reproducer cases | S | 56 | 15 OK, 37 store-side decode errors (#3090), 4 both-error | 52 identical sets, 4 both-error¹ |
| 2. #2994 single/multi/conflicting/IN/non-equality labels with edge sort keys | J | 35 | 32 OK, 1 error (#3090 shape), 2 without() + range-index queries throw on both backends |
35 identical sets |
3. #3182 flattened within() + post-filtering, cache hit and miss |
K | 40 | 24 OK, 16 wrong sets — HStore returns only the first within() value when a SEARCH condition is present (20 of 40/50/60/80, no error) |
40 identical, every query run twice, #3180 combo ×10 stable |
| 4. #3140 cross-partition limit/offset/page-cursor | L | 43 | 43 identical | 43 identical across 3 partitions |
Version axis with the backend held constant (RocksDB master vs RocksDB combined): 168/174 identical sets, the only differences being the two without() cases that throw on master and return results on combined — i.e. no other semantic change from #2994/#3182 visible to this suite.
¹ The 4 both-error cases are string range predicates in the REST properties filter (P.gte("ETC") → expect a number) rejected on both backends, while the same ranges work through Gremlin — a REST parser limitation, not part of these PRs.
Suite, cluster scripts, exact branch recipe and raw reports (ids included, so every mismatch can be re-derived): https://github.com/SebastianGruza/hugegraph-oracle-suite — aggregated numbers in results/README.md. It is Python 3 stdlib only and takes any two servers by port, so it can be re-run against future heads of #2994/#3184. One unrelated server-level finding from the same run (a duplicated record on page boundaries when limit is a multiple of 500, identical on both backends) is filed separately as #3191.
Notes from the #3184 review, recorded here for the proper codec fix. Everything below is outside #3184, which guards only queryByRange(Session, IdRangeQuery).
HstoreTable.queryAll()pushes((ConditionQuery) query).bytes()on both exits with no guard, and the shard overloadqueryByRange(Session, Shard, ConditionQuery)callsquery.bytes()unconditionally. The guard cannot simply be copied there: on a full scan nothing else enforces the label, sinceGraphTransaction.rightResultFromIndexQuery()returnstrueearly for a label-only query (lines 1914-1918). Spotted by @bitflicker64 in https://github.com/apache/hugegraph/pull/3184#discussion_r4023288079.- Reachability on hstore: label-only queries never enter
queryAll(), becauseHstoreFeatures.supportsQueryByLabel()isfalse, so core routes them to the label index (GraphIndexTransaction.queryByLabel) or rejects them withNoIndexExceptionwhen the label index is disabled;g.E()withouthas()sends a plainQuery(HugeGraphStep.makeQuery), soqueryAll()pushesnull. What does reachqueryAll()with aConditionQueryis the paged full scan (has('~page', '')); what reaches the shard overload is REST/traversers/{vertices,edges}/scan. - Measured on master
36811483, 5 M edges with 4 sort keys: both paths from point 2 returned rows with properties on the same owner's edges on which the range path fails withCan't construct Cardinality from code 0. I did not trace why the node-side decoder is not tripped there (ScanUtilwraps every scan method inFilterIterator.of), so I treat this as open rather than as "no gap". - From the same review:
prepareConditionQueryList()is guarded bycontainsLabelOrUserpropRelation()whileprepareConditionQuery()usesuserpropConditions(), so a label-only query passes the list variant. No live caller today (HstoreStore.query(List, List)is never bound,BackendStore.query(Iterator, Function, HugeGraph)is marked unused), but worth aligning in the codec fix.
Status after #3184 merged into master as 1a15e762 (2026-09-16), so that this issue keeps a clear line between what is fixed and what is still open.
Fixed by #3184 (mitigation, not the codec): HstoreTable.queryByRange(Session, IdRangeQuery) no longer pushes a sysprop-only ConditionQuery to the store, and both prepareConditionQuery* methods work on a copy instead of mutating the query core still uses. Effect measured on 5 M edges with 4 sort keys: 13/13 sort-key prefix/range shapes pass on hstore with id sets identical to rocksdb, against 8/13 store-side decode failures on master before the merge (details in the PR). Every g.V(x).outE(l).has(<sort key>...) traversal from a known vertex is therefore usable on master with HStore.
Still outstanding here:
- Item 1 of this issue, the property codec itself: the server writes raw property values, the store-side
BytesBuffer.readPropertyexpects a cardinality header. Any path that still pushes aConditionQueryand parses rows on the store trips it. Known such paths:HstoreTable.queryAll()(both exits) and the shard overloadqueryByRange(Session, Shard, ConditionQuery)(/traversers/{vertices,edges}/scan), recorded in my comment above; measured on the lab they returned rows on our data layout, so whether they fail is data dependent, not proven safe. - The guard mismatch between
prepareConditionQueryList()(containsLabelOrUserpropRelation()) andprepareConditionQuery()(userpropConditions()); no live caller today, to align in the codec fix. - Item 2 of this issue, the 22 excluded core tests with the inverted
Assume(F4 on our side): untouched by #3184. - The versioned sinking format proposed in item 1 has no owner.
If it helps, I can split 1-3 into a checklist in the issue description.
Back to item 1 (the property codec) with a full trace after #3184 landed on master (1a15e762). Two corrections to my 2026-09-16 comments first, then measurements and a proposal.
Corrections
- I wrote that the paged full scan (
has('~page', '')) reachesHstoreTable.queryAll()as aConditionQuery. Wrong:HugeGraphStep.addHasContainer()(line 184) consumes~pageviasetPage(), the has-container list stays empty andmakeQuery()builds a plainQuery, soqueryAll()pushesnull. Measured:GET /graph/{edges,vertices}?page=&limit=5→ 200, no decoder errors. - I wrote that whether
queryAll()and the shard overload fail "is data dependent". Also wrong; both are safe for reasons visible in the code: the shard overloadqueryByRange(Session, Shard, ConditionQuery)callssession.scan(table, codeFrom, codeTo, scanType, query), and that overload inHstoreSessionsImpl(lines 757-767 and 770-780) discards the condition bytes and sendsnew byte[0]. Measured: 12-shard scan through/traversers/edges/scan→ 106 edges, 0 errors, although every one of them has a DOUBLE as its first property.
The codec: every type fails, and schema does not change that
Cross-module test: a value written with the server BytesBuffer.writeProperty(PropertyKey, value) (hugegraph-core), read back with the struct BytesBuffer.readProperty(PropertyKey) (hugegraph-struct), which is exactly what FilterIterator.hasNext() does on the store for every pushed-down query. Master 1a15e762, JDK 21:
| type, value | server bytes | struct readProperty |
|---|---|---|
| DOUBLE 1.5 | 3ff8000000000000 |
Can't construct Cardinality from code 0 |
| DOUBLE 63.5 | 404fc00000000000 |
Unsupported data type UNKNOWN |
| LONG 100 | 64 |
Can't construct DataType from code 36 |
| TEXT "ETC" | 03455443 |
Can't construct Cardinality from code 0 |
| INT 7 · BOOLEAN true · FLOAT 0.5 · DATE 0 | 07 · 01 · 3f000000 · 00 |
Can't construct Cardinality from code 0 |
No type gets through; which exception fires depends only on the first byte of the value. Relevant for the fix design: the struct readProperty(PropertyKey) (BytesBuffer.java:587-596) always reads the header byte and only then sets cardinality/dataType on the key it was given, so the schema-aware path (BusinessHandlerImpl around line 700, getGraphSupplier(graph)) uses the schema for the key's identity only, not for decoding. Wiring a HugeGraphSupplier into FilterIterator fixes nothing on its own. Test source and output: https://github.com/SebastianGruza/hugegraph-validation/tree/master/results/issue-3090/codec.
The other side of the channel works: the server ConditionQuery.bytes() round-trips through the struct ConditionQuery.fromBytes() with resultType=EDGE and the conditions intact ([LABEL == 1, 1 > 1.0]), so if the bytes reached the store, parsing would start and fail on the first row with properties.
Why master does not fail: the server no longer sends any condition that forces a parse
I traced every place where HstoreTable serializes a ConditionQuery and measured each on the lab (master 1a15e762, 1 PD + 3 stores, edges with a DOUBLE as the first property; 0 decoder errors in the server and store logs after the whole series):
| path | what reaches the store | why | measured |
|---|---|---|---|
queryByPrefix / queryByRange(IdRangeQuery) by sort key, with an extra non-sort-key property (has('asset','ETC').has('epoch', gt(50)).has('amount', gt(1.0))) |
nothing | GraphTransaction.optimizeQuery() (lines 1600-1614) does query.copy() + resetUserpropConditions() once the sort keys match; HstoreStore.query() (line 400) copies the already optimized query as originQuery, so prepareConditionQuery() sees sysprops only and returns null after #3184; the rest is filtered by the server |
7 REST adjacency filters, including equality and range on amount: 200, correct sets |
non-sort-key property without an index (g.E().has('amount', gt(1.0)), g.V().hasLabel('person').has('name','zzz')) |
nothing | rejected in GraphIndexTransaction: NoIndexException |
7 Gremlin queries: 500 NoIndexException, store untouched |
queryAll(), both exits |
nothing | only a plain Query gets there: ~page is consumed in HugeGraphStep, label queries go to the label index or NoIndexException (supportsQueryByLabel()==false) |
paged edge and vertex scans: 200 |
queryByRange(Session, Shard, ConditionQuery) (/traversers/*/scan) |
empty array | HstoreSessionsImpl.scan(table, codeFrom, codeTo, …) drops query |
12 shards, 106 edges, 0 errors |
sysprop-only pushdown from queryByRange |
nothing since 1a15e762 |
#3184 | 13/13 sort-key shapes, id sets equal to rocksdb (in the PR) |
Conclusion: after #3184 there is no OLTP query that delivers ConditionQuery bytes to FilterIterator. The whole store-side "operator sinking" (FilterIterator, sort/aggregation through SortShuffleSerializer and AggregativeQueryObserver, indexIntersection) is dead code for server-written data, because each of those paths starts by parsing the row with the same readProperty. #3184 did not fix item 1; it cut the last path by which the server reached the broken parser. That changes the problem statement: not "some queries fail" but "the feature is disabled by an incompatible codec, and two guards keep it away from traffic".
Proposed direction (simpler than the versioned blob from 2026-09-02)
On 2026-09-02 I proposed a versioned pushdown blob carrying schema hints. After the trace that is unnecessary: the store has the schema. The struct SchemaDriver reads HUGEGRAPH/{cluster}/GRAPHSPACE/{gs}/GRAPH/{graph}/SCHEMA/PROPERTY_KEY/… from PD, the same path the server SchemaMetaManager writes, and BusinessHandlerImpl.getGraphSupplier(graph) already builds a SchemaGraph from it. So the codec can simply be unified on the server's schema-driven format:
- struct
BytesBuffer.readProperty/writeProperty(PropertyKey): decode by the key'sdataType/cardinality, no header byte, identical to hugegraph-core; BinaryElementSerializer.parseProperty()requires aHugeGraphSupplier;FilterIterator.of()andHgStoreWrapperExpassgetGraphSupplier(graph)instead ofnull(edge label from the schema as well, instead ofUNDEF);- the store's internal writers (
SortShuffleSerializer.writeVertex/writeEdge,AggregativeQueryObserver) move to the same codec. No data migration: the store has no persisted rows in its own format, spill files and aggregation responses are transient; - align the
prepareConditionQuery()/prepareConditionQueryList()guards (item 2 of my 2026-09-16 list); - a cross-module test in CI: server writes, struct reads, all types and cardinalities, plus a
Comparabletest forCondition.RelationType.compareon the struct side; - only afterwards, separately: decide whether the server should push user-property conditions again (today it pushes none), i.e. whether sinking returns to traffic.
Rolling upgrades are not a concern, because no bytes reach the store today: an old server with a new store and a new server with an old store behave exactly as now. Consequence for item 6: without it, 1-5 is a latent fix visible only in tests, and I treat it as such.
@imbajin @bitflicker64: is this the direction you want? If so, I'll take 1-5 as one PR across struct + store + hstore, with the test from item 5 as the first commit (red on master). If you would rather keep sinking disabled and remove the dead code, I can prepare that too, but I'd prefer not to guess.