Thanks Ben, Paul, Alain. I debug at client side find the reason is pub_timestamp duplicated. I will use timeuuid instead.
Thanks, Linbo 2016-06-15 13:09 GMT+08:00 Alain Rastoul <alf.mmm....@gmail.com>: > On 15/06/2016 06:40, linbo liao wrote: > >> I am not sure, but looks it will cause the update other than insert. If >> it is true, the only way is request includes IF NOT EXISTS, inform the >> client it failed? >> >> Thanks, >> Linbo >> >> Hi Linbo, > > +1 with what Ben said, timestamp has a millisecond precision and is a bad > choice for making PK unicity. > If your client and server are on the same physical machine (both on same > computer or different vms on same hypervisor), insert duration can go down > to very few microseconds (2~3 on a recent computer). > Your insert will/should often become "update". > The reason is that update does not exists in cassandra, neither delete, > they are just "appends": append with same key for update or append of a > tombstone for delete. > You should try to use a timeuuid instead, it has a node, clock sequence, a > counter plus the timestamp part that you can get with cql functions, and it > exists for that use. > see here for the functions > > https://docs.datastax.com/en/cql/3.3/cql/cql_reference/timeuuid_functions_r.html > > > -- > best, > Alain >