s7/scale7-pelops — Issue #63: Reusing deleted row key
Author: kcarlson
Created: 2012-03-01 18:18:12+00:00
State: open

I am having an issue with row deletion. The use case is as follows: I insert a new row with key A, I delete the row with key A and it is successfully deleted (well, tombstoned).

The problem comes when I want to insert a new row with the same key, key A. It is not inserted.

The use case above does however work as expected when using cassandra's cli. Below is a test to reproduce:

UUID uuid = TimeUUIDUtils.getUniqueTimeUUIDinMillis();

Mutator mutator = PelopsFactory.createMutator();

mutator.writeColumn(
"MyColumnFamily",
Bytes.fromUuid(uuid),
mutator.newColumn(
Bytes.fromUTF8("columnA"),
Bytes.fromUTF8("someData!")
)
);

mutator.execute(ConsistencyLevel.ONE);

Selector selector = PelopsFactory.createSelector();

Column column = selector.getColumnFromRow(
"MyColumnFamily",
Bytes.fromUuid(uuid),
Bytes.fromUTF8("columnA"),
ConsistencyLevel.ONE
);

assert Bytes.fromByteArray(column.getValue()).toUTF8().equals("someData!");

RowDeletor rowDeleter = PelopsFactory.createRowDeletor();

rowDeleter.deleteRow(
"MyColumnFamily",
Bytes.fromUuid(uuid),
ConsistencyLevel.ONE);

boolean thrown = false;

try
{
selector.getColumnFromRow(
"MyColumnFamily",
Bytes.fromUuid(uuid),
Bytes.fromUTF8("columnA"),
ConsistencyLevel.ONE
);
}
catch(NotFoundException ex)
{
thrown = true;
}

assert thrown;

mutator.writeColumn(
"MyColumnFamily",
Bytes.fromUuid(uuid),
mutator.newColumn(
Bytes.fromUTF8("columnA"),
Bytes.fromUTF8("someData!")
)
);

mutator.execute(ConsistencyLevel.ONE);

selector = PelopsFactory.createSelector();

column = selector.getColumnFromRow(
"MyColumnFamily",
Bytes.fromUuid(uuid),
Bytes.fromUTF8("columnA"),
ConsistencyLevel.ONE
);

assert Bytes.fromByteArray(column.getValue()).toUTF8().equals("someData!");