You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Ted Zlatanov <tz...@lifelogs.com> on 2010/03/15 21:41:34 UTC

bundled mutations (Deletion+insertion of the same SuperColumn)

Can there be any assurance that if I specify a Deletion and an insertion
for a specific SuperColumn in the same batch_mutate() call, they will
happen atomically?

In other words I want to make sure readers don't get a missing value for
that SuperColumn if their read should occur after the Deletion but
before the insertion.

Ted


Re: bundled mutations (Deletion+insertion of the same SuperColumn)

Posted by Jonathan Ellis <jb...@gmail.com>.
In that case you should do the insert first, then the delete in a
separate mutation (with, presumably, an older timestamp).

2010/3/15 Ted Zlatanov <tz...@lifelogs.com>:
> Can there be any assurance that if I specify a Deletion and an insertion
> for a specific SuperColumn in the same batch_mutate() call, they will
> happen atomically?
>
> In other words I want to make sure readers don't get a missing value for
> that SuperColumn if their read should occur after the Deletion but
> before the insertion.
>
> Ted
>
>

Re: bundled mutations (Deletion+insertion of the same SuperColumn)

Posted by Ted Zlatanov <tz...@lifelogs.com>.
On Mon, 15 Mar 2010 16:45:49 -0400 Jake Luciani <ja...@gmail.com> wrote: 

JL> On Mar 15, 2010, at 4:41 PM, Ted Zlatanov <tz...@lifelogs.com> wrote:

>> Can there be any assurance that if I specify a Deletion and an
>> insertion for a specific SuperColumn in the same batch_mutate() call,
>> they will happen atomically?

JL> Timestamps.

Sorry to be dense but this is not really explained in
http://wiki.apache.org/cassandra/API or anywhere else on the wiki so I
need to ask for more help.  I looked in the archives and threads like
"why does remove need a timestamp?" talk about this but only about the
remove or get operations in isolation, not together.  I understand
removal timestamps need to be larger than the old data's timestamps.

The API page section on Deletion says it operates on Columns "matching
the specified timestamp" but it's not clear what kind of match this is
('>' or '>=').  If my mutation is:

Deletion("hello", T1) +
... insertion wrapper(SuperColumn("hello", new Column("x", "y", T2)))

What should T1 and T2 be, assuming all existing columns in "hello" have
a timestamp of a minute ago (guaranteed lower than T1 and T2 because
there's only one writer)?  Should I make T1 the current time minus one
and T2 the current time?  My goal is to ensure that "hello" is never
empty to readers.  I'm trying to avoid even a 1-millisecond gap because
I have hundreds of fast readers and there's a good chance they'll hit
it.

Thanks
Ted


Re: bundled mutations (Deletion+insertion of the same SuperColumn)

Posted by Jake Luciani <ja...@gmail.com>.
Timestamps.

On Mar 15, 2010, at 4:41 PM, Ted Zlatanov <tz...@lifelogs.com> wrote:

> Can there be any assurance that if I specify a Deletion and an  
> insertion
> for a specific SuperColumn in the same batch_mutate() call, they will
> happen atomically?
>
> In other words I want to make sure readers don't get a missing value  
> for
> that SuperColumn if their read should occur after the Deletion but
> before the insertion.
>
> Ted
>