Your questions seem more appropriate for the user list because you are trying
to solve for use cases.
On Feb 11, 2019, 6:48 AM -0500, Sreenivasulu Nallapati
<sreeni.nallap...@gmail.com>, wrote:
> Hi,
> I am parsing the commit log files and I could not able to segregate the
> inserts/deletes/updates from the mutations. Is there any way that we can
> identify the event that is executed from commit logs?
>
> Here is the partial code:
>
> public class CustomCommitLogReadHandler implements CommitLogReadHandler {
>
> private static final Logger LOGGER =
> LoggerFactory.getLogger(CustomCommitLogReadHandler.class);
>
> private final String keyspace;
> private final String table;
>
> public CustomCommitLogReadHandler(Map<String, Object> configuration) {
> keyspace = (String) YamlUtils.select(configuration,
> "cassandra.keyspace");
> table = (String) YamlUtils.select(configuration, "cassandra.table");
> }
>
> @Override
> public void handleMutation(Mutation mutation, int size, int
> entryLocation, CommitLogDescriptor descriptor) {
> LOGGER.debug("Handle mutation started...");
> for (PartitionUpdate partitionUpdate :
> mutation.getPartitionUpdates()) {
> process(partitionUpdate);
> }
> LOGGER.debug("Handle mutation finished...");
> }
>
> @SuppressWarnings("unchecked")
> private void process(Partition partition) {
> LOGGER.debug("Process method started...");
> if (!partition.metadata().ksName.equals(keyspace)) {
> LOGGER.debug("Keyspace should be '{}' but is '{}'.", keyspace,
> partition.metadata().ksName);
> return;
> }
> if (!partition.metadata().cfName.equals(table)) {
> LOGGER.debug("Table should be '{} but is '{}'.", table,
> partition.metadata().cfName);
> return;
> }
> String key = getKey(partition);
> JSONObject obj = new JSONObject();
>
>
> Thanks
> Sreeni