private List<LogEntry> writePending(ConsistencyLevel consistencyLevel, List<IMutation> mutations) throws Throwable { List<LogEntry> logEntries = new ArrayList<LogEntry>(); for (IMutation mutation : mutations) { if (mutation instanceof RowMutation) { RowMutation rowMutation = (RowMutation) mutation; logger.debug("Mutation for [" + rowMutation.getTable() + "] with consistencyLevel [" + consistencyLevel + "]"); if (!rowMutation.getTable().equals(CommitLog.KEYSPACE)) { logEntries.addAll(CommitLog.getCommitLog().writePending(consistencyLevel, rowMutation)); } } } return logEntries; }
public List<LogEntry> writePending(ConsistencyLevel consistencyLevel, RowMutation rowMutation) throws Throwable { List<String> columnNames = new ArrayList<String>(); for (ColumnFamily cf : rowMutation.getColumnFamilies()) { for (ByteBuffer b : cf.getColumnNames()) { columnNames.add(ByteBufferUtil.string(b)); } } String keyspace = rowMutation.getTable(); ByteBuffer rowKey = rowMutation.key(); List<LogEntry> entries = new ArrayList<LogEntry>(); for (Integer cfId : rowMutation.getColumnFamilyIds()) { ColumnFamily columnFamily = rowMutation.getColumnFamily(cfId); String path = keyspace + ":" + columnFamily.metadata().cfName; List<Trigger> triggers = TriggerStore.getStore().getTriggers().get(path); if (triggers != null && triggers.size() > 0) { String hostName = LogEntryStore.getHostName(); LogEntry entry = new LogEntry(keyspace, columnFamily, rowKey, consistencyLevel, hostName, System.currentTimeMillis(), columnNames); entries.add(entry); write(entry, PENDING_PRIORITY); } } return entries; }