Skip to content

Back the local metastore with an in-memory ByteArrayStore - #413

Merged
em3s merged 9 commits into
mainfrom
feature/bytearray-labels
Jul 16, 2026
Merged

em3s merged 9 commits into
mainfrom
feature/bytearray-labels

Conversation

@em3s

@em3s em3s commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Replace the H2-backed local store inside LocalBackedJdbcHashLabel with a single in-memory ByteArrayStore, removing H2 from the production runtime.

The store is created once in Graph and shared through GraphDefaults.localStore; the local side becomes a ByteArrayIndexedLabel while the global side stays a JdbcHashLabel on MySQL. createDatabase no longer provisions a separate local H2 database.

Builds on the ByteArrayStore-backed labels now on main (#421). Previously the tail of a 3-PR stack; #418 (dead inspector/endpoint removal) and #421 (the ByteArrayStore labels) have since merged, so this now targets main directly.

Changes

  • LocalBackedJdbcHashLabel now takes injected labels — local is a ByteArrayIndexedLabel over the shared graph.localStore, global stays JdbcHashLabel. indexName=null scans (DdlService.getAll) route to a synthetic __default__ prefix-scan index.
  • Drop localMetastore from Graph / GraphDefaults, add localStore, and remove the H2 branch of createDatabase.
  • Keep H2 as a runtimeOnly dependency: the global metastore still falls back to in-memory H2 when no metastoreUrl is configured, so the server must keep the driver on the runtime classpath.
  • InitialSpec verifies the system metadata by decoding hash edges straight from the shared local store; LocalBackedJdbcHashLabelSpec covers the overlay round-trip and the indexName=null scan routing; GraphFixtures is updated to build labels over the shared local store.

How to Test

  • ./gradlew build
  • LocalBackedJdbcHashLabelSpec covers the local write/read round-trip and __default__ scan routing.
  • Boots cleanly with the default profile (H2 metastore fallback) — verified Started ServerApplicationKt with bootRun.

AI Assistance

  • This PR was written largely with AI assistance.
    • Tool / model: Claude Opus 4.8

@em3s em3s self-assigned this Jul 15, 2026
@em3s em3s changed the title Add ByteArrayStore-backed Hash/Indexed labels Back the local metastore with an in-memory ByteArrayStore (drop H2) Jul 15, 2026
em3s and others added 3 commits July 16, 2026 00:37
MetastoreInspector and MetastoreController only powered the debug
/graph/v2/metastore/{global,local} dump endpoints, which are unused.
Drop them along with the two inspector beans and the Graph property.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Add ByteArrayHashLabel and ByteArrayIndexedLabel, storage-agnostic twins
of the HBase labels backed by an in-memory ByteArrayStore. Every edge
kind is encoded in the row key, so a single ordered store reproduces the
HBase semantics without table provisioning.

ByteArrayLabelSpec drives them without a Graph, covering the hash
round-trip, delete, degree counter, and indexed range scan.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Replace the H2-backed local metastore with a single in-memory
ByteArrayStore created once in Graph and shared through
GraphDefaults.localStore. LocalBackedJdbcHashLabel now overlays a
ByteArrayIndexedLabel (local) on top of the JDBC global metastore, and
createDatabase no longer provisions a separate local H2 database.

InitialSpec verifies the system metadata by decoding hash edges straight
from the shared local store; LocalBackedJdbcHashLabelSpec covers the
overlay round-trip and the indexName=null scan routing.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@em3s
em3s force-pushed the feature/bytearray-labels branch from f8c9297 to 937bcde Compare July 15, 2026 15:43
@em3s em3s changed the title Back the local metastore with an in-memory ByteArrayStore (drop H2) Back the local metastore with an in-memory ByteArrayStore Jul 15, 2026
@em3s
em3s changed the base branch from main to bytearray-a July 15, 2026 15:44
Base automatically changed from bytearray-a to bytearray-c July 16, 2026 00:46
Base automatically changed from bytearray-c to main July 16, 2026 01:23
em3s and others added 5 commits July 16, 2026 10:24
main replaced ByteArrayLabelSpec with the backend-agnostic
AbstractLabelCompatibilityTest (#421). After merging main this branch
carried both, testing the same four cases twice; remove the stale kotest
spec.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
…dundant case

Rewrite the kotest StringSpec as a JUnit 5 test and drop the write
round-trip case, which duplicates ByteArrayLabelCompatibilityTest. Keep
only the indexName=null -> __default__ scan routing, which is unique to
LocalBackedJdbcHashLabel.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@em3s
em3s marked this pull request as ready for review July 16, 2026 01:52
@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. enhancement New feature or request labels Jul 16, 2026
@em3s

em3s commented Jul 16, 2026

Copy link
Copy Markdown
Contributor Author

LocalBackedJdbcHashLabel was backed by two JDBC databases. This PR demonstrates that its local side can be replaced with a different storage - one that is IndexedLabel (EdgeTable in v3), where it used to be a HashLabel - without any storage-backend infra, since the replacement is memory-backed. It's a good starting point for consolidating the metastore onto the datastore://.

The global JdbcHashLabel does not support counting and returns a -1
sentinel row per src. Merging it into count() polluted the result with
that sentinel. Count the local store only; the single-src override is
dropped in favor of the Label interface default that delegates to the
srcSet form.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@em3s

em3s commented Jul 16, 2026 •

Copy link
Copy Markdown
Contributor Author

Merging

@em3s
em3s merged commit 3cc3c28 into main Jul 16, 2026
2 checks passed
@em3s
em3s deleted the feature/bytearray-labels branch July 16, 2026 02:39
em3s added a commit that referenced this pull request Jul 16, 2026
Merging main brought in the in-memory ByteArrayStore local metastore (#413),
whose ByteArrayIndexedLabel rejects unknown index names. The empty-src scan
test still requested created_at_desc, which the old H2 path silently ignored.
Route it through indexName=null (__default__), the real scan path for
metastore-backed HASH labels.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant