Repository navigation
Skip __count__ sentinel group in mutation path - #396
Conversation
The `__count__` group is a sentinel reserved for AGG query interface compatibility and topk metadata; reads delegate to native EdgeCount instead of EdgeGroup. Without this guard, mutations on tables whose groups include `__count__` would still emit an unnecessary EdgeGroupRecord (HBase Increment). Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <[email protected]> Co-Authored-By: Happy <[email protected]>
…-group case Group validation isn't implemented yet, but the sentinel is intended to only ever be registered with empty fields going forward, so the tests reflect that instead of an arbitrary field list. Also add the sentinel-mixed-with-a-real-group case to MultiEdgeStrategy to match the existing Edge coverage. Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <[email protected]> Co-Authored-By: Happy <[email protected]>
|
Addressed offline review feedback from @em3s: don't special-case Follow-up commit replaces the standalone |
Comparing directly against a single constant meant every future reserved group name would need its own equality check wired in by hand. Constants.Group.Reserved centralizes reserved names in one enum; EdgeMutationBuilder now skips any group via Reserved.contains(), so adding a new reserved name is a one-line enum entry with nothing else to keep in sync. Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <[email protected]> Co-Authored-By: Happy <[email protected]>
The enum added per-entry skipsGroupMutation tracking, but that's more machinery than the read path uses for the same sentinel (QueryService still does a plain equality check against COUNT_SENTINEL). Keep Constants.Group.COUNT_SENTINEL as a single constant and move the reserved-name set into EdgeMutationBuilder, where the mutation-skip behavior actually lives. Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <[email protected]> Co-Authored-By: Happy <[email protected]>
|
Follow-up on the exclude-set approach: I initially replaced the constant with a |
|
Optimistic Merge |
Summary
__count__is a sentinel group name reserved for AGG query interface compatibility and global topk metadata, added in #387. On read, it delegates to the native EdgeCount query instead of a real EdgeGroup lookup, so it never needs an EdgeGroup row of its own. The mutation path didn't know about this yet: if a table'sgroupsmetadata included__count__, every edge insert/update/delete would still emit an unnecessaryEdgeGroupRecord(HBaseIncrement) for it.Follow-up to #387, which introduced the
__count__sentinel on the read path.Changes
core/.../edge/mutation/EdgeMutationBuilder.kt—buildGroupRecords()now skips any group whose name equalsConstants.Group.COUNT_SENTINEL, before building itsEdgeGroupRecords. This function is the single choke point for all three mutation transitions (CREATED / DELETED / UPDATED), so one guard covers the whole write path.core/.../edge/mutation/EdgeMutationBuilderTest.kt— 3 new cases: CREATED with only a__count__group produces nogroupRecords(Edge and MultiEdge strategies); a__count__group mixed with a real group is skipped while the real group's records are still produced correctly.Out of scope: bulk-load doesn't have an EdgeGroup encoder yet (#389); the same skip will need to be added there once it exists.
How to Test
./gradlew :core:test --tests '*EdgeMutationBuilderTest'Regression check for the existing sentinel read path:
AI Assistance