basho / riak

Riak is a decentralized datastore from Basho Technologies.
http://docs.basho.com
Apache License 2.0
3.94k stars 536 forks source link

riak-ts: can't delete keys #937

Open jamesruan opened 6 years ago

jamesruan commented 6 years ago

I'm using a ts 1.5.2. Following code is running in riak-expoler. It has similar output in riak-shell.

select * from logv2 where time > '2018-03-15 00:00' and time < '2018-04-15 00:00' and type = 'log'

[1522235100839, "go logger client", "log", "[DEBUG]", "test log debug"], 
[1522235100880, "go logger client", "log", "[TRACE]", "test log trace"], 
[1522235100919, "go logger client", "log", "[INFO ]", "test log info"], 
...

delete from logv2 where time = 1522235100839 and type = 'log'

500 Internal Server Error trying to execute query 

Server error: {1009,Unable to get delete key: [\"invalid key\"]}

delete from logv2 where time > '2018-03-15 00:00' and time < '2018-04-15 00:00' and type = 'log'

500 Internal Server Error trying to execute query 

Server error: {1009, Unable to get delete key: \"Invalid clause {'<',<<\\\"time\\\,{integer,1523750400000}}\\nInvalid clause {'>',<<\\\"time\\\,{integer,1521072059999}}\\n\"}

describe logv2

["time", "timestamp", false, 2, 2, 1, "d", []], 
["source", "varchar", false, [], 
3, [], 
[], 
[]], 
["type", "varchar", false, 1, 1, [], 
[], 
[]], 
["subtype", "varchar", false, [], 
4, [], 
[], 
[]], 
["text", "blob", false, [], 
[], 
[], 
[], 
gordonguthrie commented 6 years ago

What is your key defintion? I would expect it to be 'time' and 'source' at least.

Your delete statement needs to cover the entire key

What is the CREATE TABLE you used to create the table

http://docs.basho.com/riak/ts/1.5.2/using/querying/delete/

jamesruan commented 6 years ago

Sorry to reply late.

I'm no longer having access to the server. So I can not provide more info for this case. As far as I remember the key is time+type, indexed further by source subtype.

If in case that the delete has not cover the entire key, why would the select be successful?