this test case pass @ first time, failed next. don't know why didn't update column value "value1" after execute insert method @ second time.
[testmethod] public void testmethod() { client.set_keyspace(keyspace); byte[] key = utf8encoding.getbytes("123456789"); columnparent parent = new columnparent(); parent.column_family = "users"; column column = new column(); column.name = utf8encoding.getbytes("columnname1"); column.timestamp = datetime.now.millisecond; column.value = utf8encoding.getbytes("value1"); // insert client.insert(key, parent, column, consistencylevel.one); columnpath path = new columnpath(); path.column_family = "users"; path.column = utf8encoding.getbytes("columnname1"); // search columnorsupercolumn returnedcolumn = client.get(key, path, consistencylevel.one); assert.areequal("value1", utf8encoding.getstring(returnedcolumn.column.value)); // update column.timestamp = datetime.now.millisecond; column.value = utf8encoding.getbytes("value2"); client.insert(key, parent, column, consistencylevel.one); returnedcolumn = client.get(key, path, consistencylevel.one); assert.areequal("value2", utf8encoding.getstring(returnedcolumn.column.value));
if calling twice in row in code need make sure time stamp incrementing. use microsecond resolution , make function remembers last time returned , adds 1 if next time less or equal last time returned.
only using millisecond resolution time stamps same, cassandra reverts comparing bytes, value2 wins.
Comments
Post a Comment