You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Sam Tunnicliffe (JIRA)" <ji...@apache.org> on 2015/05/08 18:20:00 UTC
[jira] [Commented] (CASSANDRA-9334) Returning null from a trigger
does not abort the write
[ https://issues.apache.org/jira/browse/CASSANDRA-9334?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14534813#comment-14534813 ]
Sam Tunnicliffe commented on CASSANDRA-9334:
--------------------------------------------
Well, it's been this way since triggers were introduced. The initial implementation of {{StorageProxy#mutateWithTriggers}}
{code}
public static void mutateWithTriggers(Collection<? extends IMutation> mutations, ConsistencyLevel consistencyLevel, boolean mutateAtomically) throws WriteTimeoutException, UnavailableException,
OverloadedException, InvalidRequestException
{
Collection<RowMutation> tmutations = TriggerExecutor.instance.execute(mutations);
if (mutateAtomically || tmutations != null)
{
Collection<RowMutation> allMutations = (Collection<RowMutation>) mutations;
if (tmutations != null)
allMutations.addAll(tmutations);
StorageProxy.mutateAtomically(allMutations, consistencyLevel);
}
else
{
StorageProxy.mutate(mutations, consistencyLevel);
}
}
{code}
So I would say it's a bug in the javadoc.
Do you think it's a valid use case to be able to abort the entire mutation via a trigger?
> Returning null from a trigger does not abort the write
> ------------------------------------------------------
>
> Key: CASSANDRA-9334
> URL: https://issues.apache.org/jira/browse/CASSANDRA-9334
> Project: Cassandra
> Issue Type: Bug
> Components: Core
> Reporter: Brandon Williams
> Assignee: Sam Tunnicliffe
> Fix For: 2.0.x
>
>
> The javadoc for ITrigger seems to indicate that returning null means no mutations for the write will be applied at all:
> {noformat}
> * Called exactly once per CF update, returned mutations are atomically updated.
> *
> * @param key - Row Key for the update.
> * @param update - Update received for the CF
> * @return modifications to be applied, null if no action to be performed.
> {noformat}
> and indeed, TriggerExecutor.execute seems to have code for this:
> {noformat}
> if (augmentedMutations == null)
> return null;
> {noformat}
> but it never fires. In testing with a trigger that always returns null, the original mutation is still applied.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)