-
Notifications
You must be signed in to change notification settings - Fork 44
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
feat: Add Defra-Lens support for branching schema #2421
feat: Add Defra-Lens support for branching schema #2421
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #2421 +/- ##
===========================================
- Coverage 74.92% 74.86% -0.06%
===========================================
Files 268 268
Lines 25888 25875 -13
===========================================
- Hits 19395 19371 -24
- Misses 5169 5178 +9
- Partials 1324 1326 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 8 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
527d1e5
to
8d61158
Compare
lens/history.go
Outdated
} | ||
targetHistoryItem, ok := history[targetSchemaVersionID] | ||
if !ok { | ||
// If the target schema version is unknown then there are possible no migrations |
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.
typo: possibly
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.
cheers, is actually in the wrong place, should be on the right side of no
- Move word
cols, err := description.GetCollectionsBySchemaRoot(ctx, txn, schemaRoot) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
history := map[collectionID]*schemaHistoryLink{} | ||
history := map[schemaVersionID]*schemaHistoryLink{} | ||
schemaVersionsByColID := map[uint32]schemaVersionID{} | ||
|
||
for _, c := range cols { | ||
col := c |
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.
question: (I know it's from a different PR but I might of missed it then) I don't think this necessary. Why did you decide to do this?
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.
I have no idea, might have made sense at one point, or it might have been a brain-fart.
I'll remove it shortly before merge.
- Remove odd var copy
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.
I found out, it is because we want a pointer to it, and the way Go works means that without the copy col
would always be the last col in cols
.
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.
Thanks for reminding me of this. Could you add a TODO remove when Go 1.22
comment above it please.
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.
Ah nice, glad that will fix it - will do
- Add too comment
4bc7c0c
to
d17eceb
Compare
I think I accidentally commited this in my last PR
7827019
to
07c3167
Compare
"github.com/sourcenetwork/defradb/tests/lenses" | ||
) | ||
|
||
func TestSchemaMigrationQueryWithP2PReplicatedDocOnOtherSchemaBranch(t *testing.T) { |
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.
thought: This test should propably be in the net replicator test no?
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.
It fits in both directories just as well IMO - I probably prefer it here because I see it more from a schema migration perspective, and you probably see it in the net
directory as you see it more from a P2P perspective.
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.
In a sense, everything that is in the net
directory also relate to some other test directory. In my mind, as soon as a test is interacting with the P2P system, it would be better placed in the net
package.
tests/integration/schema/migrations/query/with_p2p_schema_branch_test.go
Show resolved
Hide resolved
tests/integration/schema/migrations/query/with_p2p_schema_branch_test.go
Outdated
Show resolved
Hide resolved
}, | ||
testUtils.WaitForSync{}, | ||
testUtils.Request{ | ||
// Node 0 should yield results as they were defined, as the newer schema version is |
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.
todo: delete comment
- delete comment
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.
LGTM! Thanks for answering all my comments and questions.
Thanks for finding a bunch of stuff (including the ones raised on discord) :) |
e7133c4
to
9270daf
Compare
Relevant issue(s)
Resolves #2293
Description
Adds Defra-Lens support for branching schema.
Defra will now be able to handle migrations for a branching schema version DAG.