Repository navigation
Check a fragment's NodeId index on each database it is used on - #598
Merged
Merged
Conversation
The unindexed-NodeId warning checked a fragment only on the databases whose catalogs name it. A fragment catalogued for one database and saved to another was never warned of on the other, though every save there scans the label. Each operation of an object manager now tells the check which database a fragment is used on, by the name it is registered under: saves, loads, counts, searches, deletes, patches, edges and groups. A view counts its root, its nested views and the targets of its relationship fragments. A use on a database already listed is checked at once, and one not yet listed when an enforce lists it. After the first use on a database, a use costs one lookup, without the lock; it never reads the store and never raises. As drivine4j#894 (drivine4j#858).
…s, and that a used class can still be collected (#552)
…, and say the catalogued rule's docs name used-on databases (#552)
Draft
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.
Closes #552
Until now, the unindexed-
@NodeIdwarning checked a fragment only on the databases whose catalogs name it. A fragment catalogued for one database and saved to another was never warned of on the second, though every save there scans the label. This port of drivine4j#894 (drivine4j#858) closes that gap.Each operation of an object manager now tells the check which database a fragment is used on, by the name the database is registered under, so a manager for
defaultcounts as its first registered database:load_all,load,count,load_nearest,load_matching,save,create,update,delete,delete_all,save_all,patchandpatch_all.edgescounts both nodes it matches by id, and the target class ofload_related.groupscounts the fragment it groups.A fragment is checked on a database it was used on, or wherever the existing catalog rule already checked it. So every warning given before is kept, and the databases a fragment is used on are added. A use on a database that an enforce has already listed is checked at once. A use on one not listed yet is checked when an enforce lists it.
After the first use on a database, a use costs one lookup, without the lock. The check never reads the store and never raises. With no
SchemaManager, nothing changes.docs/07-schema.mddescribes the new rule.Tests (
tests/unit/test_node_id_index_check.py):edgesand of itsgroups, on SQLite, on the async and sync API, through the manager fordefault. Removing any hook fails the test.aand saved tobis warned of on both.Unit: 3226 passed. Whole suite with Oracle (
ORACLE_TESTS=true) on the final commit:tests/integration: 4710 passed, 291 skipped, 7 xfailed, 1 xpassed, 0 failedtests/sync_integration: 4640 passed, 290 skipped, 7 xfailed, 1 xpassed, 0 failedReview: 3 passes, last CLEAN.