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

Fix metadata indexes #93

Merged
merged 3 commits into from
Feb 9, 2021
Merged

Fix metadata indexes #93

merged 3 commits into from
Feb 9, 2021

Conversation

dchiquito
Copy link
Contributor

Fixes #88

This raised some interesting problems with uniqueness. Django has two ways of specifying uniqueness constraints, unique_together (older) and UniqueConstraint (newer, preferred). However, both create a btree index over all the fields, which is the cause of the issues mentioned in #88. I could not find a way to force them to use a different index.

I believe in the current implementation it is safe to simply remove the constraint entirely. VersionMetadata and AssetMetadata are always created like this:

VersionMetadata.objects.get_or_create(name=..., metadata=...)

This will fetch the existing VersionMetadata if it already exists, and given that VersionMetadata are immutable, a duplicate VersionMetadata should never be created.

I added HashIndexes to replace the btree indexes provided from the unique_together, so lookups should still be performant.

@dchiquito dchiquito merged commit b520fcd into master Feb 9, 2021
@dchiquito dchiquito deleted the 88-metadata-index branch February 9, 2021 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error when creating attempting to insert dandiset metadata
2 participants