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

Deletes not working with CosmosDB #764

Open
patriknw opened this issue Apr 3, 2020 · 0 comments
Open

Deletes not working with CosmosDB #764

patriknw opened this issue Apr 3, 2020 · 0 comments
Labels
1 - triaged Tickets that are safe to pick up for contributing in terms of likeliness of being accepted

Comments

@patriknw
Copy link
Member

patriknw commented Apr 3, 2020

CREATE TABLE IF NOT EXISTS test.journal (
  persistence_id text,
  partition_nr bigint,
  sequence_nr bigint,
  timestamp timeuuid,
  event text,
  PRIMARY KEY ((persistence_id, partition_nr), sequence_nr, timestamp));

INSERT INTO test.journal (persistence_id, partition_nr, sequence_nr, timestamp, event)
  VALUES ('a', 1, 1, now(), 'a1');

We would like to perform range deletes but that is not supported.

DELETE FROM test.journal WHERE
  persistence_id = 'a' AND
  partition_nr = 1 AND
  sequence_nr >= 0 AND
  sequence_nr <= 17;

InvalidRequest: Error from server: code=2200 [Invalid query] message="Only EQ relation is supported on the partition key for now for DELETE statements"

A less efficient alternative would be to delete each row separately, but that doesn't behave in the same way as Apache Cassandra.

DELETE FROM test.journal WHERE
  persistence_id = 'a' AND
  partition_nr = 1 AND
  sequence_nr = 1;

InvalidRequest: Error from server: code=2200 [Invalid query] message="Some clustering keys are missing"

The missing clustering key is the timestamp. Apache Cassandra doesn't require that all clustering keys are defined for deletes.

A workaround for that could be to not have the timestamp as a clustering key for CosmosDB. I still think we should have it for Cassandra because it's nice that we don't overwrite when accidentally using same pid/seqnr.

We also have the timebucket, but that can be removed #399

@chbatey chbatey added the 1 - triaged Tickets that are safe to pick up for contributing in terms of likeliness of being accepted label Apr 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 - triaged Tickets that are safe to pick up for contributing in terms of likeliness of being accepted
Projects
None yet
Development

No branches or pull requests

2 participants