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

Fixes Issue 366 #376

Merged
merged 14 commits into from
Apr 29, 2024
Merged

Fixes Issue 366 #376

merged 14 commits into from
Apr 29, 2024

Conversation

tywalch
Copy link
Owner

@tywalch tywalch commented Apr 28, 2024

No description provided.

tywalch added 4 commits April 12, 2024 11:42
…ch`, and `upsert`.

The operations `update`, `patch`, and `upsert` will need to change their current behavior when encountering a `false` value from `condition`. In that case, these operations will actually need to `delete` the `pk` and `sk` for that index.
The condition callback will be invoked only when a composite attribute associated with an index is set via an update, patch, or upsert. [existing behavior]
The condition callback is provided the attributes being set on that particular operation, including the item's identifying composite attributes. [existing behavior]
If the condition callback returns true, ElectroDB will attempt to create the index and all of its associated keys. If an index cannot be created because an update operation only has enough context for a partial key, ElectroDB will throw. [the original issue here, fixed]
If the condition callback returns false, the index and all of its associated keys will be removed from the item. [new behavior]
Item #1 above is the key to solving the issue you bring up in your first comment, and it's actually what we do currently. This means that condition would only be called when an index must be recalculated. furthermore, as described in #3, ElectroDB will actually throw if your update operation (set and remove) lacks a full composite context and would result in a "partial" key. This would mean that all * -> true transitions are already validated to have all the composite parts necessary to recreate the complete index already.
Checkpointing initial pass at new condition tests, tests not passing.
@tywalch tywalch changed the title Issue/366 Fixes Issue 366 Apr 28, 2024
Copy link

netlify bot commented Apr 28, 2024

Deploy Preview for electrodb-dev canceled.

Name Link
🔨 Latest commit 87521c4
🔍 Latest deploy log https://app.netlify.com/sites/electrodb-dev/deploys/662fef11aace700008234ac3

@tywalch tywalch merged commit caffc1b into master Apr 29, 2024
8 checks passed
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.

Index condition does only identify impacted pk on upsert and not on patch or update
1 participant