Skip to content
This repository has been archived by the owner on May 13, 2022. It is now read-only.

[Vent] Support deletion of multiple rows #1403

Open
silasdavis opened this issue Aug 26, 2020 · 1 comment
Open

[Vent] Support deletion of multiple rows #1403

silasdavis opened this issue Aug 26, 2020 · 1 comment

Comments

@silasdavis
Copy link
Contributor

Currently we only support deletion (logic here: https://github.com/hyperledger/burrow/blob/master/vent/service/rowbuilder.go#L46) of single rows by only accepting primary keys (and all parts of composite). This makes sense as as a safer behaviour.

However sometimes it is useful to delete multiple rows with a partial match on primary key (or indeed any key) as in the case of cleaning up orphaned rows in a link table.

We could provide a DeleteMode flag on the projection and/or we could decide to give meaning the the value of the delete marker field which can currently be anything (usually 0). Instead we could say DeletePrimary == 0 DeletePartialPrimary == 1 DeleteMultiple == 2 or something like that.

The latter is simpler to implement but we probably want the flag for safety. The fields in a delete projection are intended to match the primary keys (other keys are ignored). Currently it is an error if we do not have all primary keys set. Perhaps DeleteMode == "Primary" should be default like current behaviour and can be omitted, and DeleteMode == "Matching" will delete any rows that match.

@silasdavis
Copy link
Contributor Author

silasdavis commented Aug 26, 2020

Come to think of it, it's not clear to me why we don't control deletion entirely from the projection spec, there's not really any need for the marker field.

I think this was introduced before we had access to the EventName in a projection filter. The event name is enough to convey deletion semantics in every usage I can think of (usually LogFooBlahDeletion).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

1 participant