feat: Implement write-only index state that is not considered for read queries#4894
Draft
porunov wants to merge 1 commit into
Draft
feat: Implement write-only index state that is not considered for read queries#4894porunov wants to merge 1 commit into
porunov wants to merge 1 commit into
Conversation
…d queries Signed-off-by: Oleksandr Porunov <alexandr.porunov@gmail.com>
9 tasks
porunov
added a commit
to porunov/janusgraph
that referenced
this pull request
Jul 14, 2026
…d queries Add SchemaStatus.WRITE_ONLY_ENABLED and SchemaAction.ENABLE_WRITE_ONLY. An index in this state receives updates for all graph mutations but is not used to answer queries, and SchemaAction.REINDEX preserves this state instead of automatically enabling the index. This enables the workflow "create index -> reindex it without enabling -> enable it later when necessary", as well as demoting an ENABLED index to write-only and re-enabling it later without a reindex. WRITE_ONLY_ENABLED is appended at the end of SchemaStatus because the status is persisted by its ordinal. Additional lifecycle extensions (no changes to existing workflows): - DISABLE_INDEX can be applied to an INSTALLED index, allowing an index to be created and disabled in the same management transaction so that it never receives writes until explicitly activated. - REGISTER_INDEX can be applied to a DISABLED index to re-activate it for writes with the registration barrier required for a lossless reindex. - ENABLE_INDEX, DISCARD_INDEX and MARK_DISCARDED accept WRITE_ONLY_ENABLED. - A pending index registration no longer overwrites a status change that superseded it (e.g. disabling an index while its registration acknowledgement is still pending). Add SchemaAction.REMOVE_STALE_ENTRIES which removes index entries that reference graph elements that no longer exist, for example because the element was deleted while an index status change was still propagating through the cluster or while the index was disabled. The action complements REINDEX: a reindex restores missing entries for existing elements but never removes entries, while REMOVE_STALE_ENTRIES removes entries of deleted elements but never adds entries. Composite graph indexes are cleaned by the new StaleIndexEntryRemoveJob which scans the internal index store; mixed graph indexes are cleaned by the new MixedIndexStaleEntryRemover which enumerates the documents through exists-queries against the index backend and deletes stale documents in batches, running on a background thread behind the new (cancellable) CompletableScanJobFuture. Removed and examined entries are reported through the ScanMetrics custom metrics "stale-entries-removed" and "scanned-entries". Vertex-centric indexes are not supported by this action. The index lifecycle documentation is rewritten to reflect the actual write behavior of the existing states (INSTALLED and REGISTERED indexes have always received graph updates; queries only ever use ENABLED indexes), now includes the write-only workflows, an updated state transition diagram and a new section about consistency during status transitions, and the IndexRemoveJob validation error message reports the accepted statuses derived from SchemaAction.DISCARD_INDEX instead of a stale hardcoded text. Fixes JanusGraph#4894 follow-up; supersedes the docs-only draft of that PR. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q6JuYe7uEs3dbr7MSPUtr2 Signed-off-by: Oleksandr Porunov <alexandr.porunov@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Write-only index is the
ENABLEDindex for write operations, but ignored for read operations. This way, users can disable indexes without forcing them to re-index it when enabling them back.Thank you for contributing to JanusGraph!
In order to streamline the review of the contribution we ask you
to ensure the following steps have been taken:
For all changes:
master)?For code changes:
For documentation related changes: