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

Update the datastore interface to return the number of deleted relationships #2265

Merged
merged 1 commit into from
Mar 10, 2025

Conversation

josephschorr
Copy link
Member

@josephschorr josephschorr commented Mar 9, 2025

This will be added to the API in a followup

@josephschorr josephschorr requested review from vroldanbet and a team as code owners March 9, 2025 09:27
@github-actions github-actions bot added area/api v1 Affects the v1 API area/datastore Affects the storage system area/dispatch Affects dispatching of requests labels Mar 9, 2025
@josephschorr josephschorr force-pushed the deleted-rel-count branch 2 times, most recently from d1c65ab to b1eda0f Compare March 10, 2025 09:54
@github-actions github-actions bot removed the area/dispatch Affects dispatching of requests label Mar 10, 2025
Copy link
Contributor

@vroldanbet vroldanbet 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 two nits

@@ -391,7 +391,7 @@ func (rwt spannerReadWriteTXN) DeleteNamespaces(ctx context.Context, nsNames ...
// Ensure the namespace exists.

relFilter := &v1.RelationshipFilter{ResourceType: nsName}
if _, err := deleteWithFilter(ctx, rwt.spannerRWT, relFilter); err != nil {
if _, _, err := deleteWithFilter(ctx, rwt.spannerRWT, relFilter); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

hmm, are we dropping relationships if a namespace is deleted? Isn't that supposed to be an error?

Copy link
Member Author

Choose a reason for hiding this comment

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

No; this has been a long-standing internal thing we've done. We still verify you cannot do so, but it is at the API layer, so this operation usually no-ops

@@ -504,11 +504,12 @@ type ReadWriteTransaction interface {
WriteRelationships(ctx context.Context, mutations []tuple.RelationshipUpdate) error

// DeleteRelationships deletes relationships that match the provided filter, with
// the optional limit. If a limit is provided and reached, the method will return
// true as the first return value. Otherwise, the boolean can be ignored.
// the optional limit. Returnds the number of deleted relationships. If a limit
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// the optional limit. Returnds the number of deleted relationships. If a limit
// the optional limit. Returns the number of deleted relationships. If a limit

@josephschorr josephschorr added this pull request to the merge queue Mar 10, 2025
Merged via the queue into authzed:main with commit 47c99ad Mar 10, 2025
41 checks passed
@josephschorr josephschorr deleted the deleted-rel-count branch March 10, 2025 10:25
@github-actions github-actions bot locked and limited conversation to collaborators Mar 10, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/api v1 Affects the v1 API area/datastore Affects the storage system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants