-
-
Notifications
You must be signed in to change notification settings - Fork 24
Implement self ref fk ordering #322
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
ozer550
wants to merge
7
commits into
learningequality:release-v0.9.x
Choose a base branch
from
ozer550:implement-self-ref-fk-ordering
base: release-v0.9.x
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
207fcab
add _self_ref_order field
ozer550 0f309c3
implement ordering
ozer550 c192222
update store write path
ozer550 6397c61
carry _self_ref_order through Sync API, Queue and Dequeue
ozer550 40be75d
implement server compute order during the dequeue stage
ozer550 e67fbd0
refactor self-ref order fallback to use model-scoped db updates
ozer550 d1325b0
update the child ordering to be incremental
ozer550 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -178,5 +178,6 @@ class Meta: | |
| "profile", | ||
| "rmcb_list", | ||
| "_self_ref_fk", | ||
| "_self_ref_order", | ||
| ) | ||
| read_only_fields = fields | ||
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| # Generated by Django 3.2.25 on 2026-04-22 10:53 | ||
|
|
||
| import django.core.validators | ||
| from django.db import migrations, models | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
|
|
||
| dependencies = [ | ||
| ('morango', '0002_store_idx_morango_deserialize'), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.AddField( | ||
| model_name='buffer', | ||
| name='_self_ref_order', | ||
| field=models.IntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(0)]), | ||
| ), | ||
| migrations.AddField( | ||
| model_name='store', | ||
| name='_self_ref_order', | ||
| field=models.IntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(0)]), | ||
| ), | ||
| ] |
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
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So from our discussion on slack and seeing this, I think some of the behaviors have been taken very literally, which is my fault for not making that clearer.
We might need to query the database for this, but I think it's worth thinking through how and when this should occur. This satisfies the criteria of the behavior, but the engineering choices are up to you. The behaviors are not meant to be taken literally that this functionality should explicitly be placed here.
I say this for a couple reasons:
StoreLookupwe do bulk queries for the store records, and howStoreUpdateactually does none. There's room for improvement in managing these queries.test_handle_store_create__self_ref_parent_not_in_storeand whether that is an acceptable outcome.More on (2): say we have our buffer batch size set to 2. In the first batch, we have a parent and a child. Since the batch size is two, the parent won't be saved yet when the child is processed, so this function should result in
None. Then lets say batch #2 has two more children, of the first child (grandchildren). The function should find the store, but the store would have aNoneorder, leading toNonefor the grandchildren. Thus we have a parent-child relationship which could get out of order because ofNone.