I am able to reproduce his problem. If you take the default storage-conf.xml file and utilize the "Super2" ColumnFamily with the code below. You will see that the data is not getting created once you run the delete. It seems to not allow you to create data via Thrift. HOWEVER, data can be created via the command line tool.
import java.io.UnsupportedEncodingException; import java.util.List; import org.apache.cassandra.thrift.Cassandra; import org.apache.cassandra.thrift.Column; import org.apache.cassandra.thrift.ColumnOrSuperColumn; import org.apache.cassandra.thrift.ColumnParent; import org.apache.cassandra.thrift.ColumnPath; import org.apache.cassandra.thrift.ConsistencyLevel; import org.apache.cassandra.thrift.InvalidRequestException; import org.apache.cassandra.thrift.NotFoundException; import org.apache.cassandra.thrift.SlicePredicate; import org.apache.cassandra.thrift.SliceRange; import org.apache.cassandra.thrift.SuperColumn; import org.apache.cassandra.thrift.TimedOutException; import org.apache.cassandra.thrift.UnavailableException; import org.apache.thrift.TException; import org.apache.thrift.protocol.TBinaryProtocol; import org.apache.thrift.protocol.TProtocol; import org.apache.thrift.transport.TSocket; import org.apache.thrift.transport.TTransport; public class CrudTest { private static final String KEYSPACE = "Keyspace1"; public static void main(String[] args) { CrudTest client = new CrudTest(); try { client.run(); } catch (Exception e) { e.printStackTrace(); } } public void run() throws TException, InvalidRequestException, UnavailableException, UnsupportedEncodingException, NotFoundException, TimedOutException { TTransport tr = new TSocket("localhost", 9160); TProtocol proto = new TBinaryProtocol(tr); Cassandra.Client client = new Cassandra.Client(proto); tr.open(); System.out.println("******** CREATING DATA *********"); createData(client); getData(client); System.out.println(); System.out.println("******** DELETING DATA *********"); deleteData(client); getData(client); System.out.println(); System.out.println("******** CREATING DATA *********"); createData(client); getData(client); tr.close(); } private void createData(Cassandra.Client client) throws InvalidRequestException, UnavailableException, TimedOutException, TException { ColumnPath cp1 = new ColumnPath("Super2"); cp1.setSuper_column("hotel".getBytes()); cp1.setColumn("Best Western".getBytes()); client.insert(KEYSPACE, "name", cp1, "Best Western of SF".getBytes(), System.currentTimeMillis(), ConsistencyLevel.ALL); ColumnPath cp2 = new ColumnPath("Super2"); cp2.setSuper_column("hotel".getBytes()); cp2.setColumn("Econolodge".getBytes()); client.insert(KEYSPACE, "name", cp2, "Econolodge of SF".getBytes(), System.currentTimeMillis(), ConsistencyLevel.ALL); } private void deleteData(Cassandra.Client client) throws InvalidRequestException, UnavailableException, TimedOutException, TException { client.remove(KEYSPACE, "hotel", new ColumnPath("Super2"), System.currentTimeMillis(), ConsistencyLevel.ONE); } private void getData(Cassandra.Client client) throws InvalidRequestException, UnavailableException, TimedOutException, TException { SliceRange sliceRange = new SliceRange(); sliceRange.setStart(new byte[] {}); sliceRange.setFinish(new byte[] {}); SlicePredicate slicePredicate = new SlicePredicate(); slicePredicate.setSlice_range(sliceRange); getData(client, slicePredicate); } private void getData(Cassandra.Client client, SlicePredicate slicePredicate) throws InvalidRequestException, UnavailableException, TimedOutException, TException { List<ColumnOrSuperColumn> coscList = client.get_slice(KEYSPACE, "hotel", new ColumnParent("Super2"), slicePredicate, ConsistencyLevel.ALL); if (coscList.isEmpty()) { System.out.println("Column Or Super Column is EMPTY"); } for (ColumnOrSuperColumn cosc: coscList) { if (cosc == null) { System.out.println("NULL RETURN VALUE"); } SuperColumn superColumn = cosc.getSuper_column(); if (superColumn == null) { System.out.println("Super Column is NULL"); } else { showSuperColumnInfo(superColumn); } } } private void showSuperColumnInfo(SuperColumn superColumn) { System.out.println("######## Super Columns ###########"); System.out.println("Super Column Name = " + new String(superColumn.getName())); List<Column> columnList = superColumn.getColumns(); System.out.println("--------- Start Columns -----------"); for (Column column: columnList) { System.out.println("Column Name = " + new String(column.getName())); System.out.println("Column Value = " + new String(column.getValue())); } System.out.println("--------- End Columns -----------"); System.out.println("##################################"); } } -----Original Message----- From: Oleg Tsvinev [mailto:oleg.tsvi...@gmail.com] Sent: Thu 7/22/2010 1:56 PM To: user@cassandra.apache.org Subject: Re: CRUD test Yes, and that was the issue. But now after I delete a row from cassandra-cli, I cannot insert anything back with my code. Insert code works does not throw any exceptions but when I read just inserted columns I get NotFoundException at the last line: client = borrowClient(); Keyspace keyspace = client.getKeyspace(KEYSPACE, CONSISTENCY_LEVEL); ColumnPath cp = new ColumnPath(application); cp.setSuper_column(uuid.getBytes()); SuperColumn sc = keyspace.getSuperColumn(category, cp); It makes me think that once I remove supercolumn it cannot be created again. On Jul 22, 2010 1:13 AM, "Colin Vipurs" <zodiac...@gmail.com> wrote: Have you checked the timestamp you're using for the subsequent inserts is higher than that used in the delete? On Thu, Jul 22, 2010 at 2:29 AM, Oleg Tsvinev <oleg.tsvi...@gmail.com> wrote: > Hi there, > I'm try... -- Maybe she awoke to see the roommate's boyfriend swinging from the chandelier wearing a boar's head. Something which you, I, and everyone else would call "Tuesday", of course.
<<winmail.dat>>