Repository navigation
Reference data: show an unfinished import as importing or incomplete, not 0 - #269
Merged
Merged
Conversation
… not 0 A shared-store set's count was written only when its import finished (_finalize), while its hashes are committed in batches as it runs. So a set still being imported, or one whose import stopped part-way (GLEAPP closed, an error), listed as 0 beside the hashes it holds. - _create_set leaves count NULL until _finalize writes it; sets() reports a status: complete, importing (this process is importing it) or incomplete (count NULL, or 0 with entries, as an earlier version left it) - the Reference data and Project VIC lists show "importing..." or "incomplete - add it again" with the reason in a tooltip; the Reference data dialog reloads its list when opened, and both lists reload after a failed import too - gleapp hashset --list prints the same instead of failing on a NULL count - _bulk_end no longer repeats the checkpoint and ANALYZE outside the guard, so a failure there cannot cost the count once every entry is stored - MANUAL.md and help.html describe the two states Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Problem
A user who imported NSRL RDS sets saw some of them listed as 0 in the Reference data dialog while the hashes were visibly in the store.
The number in that list is
hashsets.count, which is written only once an import finishes (hashstore._finalize). The hashes are committed in batches of 100,000 as the import runs. So any set whose import has not reached the end reads 0:ANALYZEtail of_bulk_endskipped_finalizeeven after every entry was stored. The set keeps what was stored and is still matched against cases.Reproduced on a scratch store by ending an import after 200,000 hashes:
count=0, 200,000 MD5 rows stored.Change
_create_setleavescountNULL until_finalizewrites it.hashstore.sets()adds astatus:completeimporting: this process is importing the setincomplete:countis NULL, or 0 with entries, which is how an earlier version left an unfinished set. A 0 with nothing stored stays a real 0.gleapp hashset --list: prints the same instead of failing on a NULL count._bulk_end: no longer repeats the checkpoint andANALYZEoutside thetry, so a failure there can't cost the count once every entry is stored.docs/MANUAL.mdandhelp.htmldescribe the two states.Limitation: a set being imported by another GLEAPP process (a second window, the command line) reads incomplete in this one until that import finishes. The tooltip and the manual say so.
Testing
tests/test_reference_set_status.py, 6 tests: an interrupted import reads as incomplete, keeps its entries, and re-adding it replaces it; importing during an import; a failed list import leaves nothing behind; the old 0-with-entries case; a failingANALYZEno longer costs the count; and the CLI--listoutput. All 6 fail onmain.tools/lint_changed.py: no new warnings.check_line_endings.sh: all LF.🤖 Generated with Claude Code