java - Cassandra triggers for updating a table when another is updated -


i going through triggers implementation in cassandra. wanted implement triggers update table old values of tables has been modified. suppose have table test_table in keyspace keyspace1. have table table_track in same keyspace columns columnname , columnvalue. when row updated in test_table, populate track_table row data(in test_table before update query executed) in columns columnname , columnvalue respectively.

i couldn't find proper documentation regarding cassandra triggers anywhere. managed somehow implement invertedindex , minor examples

public collection<mutation> augment(bytebuffer key, columnfamily update) {     list<mutation> mutations = new arraylist<mutation>(update.getcolumncount());      (cell cell : update)     {         // skip row marker , other empty values, since lead empty key.         if (cell.value().remaining() > 0)         {             mutation mutation = new mutation(properties.getproperty("keyspace"), cell.value());             mutation.add(properties.getproperty("columnfamily"), cell.name(), key, system.currenttimemillis());             mutations.add(mutation);         }     }      return mutations; } 

how can modify augment method implement functionality. tnx

you using wrong key create mutation instance
here working code

public collection<mutation> augment(bytebuffer key, columnfamily update)  {         list<mutation> mutations = new arraylist<mutation>(update.getcolumncount());      (cell cell : update)     {         if (cell.value().remaining() > 0)         {             mutation mutation = new mutation(properties.getproperty("keyspace"), key);             mutation.add(properties.getproperty("columnfamily"), cell.name(), cell.value(), system.currenttimemillis());             mutations.add(mutation);         }    }    return mutations; } 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -