Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Deletes and updates in the same batch - inconsistent behavior #103

alonpilberg opened this Issue · 1 comment

2 participants


While working on an implementation of an indexing scheme atop Astyanax, I came across the following behavior which seems inconsistent. My code starts by deleting a row and then re-populating it with values:

batch.withRow(CF, "key").delete();
batch.withRow(CF, "key").putEmptyColumn("test", null);

However, this resulted in an empty row, because the same timestamp was used in both mutations. Changing the code a bit fixed that problem:

batch.withRow(CF, "key").delete().putEmptyColumn("test", null);

This is because delete() advances the internal timestamp value. The original example didn't work because withRow() creates a new ThriftColumnFamilyMutationImpl object. This seems error prone and inconsistent as I don't see a reason the behavior should be different between those 2 code segments. Note that the first example, while a bit convoluted, can more naturally happen when the deletion and creation of new values happens in different methods, which also makes using a single withRow() call much harder.
In short, I suggest withRow() returns the same object whenever it is called for the same (CF, key) pair.
A related issue is deleting and updating the same column at the same batch. Again the result is that the column is not created. In this case I think the end result should depend on the order of actions, as follows:

batch.withRow(CF, "key").deleteColumn("test").putEmptyColumn("test", null); // Expected: have an empty column "test"
batch.withRow(CF, "key").putEmptyColumn("test", null).deleteColumn("test"); // Expected: column test is deleted

This would make deleteColumn() and putColumn() behave like remove() and put() from Map.


Will be fixed in 1.56.18

@elandau elandau closed this
@DavidHerzogTU-Berlin DavidHerzogTU-Berlin referenced this issue from a commit in DavidHerzogTU-Berlin/astyanax
@elandau elandau Fix for Netflix/astyanax#103 d156015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.