Skip to content
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 schema version id to commit queries #1061

Merged
merged 4 commits into from
Jan 31, 2023

Conversation

AndrewSisley
Copy link
Contributor

Relevant issue(s)

Resolves #1006

Description

Adds schema version id to commit queries.

Also persists schema version id on field commit blocks as discussed earlier - this is because it is quite difficult to find the composite commit from the field commit, as well as being a little strange ideologically. In the future we may break this property out to a new index/key to save space/duplication, but not now.

@AndrewSisley AndrewSisley added feature New feature or request area/query Related to the query component area/schema Related to the schema system area/db-system Related to the core system related components of the DB action/no-benchmark Skips the action that runs the benchmark. labels Jan 30, 2023
@AndrewSisley AndrewSisley added this to the DefraDB v0.5 milestone Jan 30, 2023
@AndrewSisley AndrewSisley requested a review from a team January 30, 2023 21:16
@AndrewSisley AndrewSisley self-assigned this Jan 30, 2023
@AndrewSisley AndrewSisley force-pushed the sisley/feat/I1006-schema-version-commit-2 branch from 6b75761 to 79ad6f0 Compare January 30, 2023 21:17
Spotted whilst looking for a type, this variable is no longer used and can be removed
Will be added to shortly
@codecov
Copy link

codecov bot commented Jan 30, 2023

Codecov Report

Merging #1061 (3fa9e4f) into develop (c9a155a) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #1061      +/-   ##
===========================================
+ Coverage    68.19%   68.21%   +0.01%     
===========================================
  Files          173      173              
  Lines        16330    16338       +8     
===========================================
+ Hits         11137    11145       +8     
  Misses        4261     4261              
  Partials       932      932              
Impacted Files Coverage Δ
planner/mapper/commitSelect.go 0.00% <ø> (ø)
request/graphql/schema/manager.go 97.34% <ø> (ø)
core/crdt/lwwreg.go 76.66% <100.00%> (+0.80%) ⬆️
merkle/crdt/lwwreg.go 83.78% <100.00%> (+0.45%) ⬆️
planner/commit.go 83.52% <100.00%> (+0.39%) ⬆️

@AndrewSisley AndrewSisley force-pushed the sisley/feat/I1006-schema-version-commit-2 branch from 79ad6f0 to 3fa9e4f Compare January 30, 2023 21:36
Copy link
Collaborator

@fredcarle fredcarle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Just one suggestion that you can apply or not :)

Comment on lines +60 to +64
SchemaVersionID string
Priority uint64
Data []byte
DocKey []byte
}{delta.SchemaVersionID, delta.Priority, delta.Data, delta.DocKey})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Since the struct represents the LWWRegDelta struct, you could probably just use

LWWRegDelta{delta.SchemaVersionID, delta.Priority, delta.Data, delta.DocKey}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed a bit in the standup - this comment prompted the creation of #1065. In the short term I'll leave this as is, as it is not new and can be sorted out better if done in a dedicated yet broader ticket.

Copy link
Member

@shahzadlone shahzadlone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@AndrewSisley AndrewSisley merged commit a4c6869 into develop Jan 31, 2023
@AndrewSisley AndrewSisley deleted the sisley/feat/I1006-schema-version-commit-2 branch January 31, 2023 19:17
shahzadlone pushed a commit that referenced this pull request Apr 13, 2023
* Remove deadcode

Spotted whilst looking for a type, this variable is no longer used and can be removed

* Break up long line

Will be added to shortly

* Persist schemaVersionId on field commits

* Add SchemaVersionId to commit query
shahzadlone pushed a commit to shahzadlone/defradb that referenced this pull request Feb 23, 2024
* Remove deadcode

Spotted whilst looking for a type, this variable is no longer used and can be removed

* Break up long line

Will be added to shortly

* Persist schemaVersionId on field commits

* Add SchemaVersionId to commit query
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action/no-benchmark Skips the action that runs the benchmark. area/db-system Related to the core system related components of the DB area/query Related to the query component area/schema Related to the schema system feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add schema version identifier field to commit queries
3 participants